commit 6ffaed8d8713874b7c4ee112249ed82222a91ff9
Author: Vladimir N. Makarov <vmakarov@redhat.com>
Date: Thu Jan 9 16:22:02 2025 -0500
[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.
@@ -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 ();
new file mode 100644
@@ -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});
+}