diff options
author | nemet <nemet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-01-29 03:08:38 +0000 |
---|---|---|
committer | nemet <nemet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-01-29 03:08:38 +0000 |
commit | 6d329589174b6839ea23c3f39972fb02d562ae95 (patch) | |
tree | f96acf509bf5a7593c1f9458877f3b544574ae86 /gcc/combine.c | |
parent | ef2794ada088c4360423a2bc874b06d904d906f0 (diff) | |
download | gcc-6d329589174b6839ea23c3f39972fb02d562ae95.tar.gz |
* combine.c (simplify_comparison <AND>): Check
TRULY_NOOP_TRUNCATION before start using a subreg.
* config/mips/mips.md (*branch_zero<mode>,
*branch_zero<mode>_inverted, *branch_equality<mode>,
*branch_equality<mode>_inverted, *branch_equality<mode>_mips16):
Remove mode check from comparisons.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@110358 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/combine.c')
-rw-r--r-- | gcc/combine.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/gcc/combine.c b/gcc/combine.c index 2c90be5a2e4..ee8d98d9dab 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -10295,14 +10295,27 @@ simplify_comparison (enum rtx_code code, rtx *pop0, rtx *pop1) /* If this AND operation is really a ZERO_EXTEND from a narrower mode, the constant fits within that mode, and this is either an equality or unsigned comparison, try to do this comparison in - the narrower mode. */ + the narrower mode. + + Note that in: + + (ne:DI (and:DI (reg:DI 4) (const_int 0xffffffff)) (const_int 0)) + -> (ne:DI (reg:SI 4) (const_int 0)) + + unless TRULY_NOOP_TRUNCATION allows it or the register is + known to hold a value of the required mode the + transformation is invalid. */ if ((equality_comparison_p || unsigned_comparison_p) && GET_CODE (XEXP (op0, 1)) == CONST_INT && (i = exact_log2 ((INTVAL (XEXP (op0, 1)) & GET_MODE_MASK (mode)) + 1)) >= 0 && const_op >> i == 0 - && (tmode = mode_for_size (i, MODE_INT, 1)) != BLKmode) + && (tmode = mode_for_size (i, MODE_INT, 1)) != BLKmode + && (TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (tmode), + GET_MODE_BITSIZE (GET_MODE (op0))) + || (REG_P (XEXP (op0, 0)) + && reg_truncated_to_mode (tmode, XEXP (op0, 0))))) { op0 = gen_lowpart (tmode, XEXP (op0, 0)); continue; |