This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[testcase] IA-32 3.2/3.3 reload ICE


Hi!

The following testcase ICEs on IA-32. The problem is when trying to reload

(insn:HI 40 39 41 2 0x4008cb80 (set (reg:CCNO 17 flags)
        (compare:CCNO (and:SI (subreg:SI (reg/v:DI 71) 0)
                (const_int 1 [0x1]))
            (const_int 0 [0x0]))) 196 {testsi_1} (insn_list 37 (nil))
    (expr_list:REG_DEAD (reg/v:DI 71)
        (nil)))

where (reg/v:DI 71) is in an FLOAT_SSE_REGS reg.
testsi_1 has AREG class in the first alternative, which is chosen.
Then push_reload decides to not keep the SUBREG and we ICE later on since no
DImode value can be in AREG class registers (since it has only one
register).
I've tried to fix this by:
#define CLASS_CANNOT_CHANGE_MODE       AREG
#define CLASS_CANNOT_CHANGE_MODE_P(FROM,TO) \
  (GET_MODE_SIZE (FROM) > UNITS_PER_WORD                               \
   && GET_MODE_SIZE (TO) <= UNITS_PER_WORD)

which fixed this testcase but bootstrap failed in reload somewhere else.
Shouldn't push_reload check for SUBREGs if there are any hard registers in
that class for the new mode at all?

--- gcc/testsuite/gcc.dg/20020731-1.c.jj	2002-07-31 19:18:23.000000000 +0200
+++ gcc/testsuite/gcc.dg/20020731-1.c	2002-07-31 19:20:06.000000000 +0200
@@ -0,0 +1,32 @@
+/* This testcase ICEd on IA-32 in reload, as AREG class was chosen
+   for (subreg:SI (reg:DI )) and only (reg:DI ) was reloaded for input,
+   but the for latter there is no hard register in AREG class.  */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-options "-O2 -march=pentium4" } */
+
+const double h [10];
+
+typedef union
+{
+  double u1;
+  struct { unsigned int u21, u22; } u2;
+} U;
+
+double bar (double x);
+
+double
+foo (int x, unsigned int y, unsigned int z)
+{
+  int a, b;
+  double c;
+
+  b = x < 15 + 1 ? x : 15 + 1;
+  c = y;
+  if (b > 9)
+    c = h [b - 9] * c + z;
+  a = 0;
+  if (((__extension__ ({ U d; d.u1 = (c); d.u2.u21; })) & 1))
+    c += bar (c);
+  return c;
+}

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]