This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix "no-vsx" target attribute handling (PR target/69969)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: David Edelsohn <dje dot gcc at gmail dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 26 Feb 2016 20:27:37 +0100
- Subject: [PATCH] Fix "no-vsx" target attribute handling (PR target/69969)
- Authentication-results: sourceware.org; auth=none
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
Most of the errors and warnings in rs6000_option_override_internal
are emitted only if the particular option is explicit, e.g.
if (TARGET_P9_DFORM && !TARGET_P9_VECTOR)
{
if (rs6000_isa_flags_explicit & OPTION_MASK_P9_VECTOR)
error ("-mpower9-dform requires -mpower9-vector");
rs6000_isa_flags &= ~OPTION_MASK_P9_DFORM;
}
and many others, which is right, but for the
-mallow-movmisalign requires -mvsx
error it doesn't do this, so if say -mcpu=power8 compiled TU
contains a routine with target ("no-vsx") attribute, we get this
error, even when the user hasn't done anything we should complain about.
Fixed by following what we do for the other options, bootstrapped/regtested
on powerpc64le-linux (and powerpc64-linux, but regtest is still pending
there). Ok for trunk?
2016-02-26 Jakub Jelinek <jakub@redhat.com>
PR target/69969
* config/rs6000/rs6000.c (rs6000_option_override_internal): Don't
complain about -mallow-movmisalign without -mvsx if
TARGET_ALLOW_MOVMISALIGN was not set explicitly.
* gcc.target/powerpc/pr69969.c: New test.
--- gcc/config/rs6000/rs6000.c.jj 2016-02-26 12:05:39.000000000 +0100
+++ gcc/config/rs6000/rs6000.c 2016-02-26 15:58:29.250259330 +0100
@@ -4207,7 +4207,8 @@ rs6000_option_override_internal (bool gl
else if (TARGET_ALLOW_MOVMISALIGN && !TARGET_VSX)
{
- if (TARGET_ALLOW_MOVMISALIGN > 0)
+ if (TARGET_ALLOW_MOVMISALIGN > 0
+ && global_options_set.x_TARGET_ALLOW_MOVMISALIGN)
error ("-mallow-movmisalign requires -mvsx");
TARGET_ALLOW_MOVMISALIGN = 0;
--- gcc/testsuite/gcc.target/powerpc/pr69969.c.jj 2016-02-26 16:03:34.992101828 +0100
+++ gcc/testsuite/gcc.target/powerpc/pr69969.c 2016-02-26 16:03:25.000000000 +0100
@@ -0,0 +1,7 @@
+/* PR target/69969 */
+/* { dg-do compile } */
+/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */
+/* { dg-options "-mcpu=power8" } */
+
+int bar (int x) { return x; }
+__attribute__((__target__("no-vsx"))) int foo (int x) { return x; } /* { dg-bogus "-mallow-movmisalign requires -mvsx" } */
Jakub