@@ -24643,8 +24643,11 @@ rs6000_inner_target_options (tree args, bool attr_p)
{
if (mask == OPTION_MASK_VSX)
{
- mask |= OPTION_MASK_ALTIVEC;
- TARGET_AVOID_XFORM = 0;
+ if (!(rs6000_isa_flags_explicit
+ & OPTION_MASK_ALTIVEC))
+ mask |= OPTION_MASK_ALTIVEC;
+ if (!OPTION_SET_P (TARGET_AVOID_XFORM))
+ TARGET_AVOID_XFORM = 0;
}
}
@@ -18,7 +18,7 @@
#error "__VSX__ should not be defined."
#endif
-#pragma GCC target("vsx")
+#pragma GCC target("altivec,vsx")
#include <altivec.h>
#pragma GCC reset_options
new file mode 100644
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* Force power7 to avoid possible error message on AltiVec ABI change. */
+/* { dg-options "-mdejagnu-cpu=power7" } */
+
+/* Verify there is an error message for incompatible -maltivec and -mvsx
+ even when they are specified by target attributes. */
+
+int __attribute__ ((target ("no-altivec,vsx")))
+test1 (void)
+{
+ /* { dg-error "'-mvsx' and '-mno-altivec' are incompatible" "" { target *-*-* } .-1 } */
+ return 0;
+}
+
+int __attribute__ ((target ("vsx,no-altivec")))
+test2 (void)
+{
+ /* { dg-error "'-mvsx' and '-mno-altivec' are incompatible" "" { target *-*-* } .-1 } */
+ return 0;
+}