summaryrefslogtreecommitdiff
path: root/gcc/optabs.c
diff options
context:
space:
mode:
authorsayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2003-10-06 23:09:28 +0000
committersayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2003-10-06 23:09:28 +0000
commit951202762caa9e78a06bddbe8d56636eaaa65c8e (patch)
treec1d94a7feee91cefe5fd6511bcd4566bf6170943 /gcc/optabs.c
parent22ac1ed3b7695c897fa73a6fc10635b3ef896fa1 (diff)
downloadgcc-951202762caa9e78a06bddbe8d56636eaaa65c8e.tar.gz
* optabs.c (prepare_float_lib_cmp): Avoid searching for REG_RETVAL
instruction by using LCT_CONST and then calling emit_libcall_block ourselves. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@72171 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/optabs.c')
-rw-r--r--gcc/optabs.c131
1 files changed, 59 insertions, 72 deletions
diff --git a/gcc/optabs.c b/gcc/optabs.c
index d3e55b1afe7..b0953ebe77b 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -3878,9 +3878,8 @@ prepare_float_lib_cmp (rtx *px, rtx *py, enum rtx_code *pcomparison,
rtx y = protect_from_queue (*py, 0);
enum machine_mode orig_mode = GET_MODE (x);
enum machine_mode mode;
- rtx before_call;
+ rtx value, target, insns, equiv;
rtx libfunc = 0;
- rtx result;
for (mode = orig_mode; mode != VOIDmode; mode = GET_MODE_WIDER_MODE (mode))
{
@@ -3905,11 +3904,6 @@ prepare_float_lib_cmp (rtx *px, rtx *py, enum rtx_code *pcomparison,
y = convert_to_mode (mode, y, 0);
}
- before_call = get_last_insn ();
-
- result = emit_library_call_value (libfunc, NULL_RTX, LCT_CONST_MAKE_BLOCK,
- word_mode, 2, x, mode, y, mode);
-
/* If we're optimizing attach a REG_EQUAL note describing the semantics
of the libcall to the RTL. The allows the RTL optimizers to delete
the libcall if the condition can be determined at compile-time. */
@@ -3917,86 +3911,79 @@ prepare_float_lib_cmp (rtx *px, rtx *py, enum rtx_code *pcomparison,
&& ! side_effects_p (x)
&& ! side_effects_p (y))
{
- /* Search backwards through the insns emitted above looking for
- the instruction with the REG_RETVAL note. */
- rtx last = get_last_insn ();
- while (last != before_call)
+ if (comparison == UNORDERED)
{
- if (find_reg_note (last, REG_RETVAL, NULL))
- break;
- last = PREV_INSN (last);
+ rtx temp = simplify_gen_relational (NE, word_mode, mode, x, x);
+ equiv = simplify_gen_relational (NE, word_mode, mode, y, y);
+ equiv = simplify_gen_ternary (IF_THEN_ELSE, word_mode, word_mode,
+ temp, const_true_rtx, equiv);
}
-
- if (last != before_call)
+ else
{
- rtx equiv;
- if (comparison == UNORDERED)
+ equiv = simplify_gen_relational (comparison, word_mode, mode, x, y);
+ if (! FLOAT_LIB_COMPARE_RETURNS_BOOL (mode, comparison))
{
- rtx temp = simplify_gen_relational (NE, word_mode,
- mode, x, x);
- equiv = simplify_gen_relational (NE, word_mode,
- mode, y, y);
- equiv = simplify_gen_ternary (IF_THEN_ELSE, word_mode,
- word_mode, temp,
- const_true_rtx, equiv);
- }
- else
- {
- equiv = simplify_gen_relational (comparison, word_mode,
- mode, x, y);
- if (! FLOAT_LIB_COMPARE_RETURNS_BOOL (mode, comparison))
+ rtx true_rtx, false_rtx;
+
+ switch (comparison)
{
- rtx true_rtx, false_rtx;
+ case EQ:
+ true_rtx = const0_rtx;
+ false_rtx = const_true_rtx;
+ break;
- switch (comparison)
- {
- case EQ:
- true_rtx = const0_rtx;
- false_rtx = const_true_rtx;
- break;
-
- case NE:
- true_rtx = const_true_rtx;
- false_rtx = const0_rtx;
- break;
-
- case GT:
- true_rtx = const1_rtx;
- false_rtx = const0_rtx;
- break;
-
- case GE:
- true_rtx = const0_rtx;
- false_rtx = constm1_rtx;
- break;
-
- case LT:
- true_rtx = constm1_rtx;
- false_rtx = const0_rtx;
- break;
-
- case LE:
- true_rtx = const0_rtx;
- false_rtx = const1_rtx;
- break;
-
- default:
- abort ();
- }
- equiv = simplify_gen_ternary (IF_THEN_ELSE, word_mode,
- word_mode, equiv,
- true_rtx, false_rtx);
+ case NE:
+ true_rtx = const_true_rtx;
+ false_rtx = const0_rtx;
+ break;
+
+ case GT:
+ true_rtx = const1_rtx;
+ false_rtx = const0_rtx;
+ break;
+
+ case GE:
+ true_rtx = const0_rtx;
+ false_rtx = constm1_rtx;
+ break;
+
+ case LT:
+ true_rtx = constm1_rtx;
+ false_rtx = const0_rtx;
+ break;
+
+ case LE:
+ true_rtx = const0_rtx;
+ false_rtx = const1_rtx;
+ break;
+
+ default:
+ abort ();
}
+ equiv = simplify_gen_ternary (IF_THEN_ELSE, word_mode,
+ word_mode, equiv,
+ true_rtx, false_rtx);
}
- set_unique_reg_note (last, REG_EQUAL, equiv);
}
}
+ else
+ equiv = NULL_RTX;
+
+ start_sequence ();
+ value = emit_library_call_value (libfunc, NULL_RTX, LCT_CONST,
+ word_mode, 2, x, mode, y, mode);
+ insns = get_insns ();
+ end_sequence ();
+
+ target = gen_reg_rtx (word_mode);
+ emit_libcall_block (insns, target, value, equiv);
+
if (comparison == UNORDERED
|| FLOAT_LIB_COMPARE_RETURNS_BOOL (mode, comparison))
comparison = NE;
- *px = result;
+ *px = target;
*py = const0_rtx;
*pmode = word_mode;
*pcomparison = comparison;