expmed.c (emit_store_flag): If comparing two-word integer with zero, can optimize NE, EQ, GE, and LT.

* expmed.c (emit_store_flag): If comparing two-word integer
	with zero, can optimize NE, EQ, GE, and LT.

From-SVN: r33230
This commit is contained in:
Richard Kenner 2000-04-18 15:14:58 -04:00 committed by Richard Kenner
parent 60b6e1f5d5
commit 6912b84bf1
2 changed files with 32 additions and 6 deletions

View File

@ -1,14 +1,17 @@
2000-04-18 Mark Mitchell <mark@codesourcery.com>
* cpplex.c (_cpp_lex_token): Don't call CPP_BUMP_LINE when the
mark is active.
Tue Apr 18 14:16:47 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* expmed.c (emit_store_flag): If comparing two-word integer
with zero, can optimize NE, EQ, GE, and LT.
* c-decl.c (mark_binding_level): Use 'for' instead of `while'.
* conflict.c: Minor cleanups.
* optabs.c: Add blank line
* simplify-rtx.c:
* simplify-rtx.c: Minor cleanups.
2000-04-18 Mark Mitchell <mark@codesourcery.com>
* cpplex.c (_cpp_lex_token): Don't call CPP_BUMP_LINE when the
mark is active.
2000-04-17 Zack Weinberg <zack@wolery.cumb.org>

View File

@ -4181,6 +4181,29 @@ emit_store_flag (target, code, op0, op1, mode, unsignedp, normalizep)
break;
}
/* If we are comparing a double-word integer with zero, we can convert
the comparison into one involving a single word. */
if (GET_MODE_BITSIZE (mode) == BITS_PER_WORD * 2
&& GET_MODE_CLASS (mode) == MODE_INT
&& op1 == const0_rtx)
{
if (code == EQ || code == NE)
{
/* Do a logical OR of the two words and compare the result. */
rtx op0h = gen_highpart (word_mode, op0);
rtx op0l = gen_lowpart (word_mode, op0);
rtx op0both = expand_binop (word_mode, ior_optab, op0h, op0l,
NULL_RTX, unsignedp, OPTAB_DIRECT);
if (op0both != 0)
return emit_store_flag (target, code, op0both, op1, word_mode,
unsignedp, normalizep);
}
else if (code == LT || code == GE)
/* If testing the sign bit, can just test on high word. */
return emit_store_flag (target, code, gen_highpart (word_mode, op0),
op1, word_mode, unsignedp, normalizep);
}
/* From now on, we won't change CODE, so set ICODE now. */
icode = setcc_gen_code[(int) code];