aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1997-01-04 18:48:04 -0500
committerRichard Kenner <kenner@gcc.gnu.org>1997-01-04 18:48:04 -0500
commit1a6ec0703b7187362c9c81abf0fb78f66f468e5c (patch)
treee340dd21565a78d5116b02bc784ff8db36b81a83
parent4d6a19ff0f57411a6bb7c7eb5d6072392e503dd2 (diff)
downloadgcc-1a6ec0703b7187362c9c81abf0fb78f66f468e5c.zip
gcc-1a6ec0703b7187362c9c81abf0fb78f66f468e5c.tar.gz
gcc-1a6ec0703b7187362c9c81abf0fb78f66f468e5c.tar.bz2
(find_split_point, case SET): If SET_SRC is NE and STORE_FLAG_VALUE is -1, see if we can convert into NEG of shift.
(find_split_point, case SET): If SET_SRC is NE and STORE_FLAG_VALUE is -1, see if we can convert into NEG of shift. (force_to_mode, case NE): Make condition stricter. From-SVN: r13370
-rw-r--r--gcc/combine.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/gcc/combine.c b/gcc/combine.c
index 57100b9..6ebd8ca 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -1,5 +1,5 @@
/* Optimize by combining instructions for GNU compiler.
- Copyright (C) 1987, 88, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
+ Copyright (C) 1987, 88, 92-96, 1997 Free Software Foundation, Inc.
This file is part of GNU CC.
@@ -2667,6 +2667,29 @@ find_split_point (loc, insn)
}
break;
+ case NE:
+ /* if STORE_FLAG_VALUE is -1, this is (NE X 0) and only one bit of X
+ is known to be on, this can be converted into a NEG of a shift. */
+ if (STORE_FLAG_VALUE == -1 && XEXP (SET_SRC (x), 1) == const0_rtx
+ && GET_MODE (SET_SRC (x)) == GET_MODE (XEXP (SET_SRC (x), 0))
+ && 1 <= (len = exact_log2
+ (nonzero_bits (XEXP (SET_SRC (x), 0),
+ GET_MODE (XEXP (SET_SRC (x), 0))))))
+ {
+ enum machine_mode mode = GET_MODE (XEXP (SET_SRC (x), 0));
+
+ SUBST (SET_SRC (x),
+ gen_rtx_combine (NEG, mode,
+ gen_rtx_combine (LSHIFTRT, mode,
+ XEXP (SET_SRC (x), 0),
+ GEN_INT (len))));
+
+ split = find_split_point (&SET_SRC (x), insn);
+ if (split && split != &SET_SRC (x))
+ return split;
+ }
+ break;
+
case SIGN_EXTEND:
inner = XEXP (SET_SRC (x), 0);
pos = 0;
@@ -6383,10 +6406,10 @@ force_to_mode (x, mode, mask, reg, just_select)
case NE:
/* (and (ne FOO 0) CONST) can be (and FOO CONST) if CONST is included
in STORE_FLAG_VALUE and FOO has a single bit that might be nonzero,
- which is in CONST. */
+ which is equal to STORE_FLAG_VALUE. */
if ((mask & ~ STORE_FLAG_VALUE) == 0 && XEXP (x, 1) == const0_rtx
&& exact_log2 (nonzero_bits (XEXP (x, 0), mode)) >= 0
- && (nonzero_bits (XEXP (x, 0), mode) & ~ mask) == 0)
+ && nonzero_bits (XEXP (x, 0), mode) == STORE_FLAG_VALUE)
return force_to_mode (XEXP (x, 0), mode, mask, reg, next_select);
break;