This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Fix sparc64 float libcall failures
- From: "David S. Miller" <davem at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 15 Apr 2002 03:08:05 -0700 (PDT)
- Subject: Fix sparc64 float libcall failures
This fixes gcc.c-torture/execute/20020413-1.c
What is happening is that floating point libcalls were being emitted
as LCT_CONST. This is wrong, because with these libcalls on Sparc64
targets a pointer to the quad float value is passed in. So the
libcall cannot be LCT_CONST because the libcall modifies memory.
The optimizer would think the passed in memory does not change and
thus the re-read of the quad floats would never occur, resulting
in the test case never seeing updated values in the main while
loops when optimization was enabled and not TARGET_HARD_FLOAT.
While tracking this down I noticied many instances of using magic
constants instead of LCT_foo in the arguments of emit_library_call
so I fixed that up along the way too.
Finally, I killed a warning about the prototypes of a function
I added in a recent sparc bugfix.
Applied to mainline and 3.1 branch.
2002-04-15 David S. Miller <davem@redhat.com>
* config/sparc/sparc.c (sparc_emit_float_lib_cmp):
Call emit_library_call with LCT_NORMAL.
(sparc_initialize_trampoline): Use LCT_foo instead of
magic constant in emit_library_call invocations.
(sparc64_initialize_trampoline): Likewise.
(sparc_profile_hook): Likewise.
* config/sparc/sparc.md: Likewise.
* config/sparc/sparc.c (sparc_extra_constraint_check):
Fix type of argument 'c'.
* config/sparc/sparc-protos.h (sparc_extra_constraint_check):
Likewise.
--- ./config/sparc/sparc.c.~1~ Tue Apr 9 05:49:13 2002
+++ ./config/sparc/sparc.c Sat Apr 13 03:32:53 2002
@@ -5374,7 +5374,7 @@ sparc_emit_float_lib_cmp (x, y, comparis
else
slot1 = y;
- emit_library_call (gen_rtx_SYMBOL_REF (Pmode, qpfunc), 1,
+ emit_library_call (gen_rtx_SYMBOL_REF (Pmode, qpfunc), LCT_NORMAL,
DImode, 2,
XEXP (slot0, 0), Pmode,
XEXP (slot1, 0), Pmode);
@@ -5383,7 +5383,7 @@ sparc_emit_float_lib_cmp (x, y, comparis
}
else
{
- emit_library_call (gen_rtx_SYMBOL_REF (Pmode, qpfunc), 1,
+ emit_library_call (gen_rtx_SYMBOL_REF (Pmode, qpfunc), LCT_NORMAL,
SImode, 2,
x, TFmode, y, TFmode);
@@ -6395,7 +6395,7 @@ sparc_initialize_trampoline (tramp, fnad
*/
#ifdef TRANSFER_FROM_TRAMPOLINE
emit_library_call (gen_rtx (SYMBOL_REF, Pmode, "__enable_execute_stack"),
- 0, VOIDmode, 1, tramp, Pmode);
+ LCT_NORMAL, VOIDmode, 1, tramp, Pmode);
#endif
emit_move_insn
@@ -6446,7 +6446,7 @@ sparc64_initialize_trampoline (tramp, fn
{
#ifdef TRANSFER_FROM_TRAMPOLINE
emit_library_call (gen_rtx (SYMBOL_REF, Pmode, "__enable_execute_stack"),
- 0, VOIDmode, 1, tramp, Pmode);
+ LCT_NORMAL, VOIDmode, 1, tramp, Pmode);
#endif
/*
@@ -8551,7 +8551,7 @@ sparc_profile_hook (labelno)
lab = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
fun = gen_rtx_SYMBOL_REF (Pmode, MCOUNT_FUNCTION);
- emit_library_call (fun, 0, VOIDmode, 1, lab, Pmode);
+ emit_library_call (fun, LCT_NORMAL, VOIDmode, 1, lab, Pmode);
}
/* Mark ARG, which is really a struct ultrasparc_pipline_state *, for
@@ -8617,7 +8617,7 @@ sparc_elf_asm_named_section (name, flags
int
sparc_extra_constraint_check (op, c, strict)
rtx op;
- char c;
+ int c;
int strict;
{
int reload_ok_mem;
--- ./config/sparc/sparc-protos.h.~1~ Mon Apr 1 04:54:17 2002
+++ ./config/sparc/sparc-protos.h Sat Apr 13 03:33:09 2002
@@ -117,6 +117,7 @@ extern char *sparc_v8plus_shift PARAMS (
32 bits of REG are 0 before INSN. */
extern int sparc_check_64 PARAMS ((rtx, rtx));
extern rtx gen_df_reg PARAMS ((rtx, int));
-extern int sparc_extra_constraint_check PARAMS ((rtx, char, int));
+extern int sparc_extra_constraint_check PARAMS ((rtx, int, int));
#endif /* RTX_CODE */
#endif /* __SPARC_PROTOS_H__ */
--- ./config/sparc/sparc.md.~1~ Fri Apr 12 16:42:48 2002
+++ ./config/sparc/sparc.md Sat Apr 13 03:24:52 2002
@@ -5031,7 +5031,7 @@
else
slot0 = operands[0];
- emit_library_call (gen_rtx (SYMBOL_REF, Pmode, \"_Qp_stoq\"), 0,
+ emit_library_call (gen_rtx (SYMBOL_REF, Pmode, \"_Qp_stoq\"), LCT_NORMAL,
VOIDmode, 2,
XEXP (slot0, 0), Pmode,
operands[1], SFmode);
@@ -5066,7 +5066,7 @@
else
slot0 = operands[0];
- emit_library_call (gen_rtx (SYMBOL_REF, Pmode, \"_Qp_dtoq\"), 0,
+ emit_library_call (gen_rtx (SYMBOL_REF, Pmode, \"_Qp_dtoq\"), LCT_NORMAL,
VOIDmode, 2,
XEXP (slot0, 0), Pmode,
operands[1], DFmode);
@@ -5114,7 +5114,7 @@
slot0 = operands[1];
emit_library_call_value (gen_rtx (SYMBOL_REF, Pmode, \"_Qp_qtos\"),
- operands[0], 0, SFmode, 1,
+ operands[0], LCT_NORMAL, SFmode, 1,
XEXP (slot0, 0), Pmode);
DONE;
}
@@ -5148,7 +5148,7 @@
slot0 = operands[1];
emit_library_call_value (gen_rtx (SYMBOL_REF, Pmode, \"_Qp_qtod\"),
- operands[0], 0, DFmode, 1,
+ operands[0], LCT_NORMAL, DFmode, 1,
XEXP (slot0, 0), Pmode);
DONE;
}
@@ -5360,7 +5360,7 @@
slot0 = operands[1];
emit_library_call_value (gen_rtx (SYMBOL_REF, Pmode, \"_Qp_qtoi\"),
- operands[0], 0, SImode, 1,
+ operands[0], LCT_NORMAL, SImode, 1,
XEXP (slot0, 0), Pmode);
DONE;
}
@@ -5390,7 +5390,7 @@
slot0 = operands[1];
emit_library_call_value (gen_rtx (SYMBOL_REF, Pmode, \"_Qp_qtoui\"),
- operands[0], 0, SImode, 1,
+ operands[0], LCT_NORMAL, SImode, 1,
XEXP (slot0, 0), Pmode);
DONE;
}")
@@ -5432,7 +5432,7 @@
slot0 = operands[1];
emit_library_call_value (gen_rtx (SYMBOL_REF, Pmode, \"_Qp_qtox\"),
- operands[0], 0, DImode, 1,
+ operands[0], LCT_NORMAL, DImode, 1,
XEXP (slot0, 0), Pmode);
DONE;
}
@@ -5462,7 +5462,7 @@
slot0 = operands[1];
emit_library_call_value (gen_rtx (SYMBOL_REF, Pmode, \"_Qp_qtoux\"),
- operands[0], 0, DImode, 1,
+ operands[0], LCT_NORMAL, DImode, 1,
XEXP (slot0, 0), Pmode);
DONE;
}")