The following patch fixes the second test case in
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55277
As for the first case, I don' think it will be fixed soon as I have
more urgent PRs.
The patch was successfully tested and bootstrapped on x86/x86-64.
Committed as rev. 193824.
2012-11-26 Vladimir Makarov <[email protected]>
PR target/55277
* lra-constraints.c (in_class_p): Check reg class contents too.
2012-11-26 Vladimir Makarov <[email protected]>
PR target/55277
* gcc.target/i386/pr55227.c: New test.
Index: lra-constraints.c
===================================================================
--- lra-constraints.c (revision 193755)
+++ lra-constraints.c (working copy)
@@ -293,7 +293,9 @@ in_class_p (rtx reg, enum reg_class cl,
if (nregs == 1)
return true;
for (j = 0; j < nregs; j++)
- if (TEST_HARD_REG_BIT (lra_no_alloc_regs, hard_regno + j))
+ if (TEST_HARD_REG_BIT (lra_no_alloc_regs, hard_regno + j)
+ || ! TEST_HARD_REG_BIT (reg_class_contents[common_class],
+ hard_regno + j))
break;
if (j >= nregs)
return true;
Index: testsuite/gcc.target/i386/pr55277.c
===================================================================
--- testsuite/gcc.target/i386/pr55277.c (revision 0)
+++ testsuite/gcc.target/i386/pr55277.c (working copy)
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target ilp32 } */
+/* { dg-options "-O1" } */
+
+int a, c;
+
+void f(long long p)
+{
+ long long b;
+
+ if(b)
+ b = p ? : 0;
+
+ for (; p; p++)
+ p *= a & (c = p *= !a < 2);
+
+ a = b += !(b & 3740917449u);
+}