This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Patch to fix PPro
- To: bregor at anusf dot anu dot edu dot au
- Subject: Patch to fix PPro
- Date: Mon, 16 Mar 1998 10:55:34 -0800 (PST)
- Cc: scox at cygnus dot com
Hi, Roger,
This patch seems to fix the PPro bug you reported. Please give it a try.
Stan, it fixes the 5 test cases I sent you today. Could you please
check it out? I am not sure about the varasm.c change. Can you take
a closer look at it? Thanks a lot.
Thanks.
H.J.
---
Sun Mar 15 19:25:40 1998 H.J. Lu (hjl@gnu.org)
* reg-stack.c (compare_for_stack_reg): Remove the correct
register from the stack when popping the dead registers for
have_cmove == 1.
Fri Mar 13 18:40:57 1998 H.J. Lu (hjl@gnu.org)
* varasm.c (force_const_mem): Always update the label for
CONST_DOUBLE even in nested function.
(mark_constants): Enable searching inside a CONST_DOUBLE.
Thu Mar 12 08:25:19 1998 H.J. Lu (hjl@gnu.org)
* config/i386/i386.md (movsfcc_1, movdfcc_1, movxfcc_1): Handle
loading standard x87 constants.
Index: reg-stack.c
===================================================================
RCS file: /home/work/cvs/gnu/egcs/gcc/reg-stack.c,v
retrieving revision 1.1.1.8
diff -u -r1.1.1.8 reg-stack.c
--- reg-stack.c 1998/03/12 17:18:54 1.1.1.8
+++ reg-stack.c 1998/03/16 15:55:17
@@ -2067,9 +2073,25 @@
if (src1_note)
{
- CLEAR_HARD_REG_BIT (regstack->reg_set, REGNO (XEXP (src1_note, 0)));
+ int regno = REGNO (XEXP (src1_note, 0));
+ int top = regstack->top;
+ CLEAR_HARD_REG_BIT (regstack->reg_set, regno);
replace_reg (&XEXP (src1_note, 0), FIRST_STACK_REG);
regstack->top--;
+ if (regstack->reg [top] != regno)
+ {
+ int i;
+ if (! have_cmove)
+ abort ();
+ for (i = regstack->top; i >= 0; i--)
+ if (regstack->reg [i] == regno)
+ {
+ int j;
+ for (j = i; j < top; j++)
+ regstack->reg [j] = regstack->reg [j + 1];
+ break;
+ }
+ }
}
/* If the second operand dies, handle that. But if the operands are
@@ -2088,9 +2110,25 @@
if (get_hard_regnum (regstack, XEXP (src2_note, 0)) == FIRST_STACK_REG
&& src1_note)
{
- CLEAR_HARD_REG_BIT (regstack->reg_set, REGNO (XEXP (src2_note, 0)));
+ int regno = REGNO (XEXP (src2_note, 0));
+ int top = regstack->top;
+ CLEAR_HARD_REG_BIT (regstack->reg_set, regno);
replace_reg (&XEXP (src2_note, 0), FIRST_STACK_REG + 1);
regstack->top--;
+ if (regstack->reg [top] != regno)
+ {
+ int i;
+ if (! have_cmove)
+ abort ();
+ for (i = regstack->top; i >= 0; i--)
+ if (regstack->reg [i] == regno)
+ {
+ int j;
+ for (j = i; j < top; j++)
+ regstack->reg [j] = regstack->reg [j + 1];
+ break;
+ }
+ }
}
else
{
Index: varasm.c
===================================================================
RCS file: /home/work/cvs/gnu/egcs/gcc/varasm.c,v
retrieving revision 1.1.1.11
diff -u -r1.1.1.11 varasm.c
--- varasm.c 1998/03/12 17:18:41 1.1.1.11
+++ varasm.c 1998/03/14 02:35:18
@@ -3423,6 +3431,7 @@
CONSTANT_POOL_ADDRESS_P (XEXP (def, 0)) = 1;
current_function_uses_const_pool = 1;
+#if 0
if (outer_function_chain == 0)
if (GET_CODE (x) == CONST_DOUBLE)
{
@@ -3433,6 +3442,17 @@
}
CONST_DOUBLE_MEM (x) = def;
}
+#else
+ if (GET_CODE (x) == CONST_DOUBLE)
+ {
+ if (outer_function_chain == 0 && CONST_DOUBLE_MEM (x) == cc0_rtx)
+ {
+ CONST_DOUBLE_CHAIN (x) = const_double_chain;
+ const_double_chain = x;
+ }
+ CONST_DOUBLE_MEM (x) = def;
+ }
+#endif
return def;
}
@@ -3625,6 +3645,7 @@
find_pool_constant (x)->mark = 1;
return;
}
+#if 0
/* Never search inside a CONST_DOUBLE, because CONST_DOUBLE_MEM may be
a MEM, but does not constitute a use of that MEM. This is particularly
important inside a nested function, because CONST_DOUBLE_MEM may be
@@ -3632,6 +3653,7 @@
in force_const_mem. */
else if (GET_CODE (x) == CONST_DOUBLE)
return;
+#endif
/* Insns may appear inside a SEQUENCE. Only check the patterns of
insns, not any notes that may be attached. We don't want to mark
Index: config/i386/i386.md
===================================================================
RCS file: /home/work/cvs/gnu/egcs/gcc/config/i386/i386.md,v
retrieving revision 1.1.1.9
diff -u -r1.1.1.9 i386.md
--- i386.md 1998/03/16 16:50:33 1.1.1.9
+++ i386.md 1998/03/16 16:53:46
@@ -7629,8 +7630,21 @@
output_asm_insn (AS1 (fld%z2,%y2), operands);
else
{
- operands[2] = XEXP (operands[2], 0);
- output_asm_insn (AS1 (fld%z2,%y2), operands);
+ int conval = standard_80387_constant_p (operands[2]);
+
+ switch (conval)
+ {
+ case 1:
+ fprintf (asm_out_file, \"\\tfldz\\n\");
+ break;
+ case 2:
+ fprintf (asm_out_file, \"\\tfld1\\n\");
+ break;
+ default:
+ operands[2] = XEXP (operands[2], 0);
+ output_asm_insn (AS1 (fld%z2,%y2), operands);
+ break;
+ }
}
output_asm_insn (\"jmp %l1\", xops);
ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\", CODE_LABEL_NUMBER (xops[0]));
@@ -7638,8 +7652,21 @@
output_asm_insn (AS1 (fld%z3,%y3), operands);
else
{
- operands[3] = XEXP (operands[3], 0);
- output_asm_insn (AS1 (fld%z3,%y3), operands);
+ int conval = standard_80387_constant_p (operands[3]);
+
+ switch (conval)
+ {
+ case 1:
+ fprintf (asm_out_file, \"\\tfldz\\n\");
+ break;
+ case 2:
+ fprintf (asm_out_file, \"\\tfld1\\n\");
+ break;
+ default:
+ operands[3] = XEXP (operands[3], 0);
+ output_asm_insn (AS1 (fld%z3,%y3), operands);
+ break;
+ }
}
ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\", CODE_LABEL_NUMBER (xops[1]));
}
@@ -7685,8 +7712,21 @@
output_asm_insn (AS1 (fld%z2,%y2), operands);
else
{
- operands[2] = XEXP (operands[2], 0);
- output_asm_insn (AS1 (fld%z2,%y2), operands);
+ int conval = standard_80387_constant_p (operands[2]);
+
+ switch (conval)
+ {
+ case 1:
+ fprintf (asm_out_file, \"\\tfldz\\n\");
+ break;
+ case 2:
+ fprintf (asm_out_file, \"\\tfld1\\n\");
+ break;
+ default:
+ operands[2] = XEXP (operands[2], 0);
+ output_asm_insn (AS1 (fld%z2,%y2), operands);
+ break;
+ }
}
output_asm_insn (\"jmp %l1\", xops);
ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\", CODE_LABEL_NUMBER (xops[0]));
@@ -7694,8 +7734,21 @@
output_asm_insn (AS1 (fld%z3,%y3), operands);
else
{
- operands[3] = XEXP (operands[3], 0);
- output_asm_insn (AS1 (fld%z3,%y3), operands);
+ int conval = standard_80387_constant_p (operands[3]);
+
+ switch (conval)
+ {
+ case 1:
+ fprintf (asm_out_file, \"\\tfldz\\n\");
+ break;
+ case 2:
+ fprintf (asm_out_file, \"\\tfld1\\n\");
+ break;
+ default:
+ operands[3] = XEXP (operands[3], 0);
+ output_asm_insn (AS1 (fld%z3,%y3), operands);
+ break;
+ }
}
ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\", CODE_LABEL_NUMBER (xops[1]));
}
@@ -7741,8 +7794,21 @@
output_asm_insn (AS1 (fld%z2,%y2), operands);
else
{
- operands[2] = XEXP (operands[2], 0);
- output_asm_insn (AS1 (fld%z2,%y2), operands);
+ int conval = standard_80387_constant_p (operands[2]);
+
+ switch (conval)
+ {
+ case 1:
+ fprintf (asm_out_file, \"\\tfldz\\n\");
+ break;
+ case 2:
+ fprintf (asm_out_file, \"\\tfld1\\n\");
+ break;
+ default:
+ operands[2] = XEXP (operands[2], 0);
+ output_asm_insn (AS1 (fld%z2,%y2), operands);
+ break;
+ }
}
output_asm_insn (\"jmp %l1\", xops);
ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\", CODE_LABEL_NUMBER (xops[0]));
@@ -7750,8 +7816,21 @@
output_asm_insn (AS1 (fld%z3,%y3), operands);
else
{
- operands[3] = XEXP (operands[3], 0);
- output_asm_insn (AS1 (fld%z3,%y3), operands);
+ int conval = standard_80387_constant_p (operands[3]);
+
+ switch (conval)
+ {
+ case 1:
+ fprintf (asm_out_file, \"\\tfldz\\n\");
+ break;
+ case 2:
+ fprintf (asm_out_file, \"\\tfld1\\n\");
+ break;
+ default:
+ operands[3] = XEXP (operands[3], 0);
+ output_asm_insn (AS1 (fld%z3,%y3), operands);
+ break;
+ }
}
ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\", CODE_LABEL_NUMBER (xops[1]));
}