This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH rs6000] Fix PR79907
- From: Pat Haugen <pthaugen at linux dot vnet dot ibm dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Segher Boessenkool <segher at gcc dot gnu dot org>, David Edelsohn <dje dot gcc at gmail dot com>
- Date: Wed, 8 Mar 2017 16:29:59 -0600
- Subject: [PATCH rs6000] Fix PR79907
- Authentication-results: sourceware.org; auth=none
The following patch fixes an "insn does not match its constraints" ICE
that occurred when copying a VR reg to a GPR when -mno-upper-regs-df is
in effect. The regclass used for the wi/wj constraints was being
incorrectly based on TARGET_UPPER_REGS_DF instead of
TARGET_UPPER_REGS_DI. This patch fixes the initialization of the wi
constraint, which in turn is used to set the value of the wj constraint.
Bootstrap/regtest on powerp64le and powerpc64 (-m32/-m64) with no new
regressions. Ok for trunk?
-Pat
2017-03-08 Pat Haugen <pthaugen@us.ibm.com>
PR target/79907
* config/rs6000/rs6000.c (rs6000_init_hard_regno_mode_ok): Test
TARGET_UPPER_REGS_DI when setting 'wi' constraint regclass.
testsuite/ChangeLog:
2017-03-08 Pat Haugen <pthaugen@us.ibm.com>
* gcc.target/powerpc/pr79907.c: New.
Index: config/rs6000/rs6000.c
===================================================================
--- config/rs6000/rs6000.c (revision 245961)
+++ config/rs6000/rs6000.c (working copy)
@@ -3182,7 +3182,7 @@ rs6000_init_hard_regno_mode_ok (bool glo
else
rs6000_constraints[RS6000_CONSTRAINT_ws] = FLOAT_REGS;
- if (TARGET_UPPER_REGS_DF) /* DImode */
+ if (TARGET_UPPER_REGS_DI) /* DImode */
rs6000_constraints[RS6000_CONSTRAINT_wi] = VSX_REGS;
else
rs6000_constraints[RS6000_CONSTRAINT_wi] = FLOAT_REGS;
Index: testsuite/gcc.target/powerpc/pr79907.c
===================================================================
--- testsuite/gcc.target/powerpc/pr79907.c (nonexistent)
+++ testsuite/gcc.target/powerpc/pr79907.c (working copy)
@@ -0,0 +1,15 @@
+/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-require-effective-target powerpc_p8vector_ok } */
+/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" }
{ "-mcpu=power8" } } */
+/* { dg-options "-mcpu=power8 -O3 -mno-upper-regs-df" } */
+
+int foo (short a[], int x)
+{
+ unsigned int i;
+ for (i = 0; i < 1000; i++)
+ {
+ x = a[i];
+ a[i] = (x <= 0 ? 0 : x);
+ }
+ return x;
+}