summaryrefslogtreecommitdiffstats
path: root/gcc/simplify-rtx.c
diff options
context:
space:
mode:
authorbonzini <bonzini@138bc75d-0d04-0410-961f-82ee72b054a4>2004-03-05 10:41:27 +0000
committerbonzini <bonzini@138bc75d-0d04-0410-961f-82ee72b054a4>2004-03-05 10:41:27 +0000
commite5582c5cc4e7a7948b4620f24bc86d939090f4f6 (patch)
tree84242829927d10321448fbb1078ced9276267afc /gcc/simplify-rtx.c
parent266198273393b6c897773ce84198575284b3738e (diff)
downloadppe42-gcc-e5582c5cc4e7a7948b4620f24bc86d939090f4f6.tar.gz
ppe42-gcc-e5582c5cc4e7a7948b4620f24bc86d939090f4f6.zip
2004-03-05 Paolo Bonzini <bonzini@gnu.org>
* simplify-rtx.c (simplify_relational_operation): If flag_wrapv is set, do not move terms between the two side of a relational operator. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@78962 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/simplify-rtx.c')
-rw-r--r--gcc/simplify-rtx.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index bae37f870a2..b86a8b21473 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -2559,9 +2559,10 @@ simplify_relational_operation (enum rtx_code code, enum machine_mode mode,
If CODE is an unsigned comparison, then we can never do this optimization,
because it gives an incorrect result if the subtraction wraps around zero.
ANSI C defines unsigned operations such that they never overflow, and
- thus such cases can not be ignored. */
+ thus such cases can not be ignored; but we cannot do it even for
+ signed comparisons for languages such as Java, so test flag_wrapv. */
- if (INTEGRAL_MODE_P (mode) && trueop1 != const0_rtx
+ if (!flag_wrapv && INTEGRAL_MODE_P (mode) && trueop1 != const0_rtx
&& ! ((GET_CODE (op0) == REG || GET_CODE (trueop0) == CONST_INT)
&& (GET_CODE (op1) == REG || GET_CODE (trueop1) == CONST_INT))
&& 0 != (tem = simplify_binary_operation (MINUS, mode, op0, op1))
OpenPOWER on IntegriCloud