aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorPaolo Bonzini <bonzini@gnu.org>2008-09-11 14:45:05 +0000
committerPaolo Bonzini <bonzini@gcc.gnu.org>2008-09-11 14:45:05 +0000
commit308216549297c41fb602dced560fa1ed8af0f8f6 (patch)
tree92b409e6b2cc1567926f357bf36f519f4895571f /gcc/testsuite
parentcf9757477e367cf9ab4e8dae6489dcd09178033e (diff)
downloadgcc-308216549297c41fb602dced560fa1ed8af0f8f6.zip
gcc-308216549297c41fb602dced560fa1ed8af0f8f6.tar.gz
gcc-308216549297c41fb602dced560fa1ed8af0f8f6.tar.bz2
dojump.c (do_jump): Move below.
2008-09-11 Paolo Bonzini <bonzini@gnu.org> * dojump.c (do_jump) [BIT_AND_EXPR]: Move below. Fall through to TRUTH_AND_EXPR for boolean (1-bit precision) expressions. (do_jump) [BIT_IOR_EXPR]: Compile as TRUTH_OR_EXPR. * tree-flow.h (simplify_stmt_using_ranges): Accept a GSI, return a bool. * tree-ssa-propagate.c (substitute_and_fold): Pass a GSI to VRP's simplify_stmt_using_ranges. Do simplify_stmt_using_ranges before finalizing the changes. * tree-vrp.c (extract_range_from_binary_expr): Add limited support for BIT_IOR_EXPR. (simplify_truth_ops_using_ranges): New. (simplify_div_or_mod_using_ranges, simplify_abs_using_ranges, simplify_cond_using_ranges, simplify_switch_using_ranges): Return whether a simplification was made. (simplify_stmt_using_ranges): Ditto, and accept a GSI. For GS_ASSIGN, use a switch statement and also call simplify_truth_ops_using_ranges. testsuite: 2008-09-11 Paolo Bonzini <bonzini@gnu.org> * gcc.dg/tree-ssa/vrp47.c: New. * gcc.target/i386/andor-2.c: New. From-SVN: r140288
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp47.c42
-rw-r--r--gcc/testsuite/gcc.target/i386/andor-2.c30
3 files changed, 77 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 85bb2a5..84ba775 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2008-09-11 Paolo Bonzini <bonzini@gnu.org>
+
+ * gcc.dg/tree-ssa/vrp47.c: New.
+ * gcc.target/i386/andor-2.c: New.
+
2008-09-11 Ira Rosen <irar@il.ibm.com>
PR tree-optimization/37474
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp47.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp47.c
new file mode 100644
index 0000000..a1ee927
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp47.c
@@ -0,0 +1,42 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-vrp -fdump-tree-dom" } */
+
+int h(int x, int y)
+{
+ if ((x >= 0 && x <= 1) && (y >= 0 && y <= 1))
+ return x && y;
+ else
+ return -1;
+}
+
+int g(int x, int y)
+{
+ if ((x >= 0 && x <= 1) && (y >= 0 && y <= 1))
+ return x || y;
+ else
+ return -1;
+}
+
+int f(int x)
+{
+ if (x != 0 && x != 1)
+ return -2;
+
+ else
+ return !x;
+}
+
+/* Test that x and y are never compared to 0 -- they're always known to be
+ 0 or 1. */
+/* { dg-final { scan-tree-dump-times "\[xy\]\[^ \]* !=" 0 "vrp1" } } */
+
+/* This one needs more copy propagation that only happens in dom1. */
+/* { dg-final { scan-tree-dump-times "x\[^ \]* & y" 1 "dom1" } } */
+/* { dg-final { scan-tree-dump-times "x\[^ \]* & y" 1 "vrp1" { xfail *-*-* } } } */
+
+/* These two are fully simplified by VRP. */
+/* { dg-final { scan-tree-dump-times "x\[^ \]* \[|\] y" 1 "vrp1" } } */
+/* { dg-final { scan-tree-dump-times "x\[^ \]* \\^ 1" 1 "vrp1" } } */
+
+/* { dg-final { cleanup-tree-dump "vrp\[0-9\]" } } */
+/* { dg-final { cleanup-tree-dump "dom\[0-9\]" } } */
diff --git a/gcc/testsuite/gcc.target/i386/andor-2.c b/gcc/testsuite/gcc.target/i386/andor-2.c
new file mode 100644
index 0000000..88118aa
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/andor-2.c
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mtune=i686" } */
+
+int h(int x, int y)
+{
+ if ((x >= 0 && x <= 1) && (y >= 0 && y <= 1))
+ return x && y;
+ else
+ return -1;
+}
+
+int g(int x, int y)
+{
+ if ((x >= 0 && x <= 1) && (y >= 0 && y <= 1))
+ return x || y;
+ else
+ return -1;
+}
+
+int f(int x, int y)
+{
+ if (x != 0 && x != 1)
+ return -2;
+
+ else
+ return !x;
+}
+
+/* { dg-final { scan-assembler-not "setne" } } */
+/* { dg-final { scan-assembler-not "sete" } } */