aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2023-03-29 09:01:23 -0700
committerIan Lance Taylor <iant@golang.org>2023-03-29 09:01:23 -0700
commit6612f4f8cb9b0d5af18ec69ad04e56debc3e6ced (patch)
tree1deecdcfbf185c7044bc861d0ace51285c96cb62 /gcc/testsuite/gcc.dg/tree-ssa
parent795cffe109e28b248a54b8ee583cbae48368c2a7 (diff)
parentaa8f4242efc99f24de73c59d53996f28db28c13f (diff)
downloadgcc-6612f4f8cb9b0d5af18ec69ad04e56debc3e6ced.zip
gcc-6612f4f8cb9b0d5af18ec69ad04e56debc3e6ced.tar.gz
gcc-6612f4f8cb9b0d5af18ec69ad04e56debc3e6ced.tar.bz2
Merge from trunk revision aa8f4242efc99f24de73c59d53996f28db28c13f.
Diffstat (limited to 'gcc/testsuite/gcc.dg/tree-ssa')
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/20030808-1.c6
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/andnegcmp-1.c14
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/andnegcmp-2.c14
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/bool-minus-1.c11
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/bool-minus-2.c33
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/branchless-cond.c26
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/cltz-complement-max.c60
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/cltz-max.c72
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/clz-char.c34
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/clz-complement-char.c31
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/clz-complement-int.c31
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/clz-complement-long-long.c31
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/clz-complement-long.c31
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/clz-int.c34
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/clz-long-long.c34
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/clz-long.c34
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ctz-char.c36
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-char.c31
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-int.c31
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-long-long.c31
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-long.c31
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ctz-int.c36
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ctz-long-long.c36
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ctz-long.c36
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/forwprop-19.c4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/forwprop-3.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/forwprop-39.c13
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/gen-vect-34.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/loopclosedphi.c4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/modref-dse-7.c22
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/multcmp-1.c12
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/multcmp-2.c12
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/popcount-max.c33
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/popcount.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/popcount2.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/popcount3.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/popcount6.c12
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/popcount6b.c6
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr100359.c3
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr107009.c15
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr107052.c13
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr107130.c19
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr107170.c8
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr107195-1.c15
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr107195-2.c16
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr107195-3.c112
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr107273-1.c31
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr107273-2.c27
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr107293.c32
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr107323.c28
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr107355.c13
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr107394.c22
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr107490.c28
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr107541.c18
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr107699.c15
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr107732.c13
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr107767.c20
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr108137.c8
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr108354-1.c26
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr108357.c22
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr108684-1.c18
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr109031-1.c39
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr109031-2.c39
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr55157.c19
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr79095.c6
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr89317.c30
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr91091-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr99739.c40
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/reassoc-47.c4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/reassoc-48.c9
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-42.c26
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-43.c12
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-copyprop-3.c38
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-46.c23
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-100.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-101.c47
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-21.c7
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-24.c25
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-18.c7
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-21.c26
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/tree-ssa.exp2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp-float-3a.c19
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp-float-4a.c23
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp-float-5a.c16
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp-float-abs-1.c17
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp-float-plus.c21
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp-float-signbit-3.c15
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp-unreachable.c42
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp-update.c21
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp122.c19
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp123.c18
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp46.c2
92 files changed, 1994 insertions, 36 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/20030808-1.c b/gcc/testsuite/gcc.dg/tree-ssa/20030808-1.c
index 456f6f2..7d4a138 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/20030808-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/20030808-1.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O1 -fdump-tree-cddce3" } */
+/* { dg-options "-O1 -fdump-tree-dce7" } */
extern void abort (void);
@@ -33,8 +33,8 @@ delete_dead_jumptables ()
/* There should be no loads of ->code. If any exist, then we failed to
optimize away all the IF statements and the statements feeding
their conditions. */
-/* { dg-final { scan-tree-dump-times "->code" 0 "cddce3"} } */
+/* { dg-final { scan-tree-dump-times "->code" 0 "dce7"} } */
/* There should be no IF statements. */
-/* { dg-final { scan-tree-dump-times "if " 0 "cddce3"} } */
+/* { dg-final { scan-tree-dump-times "if " 0 "dce7"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/andnegcmp-1.c b/gcc/testsuite/gcc.dg/tree-ssa/andnegcmp-1.c
new file mode 100644
index 0000000..6f16783
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/andnegcmp-1.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+/* PR tree-optimization/92342 */
+
+int
+f (int m1, int m2, int c)
+{
+ int d = m1 == m2;
+ d = -d;
+ int e = d & c;
+ return e;
+}
+
+/* { dg-final { scan-tree-dump-times "\\? c_\[0-9\]\\(D\\) : 0" 1 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/andnegcmp-2.c b/gcc/testsuite/gcc.dg/tree-ssa/andnegcmp-2.c
new file mode 100644
index 0000000..0e25c8a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/andnegcmp-2.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+/* PR tree-optimization/92342 */
+
+int
+f (int m1, int m2, int c)
+{
+ int d = m1 < m2;
+ d = -d;
+ int e = c & d;
+ return e;
+}
+
+/* { dg-final { scan-tree-dump-times "\\? c_\[0-9\]\\(D\\) : 0" 1 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/bool-minus-1.c b/gcc/testsuite/gcc.dg/tree-ssa/bool-minus-1.c
new file mode 100644
index 0000000..e434ff9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/bool-minus-1.c
@@ -0,0 +1,11 @@
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+_Bool
+foo (_Bool a)
+{
+ int c = 1 - a;
+ return c;
+}
+
+/* { dg-final { scan-tree-dump-times "1 - " 0 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "~a" 1 "optimized" } } */
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/bool-minus-2.c b/gcc/testsuite/gcc.dg/tree-ssa/bool-minus-2.c
new file mode 100644
index 0000000..b77d36c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/bool-minus-2.c
@@ -0,0 +1,33 @@
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+_Bool
+foo (_Bool a, _Bool b)
+{
+ int c = 1 - a;
+ int d = 1 - b;
+ int e = c & d;
+ return 1 - e;
+}
+
+_Bool
+bar (_Bool a, _Bool b)
+{
+ int c = 1 - a;
+ int d = 1 - b;
+ _Bool e = c & d;
+ return 1 - e;
+}
+
+_Bool
+baz (_Bool a, _Bool b)
+{
+ _Bool c = 1 - a;
+ _Bool d = 1 - b;
+ _Bool e = c & d;
+ return 1 - e;
+}
+
+/* { dg-final { scan-tree-dump-times "1 - " 0 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "~a" 0 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "~b" 0 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "a_\[0-9\]+.D. \\\| b_\[0-9\]+.D." 3 "optimized" } } */
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/branchless-cond.c b/gcc/testsuite/gcc.dg/tree-ssa/branchless-cond.c
new file mode 100644
index 0000000..68087ae
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/branchless-cond.c
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+int f1(unsigned int x, unsigned int y, unsigned int z)
+{
+ return ((x & 1) == 0) ? y : z ^ y;
+}
+
+int f2(unsigned int x, unsigned int y, unsigned int z)
+{
+ return ((x & 1) != 0) ? z ^ y : y;
+}
+
+int f3(unsigned int x, unsigned int y, unsigned int z)
+{
+ return ((x & 1) == 0) ? y : z | y;
+}
+
+int f4(unsigned int x, unsigned int y, unsigned int z)
+{
+ return ((x & 1) != 0) ? z | y : y;
+}
+
+/* { dg-final { scan-tree-dump-times " -" 4 "optimized" } } */
+/* { dg-final { scan-tree-dump-times " & " 8 "optimized" } } */
+/* { dg-final { scan-tree-dump-not "if" "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/cltz-complement-max.c b/gcc/testsuite/gcc.dg/tree-ssa/cltz-complement-max.c
new file mode 100644
index 0000000..1a29ca5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/cltz-complement-max.c
@@ -0,0 +1,60 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fno-tree-loop-optimize -fdump-tree-optimized" } */
+
+#define PREC (__CHAR_BIT__)
+
+int clz_complement_count1 (unsigned char b) {
+ int c = 0;
+
+ while (b) {
+ b >>= 1;
+ c++;
+ }
+ if (c <= PREC)
+ return 0;
+ else
+ return 34567;
+}
+
+int clz_complement_count2 (unsigned char b) {
+ int c = 0;
+
+ while (b) {
+ b >>= 1;
+ c++;
+ }
+ if (c <= PREC - 1)
+ return 0;
+ else
+ return 76543;
+}
+
+int ctz_complement_count1 (unsigned char b) {
+ int c = 0;
+
+ while (b) {
+ b <<= 1;
+ c++;
+ }
+ if (c <= PREC)
+ return 0;
+ else
+ return 23456;
+}
+
+int ctz_complement_count2 (unsigned char b) {
+ int c = 0;
+
+ while (b) {
+ b <<= 1;
+ c++;
+ }
+ if (c <= PREC - 1)
+ return 0;
+ else
+ return 65432;
+}
+/* { dg-final { scan-tree-dump-times "34567" 0 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "76543" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "23456" 0 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "65432" 1 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/cltz-max.c b/gcc/testsuite/gcc.dg/tree-ssa/cltz-max.c
new file mode 100644
index 0000000..a6bea3d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/cltz-max.c
@@ -0,0 +1,72 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fno-tree-loop-optimize -fdump-tree-optimized" } */
+
+#define PREC (__CHAR_BIT__)
+
+int clz_count1 (unsigned char b) {
+ int c = 0;
+
+ if (b == 0)
+ return 0;
+
+ while (!(b & (1 << (PREC - 1)))) {
+ b <<= 1;
+ c++;
+ }
+ if (c <= PREC - 1)
+ return 0;
+ else
+ return 34567;
+}
+
+int clz_count2 (unsigned char b) {
+ int c = 0;
+
+ if (b == 0)
+ return 0;
+
+ while (!(b & (1 << PREC - 1))) {
+ b <<= 1;
+ c++;
+ }
+ if (c <= PREC - 2)
+ return 0;
+ else
+ return 76543;
+}
+
+int ctz_count1 (unsigned char b) {
+ int c = 0;
+
+ if (b == 0)
+ return 0;
+
+ while (!(b & 1)) {
+ b >>= 1;
+ c++;
+ }
+ if (c <= PREC - 1)
+ return 0;
+ else
+ return 23456;
+}
+
+int ctz_count2 (unsigned char b) {
+ int c = 0;
+
+ if (b == 0)
+ return 0;
+
+ while (!(b & 1)) {
+ b >>= 1;
+ c++;
+ }
+ if (c <= PREC - 2)
+ return 0;
+ else
+ return 65432;
+}
+/* { dg-final { scan-tree-dump-times "34567" 0 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "76543" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "23456" 0 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "65432" 1 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/clz-char.c b/gcc/testsuite/gcc.dg/tree-ssa/clz-char.c
new file mode 100644
index 0000000..4a122db
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/clz-char.c
@@ -0,0 +1,34 @@
+/* { dg-do run } */
+/* { dg-require-effective-target clzl } */
+/* { dg-options "-O2 -fno-tree-ch -fdump-tree-optimized" } */
+
+#define PREC (__CHAR_BIT__)
+
+int
+__attribute__ ((noinline, noclone))
+foo (unsigned char b) {
+ int c = 0;
+
+ if (b == 0)
+ return PREC;
+
+ while (!(b & (1 << (PREC - 1)))) {
+ b <<= 1;
+ c++;
+ }
+
+ return c;
+}
+
+int main()
+{
+ if (foo(0) != PREC)
+ __builtin_abort ();
+ if (foo(1 << (PREC - 1)) != 0)
+ __builtin_abort ();
+ if (foo(35) != PREC - 6)
+ __builtin_abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "__builtin_clz|\\.CLZ" 1 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/clz-complement-char.c b/gcc/testsuite/gcc.dg/tree-ssa/clz-complement-char.c
new file mode 100644
index 0000000..2ebe8fa
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/clz-complement-char.c
@@ -0,0 +1,31 @@
+/* { dg-do run } */
+/* { dg-require-effective-target clz } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+#define PREC (__CHAR_BIT__)
+
+int
+__attribute__ ((noinline, noclone))
+foo (unsigned char b) {
+ int c = 0;
+
+ while (b) {
+ b >>= 1;
+ c++;
+ }
+
+ return c;
+}
+
+int main()
+{
+ if (foo(0) != 0)
+ __builtin_abort ();
+ if (foo(5) != 3)
+ __builtin_abort ();
+ if (foo(255) != 8)
+ __builtin_abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "__builtin_clz|\\.CLZ" 1 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/clz-complement-int.c b/gcc/testsuite/gcc.dg/tree-ssa/clz-complement-int.c
new file mode 100644
index 0000000..f2c5c23
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/clz-complement-int.c
@@ -0,0 +1,31 @@
+/* { dg-do run } */
+/* { dg-require-effective-target clz } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+#define PREC (__CHAR_BIT__ * __SIZEOF_INT__)
+
+int
+__attribute__ ((noinline, noclone))
+foo (unsigned int b) {
+ int c = 0;
+
+ while (b) {
+ b >>= 1;
+ c++;
+ }
+
+ return c;
+}
+
+int main()
+{
+ if (foo(0) != 0)
+ __builtin_abort ();
+ if (foo(5) != 3)
+ __builtin_abort ();
+ if (foo(1 << (PREC - 1)) != PREC)
+ __builtin_abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "__builtin_clz|\\.CLZ" 1 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/clz-complement-long-long.c b/gcc/testsuite/gcc.dg/tree-ssa/clz-complement-long-long.c
new file mode 100644
index 0000000..7f7793f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/clz-complement-long-long.c
@@ -0,0 +1,31 @@
+/* { dg-do run } */
+/* { dg-require-effective-target clzll } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+#define PREC (__CHAR_BIT__ * __SIZEOF_LONG_LONG__)
+
+int
+__attribute__ ((noinline, noclone))
+foo (unsigned long long b) {
+ int c = 0;
+
+ while (b) {
+ b >>= 1;
+ c++;
+ }
+
+ return c;
+}
+
+int main()
+{
+ if (foo(0) != 0)
+ __builtin_abort ();
+ if (foo(5) != 3)
+ __builtin_abort ();
+ if (foo(1LL << (PREC - 1)) != PREC)
+ __builtin_abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "__builtin_clz|\\.CLZ" 1 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/clz-complement-long.c b/gcc/testsuite/gcc.dg/tree-ssa/clz-complement-long.c
new file mode 100644
index 0000000..97161bb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/clz-complement-long.c
@@ -0,0 +1,31 @@
+/* { dg-do run } */
+/* { dg-require-effective-target clzl } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+#define PREC (__CHAR_BIT__ * __SIZEOF_LONG__)
+
+int
+__attribute__ ((noinline, noclone))
+foo (unsigned long b) {
+ int c = 0;
+
+ while (b) {
+ b >>= 1;
+ c++;
+ }
+
+ return c;
+}
+
+int main()
+{
+ if (foo(0) != 0)
+ __builtin_abort ();
+ if (foo(5) != 3)
+ __builtin_abort ();
+ if (foo(1L << (PREC - 1)) != PREC)
+ __builtin_abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "__builtin_clz|\\.CLZ" 1 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/clz-int.c b/gcc/testsuite/gcc.dg/tree-ssa/clz-int.c
new file mode 100644
index 0000000..96646f8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/clz-int.c
@@ -0,0 +1,34 @@
+/* { dg-do run } */
+/* { dg-require-effective-target clzl } */
+/* { dg-options "-O2 -fno-tree-ch -fdump-tree-optimized" } */
+
+#define PREC (__CHAR_BIT__ * __SIZEOF_INT__)
+
+int
+__attribute__ ((noinline, noclone))
+foo (unsigned int b) {
+ int c = 0;
+
+ if (b == 0)
+ return PREC;
+
+ while (!(b & (1 << (PREC - 1)))) {
+ b <<= 1;
+ c++;
+ }
+
+ return c;
+}
+
+int main()
+{
+ if (foo(0) != PREC)
+ __builtin_abort ();
+ if (foo(1 << (PREC - 1)) != 0)
+ __builtin_abort ();
+ if (foo(35) != PREC - 6)
+ __builtin_abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "__builtin_clz|\\.CLZ" 1 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/clz-long-long.c b/gcc/testsuite/gcc.dg/tree-ssa/clz-long-long.c
new file mode 100644
index 0000000..80d3edc
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/clz-long-long.c
@@ -0,0 +1,34 @@
+/* { dg-do run } */
+/* { dg-require-effective-target clzll } */
+/* { dg-options "-O2 -fno-tree-ch -fdump-tree-optimized" } */
+
+#define PREC (__CHAR_BIT__ * __SIZEOF_LONG_LONG__)
+
+int
+__attribute__ ((noinline, noclone))
+foo (unsigned long long b) {
+ int c = 0;
+
+ if (b == 0)
+ return PREC;
+
+ while (!(b & (1LL << (PREC - 1)))) {
+ b <<= 1;
+ c++;
+ }
+
+ return c;
+}
+
+int main()
+{
+ if (foo(0) != PREC)
+ __builtin_abort ();
+ if (foo(1LL << (PREC - 1)) != 0)
+ __builtin_abort ();
+ if (foo(35) != PREC - 6)
+ __builtin_abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "__builtin_clz|\\.CLZ" 1 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/clz-long.c b/gcc/testsuite/gcc.dg/tree-ssa/clz-long.c
new file mode 100644
index 0000000..1c8037f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/clz-long.c
@@ -0,0 +1,34 @@
+/* { dg-do run } */
+/* { dg-require-effective-target clzl } */
+/* { dg-options "-O2 -fno-tree-ch -fdump-tree-optimized" } */
+
+#define PREC (__CHAR_BIT__ * __SIZEOF_LONG__)
+
+int
+__attribute__ ((noinline, noclone))
+foo (unsigned long b) {
+ int c = 0;
+
+ if (b == 0)
+ return PREC;
+
+ while (!(b & (1L << (PREC - 1)))) {
+ b <<= 1;
+ c++;
+}
+
+ return c;
+}
+
+int main()
+{
+ if (foo(0) != PREC)
+ __builtin_abort ();
+ if (foo(1L << (PREC - 1)) != 0)
+ __builtin_abort ();
+ if (foo(35) != PREC - 6)
+ __builtin_abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "__builtin_clz|\\.CLZ" 1 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ctz-char.c b/gcc/testsuite/gcc.dg/tree-ssa/ctz-char.c
new file mode 100644
index 0000000..3cd166a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ctz-char.c
@@ -0,0 +1,36 @@
+/* { dg-do run } */
+/* { dg-require-effective-target ctz } */
+/* { dg-options "-O2 -fno-tree-ch -fdump-tree-optimized" } */
+
+#define PREC (__CHAR_BIT__)
+
+int
+__attribute__ ((noinline, noclone))
+foo (unsigned char b) {
+ int c = 0;
+
+ if (b == 0)
+ return PREC;
+
+ while (!(b & 1)) {
+ b >>= 1;
+ c++;
+ }
+
+ return c;
+}
+
+int main()
+{
+ if (foo(0) != PREC)
+ __builtin_abort ();
+ if (foo(128) != 7)
+ __builtin_abort ();
+ if (foo(96) != 5)
+ __builtin_abort ();
+ if (foo(35) != 0)
+ __builtin_abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "__builtin_ctz|\\.CTZ" 1 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-char.c b/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-char.c
new file mode 100644
index 0000000..b9afe88
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-char.c
@@ -0,0 +1,31 @@
+/* { dg-do run } */
+/* { dg-require-effective-target ctz } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+#define PREC (__CHAR_BIT__)
+
+int
+__attribute__ ((noinline, noclone))
+foo (unsigned char b) {
+ int c = 0;
+
+ while (b) {
+ b <<= 1;
+ c++;
+ }
+
+ return c;
+}
+
+int main()
+{
+ if (foo(0) != 0)
+ __builtin_abort ();
+ if (foo(96) != PREC - 5)
+ __builtin_abort ();
+ if (foo(35) != PREC)
+ __builtin_abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "__builtin_ctz|\\.CTZ" 1 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-int.c b/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-int.c
new file mode 100644
index 0000000..d2702a6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-int.c
@@ -0,0 +1,31 @@
+/* { dg-do run } */
+/* { dg-require-effective-target ctz } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+#define PREC (__CHAR_BIT__ * __SIZEOF_INT__)
+
+int
+__attribute__ ((noinline, noclone))
+foo (unsigned int b) {
+ int c = 0;
+
+ while (b) {
+ b <<= 1;
+ c++;
+ }
+
+ return c;
+}
+
+int main()
+{
+ if (foo(0) != 0)
+ __builtin_abort ();
+ if (foo(96) != PREC - 5)
+ __builtin_abort ();
+ if (foo(35) != PREC)
+ __builtin_abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "__builtin_ctz|\\.CTZ" 1 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-long-long.c b/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-long-long.c
new file mode 100644
index 0000000..1ea0d5d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-long-long.c
@@ -0,0 +1,31 @@
+/* { dg-do run } */
+/* { dg-require-effective-target ctzll } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+#define PREC (__CHAR_BIT__ * __SIZEOF_LONG_LONG__)
+
+int
+__attribute__ ((noinline, noclone))
+foo (unsigned long long b) {
+ int c = 0;
+
+ while (b) {
+ b <<= 1;
+ c++;
+ }
+
+ return c;
+}
+
+int main()
+{
+ if (foo(0) != 0)
+ __builtin_abort ();
+ if (foo(96) != PREC - 5)
+ __builtin_abort ();
+ if (foo(35) != PREC)
+ __builtin_abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "__builtin_ctz|\\.CTZ" 1 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-long.c b/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-long.c
new file mode 100644
index 0000000..80fb02d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-long.c
@@ -0,0 +1,31 @@
+/* { dg-do run } */
+/* { dg-require-effective-target ctzl } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+#define PREC (__CHAR_BIT__ * __SIZEOF_LONG__)
+
+int
+__attribute__ ((noinline, noclone))
+foo (unsigned long b) {
+ int c = 0;
+
+ while (b) {
+ b <<= 1;
+ c++;
+ }
+
+ return c;
+}
+
+int main()
+{
+ if (foo(0) != 0)
+ __builtin_abort ();
+ if (foo(96) != PREC - 5)
+ __builtin_abort ();
+ if (foo(35) != PREC)
+ __builtin_abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "__builtin_ctz|\\.CTZ" 1 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ctz-int.c b/gcc/testsuite/gcc.dg/tree-ssa/ctz-int.c
new file mode 100644
index 0000000..7f63493
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ctz-int.c
@@ -0,0 +1,36 @@
+/* { dg-do run } */
+/* { dg-require-effective-target ctz } */
+/* { dg-options "-O2 -fno-tree-ch -fdump-tree-optimized" } */
+
+#define PREC (__CHAR_BIT__ * __SIZEOF_INT__)
+
+int
+__attribute__ ((noinline, noclone))
+foo (unsigned int b) {
+ int c = 0;
+
+ if (b == 0)
+ return PREC;
+
+ while (!(b & 1)) {
+ b >>= 1;
+ c++;
+ }
+
+ return c;
+}
+
+int main()
+{
+ if (foo(0) != PREC)
+ __builtin_abort ();
+ if (foo(1 << (PREC - 1)) != PREC - 1)
+ __builtin_abort ();
+ if (foo(96) != 5)
+ __builtin_abort ();
+ if (foo(35) != 0)
+ __builtin_abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "__builtin_ctz|\\.CTZ" 1 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ctz-long-long.c b/gcc/testsuite/gcc.dg/tree-ssa/ctz-long-long.c
new file mode 100644
index 0000000..924f61b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ctz-long-long.c
@@ -0,0 +1,36 @@
+/* { dg-do run } */
+/* { dg-require-effective-target ctzll } */
+/* { dg-options "-O2 -fno-tree-ch -fdump-tree-optimized" } */
+
+#define PREC (__CHAR_BIT__ * __SIZEOF_LONG_LONG__)
+
+int
+__attribute__ ((noinline, noclone))
+foo (unsigned long long b) {
+ int c = 0;
+
+ if (b == 0)
+ return PREC;
+
+ while (!(b & 1)) {
+ b >>= 1;
+ c++;
+ }
+
+ return c;
+}
+
+int main()
+{
+ if (foo(0) != PREC)
+ __builtin_abort ();
+ if (foo(1LL << (PREC - 1)) != PREC - 1)
+ __builtin_abort ();
+ if (foo(96) != 5)
+ __builtin_abort ();
+ if (foo(35) != 0)
+ __builtin_abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "__builtin_ctz|\\.CTZ" 1 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ctz-long.c b/gcc/testsuite/gcc.dg/tree-ssa/ctz-long.c
new file mode 100644
index 0000000..178945d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ctz-long.c
@@ -0,0 +1,36 @@
+/* { dg-do run } */
+/* { dg-require-effective-target ctzl } */
+/* { dg-options "-O2 -fno-tree-ch -fdump-tree-optimized" } */
+
+#define PREC (__CHAR_BIT__ * __SIZEOF_LONG__)
+
+int
+__attribute__ ((noinline, noclone))
+foo (unsigned long b) {
+ int c = 0;
+
+ if (b == 0)
+ return PREC;
+
+ while (!(b & 1)) {
+ b >>= 1;
+ c++;
+ }
+
+ return c;
+}
+
+int main()
+{
+ if (foo(0) != PREC)
+ __builtin_abort ();
+ if (foo(1L << (PREC - 1)) != PREC - 1)
+ __builtin_abort ();
+ if (foo(96) != 5)
+ __builtin_abort ();
+ if (foo(35) != 0)
+ __builtin_abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "__builtin_ctz|\\.CTZ" 1 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/forwprop-19.c b/gcc/testsuite/gcc.dg/tree-ssa/forwprop-19.c
index 4d77138..6ca81cb 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/forwprop-19.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/forwprop-19.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O -fdump-tree-forwprop1" } */
+/* { dg-options "-O -fdump-tree-dse1" } */
typedef int vec __attribute__((vector_size (4 * sizeof (int))));
void f (vec *x1, vec *x2)
@@ -11,4 +11,4 @@ void f (vec *x1, vec *x2)
*x1 = z;
}
-/* { dg-final { scan-tree-dump-not "VEC_PERM_EXPR" "forwprop1" } } */
+/* { dg-final { scan-tree-dump-not "VEC_PERM_EXPR" "dse1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/forwprop-3.c b/gcc/testsuite/gcc.dg/tree-ssa/forwprop-3.c
index 4aa68c6..bfdfba1 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/forwprop-3.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/forwprop-3.c
@@ -14,4 +14,4 @@ int foo(struct bar *x)
return 0;
}
-/* { dg-final { scan-tree-dump "Replaced .p_. < q_.. with .1." "forwprop1" } } */
+/* { dg-final { scan-tree-dump "return 1;" "forwprop1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/forwprop-39.c b/gcc/testsuite/gcc.dg/tree-ssa/forwprop-39.c
new file mode 100644
index 0000000..232f409
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/forwprop-39.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-forwprop1 -fdump-tree-optimized" } */
+
+extern void push1(void *p, float _Complex x);
+void foo (void *q, float _Complex *x)
+{
+ float r = __real *x;
+ float i = __imag *x;
+ push1 (q, __builtin_complex (r, i));
+}
+
+/* { dg-final { scan-tree-dump-not "COMPLEX_EXPR" "forwprop1" } } */
+/* { dg-final { scan-tree-dump-not "REALPART_EXPR" "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-34.c b/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-34.c
index 41877e0..c2e5dfe 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-34.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-34.c
@@ -13,4 +13,4 @@ float summul(int n, float *arg1, float *arg2)
return res1;
}
-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { ! { avr-*-* pru-*-* riscv*-*-* } } } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_masked_load } } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/loopclosedphi.c b/gcc/testsuite/gcc.dg/tree-ssa/loopclosedphi.c
index d71b757..0a8a417 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/loopclosedphi.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/loopclosedphi.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O3 -fno-tree-ch -w -fdump-tree-loopdone-details" } */
+/* { dg-options "-O3 -fno-tree-ch -fno-unswitch-loops -w -fdump-tree-loopdone-details" } */
void
t6 (int qz, int wh)
@@ -18,4 +18,4 @@ t6 (int qz, int wh)
qz = jl * wh;
}
-/* { dg-final { scan-tree-dump-times "Replacing" 2 "loopdone"} } */
+/* { dg-final { scan-tree-dump-times "Replacing" 3 "loopdone"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/modref-dse-7.c b/gcc/testsuite/gcc.dg/tree-ssa/modref-dse-7.c
new file mode 100644
index 0000000..85a01d3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/modref-dse-7.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+struct list
+{
+ struct list *next;
+};
+__attribute__ ((noinline))
+void
+kill(struct list *l, int *a)
+{
+ while (l)
+ l=l->next;
+ *a = 0;
+}
+void
+test(struct list *l, int *a)
+{
+ *a=12345;
+ kill (l, a);
+ return;
+}
+/* { dg-final { scan-tree-dump-not "12345" "optimized"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/multcmp-1.c b/gcc/testsuite/gcc.dg/tree-ssa/multcmp-1.c
new file mode 100644
index 0000000..fb44cac
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/multcmp-1.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+int
+f (int m1, int m2, int c)
+{
+ int d = m1 == m2;
+ int e = d * c;
+ return e;
+}
+
+/* { dg-final { scan-tree-dump-times "\\? c_\[0-9\]\\(D\\) : 0" 1 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/multcmp-2.c b/gcc/testsuite/gcc.dg/tree-ssa/multcmp-2.c
new file mode 100644
index 0000000..be38b2e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/multcmp-2.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+int
+f (int m1, int m2, int c)
+{
+ int d = m1 != m2;
+ int e = c * d;
+ return e;
+}
+
+/* { dg-final { scan-tree-dump-times "\\? c_\[0-9\]\\(D\\) : 0" 1 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/popcount-max.c b/gcc/testsuite/gcc.dg/tree-ssa/popcount-max.c
new file mode 100644
index 0000000..ca7204c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/popcount-max.c
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fno-tree-loop-optimize -fdump-tree-optimized" } */
+
+#define PREC (__CHAR_BIT__)
+
+int count1 (unsigned char b) {
+ int c = 0;
+
+ while (b) {
+ b &= b - 1;
+ c++;
+ }
+ if (c <= PREC)
+ return 0;
+ else
+ return 34567;
+}
+
+int count2 (unsigned char b) {
+ int c = 0;
+
+ while (b) {
+ b &= b - 1;
+ c++;
+ }
+ if (c <= PREC - 1)
+ return 0;
+ else
+ return 76543;
+}
+
+/* { dg-final { scan-tree-dump-times "34567" 0 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "76543" 1 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/popcount.c b/gcc/testsuite/gcc.dg/tree-ssa/popcount.c
index b469410..efd906a 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/popcount.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/popcount.c
@@ -39,4 +39,4 @@ void PopCount3 (long b1) {
}
}
-/* { dg-final { scan-tree-dump-times "__builtin_popcount" 3 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_popcount|\\.POPCOUNT" 3 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/popcount2.c b/gcc/testsuite/gcc.dg/tree-ssa/popcount2.c
index ef73e34..ae38a32 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/popcount2.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/popcount2.c
@@ -26,4 +26,4 @@ int main()
return 0;
}
-/* { dg-final { scan-tree-dump-times "__builtin_popcount" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_popcount|\\.POPCOUNT" 1 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/popcount3.c b/gcc/testsuite/gcc.dg/tree-ssa/popcount3.c
index ef43891..50befb3 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/popcount3.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/popcount3.c
@@ -12,5 +12,5 @@ int PopCount (long b) {
return c;
}
-/* { dg-final { scan-tree-dump-times "__builtin_popcount" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_popcount|\\.POPCOUNT" 1 "optimized" } } */
/* { dg-final { scan-tree-dump-times "if" 0 "phiopt4" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/popcount6.c b/gcc/testsuite/gcc.dg/tree-ssa/popcount6.c
new file mode 100644
index 0000000..1406ad9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/popcount6.c
@@ -0,0 +1,12 @@
+// { dg-do compile }
+// { dg-options "-O2 -fdump-tree-evrp" }
+
+int g(int n)
+{
+ n &= 0x8000;
+ if (n == 0)
+ return 1;
+ return __builtin_popcount(n);
+}
+
+// { dg-final { scan-tree-dump "return 1;" "evrp" } }
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/popcount6b.c b/gcc/testsuite/gcc.dg/tree-ssa/popcount6b.c
new file mode 100644
index 0000000..90336ec
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/popcount6b.c
@@ -0,0 +1,6 @@
+// { dg-do compile }
+// { dg-options "-O2 -fdump-tree-evrp -fno-tree-ccp" }
+
+#include "popcount6.c"
+
+// { dg-final { scan-tree-dump "return 1;" "evrp" } }
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr100359.c b/gcc/testsuite/gcc.dg/tree-ssa/pr100359.c
index 2924352..236dbef 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr100359.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr100359.c
@@ -1,4 +1,5 @@
-/* { dg-do link } */
+/* { dg-do link { target natural_alignment_32 } } */
+/* { dg-do compile { target { ! natural_alignment_32 } } } */
/* { dg-options "-O3 -fdump-tree-cunrolli-optimized" } */
extern void foo(void);
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr107009.c b/gcc/testsuite/gcc.dg/tree-ssa/pr107009.c
new file mode 100644
index 0000000..5010aed
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr107009.c
@@ -0,0 +1,15 @@
+// { dg-do compile }
+// { dg-options "-O2 -fdump-tree-dom2-alias" }
+
+typedef __SIZE_TYPE__ size_t;
+
+void saxpy(size_t n)
+{
+ if (n == 0 || n % 8 != 0)
+ __builtin_unreachable();
+
+ extern void foobar (size_t n);
+ foobar (n);
+}
+
+// { dg-final { scan-tree-dump "NONZERO.*fff8" "dom2" } }
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr107052.c b/gcc/testsuite/gcc.dg/tree-ssa/pr107052.c
new file mode 100644
index 0000000..88b5213
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr107052.c
@@ -0,0 +1,13 @@
+// { dg-do compile }
+// { dg-options "-O2 -fdump-tree-evrp" }
+
+void link_failure();
+void f(int a)
+{
+ a &= 0x300;
+ int b = __builtin_popcount(a);
+ if (b > 3)
+ link_failure();
+}
+
+// { dg-final { scan-tree-dump-not "link_failure" "evrp" } }
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr107130.c b/gcc/testsuite/gcc.dg/tree-ssa/pr107130.c
new file mode 100644
index 0000000..11fb816
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr107130.c
@@ -0,0 +1,19 @@
+// { dg-do compile }
+// { dg-options "-Os -fno-tree-ccp -fno-tree-forwprop -fno-tree-fre -fdump-tree-vrp1" }
+
+static inline int
+foo (int i)
+{
+ return __builtin_ffsl (i);
+}
+
+int
+main (void)
+{
+ int x = foo (41);
+ if (x != 1)
+ __builtin_abort ();
+ return 0;
+}
+
+// { dg-final { scan-tree-dump-not "builtin_abort" "vrp1" } }
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr107170.c b/gcc/testsuite/gcc.dg/tree-ssa/pr107170.c
new file mode 100644
index 0000000..7a5a4a3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr107170.c
@@ -0,0 +1,8 @@
+// { dg-do compile }
+// { dg-options "-O2" }
+
+int main() {
+ double a;
+ if (__builtin_signbit(a))
+ __builtin_abort();
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr107195-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr107195-1.c
new file mode 100644
index 0000000..a0c20db
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr107195-1.c
@@ -0,0 +1,15 @@
+// { dg-do run }
+// { dg-options "-O1 -fno-tree-ccp" }
+
+int a, b;
+int main() {
+ int c = 0;
+ if (a)
+ c = 1;
+ c = 1 & (a && c) && b;
+ if (a) {
+ b = c;
+ __builtin_abort ();
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr107195-2.c b/gcc/testsuite/gcc.dg/tree-ssa/pr107195-2.c
new file mode 100644
index 0000000..d447c78
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr107195-2.c
@@ -0,0 +1,16 @@
+// { dg-do run }
+// { dg-options "-O1" }
+
+int a, b;
+int main() {
+ int c = 0;
+ long d;
+ for (; b < 1; b++) {
+ (c && d) & 3 || a;
+ d = c;
+ c = -1;
+ if (d)
+ __builtin_abort();
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr107195-3.c b/gcc/testsuite/gcc.dg/tree-ssa/pr107195-3.c
new file mode 100644
index 0000000..eba4218
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr107195-3.c
@@ -0,0 +1,112 @@
+/* Inspired by 'libgomp.oacc-c-c++-common/nvptx-sese-1.c'. */
+
+/* { dg-additional-options -O1 } */
+/* { dg-additional-options -fdump-tree-dom3-raw } */
+
+
+extern int
+__attribute__((const))
+foo1 (int);
+
+int f1 (int r)
+{
+ if (foo1 (r)) /* If this first 'if' holds... */
+ r *= 2; /* ..., 'r' now has a zero-value lower-most bit... */
+
+ if (r & 1) /* ..., so this second 'if' can never hold... */
+ { /* ..., so this is unreachable. */
+ /* In constrast, if the first 'if' does not hold ('foo1 (r) == 0'), the
+ second 'if' may hold, but we know ('foo1' being 'const') that
+ 'foo1 (r) == 0', so don't have to re-evaluate it here: */
+ r += foo1 (r);
+ }
+
+ return r;
+}
+/* Thus, if optimizing, we only ever expect one call of 'foo1'.
+ { dg-final { scan-tree-dump-times {gimple_call <foo1,} 1 dom3 } } */
+
+
+extern int
+__attribute__((const))
+foo2 (int);
+
+int f2 (int r)
+{
+ if (foo2 (r))
+ r *= 8;
+
+ if (r & 7)
+ r += foo2 (r);
+
+ return r;
+}
+/* { dg-final { scan-tree-dump-times {gimple_call <foo2,} 1 dom3 } } */
+
+
+extern int
+__attribute__((const))
+foo3 (int);
+
+int f3 (int r)
+{
+ if (foo3 (r))
+ r <<= 4;
+
+ if ((r & 64) && ((r & 8) || (r & 4) || (r & 2) || (r & 1)))
+ r += foo3 (r);
+
+ return r;
+}
+/* { dg-final { scan-tree-dump-times {gimple_call <foo3,} 1 dom3 } } */
+
+
+extern int
+__attribute__((const))
+foo4 (int);
+
+int f4 (int r)
+{
+ if (foo4 (r))
+ r *= 8;
+
+ if ((r >> 1) & 2)
+ r += foo4 (r);
+
+ return r;
+}
+/* { dg-final { scan-tree-dump-times {gimple_call <foo4,} 1 dom3 } } */
+
+
+extern int
+__attribute__((const))
+foo5 (int);
+
+int f5 (int r) /* Works for both 'signed' and 'unsigned'. */
+{
+ if (foo5 (r))
+ r *= 2;
+
+ if ((r % 2) != 0)
+ r += foo5 (r);
+
+ return r;
+}
+/* { dg-final { scan-tree-dump-times {gimple_call <foo5,} 1 dom3 } } */
+
+
+extern int
+__attribute__((const))
+foo6 (int);
+
+int f6 (unsigned int r) /* 'unsigned' is important here. */
+{
+ if (foo6 (r))
+ r *= 2;
+
+ if ((r % 2) == 1)
+ r += foo6 (r);
+
+ return r;
+}
+/* { dg-final { scan-tree-dump-times {gimple_call <foo6,} 1 dom3 } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr107273-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr107273-1.c
new file mode 100644
index 0000000..db2e2c0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr107273-1.c
@@ -0,0 +1,31 @@
+/* { dg-do run } */
+/* { dg-options "-O3" } */
+
+int printf(const char *, ...);
+int a[1] = {1};
+short b, c = 5500;
+int d;
+long e;
+char f = 1;
+int main() {
+ while (1) {
+ long g = b < 1;
+ e = g;
+ break;
+ }
+ for (; f; f--) {
+ if (e) {
+ d = -(6L | -(c & 1000));
+ }
+ char h = d;
+ if (b)
+ b = 0;
+ if (d < 200)
+ while (1)
+ printf("%d", a[c]);
+ short i = h * 210;
+ c = i;
+ }
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr107273-2.c b/gcc/testsuite/gcc.dg/tree-ssa/pr107273-2.c
new file mode 100644
index 0000000..3374507
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr107273-2.c
@@ -0,0 +1,27 @@
+/* { dg-do run } */
+/* { dg-options "-Os" } */
+
+int a, d, f;
+char b, g;
+unsigned i;
+int main() {
+ int c = 300, h = 40;
+ char e = 1;
+ for (; a < 1; a++) {
+ c = ~((i - ~c) | e);
+ L1:
+ e = f = c;
+ if (c)
+ if (c > -200)
+ e = g % (1 << h);
+ char k = 0;
+ L2:;
+ }
+ if (b) {
+ if (d)
+ goto L2;
+ if (!b)
+ goto L1;
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr107293.c b/gcc/testsuite/gcc.dg/tree-ssa/pr107293.c
new file mode 100644
index 0000000..724c31a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr107293.c
@@ -0,0 +1,32 @@
+// { dg-do run }
+// { dg-options "-w -Os" }
+
+short a;
+int b[1];
+
+int c(int p) {
+ return (p < 0) ? 0 : 10 + ((p / 100 - 16) / 4);
+}
+
+void f(int n) {
+ while (1) {
+ int m = n;
+ while ((m ) )
+ m /= 2;
+ break;
+ }
+}
+
+void g() {
+ int h = a = 0;
+ for (; h + a <= 0; a++) {
+ if (b[c(a - 6)])
+ break;
+ f(a);
+ }
+}
+int main() {
+ g();
+ if (a != 1)
+ __builtin_abort ();
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr107323.c b/gcc/testsuite/gcc.dg/tree-ssa/pr107323.c
new file mode 100644
index 0000000..1204b6e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr107323.c
@@ -0,0 +1,28 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fno-tree-vectorize" } */
+
+int A[4];
+int B[4];
+
+static const char *__attribute__((noipa)) foo()
+{
+ return "1";
+}
+
+int main()
+{
+ const char *s = foo();
+
+ A[0] = 1000;
+ for(int i = 1; i < 4; ++i) {
+ B[i] = 0;
+ A[i] = 0;
+ if(s[0])
+ B[i] = 1;
+ A[i] = A[i - 1];
+ }
+
+ if (A[3] != 1000)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr107355.c b/gcc/testsuite/gcc.dg/tree-ssa/pr107355.c
new file mode 100644
index 0000000..4079634
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr107355.c
@@ -0,0 +1,13 @@
+// { dg-do compile }
+// { dg-options "-O2 -fno-guess-branch-probability -fsanitize=float-cast-overflow --param=max-jump-thread-duplication-stmts=240" }
+
+float f;
+
+void
+foo (double d)
+{
+ (char) f;
+ long l = __builtin_fabs (d);
+ (char) f;
+ (long) d;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr107394.c b/gcc/testsuite/gcc.dg/tree-ssa/pr107394.c
new file mode 100644
index 0000000..0e1e5ac
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr107394.c
@@ -0,0 +1,22 @@
+// { dg-do compile }
+// { dg-options "-O2" }
+
+static double
+quux (double x)
+{
+ return __builtin_fabs (x);
+}
+
+__attribute__ ((flatten, optimize ("-ffinite-math-only"))) static int
+bar (int *p)
+{
+ *p = quux (0.0);
+
+ return 0;
+}
+
+void
+foo (int *p)
+{
+ (void) bar (p);
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr107490.c b/gcc/testsuite/gcc.dg/tree-ssa/pr107490.c
new file mode 100644
index 0000000..87c7f0a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr107490.c
@@ -0,0 +1,28 @@
+// { dg-do compile }
+// { dg-options "-Os -fno-trapping-math -w" }
+
+extern void abort (void);
+
+#define MIN2(a,b) (((a)<(b)) ? (a) : (b))
+#define MAX2(a,b) (((a)>(b)) ? (a) : (b))
+
+double p[2] = { 4.f, 5.f };
+
+int main()
+{
+ long j;
+ double R, n, x;
+ n = 1.e300f;
+ x = -1.e300f;
+ for( j=0; j < 2; j++ )
+ {
+ x = MAX2(x,p[j]);
+ n = MIN2(n,p[j]);
+ }
+ R = x-n;
+
+ if( R < 0.1 )
+ abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr107541.c b/gcc/testsuite/gcc.dg/tree-ssa/pr107541.c
new file mode 100644
index 0000000..9c89db5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr107541.c
@@ -0,0 +1,18 @@
+// { dg-do run }
+// { dg-options "-O1" }
+
+unsigned char a = 1;
+char b, e;
+long long c;
+short d;
+int main() {
+ if (sizeof (short) != 2 || sizeof (int) != 4 || sizeof (long long) != 8)
+ return 0;
+ a = ~(1 && a);
+ c = ~((~a / 8 | -2) & 11007578330939886389LLU);
+ e = -c;
+ d = ~c / e;
+ if (d < 2000)
+ __builtin_abort();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr107699.c b/gcc/testsuite/gcc.dg/tree-ssa/pr107699.c
new file mode 100644
index 0000000..4bf864d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr107699.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fdump-tree-forwprop1" } */
+
+struct { int data[16]; } x;
+
+int foo (int n)
+{
+ int *p = x.data + n;
+ /* Should simplify this to n * 4 != 0. */
+ if ((void *)&x != (void *)p)
+ return 1;
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump " != 0" "forwprop1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr107732.c b/gcc/testsuite/gcc.dg/tree-ssa/pr107732.c
new file mode 100644
index 0000000..b216f38
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr107732.c
@@ -0,0 +1,13 @@
+// { dg-do compile }
+// { dg-options "-O2" }
+
+double sqrt(double);
+double a, b, c;
+void d() {
+ for (;;) {
+ c = __builtin_fabs(a);
+ sqrt(c);
+ if (a)
+ a = b;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr107767.c b/gcc/testsuite/gcc.dg/tree-ssa/pr107767.c
new file mode 100644
index 0000000..bace8ab
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr107767.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-Os -fdump-tree-switchconv" } */
+
+int firewall2(const unsigned char *restrict data)
+{
+ const unsigned short dst_port = *((const unsigned short *)data + 32);
+
+ if (dst_port == 15) return 1;
+ if (dst_port == 23) return 1;
+ if (dst_port == 47) return 1;
+ if (dst_port == 45) return 1;
+ if (dst_port == 42) return 1;
+ if (dst_port == 1) return 1;
+ if (dst_port == 2) return 1;
+ if (dst_port == 3) return 1;
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-not "CSWTCH" "switchconv" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr108137.c b/gcc/testsuite/gcc.dg/tree-ssa/pr108137.c
new file mode 100644
index 0000000..f0cb71b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr108137.c
@@ -0,0 +1,8 @@
+// PR tree-optimization/108137
+// { dg-do compile }
+// { dg-options "-Wformat-overflow" }
+
+void f(unsigned short x_port, unsigned int x_host)
+{
+ __builtin_printf("missing %s", x_port ? "host" : &"host:port"[x_host ? 5 : 0]);
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr108354-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr108354-1.c
new file mode 100644
index 0000000..60d1dbc
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr108354-1.c
@@ -0,0 +1,26 @@
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+int b;
+int *c;
+int e;
+static int *f = &e;
+int g;
+void foo();
+short(a)(short h, short i) { return h - i; }
+int(d)(int h) { return h == 83647 ? 0 : -h; }
+int main() {
+ short j;
+ int *k = &e, *l = &b;
+ *f = 0 == c;
+ j = a(0 != 2, *k);
+ if (d(j ^ (0 == l || *k)) != *k)
+ ;
+ else
+ foo();
+ c = &g;
+}
+
+/* { dg-final { scan-tree-dump-times " 1 - " 0 "optimized" } } */
+/* There should be no calls to foo. */
+/* { dg-final { scan-tree-dump-times "foo " 0 "optimized" } } */
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr108357.c b/gcc/testsuite/gcc.dg/tree-ssa/pr108357.c
new file mode 100644
index 0000000..44c457b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr108357.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-threadfull1" } */
+
+static char b;
+static unsigned c;
+void foo();
+short(a)(short d, short e) { return d * e; }
+static short f(short d) {
+ b = 0;
+ if ((d && 0 >= c < d) ^ d)
+ ;
+ else
+ foo();
+ return d;
+}
+int main()
+{
+ short g = a(5, b ^ 9854);
+ f(g);
+}
+
+/* { dg-final { scan-tree-dump-not "foo" "threadfull1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr108684-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr108684-1.c
new file mode 100644
index 0000000..3ba206f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr108684-1.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+
+static int t;
+
+int f (int *a)
+{
+ int t1, t2 = 0;
+ asm ("shouldshowupstill %1" : "=r" (t1), "=m"(t2) : : );
+ t = t1;
+ return t2;
+}
+
+/* Check to make sure DCE does not remove the inline-asm as it writes to t2. */
+/* We used to DCE this inline-asm when removing the store to t. */
+/* { dg-final { scan-assembler "shouldshowupstill" } } */
+/* { dg-final { scan-tree-dump-times "shouldshowupstill" 1 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr109031-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr109031-1.c
new file mode 100644
index 0000000..84e1a08
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr109031-1.c
@@ -0,0 +1,39 @@
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+unsigned char uc;
+unsigned short us;
+
+void testuc() {
+ unsigned int g = 0;
+ unsigned int *p1 = &g;
+ unsigned char *p2 = &uc;
+
+ do {
+ (*p1)++;
+ (*p2)--;
+ } while (uc);
+
+ if (g != 256)
+ __builtin_abort();
+}
+
+void testus() {
+ unsigned int g = 0;
+ unsigned int *p1 = &g;
+ unsigned short *p2 = &us;
+
+ do {
+ (*p1)++;
+ (*p2)--;
+ } while (us);
+
+ if (g != 65536)
+ __builtin_abort();
+}
+
+int main() {
+ testuc();
+ testus();
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr109031-2.c b/gcc/testsuite/gcc.dg/tree-ssa/pr109031-2.c
new file mode 100644
index 0000000..6f28b3b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr109031-2.c
@@ -0,0 +1,39 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fwrapv" } */
+signed char sc;
+signed short ss;
+
+void testsc() {
+ unsigned int g = 0;
+ unsigned int *p1 = &g;
+ signed char *p2 = &sc;
+
+ do {
+ (*p1)++;
+ (*p2)--;
+ } while (sc);
+
+ if (g != 256)
+ __builtin_abort();
+}
+
+void testss() {
+ unsigned int g = 0;
+ unsigned int *p1 = &g;
+ signed short *p2 = &ss;
+
+ do {
+ (*p1)++;
+ (*p2)--;
+ } while (ss);
+
+ if (g != 65536)
+ __builtin_abort();
+}
+
+int main() {
+ testsc();
+ testss();
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr55157.c b/gcc/testsuite/gcc.dg/tree-ssa/pr55157.c
new file mode 100644
index 0000000..bbdda45
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr55157.c
@@ -0,0 +1,19 @@
+// { dg-do compile }
+// { dg-options "-O2 -fdump-tree-evrp" }
+
+void gg(void);
+int f(unsigned t)
+{
+ unsigned g = t*16;
+ if (g==0) return 1;
+ gg();
+ gg();
+ gg();
+ gg();
+ gg();
+ gg();
+ if (g<=4) return 1;
+ return 0;
+}
+
+// { dg-final { scan-tree-dump-times " if " 1 "evrp" } }
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr79095.c b/gcc/testsuite/gcc.dg/tree-ssa/pr79095.c
index f635fca..b175187 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr79095.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr79095.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fno-ipa-icf -fdump-tree-vrp1" } */
+/* { dg-options "-O2 -fno-ipa-icf -fdump-tree-evrp" } */
extern void arf (unsigned x, unsigned y);
extern void baz (unsigned x, unsigned y);
@@ -429,8 +429,8 @@ f4nro (unsigned a, unsigned b)
}
/* All calls to baz should still reference a & b as arguments. */
-/* { dg-final { scan-tree-dump-times "baz \\(a_\[0-9\]+\\(D\\), b_\[0-9\]+\\)" 32 "vrp1"} } */
+/* { dg-final { scan-tree-dump-times "baz \\(a_\[0-9\]+\\(D\\), b_\[0-9\]+\\)" 32 "evrp"} } */
/* All calls to arf should have constant arguments. */
-/* { dg-final { scan-tree-dump-times "arf \\(\[0-9\]+, \[0-9\]+\\)" 32 "vrp1"} } */
+/* { dg-final { scan-tree-dump-times "arf \\(\[0-9\]+, \[0-9\]+\\)" 32 "evrp"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr89317.c b/gcc/testsuite/gcc.dg/tree-ssa/pr89317.c
new file mode 100644
index 0000000..0c8f2f5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr89317.c
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fdump-tree-ccp1" } */
+
+struct b { int data[16]; };
+
+int foo (struct b *x)
+{
+ int *a = x->data;
+ int *b = ((int*)x) + 4;
+ return b - a;
+}
+
+int bar (struct b *x)
+{
+ int *a = x->data;
+ int *b = ((int*)x) + 4;
+ if (a != b)
+ return 1;
+ return 0;
+}
+
+int baz (struct b *x)
+{
+ int *a = x->data;
+ int *b = ((int*)x) + 4;
+ return (a != b);
+}
+
+/* { dg-final { scan-tree-dump "return 4;" "ccp1" } } */
+/* { dg-final { scan-tree-dump-times "return 1;" 2 "ccp1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr91091-2.c b/gcc/testsuite/gcc.dg/tree-ssa/pr91091-2.c
index ecc50d3..7925415 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr91091-2.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr91091-2.c
@@ -12,4 +12,4 @@ void swap(struct s* p, struct t* q)
/* The second statement is redundant. */
/* { dg-final { scan-tree-dump-times "x = " 1 "fre1" { xfail { ! natural_alignment_32 } } } } */
-/* { dg-final { scan-tree-dump-times " = \[^;\]*x;" 1 "fre1" { xfail { ! natural_alignment_32 } } } } */
+/* { dg-final { scan-tree-dump-times " = \[^;\]*x;" 1 "fre1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr99739.c b/gcc/testsuite/gcc.dg/tree-ssa/pr99739.c
new file mode 100644
index 0000000..3ebaa4b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr99739.c
@@ -0,0 +1,40 @@
+/* PR tree-optimization/99739 */
+/* { dg-do compile } */
+/* { dg-options "-O1 -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-not "__builtin_abort \\\(\\\);" "optimized" } } */
+
+static inline int
+foo (int i, int j, int k)
+{
+ int x = 1;
+ if (i && j && k)
+ x = 2;
+ if (i && j && k)
+ return x;
+ return -1;
+}
+
+void
+bar (int i, int j, int k)
+{
+ if (foo (i, j, k) == 1)
+ __builtin_abort ();
+}
+
+static inline int
+baz (int i, int j, int k)
+{
+ int x = 1;
+ if (i && j && k)
+ x = 2;
+ if (i && k && j)
+ return x;
+ return -1;
+}
+
+void
+qux (int i, int j, int k)
+{
+ if (baz (i, j, k) == 1)
+ __builtin_abort ();
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-47.c b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-47.c
index 1b0f0fd..cd2cc74 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-47.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-47.c
@@ -4,6 +4,6 @@
#define MODIFY
#include "reassoc-46.h"
-/* Check that if the loop accumulator is saved into a global variable, it's
- still added last. */
+/* Check that if the loop accumulator is modified using a chain of operations
+ other than addition, its new value is still added last. */
/* { dg-final { scan-tree-dump-times {(?:vect_)?sum_[\d._]+ = (?:(?:vect_)?_[\d._]+ \+ (?:vect_)?sum_[\d._]+|(?:vect_)?sum_[\d._]+ \+ (?:vect_)?_[\d._]+)} 1 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-48.c b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-48.c
deleted file mode 100644
index 13836eb..0000000
--- a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-48.c
+++ /dev/null
@@ -1,9 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-optimized -ftree-vectorize" } */
-
-#define STORE
-#include "reassoc-46.h"
-
-/* Check that if the loop accumulator is modified using a chain of operations
- other than addition, its new value is still added last. */
-/* { dg-final { scan-tree-dump-times {(?:vect_)?sum_[\d._]+ = (?:(?:vect_)?_[\d._]+ \+ (?:vect_)?sum_[\d._]+|(?:vect_)?sum_[\d._]+ \+ (?:vect_)?_[\d._]+)} 1 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-42.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-42.c
new file mode 100644
index 0000000..b4e5c0f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-42.c
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options "-fgimple -O -fdump-tree-ccp1" } */
+
+__GIMPLE (ssa,startwith("ccp")) int foo (int n)
+{
+ int i;
+ int j;
+
+ __BB(2):
+ i_1 = 0;
+ goto __BB3;
+
+ __BB(3):
+ i_2 = __PHI (__BB2: i_1, __BB3: i_4);
+ j_3 = i_2;
+ i_4 = i_2 + 1;
+ if (i_4 < n_5(D))
+ goto __BB3;
+ else
+ goto __BB4;
+
+ __BB(4):
+ return j_3;
+}
+
+/* { dg-final { scan-tree-dump "return i_2;" "ccp1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-43.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-43.c
new file mode 100644
index 0000000..3e0a3d6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-43.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O -ftrivial-auto-var-init=zero -fdump-tree-ccp1" } */
+
+int foo (int flag)
+{
+ int i;
+ if (flag)
+ i = 1;
+ return i;
+}
+
+/* { dg-final { scan-tree-dump "return 1;" "ccp1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-copyprop-3.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-copyprop-3.c
new file mode 100644
index 0000000..d22b392
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-copyprop-3.c
@@ -0,0 +1,38 @@
+/* { dg-do link } */
+/* { dg-require-effective-target int32plus } */
+/* { dg-options "-O -fdump-tree-copyprop2" } */
+
+#include <limits.h>
+enum { a } b();
+int d;
+int e;
+int f;
+void foo();
+[[gnu::noipa]]
+void bar49_(void){}
+[[gnu::noipa]]
+void(c)(void){}
+static short g(int h, int i) {
+ int j = -1420678603, k = 1;
+ if (h)
+ for (; j < INT_MAX-18; j = j + 9) {
+ f = 0;
+ for (; f <= 1; c())
+ k = 90;
+ }
+ i = k;
+ for (; e; ++e) {
+ if (i)
+ continue;
+ foo();
+ i = b();
+ }
+ return 4;
+}
+int l() {
+ bar49_();
+ return 1;
+}
+int main() { d = d || g(d, l()); }
+
+/* { dg-final { scan-tree-dump-not "foo" "copyprop2" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-46.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-46.c
new file mode 100644
index 0000000..c98038a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-46.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-dse1" } */
+
+int a;
+static long b, d;
+short c;
+void foo();
+char e(int **f) {
+ **f = 0;
+ if (a) {
+ unsigned long *g = &b;
+ unsigned long **h = &g;
+ for (; d;) {
+ foo();
+ for (; c;) {
+ unsigned long ***i = &h;
+ }
+ }
+ }
+ return 1;
+}
+
+/* { dg-final { scan-tree-dump-not "&b" "dse1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-100.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-100.c
index ead7654..1b6a3a3 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-100.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-100.c
@@ -22,4 +22,4 @@ void foo (int *p, int n)
while (--n);
}
-/* { dg-final { scan-tree-dump-not "baz" "fre1" } } */
+/* { dg-final { scan-tree-dump-not "baz" "fre1" { xfail { ! natural_alignment_32 } } } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-101.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-101.c
new file mode 100644
index 0000000..c67f211
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-101.c
@@ -0,0 +1,47 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fdump-tree-fre1-details" } */
+
+int test1 (int i, int j)
+{
+ int k;
+ if (i != j)
+ k = i;
+ else
+ k = j;
+ return k;
+}
+
+int test2 (int i, int j)
+{
+ int k;
+ if (i != j)
+ k = j;
+ else
+ k = i;
+ return k;
+}
+
+int test3 (int i, int j)
+{
+ int k;
+ if (i == j)
+ k = j;
+ else
+ k = i;
+ return k;
+}
+
+int test4 (int i, int j)
+{
+ int k;
+ if (i == j)
+ k = i;
+ else
+ k = j;
+ return k;
+}
+
+/* We'd expect 4 hits but since we only keep one forwarder the
+ VN predication machinery cannot record something for the entry
+ block since it doesn't work on edges but on their source. */
+/* { dg-final { scan-tree-dump-times "equal on edge" 2 "fre1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-21.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-21.c
index ffe6f8f..fe29e84 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-21.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-21.c
@@ -17,7 +17,7 @@ void
func (int m, int n, int k, struct obj *a)
{
struct obj *q = a;
- for (int j = 0; j < m; j++)
+ for (int j = 0; j < n; j++)
if (__builtin_expect (m, 0))
for (int i = 0; i < m; i++)
{
@@ -31,5 +31,6 @@ func (int m, int n, int k, struct obj *a)
}
}
-/* { dg-final { scan-tree-dump-not "Executing store motion of" "lim2" } } */
-
+/* { dg-final { scan-tree-dump "Executing store motion of count from loop 2" "lim2" } } */
+/* { dg-final { scan-tree-dump "Executing store motion of \[^ \]*data1 from loop 2" "lim2" } } */
+/* { dg-final { scan-tree-dump-times "Executing store motion of" 2 "lim2" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-24.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-24.c
new file mode 100644
index 0000000..6b46349
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-24.c
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-lim2-details -fdump-tree-optimized" } */
+
+extern volatile int *x;
+static int gCrc;
+
+static int __attribute__((noinline)) crc16Add(int crc, int b)
+{
+ return crc + b;
+}
+
+void f(int data, int dataSz)
+{
+ int i;
+
+ for(i=0;i<dataSz;i++)
+ {
+ gCrc = crc16Add(gCrc, data);
+ *x = data;
+ }
+}
+
+/* { dg-final { scan-tree-dump "Executing store motion of gCrc" "lim2" } } */
+/* { dg-final { scan-tree-dump-not "Re-issueing" "lim2" } } */
+/* { dg-final { scan-tree-dump-times "\\*x" 1 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-18.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-18.c
index 421c78e..9ac0fc6e 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-18.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-18.c
@@ -207,6 +207,9 @@ compute_on_bytes (uint8_t *in_data, int in_len, uint8_t *out_data, int out_len)
from bb 31 to bb 33"
When -m32, Power and X86 will sink 3 instructions, but arm ilp32 couldn't
sink due to ivopts chooses two IV candidates instead of one, which is
- expected, so this case is restricted to lp64 only so far. */
+ expected, so this case is restricted to lp64 only so far. This different
+ ivopts choice affects riscv64 as well, probably because it also lacks
+ base+index addressing modes, so the ip[len] address computation can't be
+ made from the IV computation above. */
- /* { dg-final { scan-tree-dump-times "Sunk statements: 4" 1 "sink2" { target lp64 } } } */
+ /* { dg-final { scan-tree-dump-times "Sunk statements: 4" 1 "sink2" { target lp64 xfail { riscv64-*-* } } } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-21.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-21.c
new file mode 100644
index 0000000..16537cc
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-21.c
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-thread2-stats -fdump-tree-optimized" } */
+
+long a;
+int b;
+void bar64_(void);
+void foo();
+int main() {
+ char c = 0;
+ unsigned d = 10;
+ int e = 2;
+ for (; d; d--) {
+ bar64_();
+ b = d;
+ e && (c = (e = 0) != 4) > 1;
+ }
+ if (c < 1)
+ foo();
+ a = b;
+}
+
+/* We need to perform a non-multi-way branch FSM thread creating an
+ irreducible loop in thread2 to allow followup threading to
+ remove the call to foo (). */
+/* { dg-final { scan-tree-dump "Jumps threaded: 1" "thread2" } } */
+/* { dg-final { scan-tree-dump-not "foo" "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/tree-ssa.exp b/gcc/testsuite/gcc.dg/tree-ssa/tree-ssa.exp
index e5b524f..a5712eb 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/tree-ssa.exp
+++ b/gcc/testsuite/gcc.dg/tree-ssa/tree-ssa.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 1997-2022 Free Software Foundation, Inc.
+# Copyright (C) 1997-2023 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-3a.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-3a.c
new file mode 100644
index 0000000..5aadaa7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-3a.c
@@ -0,0 +1,19 @@
+// { dg-do compile }
+// { dg-options "-O2 -fno-thread-jumps -fdisable-tree-fre1 -fdump-tree-evrp" }
+
+void link_error ();
+void bar ();
+
+float
+foo (float x)
+{
+ if (x != x)
+ {
+ // The true side of x != x implies NAN, so we should be able to
+ // fold this.
+ if (!__builtin_isnan (x))
+ link_error ();
+ }
+}
+
+// { dg-final { scan-tree-dump-not "link_error" "evrp" } }
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-4a.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-4a.c
new file mode 100644
index 0000000..7d3187b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-4a.c
@@ -0,0 +1,23 @@
+// { dg-do compile }
+// { dg-options "-O2 -fno-thread-jumps -fdisable-tree-fre1 -fdump-tree-evrp" }
+
+void link_error ();
+void bar ();
+
+float
+foo (float x)
+{
+ if (x == x)
+ {
+ bar ();
+ }
+ else
+ {
+ // The false side of x == x implies NAN, so we should be able to
+ // fold this.
+ if (!__builtin_isnan (x))
+ link_error ();
+ }
+}
+
+// { dg-final { scan-tree-dump-not "link_error" "evrp" } }
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-5a.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-5a.c
new file mode 100644
index 0000000..0833230
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-5a.c
@@ -0,0 +1,16 @@
+// { dg-do compile }
+// { dg-options "-O2 -fno-thread-jumps -fdisable-tree-fre1 -fdump-tree-evrp" }
+
+void link_error ();
+
+float
+foo (float x)
+{
+ if (__builtin_isnan (x))
+ {
+ if (!__builtin_isnan (x))
+ link_error ();
+ }
+}
+
+// { dg-final { scan-tree-dump-not "link_error" "evrp" } }
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-abs-1.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-abs-1.c
new file mode 100644
index 0000000..4b7b758
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-abs-1.c
@@ -0,0 +1,17 @@
+// { dg-do compile }
+// { dg-options "-O2 -fno-thread-jumps -fdump-tree-evrp" }
+
+void link_error ();
+
+void
+foo (double x, double y)
+{
+ if (x > y && __builtin_signbit (y) == 0)
+ {
+ // y == +INF is impossible.
+ if (__builtin_isinf (y))
+ link_error ();
+ }
+}
+
+// { dg-final { scan-tree-dump-not "link_error" "evrp" } }
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-plus.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-plus.c
new file mode 100644
index 0000000..3739ea4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-plus.c
@@ -0,0 +1,21 @@
+// { dg-do compile }
+// { dg-options "-O2 -fno-tree-fre -fno-tree-dominator-opts -fno-thread-jumps -fdump-tree-vrp2" }
+
+double BG_SplineLength ()
+{
+ double lastPoint;
+ double i;
+
+ for (i = 0.01;i<=1;i+=0.1f)
+ if (!(i != 0.0))
+ {
+ lastPoint = i;
+ }
+ else
+ {
+ lastPoint = 2;
+ }
+ return lastPoint;
+}
+
+// { dg-final { scan-tree-dump-times "return 2\\.0e" 1 "vrp2" } }
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-signbit-3.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-signbit-3.c
new file mode 100644
index 0000000..182a33f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-signbit-3.c
@@ -0,0 +1,15 @@
+// { dg-do compile }
+// { dg-options "-O2 -ffinite-math-only -fdump-tree-evrp" }
+
+void link_error();
+
+void foo(float x)
+{
+ if (__builtin_signbit (x))
+ {
+ if (x > 0.0)
+ link_error();
+ }
+}
+
+// { dg-final { scan-tree-dump-not "link_error" "evrp" } }
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp-unreachable.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp-unreachable.c
new file mode 100644
index 0000000..cdc5740
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp-unreachable.c
@@ -0,0 +1,42 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-vrp1-alias -fdump-tree-vrp2-alias" } */
+
+void dead (unsigned n);
+void alive (unsigned n);
+
+void func (unsigned n, unsigned m)
+{
+ if (n == 0)
+ __builtin_unreachable();
+ if (n == 1)
+ __builtin_unreachable();
+ if (n & 0x1)
+ __builtin_unreachable();
+ if (n == 2)
+ __builtin_unreachable();
+ if (n == 3)
+ __builtin_unreachable();
+ if (n & 0x2)
+ __builtin_unreachable();
+ if (n == 4)
+ __builtin_unreachable();
+ if (n == 5)
+ __builtin_unreachable();
+ if (n & 0x4)
+ __builtin_unreachable();
+ if (n == 6)
+ __builtin_unreachable();
+ if (n == 7)
+ __builtin_unreachable();
+ if (n <8)
+ dead (n);
+ if (n != m)
+ __builtin_unreachable();
+ alive (n);
+ alive (m);
+}
+
+/* { dg-final { scan-tree-dump-not "dead" "vrp1" } } */
+/* { dg-final { scan-tree-dump-times "builtin_unreachable" 1 "vrp1" } } */
+/* { dg-final { scan-tree-dump-not "builtin_unreachable" "vrp2" } } */
+/* { dg-final { scan-tree-dump-times "fff8" 4 "vrp2" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp-update.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp-update.c
new file mode 100644
index 0000000..9e5da88
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp-update.c
@@ -0,0 +1,21 @@
+/* { dg-options "-O2 -fdump-tree-vrp1 " } */
+
+/* Tests that calls to update_stmt by the folder will also update ranger's
+ cache value and produce the correct result for the builtin_constant_p
+ function. */
+
+void dead ();
+
+void foo( void *_thrdescr, int _result)
+{
+ const char *lossage = _result ? "constant string" : 0;
+
+ if (__builtin_expect (lossage != ((void *)0) , 0))
+ {
+ unsigned __message_length = __builtin_strlen (lossage);
+ if (! __builtin_constant_p (__message_length))
+ dead ();
+ }
+}
+
+/* { dg-final { scan-tree-dump-not "dead" "vrp1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp122.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp122.c
new file mode 100644
index 0000000..b2ddcda
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp122.c
@@ -0,0 +1,19 @@
+// { dg-do compile }
+// { dg-options "-O2 -fdump-tree-evrp-details" }
+
+void gg(void);
+int f(unsigned t)
+{
+ unsigned g = t*16;
+ if (g==0) return 1;
+ gg();
+ gg();
+ gg();
+ gg();
+ gg();
+ gg();
+ if (g<=4) return 1;
+ return 0;
+}
+
+// { dg-final { scan-tree-dump "Global Exported: g_.* NONZERO 0x.*fff0" "evrp" } }
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp123.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp123.c
new file mode 100644
index 0000000..1ad3caa
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp123.c
@@ -0,0 +1,18 @@
+// { dg-options "-O1 -fdump-tree-dom3-raw" }
+
+extern int
+__attribute__((const))
+foo4b (int);
+
+int f4b (unsigned int r)
+{
+ if (foo4b (r))
+ r *= 8U;
+
+ if ((r / 2U) & 2U)
+ r += foo4b (r);
+
+ return r;
+}
+
+// { dg-final { scan-tree-dump-times {gimple_call <foo4b,} 1 dom3 } }
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp46.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp46.c
index ebdc2e3..6d3f752 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/vrp46.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp46.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-vrp1 --param fsm-scale-path-blocks=1" } */
+/* { dg-options "-O2 -fdump-tree-vrp1" } */
int func_81 (int);
int func_98 (int);