summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>2000-04-18 15:14:58 -0400
committerRichard Kenner <kenner@gcc.gnu.org>2000-04-18 15:14:58 -0400
commit6912b84bf1a10c6bc8c9c337153189a44bdce35f (patch)
tree63c641373bc58210fc72a1e3d073d51bc6276e52 /gcc
parent60b6e1f5d5a3502cdc4c5491474812623c4654af (diff)
downloadgcc-6912b84bf1a10c6bc8c9c337153189a44bdce35f.tar.gz
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog15
-rw-r--r--gcc/expmed.c23
2 files changed, 32 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 0ba9d8b55be..d9eb7c4b0c3 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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>
diff --git a/gcc/expmed.c b/gcc/expmed.c
index 16c9bef6b5f..bb06536e5e5 100644
--- a/gcc/expmed.c
+++ b/gcc/expmed.c
@@ -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];