Commit 884815aa by Jan Beulich Committed by Richard Henderson

expmed.c (emit_store_flag): Also special-case double-word (in-)equality comparison against -1.

        * expmed.c (emit_store_flag): Also special-case double-word
        (in-)equality comparison against -1.

From-SVN: r84268
parent ff15c351
2004-07-06 Jan Beulich <jbeulich@novell.com> 2004-07-06 Jan Beulich <jbeulich@novell.com>
* expmed.c (emit_store_flag): Also special-case double-word
(in-)equality comparison against -1.
* config/i386/i386.c (ix86_gimplify_va_arg): Don't need temporary for * config/i386/i386.c (ix86_gimplify_va_arg): Don't need temporary for
passing arguments the containers for which are registers. passing arguments the containers for which are registers.
......
...@@ -4602,27 +4602,29 @@ emit_store_flag (rtx target, enum rtx_code code, rtx op0, rtx op1, ...@@ -4602,27 +4602,29 @@ emit_store_flag (rtx target, enum rtx_code code, rtx op0, rtx op1,
break; break;
} }
/* If we are comparing a double-word integer with zero, we can convert /* If we are comparing a double-word integer with zero or -1, we can
the comparison into one involving a single word. */ convert the comparison into one involving a single word. */
if (GET_MODE_BITSIZE (mode) == BITS_PER_WORD * 2 if (GET_MODE_BITSIZE (mode) == BITS_PER_WORD * 2
&& GET_MODE_CLASS (mode) == MODE_INT && GET_MODE_CLASS (mode) == MODE_INT
&& op1 == const0_rtx
&& (!MEM_P (op0) || ! MEM_VOLATILE_P (op0))) && (!MEM_P (op0) || ! MEM_VOLATILE_P (op0)))
{ {
if (code == EQ || code == NE) if ((code == EQ || code == NE)
&& (op1 == const0_rtx || op1 == constm1_rtx))
{ {
rtx op00, op01, op0both; rtx op00, op01, op0both;
/* Do a logical OR of the two words and compare the result. */ /* Do a logical OR or AND of the two words and compare the result. */
op00 = simplify_gen_subreg (word_mode, op0, mode, 0); op00 = simplify_gen_subreg (word_mode, op0, mode, 0);
op01 = simplify_gen_subreg (word_mode, op0, mode, UNITS_PER_WORD); op01 = simplify_gen_subreg (word_mode, op0, mode, UNITS_PER_WORD);
op0both = expand_binop (word_mode, ior_optab, op00, op01, op0both = expand_binop (word_mode,
NULL_RTX, unsignedp, OPTAB_DIRECT); op1 == const0_rtx ? ior_optab : and_optab,
op00, op01, NULL_RTX, unsignedp, OPTAB_DIRECT);
if (op0both != 0) if (op0both != 0)
return emit_store_flag (target, code, op0both, op1, word_mode, return emit_store_flag (target, code, op0both, op1, word_mode,
unsignedp, normalizep); unsignedp, normalizep);
} }
else if (code == LT || code == GE) else if ((code == LT || code == GE) && op1 == const0_rtx)
{ {
rtx op0h; rtx op0h;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment