aboutsummaryrefslogtreecommitdiff
path: root/gcc/simplify-rtx.c
diff options
context:
space:
mode:
authorBernd Schmidt <bernds@codesourcery.com>2010-08-03 23:48:52 +0000
committerBernd Schmidt <bernds@gcc.gnu.org>2010-08-03 23:48:52 +0000
commit29b40d79bb5827f79c71e97ed029cdada940dc55 (patch)
treeecb6814d4696c9ee687838148c96dfdb407da3ab /gcc/simplify-rtx.c
parent15b71db372221e4cb5b5e490397cd4ea4199505f (diff)
downloadgcc-29b40d79bb5827f79c71e97ed029cdada940dc55.zip
gcc-29b40d79bb5827f79c71e97ed029cdada940dc55.tar.gz
gcc-29b40d79bb5827f79c71e97ed029cdada940dc55.tar.bz2
simplify-rtx.c (simplify_binary_operation_1): Try to simplify away NEG as operand of a MULT by merging it with the other operand.
* simplify-rtx.c (simplify_binary_operation_1): Try to simplify away NEG as operand of a MULT by merging it with the other operand. * combine.c (make_compound_operation): Use trunc_int_for_mode when generating a MULT with constant. Canonicalize PLUS and MINUS involving MULT. * config/arm/constraints.md (M): Examine only 32 bits of a HOST_WIDE_INT. * config/arm/predicates.md (power_of_two_operand): Likewise. From-SVN: r162849
Diffstat (limited to 'gcc/simplify-rtx.c')
-rw-r--r--gcc/simplify-rtx.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index 8e29d2d..86de77e 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -2109,6 +2109,19 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode,
if (trueop1 == constm1_rtx)
return simplify_gen_unary (NEG, mode, op0, mode);
+ if (GET_CODE (op0) == NEG)
+ {
+ rtx temp = simplify_unary_operation (NEG, mode, op1, mode);
+ if (temp)
+ return simplify_gen_binary (MULT, mode, XEXP (op0, 0), temp);
+ }
+ if (GET_CODE (op1) == NEG)
+ {
+ rtx temp = simplify_unary_operation (NEG, mode, op0, mode);
+ if (temp)
+ return simplify_gen_binary (MULT, mode, temp, XEXP (op1, 0));
+ }
+
/* Maybe simplify x * 0 to 0. The reduction is not valid if
x is NaN, since x * 0 is then also NaN. Nor is it valid
when the mode has signed zeros, since multiplying a negative