aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimir N. Makarov <vmakarov@redhat.com>2025-01-09 16:22:02 -0500
committerVladimir N. Makarov <vmakarov@redhat.com>2025-01-09 16:27:28 -0500
commitfab96de044f1f023f52d43af866205d17d8895fb (patch)
tree23f29efb13193de1b4b6e79cb0c80b1de3483dc9
parent3cae3a80695e5aabd7353c02e179c997158eef30 (diff)
downloadgcc-fab96de044f1f023f52d43af866205d17d8895fb.zip
gcc-fab96de044f1f023f52d43af866205d17d8895fb.tar.gz
gcc-fab96de044f1f023f52d43af866205d17d8895fb.tar.bz2
[PR118017][LRA]: Don't inherit reg of non-uniform reg class
In the PR case LRA inherited value of register of class INT_SSE_REGS which resulted in LRA cycling when LRA tried to use different move alternatives with SSE/general regs and memory. The patch rejects to inherit such (non-uniform) classes to prevent cycling. gcc/ChangeLog: PR target/118017 * lra-constraints.cc (inherit_reload_reg): Check reg class on uniformity. gcc/testsuite/ChangeLog: PR target/118017 * gcc.target/i386/pr118017.c: New.
-rw-r--r--gcc/lra-constraints.cc14
-rw-r--r--gcc/testsuite/gcc.target/i386/pr118017.c21
2 files changed, 35 insertions, 0 deletions
diff --git a/gcc/lra-constraints.cc b/gcc/lra-constraints.cc
index a0f05b2..8f32e98 100644
--- a/gcc/lra-constraints.cc
+++ b/gcc/lra-constraints.cc
@@ -5878,6 +5878,20 @@ inherit_reload_reg (bool def_p, int original_regno,
}
return false;
}
+ if (ira_reg_class_min_nregs[rclass][GET_MODE (original_reg)]
+ != ira_reg_class_max_nregs[rclass][GET_MODE (original_reg)])
+ {
+ if (lra_dump_file != NULL)
+ {
+ fprintf (lra_dump_file,
+ " Rejecting inheritance for %d "
+ "because of requiring non-uniform class %s\n",
+ original_regno, reg_class_names[rclass]);
+ fprintf (lra_dump_file,
+ " >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n");
+ }
+ return false;
+ }
new_reg = lra_create_new_reg (GET_MODE (original_reg), original_reg,
rclass, NULL, "inheritance");
start_sequence ();
diff --git a/gcc/testsuite/gcc.target/i386/pr118017.c b/gcc/testsuite/gcc.target/i386/pr118017.c
new file mode 100644
index 0000000..c82d71e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr118017.c
@@ -0,0 +1,21 @@
+/* PR target/118017 */
+/* { dg-do compile } */
+/* { dg-options "-Og -frounding-math -mno-80387 -mno-mmx -Wno-psabi" } */
+
+typedef __attribute__((__vector_size__ (64))) _Float128 F;
+typedef __attribute__((__vector_size__ (64))) _Decimal64 G;
+typedef __attribute__((__vector_size__ (64))) _Decimal128 H;
+
+void
+bar(_Float32, _BitInt(1025), _BitInt(1025), _Float128, __int128, __int128, F,
+ int, int, G, _Float64, __int128, __int128, H, F);
+
+
+void
+foo ()
+{
+ bar ((__int128)68435455, 0, 0, 0, 0, 0, (F){}, 0, 0, (G){3689348814741910323},
+ 0, 0, 0, (H){0, (_Decimal128) ((__int128) 860933398830926 << 64),
+ (_Decimal128) ((__int128) 966483857959145 << 64), 4},
+ (F){(__int128) 3689348814741910323 << 64 | 3});
+}