@@ -5539,6 +5539,12 @@ ix86_valid_target_attribute_tree (tree args,
= TREE_TARGET_OPTION (target_option_default_node);
struct gcc_options enum_opts_set;
+ /* Allow enabling ISAs which have been enabled at command-line so
+ that __attribute__ ((target("arch=broadwell"))) enables AVX when
+ there is -mavx at command-line. */
+ opts->x_ix86_isa_flags_explicit &= ~ix86_isa_flags;
+ opts->x_ix86_isa_flags2_explicit &= ~ix86_isa_flags2;
+
memset (&enum_opts_set, 0, sizeof (enum_opts_set));
/* Process each of the options on the chain. */
@@ -2,7 +2,7 @@
// { dg-do run }
// { dg-require-ifunc "" }
-// { dg-options "-O2" }
+// { dg-options "-O2 -march=x86-64" }
#include <assert.h>
new file mode 100644
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx -march=x86-64" } */
+
+__attribute__ ((target("arch=broadwell")))
+float
+foo (float x)
+{
+ return x;
+}