aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/execute
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2017-08-01 08:43:45 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2017-08-01 08:43:45 +0000
commit1c6e4932ee0cd58c3f3671549af55df7a35c8786 (patch)
treeeb10776d2a5bca963431b450de52d960a47d4eab /gcc/testsuite/gcc.c-torture/execute
parent50db208bc62d8d8c29aa9769ac7647bbdb1d8e23 (diff)
PR tree-optimization/81588
* tree-ssa-reassoc.c (optimize_range_tests_var_bound): If ranges[i].in_p, invert comparison code ccode. For >/>=, swap rhs1 and rhs2 and comparison code unconditionally, for </<= don't do that. Don't swap rhs1/rhs2 again if ranges[i].in_p, instead invert comparison code ccode if opcode or oe->rank is BIT_IOR_EXPR. * gcc.dg/tree-ssa/pr81588.c: New test. * gcc.dg/pr81588.c: New test. * gcc.c-torture/execute/pr81588.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@250761 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.c-torture/execute')
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr81588.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr81588.c b/gcc/testsuite/gcc.c-torture/execute/pr81588.c
new file mode 100644
index 00000000000..b8f84b3e18c
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr81588.c
@@ -0,0 +1,45 @@
+/* PR tree-optimization/81588 */
+
+__attribute__((noinline, noclone)) int
+bar (int x)
+{
+ __asm volatile ("" : : "g" (x) : "memory");
+}
+
+__attribute__((noinline, noclone)) int
+foo (unsigned x, long long y)
+{
+ if (y < 0)
+ return 0;
+ if (y < (long long) (4 * x))
+ {
+ bar (y);
+ return 1;
+ }
+ return 0;
+}
+
+int
+main ()
+{
+ volatile unsigned x = 10;
+ volatile long long y = -10000;
+ if (foo (x, y) != 0)
+ __builtin_abort ();
+ y = -1;
+ if (foo (x, y) != 0)
+ __builtin_abort ();
+ y = 0;
+ if (foo (x, y) != 1)
+ __builtin_abort ();
+ y = 39;
+ if (foo (x, y) != 1)
+ __builtin_abort ();
+ y = 40;
+ if (foo (x, y) != 0)
+ __builtin_abort ();
+ y = 10000;
+ if (foo (x, y) != 0)
+ __builtin_abort ();
+ return 0;
+}