aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorKewen Lin <linkw@linux.ibm.com>2024-07-23 00:47:49 -0500
committerThomas Koenig <tkoenig@gcc.gnu.org>2024-07-28 19:05:46 +0200
commit8237d37d294b70c81ae95f72c1e2c814cf1369f2 (patch)
treefa19c7463ad760b47263ddb7ffa9c79eaf2b621b /gcc
parent150f5707ca5506917504631d60cd0b060019a778 (diff)
downloadgcc-8237d37d294b70c81ae95f72c1e2c814cf1369f2.zip
gcc-8237d37d294b70c81ae95f72c1e2c814cf1369f2.tar.gz
gcc-8237d37d294b70c81ae95f72c1e2c814cf1369f2.tar.bz2
rs6000: Escalate warning to error for VSX with explicit no-altivec etc.
As the discussion in PR115688, for now when users specify -mvsx and -mno-altivec explicitly, compiler emits warning rather than error, but considering both options are given explicitly, emitting hard error should be better. So this patch is to escalate some related warning to error when both are incompatible. PR target/115713 gcc/ChangeLog: * config/rs6000/rs6000.cc (rs6000_option_override_internal): Emit error messages when explicit VSX encounters explicit soft-float, no-altivec or avoid-indexed-addresses. gcc/testsuite/ChangeLog: * gcc.target/powerpc/warn-1.c: Move to ... * gcc.target/powerpc/error-1.c: ... here. Adjust dg-warning with dg-error and remove ineffective scan.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/config/rs6000/rs6000.cc41
-rw-r--r--gcc/testsuite/gcc.target/powerpc/error-1.c (renamed from gcc/testsuite/gcc.target/powerpc/warn-1.c)3
2 files changed, 24 insertions, 20 deletions
diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
index eddd2ad..019bb7c 100644
--- a/gcc/config/rs6000/rs6000.cc
+++ b/gcc/config/rs6000/rs6000.cc
@@ -3830,32 +3830,37 @@ rs6000_option_override_internal (bool global_init_p)
/* Add some warnings for VSX. */
if (TARGET_VSX)
{
- const char *msg = NULL;
+ bool explicit_vsx_p = rs6000_isa_flags_explicit & OPTION_MASK_VSX;
if (!TARGET_HARD_FLOAT)
{
- if (rs6000_isa_flags_explicit & OPTION_MASK_VSX)
- msg = N_("%<-mvsx%> requires hardware floating point");
- else
+ if (explicit_vsx_p)
{
- rs6000_isa_flags &= ~ OPTION_MASK_VSX;
- rs6000_isa_flags_explicit |= OPTION_MASK_VSX;
+ if (rs6000_isa_flags_explicit & OPTION_MASK_SOFT_FLOAT)
+ error ("%<-mvsx%> and %<-msoft-float%> are incompatible");
+ else
+ warning (0, N_("%<-mvsx%> requires hardware floating-point"));
}
+ rs6000_isa_flags &= ~OPTION_MASK_VSX;
+ rs6000_isa_flags_explicit |= OPTION_MASK_VSX;
}
else if (TARGET_AVOID_XFORM > 0)
- msg = N_("%<-mvsx%> needs indexed addressing");
- else if (!TARGET_ALTIVEC && (rs6000_isa_flags_explicit
- & OPTION_MASK_ALTIVEC))
- {
- if (rs6000_isa_flags_explicit & OPTION_MASK_VSX)
- msg = N_("%<-mvsx%> and %<-mno-altivec%> are incompatible");
+ {
+ if (explicit_vsx_p && OPTION_SET_P (TARGET_AVOID_XFORM))
+ error ("%<-mvsx%> and %<-mavoid-indexed-addresses%>"
+ " are incompatible");
else
- msg = N_("%<-mno-altivec%> disables vsx");
- }
-
- if (msg)
+ warning (0, N_("%<-mvsx%> needs indexed addressing"));
+ rs6000_isa_flags &= ~OPTION_MASK_VSX;
+ rs6000_isa_flags_explicit |= OPTION_MASK_VSX;
+ }
+ else if (!TARGET_ALTIVEC
+ && (rs6000_isa_flags_explicit & OPTION_MASK_ALTIVEC))
{
- warning (0, msg);
- rs6000_isa_flags &= ~ OPTION_MASK_VSX;
+ if (explicit_vsx_p)
+ error ("%<-mvsx%> and %<-mno-altivec%> are incompatible");
+ else
+ warning (0, N_("%<-mno-altivec%> disables vsx"));
+ rs6000_isa_flags &= ~OPTION_MASK_VSX;
rs6000_isa_flags_explicit |= OPTION_MASK_VSX;
}
}
diff --git a/gcc/testsuite/gcc.target/powerpc/warn-1.c b/gcc/testsuite/gcc.target/powerpc/error-1.c
index 76ac0c4..d38eba8 100644
--- a/gcc/testsuite/gcc.target/powerpc/warn-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/error-1.c
@@ -3,7 +3,7 @@
/* { dg-require-effective-target powerpc_vsx_ok } */
/* { dg-options "-O -mvsx -mno-altivec" } */
-/* { dg-warning "'-mvsx' and '-mno-altivec' are incompatible" "" { target *-*-* } 0 } */
+/* { dg-error "'-mvsx' and '-mno-altivec' are incompatible" "" { target *-*-* } 0 } */
double
foo (double *x, double *y)
@@ -16,4 +16,3 @@ foo (double *x, double *y)
return z[0] * z[1];
}
-/* { dg-final { scan-assembler-not "xsadddp" } } */