summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr20922-4.c
diff options
context:
space:
mode:
authorphython <phython@138bc75d-0d04-0410-961f-82ee72b054a4>2005-04-18 15:18:21 +0000
committerphython <phython@138bc75d-0d04-0410-961f-82ee72b054a4>2005-04-18 15:18:21 +0000
commit89a6fcda688b6ac8df4d0a70e448556b88758582 (patch)
tree9a986aa5b5fe42c3e7cb2e30a5bd0d19a609233d /gcc/testsuite/gcc.dg/pr20922-4.c
parent6dbbbfec3b418e6dc95f1dc60c37ba41b12cc14d (diff)
downloadgcc-89a6fcda688b6ac8df4d0a70e448556b88758582.tar.gz
2005-04-18 James A. Morrison <phython@gcc.gnu.org>
PR tree-optimization/20922 * fold-const.c (fold_binary): Fold X - c > X and X + c < X to false. Fold X + c >= X and fold X - c <= X to true. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@98321 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/pr20922-4.c')
-rw-r--r--gcc/testsuite/gcc.dg/pr20922-4.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/pr20922-4.c b/gcc/testsuite/gcc.dg/pr20922-4.c
new file mode 100644
index 00000000000..664a62f4e4c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr20922-4.c
@@ -0,0 +1,38 @@
+/* { dg-do compile } */
+/* { dg-options "-fno-wrapv -fdump-tree-generic" } */
+int f(int i)
+{
+ return i < (i - 2);
+}
+
+int g(int i)
+{
+ return i > (i + 2);
+}
+
+int h(int i)
+{
+ return i < (i + (-2));
+}
+
+int j(int i)
+{
+ return i > (i - (-2));
+}
+
+int x(double i)
+{
+ return i < (i - 2.0);
+}
+
+int y(double i)
+{
+ return i > (i + 2.0);
+}
+
+int z(double i)
+{
+ return i < (i + (-2.0));
+}
+/* { dg-final { scan-tree-dump-times " = 0" 7 "generic" } } */
+/* { dg-final { cleanup-tree-dump "generic" } } */