]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Add ALTIVEC_REGS as pressure class.
authorPat Haugen <pthaugen@linux.ibm.com>
Mon, 10 May 2021 18:49:06 +0000 (13:49 -0500)
committerPat Haugen <pthaugen@linux.ibm.com>
Mon, 10 May 2021 18:49:06 +0000 (13:49 -0500)
Code that has heavy register pressure on Altivec registers can suffer from
over-aggressive scheduling during sched1, which then leads to increased
register spill. This is due to the fact that registers that prefer
ALTIVEC_REGS are currently assigned an allocno class of VSX_REGS. This then
misleads the scheduler to think there are 64 regs available, when in reality
there are only 32 Altivec regs. This patch fixes the problem by assigning an
allocno class of ALTIVEC_REGS and adding ALTIVEC_REGS as a pressure class.

2021-05-10  Pat Haugen  <pthaugen@linux.ibm.com>

gcc/ChangeLog:

* config/rs6000/rs6000.c (rs6000_ira_change_pseudo_allocno_class):
Return ALTIVEC_REGS if that is best_class.
(rs6000_compute_pressure_classes): Add ALTIVEC_REGS.

gcc/testsuite/ChangeLog:

* gcc.target/powerpc/fold-vec-insert-float-p9.c: Adjust counts.
* gcc.target/powerpc/vec-rlmi-rlnm.c: Likewise.

gcc/config/rs6000/rs6000.c
gcc/testsuite/gcc.target/powerpc/fold-vec-insert-float-p9.c
gcc/testsuite/gcc.target/powerpc/vec-rlmi-rlnm.c

index ee15af9efa434ef8c46557ab581798f8ea1484a9..c852fb8784847e451294752da13d29a8599b713f 100644 (file)
@@ -22527,11 +22527,14 @@ rs6000_ira_change_pseudo_allocno_class (int regno ATTRIBUTE_UNUSED,
         of allocno class.  */
       if (best_class == BASE_REGS)
        return GENERAL_REGS;
-      if (TARGET_VSX
-         && (best_class == FLOAT_REGS || best_class == ALTIVEC_REGS))
+      if (TARGET_VSX && best_class == FLOAT_REGS)
        return VSX_REGS;
       return best_class;
 
+    case VSX_REGS:
+      if (best_class == ALTIVEC_REGS)
+       return ALTIVEC_REGS;
+
     default:
       break;
     }
@@ -23649,12 +23652,12 @@ rs6000_compute_pressure_classes (enum reg_class *pressure_classes)
 
   n = 0;
   pressure_classes[n++] = GENERAL_REGS;
+  if (TARGET_ALTIVEC)
+    pressure_classes[n++] = ALTIVEC_REGS;
   if (TARGET_VSX)
     pressure_classes[n++] = VSX_REGS;
   else
     {
-      if (TARGET_ALTIVEC)
-       pressure_classes[n++] = ALTIVEC_REGS;
       if (TARGET_HARD_FLOAT)
        pressure_classes[n++] = FLOAT_REGS;
     }
index 1c57672314647d0f36bc1200720dc04ce431a543..45417680e33e713ed487135ded5a5614231130ba 100644 (file)
@@ -31,5 +31,5 @@ testf_cst (float f, vector float vf)
 /* { dg-final { scan-assembler-times {\mstfs\M} 2 { target ilp32 } } } */
 /* { dg-final { scan-assembler-times {\mlxv\M} 2 { target ilp32 } } } */
 /* { dg-final { scan-assembler-times {\mlvewx\M} 1 { target ilp32 } } } */
-/* { dg-final { scan-assembler-times {\mvperm\M} 1 { target ilp32 } } } */
-/* { dg-final { scan-assembler-times {\mxxperm\M} 2 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mvperm\M} 2 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mxxperm\M} 1 { target ilp32 } } } */
index 1e7d7390c5be583379a42e15113e383287332c6e..5512c0f150e44807f630760da982d3ea2be4aa98 100644 (file)
@@ -62,6 +62,6 @@ rlnm_test_2 (vector unsigned long long x, vector unsigned long long y,
 /* { dg-final { scan-assembler-times "vextsb2d" 1 } } */
 /* { dg-final { scan-assembler-times "vslw" 1 } } */
 /* { dg-final { scan-assembler-times "vsld" 1 } } */
-/* { dg-final { scan-assembler-times "xxlor" 3 } } */
+/* { dg-final { scan-assembler-times "xxlor" 2 } } */
 /* { dg-final { scan-assembler-times "vrlwnm" 2 } } */
 /* { dg-final { scan-assembler-times "vrldnm" 2 } } */