aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/simplify-rtx.c8
-rw-r--r--gcc/testsuite/ChangeLog8
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr23047.c16
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr23047.x2
5 files changed, 37 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b0d7bff..d888c82 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2005-07-25 James A. Morrison <phython@gcc.gnu.org>
+
+ PR rtl-optimization/23047
+ * simplify-rtx.c (simplify_const_relational_operation): Respect
+ flag_wrapv for comparisons with ABS.
+
2005-07-27 James A. Morrison <phython@gcc.gnu.org>
PR tree-optimization/22493
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index ae1fea7..e3e2999 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -3236,7 +3236,9 @@ simplify_const_relational_operation (enum rtx_code code,
case LT:
/* Optimize abs(x) < 0.0. */
- if (trueop1 == CONST0_RTX (mode) && !HONOR_SNANS (mode))
+ if (trueop1 == CONST0_RTX (mode)
+ && !HONOR_SNANS (mode)
+ && !(flag_wrapv && INTEGRAL_MODE_P (mode)))
{
tem = GET_CODE (trueop0) == FLOAT_EXTEND ? XEXP (trueop0, 0)
: trueop0;
@@ -3247,7 +3249,9 @@ simplify_const_relational_operation (enum rtx_code code,
case GE:
/* Optimize abs(x) >= 0.0. */
- if (trueop1 == CONST0_RTX (mode) && !HONOR_NANS (mode))
+ if (trueop1 == CONST0_RTX (mode)
+ && !HONOR_NANS (mode)
+ && !(flag_wrapv && INTEGRAL_MODE_P (mode)))
{
tem = GET_CODE (trueop0) == FLOAT_EXTEND ? XEXP (trueop0, 0)
: trueop0;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index d2861aa..ddf272d 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,6 +1,12 @@
2005-07-27 James A. Morrison <phython@gcc.gnu.org>
- PR rtl-optimization/22493
+ PR rtl-optimization/23047
+ * gcc.c-torture/execute/pr23047.c: New test.
+ * gcc.c-torture/execute/pr23047.x: New.
+
+2005-07-27 James A. Morrison <phython@gcc.gnu.org>
+
+ PR tree-optimization/22493
* gcc.c-torture/execute/pr22493-1.c: New test.
* gcc.c-torture/execute/pr22493-1.x: New.
* gcc.c-torture/execute/vrp-1.c: New test.
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr23047.c b/gcc/testsuite/gcc.c-torture/execute/pr23047.c
new file mode 100644
index 0000000..7557fc2
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr23047.c
@@ -0,0 +1,16 @@
+#include <limits.h>
+extern void abort ();
+extern void exit (int);
+void f(int i)
+{
+ i = i > 0 ? i : -i;
+ if (i<0)
+ return;
+ abort ();
+}
+
+int main(int argc, char *argv[])
+{
+ f(INT_MIN);
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr23047.x b/gcc/testsuite/gcc.c-torture/execute/pr23047.x
new file mode 100644
index 0000000..36a5839
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr23047.x
@@ -0,0 +1,2 @@
+set additional_flags "-fwrapv"
+return 0