aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2022-09-22 06:29:20 -0700
committerIan Lance Taylor <iant@golang.org>2022-09-22 06:29:20 -0700
commit795cffe109e28b248a54b8ee583cbae48368c2a7 (patch)
tree0c12b075c51c0d5097f26953835ae540d9f2f501 /gcc/testsuite/gcc.dg/tree-ssa
parent9f62ed218fa656607740b386c0caa03e65dcd283 (diff)
parentf35be1268c996d993ab0b4ff329734d467474445 (diff)
downloadgcc-795cffe109e28b248a54b8ee583cbae48368c2a7.zip
gcc-795cffe109e28b248a54b8ee583cbae48368c2a7.tar.gz
gcc-795cffe109e28b248a54b8ee583cbae48368c2a7.tar.bz2
Merge from trunk revision f35be1268c996d993ab0b4ff329734d467474445.
Diffstat (limited to 'gcc/testsuite/gcc.dg/tree-ssa')
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/gen-vect-34.c16
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ldist-39.c16
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/minmax-10.c32
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/minmax-11.c34
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/minmax-12.c32
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/minmax-13.c32
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/minmax-14.c33
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/minmax-15.c34
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/minmax-16.c29
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/minmax-3.c29
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/minmax-4.c29
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/minmax-5.c29
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/minmax-6.c29
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/minmax-7.c29
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/minmax-8.c29
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/minmax-9.c32
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr106819.c24
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr106867.c16
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr106967.c16
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr106970.c9
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr93776.c27
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/recip-3.c5
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/split-path-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-100.c25
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-16.c24
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-17.c7
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-18.c20
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-19.c33
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-20.c15
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp-float-1.c19
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp-float-11.c26
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp-float-3.c18
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp-float-4.c16
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp-float-6.c20
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp-float-7.c14
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp-float-8.c26
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp-float-inf-1.c15
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp-float-nan-1.c18
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp-float-signbit-1.c12
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp-float-signbit-2.c24
41 files changed, 868 insertions, 29 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-34.c b/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-34.c
new file mode 100644
index 0000000..41877e0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-34.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-Ofast -fdump-tree-vect-details" } */
+/* { dg-additional-options "-mavx2" { target { x86_64-*-* i?86-*-* } } } */
+
+float summul(int n, float *arg1, float *arg2)
+{
+ int i;
+ float res1 = 1.0;
+ for(i = 0; i < n; i++) {
+ if(arg2[i])
+ res1 *= arg1[i];
+ }
+ return res1;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { ! { avr-*-* pru-*-* riscv*-*-* } } } } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ldist-39.c b/gcc/testsuite/gcc.dg/tree-ssa/ldist-39.c
new file mode 100644
index 0000000..3ef7286
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ldist-39.c
@@ -0,0 +1,16 @@
+/* PR/106533 */
+/* { dg-options "-O2 -fdump-tree-ldist-optimized" } */
+
+void bar (int *a, int * __restrict b)
+{
+ for (int k = 0; k < 10; k++)
+ {
+ for (int j = 0; j < 100000; ++j)
+ a[j] = b[j];
+ __builtin_printf ("Foo!");
+ }
+}
+
+/* The stmt with side-effects in the outer loop should not prevent
+ distribution of the inner loop of the loop nest. */
+/* { dg-final { scan-tree-dump "optimized: Loop . distributed: split to 0 loops and 1 library calls" "ldist" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/minmax-10.c b/gcc/testsuite/gcc.dg/tree-ssa/minmax-10.c
new file mode 100644
index 0000000..c9322a1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/minmax-10.c
@@ -0,0 +1,32 @@
+/* { dg-do run } */
+/* { dg-options "-O -fdump-tree-optimized" } */
+
+#include <stdint.h>
+
+__attribute__ ((noipa, noinline))
+uint8_t three_max (uint8_t xc, uint8_t xm, uint8_t xy) {
+ uint8_t xk;
+ xc=~xc;
+ xm=~xm;
+ xy=~xy;
+ if (xc > xm) {
+ xk = (uint8_t) (xc > xy ? xc : xy);
+ } else {
+ xk = (uint8_t) (xm > xy ? xm : xy);
+ }
+ return xk;
+}
+
+int
+main (void)
+{
+ volatile uint8_t xy = 255;
+ volatile uint8_t xm = 0;
+ volatile uint8_t xc = 127;
+ if (three_max (xc, xm, xy) != 255)
+ __builtin_abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "MIN_EXPR" 2 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "= ~" 1 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/minmax-11.c b/gcc/testsuite/gcc.dg/tree-ssa/minmax-11.c
new file mode 100644
index 0000000..b1da417
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/minmax-11.c
@@ -0,0 +1,34 @@
+/* { dg-do run } */
+/* { dg-options "-O -fdump-tree-optimized" } */
+
+#include <stdint.h>
+
+
+__attribute__ ((noipa, noinline))
+uint8_t three_minmax1 (uint8_t xc, uint8_t xm, uint8_t xy) {
+ uint8_t xk;
+ xc=~xc;
+ xm=~xm;
+ xy=~xy;
+ if (xc > xm) {
+ xk = (uint8_t) (xc < xy ? xc : xy);
+ } else {
+ xk = (uint8_t) (xm < xy ? xm : xy);
+ }
+ return xk;
+}
+
+int
+main (void)
+{
+ volatile uint8_t xy = 255;
+ volatile uint8_t xm = 0;
+ volatile uint8_t xc = 127;
+ if (three_minmax1 (xc, xm, xy) != 0)
+ __builtin_abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "MIN_EXPR" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "MAX_EXPR" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "= ~" 1 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/minmax-12.c b/gcc/testsuite/gcc.dg/tree-ssa/minmax-12.c
new file mode 100644
index 0000000..cb9188f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/minmax-12.c
@@ -0,0 +1,32 @@
+/* { dg-do run } */
+/* { dg-options "-O -fdump-tree-phiopt" } */
+
+#include <stdint.h>
+
+__attribute__ ((noinline, noipa))
+uint8_t three_minmax3 (uint8_t xc, uint8_t xm, uint8_t xy) {
+ uint8_t xk;
+ xc=~xc;
+ xm=~xm;
+ xy=~xy;
+ if (xc > xm) {
+ xk = (uint8_t) (xy < xc ? xc : xy);
+ } else {
+ xk = (uint8_t) (xm < xy ? xm : xy);
+ }
+ return xk;
+}
+
+int
+main (void)
+{
+ volatile uint8_t xy = 255;
+ volatile uint8_t xm = 0;
+ volatile uint8_t xc = 127;
+ if (three_minmax3 (xc, xm, xy) != 0)
+ __builtin_abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "MIN_EXPR" 1 "phiopt1" } } */
+/* { dg-final { scan-tree-dump-times "MAX_EXPR" 1 "phiopt1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/minmax-13.c b/gcc/testsuite/gcc.dg/tree-ssa/minmax-13.c
new file mode 100644
index 0000000..62ba71e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/minmax-13.c
@@ -0,0 +1,32 @@
+/* { dg-do run } */
+/* { dg-options "-O -fdump-tree-phiopt" } */
+
+#include <stdint.h>
+
+__attribute__ ((noipa, noinline))
+uint8_t three_minmax2 (uint8_t xc, uint8_t xm, uint8_t xy) {
+ uint8_t xk;
+ xc=~xc;
+ xm=~xm;
+ xy=~xy;
+ if (xc > xm) {
+ xk = (uint8_t) (xc > xy ? xc : xy);
+ } else {
+ xk = (uint8_t) (xm < xy ? xm : xy);
+ }
+ return xk;
+}
+
+int
+main (void)
+{
+ volatile uint8_t xy = 255;
+ volatile uint8_t xm = 127;
+ volatile uint8_t xc = 0;
+ if (three_minmax2 (xc, xm, xy) != 255)
+ __builtin_abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "MIN_EXPR" 1 "phiopt1" } } */
+/* { dg-final { scan-tree-dump-times "MAX_EXPR" 1 "phiopt1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/minmax-14.c b/gcc/testsuite/gcc.dg/tree-ssa/minmax-14.c
new file mode 100644
index 0000000..a3ec584
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/minmax-14.c
@@ -0,0 +1,33 @@
+/* { dg-do run } */
+/* { dg-options "-O -fdump-tree-optimized" } */
+
+#include <stdint.h>
+
+__attribute__ ((noipa, noinline))
+uint8_t three_minmax11 (uint8_t xc, uint8_t xm, uint8_t xy) {
+ uint8_t xk;
+ xc=~xc;
+ xm=~xm;
+ xy=~xy;
+ if (xc < xm) {
+ xk = (uint8_t) (xc > xy ? xc : xy);
+ } else {
+ xk = (uint8_t) (xm > xy ? xm : xy);
+ }
+ return xk;
+}
+
+int
+main (void)
+{
+ volatile uint8_t xy = 255;
+ volatile uint8_t xm = 0;
+ volatile uint8_t xc = 127;
+ if (three_minmax11 (xc, xm, xy) != 128)
+ __builtin_abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "MIN_EXPR" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "MAX_EXPR" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "= ~" 1 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/minmax-15.c b/gcc/testsuite/gcc.dg/tree-ssa/minmax-15.c
new file mode 100644
index 0000000..8a39871
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/minmax-15.c
@@ -0,0 +1,34 @@
+/* { dg-do run } */
+/* { dg-options "-O -fdump-tree-phiopt" } */
+
+#include <stdint.h>
+#include <stdbool.h>
+
+__attribute__ ((noinline, noipa))
+uint8_t three_min (uint8_t xc, uint8_t xm, uint8_t xy) {
+ uint8_t xk;
+ if (xc)
+ {
+ if (xc < xm) {
+ xk = (uint8_t) (xc < xy ? xc : xy);
+ } else {
+ xk = (uint8_t) (xm < xy ? xm : xy);
+ }
+ }
+
+ return xk;
+}
+
+int
+main (void)
+{
+ volatile uint8_t xy = 255;
+ volatile uint8_t xm = 0;
+ volatile uint8_t xc = 127;
+ if (three_min (xc, xm, xy) != 0)
+ __builtin_abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "MIN_EXPR" 3 "phiopt1" } } */
+/* { dg-final { scan-tree-dump-times "MAX_EXPR" 0 "phiopt1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/minmax-16.c b/gcc/testsuite/gcc.dg/tree-ssa/minmax-16.c
new file mode 100644
index 0000000..4febd09
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/minmax-16.c
@@ -0,0 +1,29 @@
+/* { dg-do run } */
+/* { dg-options "-O -fdump-tree-phiopt -g" } */
+
+#include <stdint.h>
+
+__attribute__ ((noipa, noinline))
+uint8_t three_min (uint8_t xc, uint8_t xm, uint8_t xy) {
+ uint8_t xk;
+ if (xc < xm) {
+ xk = (uint8_t) (xc < xy ? xc : xy);
+ } else {
+ xk = (uint8_t) (xm < xy ? xm : xy);
+ }
+ return xk;
+}
+
+int
+main (void)
+{
+ volatile uint8_t xy = 255;
+ volatile uint8_t xm = 0;
+ volatile uint8_t xc = 127;
+ if (three_min (xc, xm, xy) != 0)
+ __builtin_abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "MIN_EXPR" 3 "phiopt1" } } */
+/* { dg-final { scan-tree-dump-times "MAX_EXPR" 0 "phiopt1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/minmax-3.c b/gcc/testsuite/gcc.dg/tree-ssa/minmax-3.c
new file mode 100644
index 0000000..2af1077
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/minmax-3.c
@@ -0,0 +1,29 @@
+/* { dg-do run } */
+/* { dg-options "-O -fdump-tree-phiopt" } */
+
+#include <stdint.h>
+
+__attribute__ ((noipa, noinline))
+uint8_t three_min (uint8_t xc, uint8_t xm, uint8_t xy) {
+ uint8_t xk;
+ if (xc < xm) {
+ xk = (uint8_t) (xc < xy ? xc : xy);
+ } else {
+ xk = (uint8_t) (xm < xy ? xm : xy);
+ }
+ return xk;
+}
+
+int
+main (void)
+{
+ volatile uint8_t xy = 255;
+ volatile uint8_t xm = 0;
+ volatile uint8_t xc = 127;
+ if (three_min (xc, xm, xy) != 0)
+ __builtin_abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "MIN_EXPR" 3 "phiopt1" } } */
+/* { dg-final { scan-tree-dump-times "MAX_EXPR" 0 "phiopt1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/minmax-4.c b/gcc/testsuite/gcc.dg/tree-ssa/minmax-4.c
new file mode 100644
index 0000000..973f39b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/minmax-4.c
@@ -0,0 +1,29 @@
+/* { dg-do run } */
+/* { dg-options "-O -fdump-tree-phiopt" } */
+
+#include <stdint.h>
+
+__attribute__ ((noipa, noinline))
+uint8_t three_max (uint8_t xc, uint8_t xm, uint8_t xy) {
+ uint8_t xk;
+ if (xc > xm) {
+ xk = (uint8_t) (xc > xy ? xc : xy);
+ } else {
+ xk = (uint8_t) (xm > xy ? xm : xy);
+ }
+ return xk;
+}
+
+int
+main (void)
+{
+ volatile uint8_t xy = 255;
+ volatile uint8_t xm = 0;
+ volatile uint8_t xc = 127;
+ if (three_max (xc, xm, xy) != 255)
+ __builtin_abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "MIN_EXPR" 0 "phiopt1" } } */
+/* { dg-final { scan-tree-dump-times "MAX_EXPR" 3 "phiopt1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/minmax-5.c b/gcc/testsuite/gcc.dg/tree-ssa/minmax-5.c
new file mode 100644
index 0000000..34e4e72
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/minmax-5.c
@@ -0,0 +1,29 @@
+/* { dg-do run } */
+/* { dg-options "-O -fdump-tree-phiopt" } */
+
+#include <stdint.h>
+
+__attribute__ ((noipa, noinline))
+uint8_t three_minmax1 (uint8_t xc, uint8_t xm, uint8_t xy) {
+ uint8_t xk;
+ if (xc > xm) {
+ xk = (uint8_t) (xc < xy ? xc : xy);
+ } else {
+ xk = (uint8_t) (xm < xy ? xm : xy);
+ }
+ return xk;
+}
+
+int
+main (void)
+{
+ volatile uint8_t xy = 255;
+ volatile uint8_t xm = 0;
+ volatile uint8_t xc = 127;
+ if (three_minmax1 (xc, xm, xy) != 127)
+ __builtin_abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "MIN_EXPR" 2 "phiopt1" } } */
+/* { dg-final { scan-tree-dump-times "MAX_EXPR" 1 "phiopt1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/minmax-6.c b/gcc/testsuite/gcc.dg/tree-ssa/minmax-6.c
new file mode 100644
index 0000000..443d68f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/minmax-6.c
@@ -0,0 +1,29 @@
+/* { dg-do run } */
+/* { dg-options "-O -fdump-tree-phiopt" } */
+
+#include <stdint.h>
+
+__attribute__ ((noipa, noinline))
+uint8_t three_minmax3 (uint8_t xc, uint8_t xm, uint8_t xy) {
+ uint8_t xk;
+ if (xc > xm) {
+ xk = (uint8_t) (xy < xc ? xc : xy);
+ } else {
+ xk = (uint8_t) (xm < xy ? xm : xy);
+ }
+ return xk;
+}
+
+int
+main (void)
+{
+ volatile uint8_t xy = 255;
+ volatile uint8_t xm = 0;
+ volatile uint8_t xc = 127;
+ if (three_minmax3 (xc, xm, xy) != 255)
+ __builtin_abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "MIN_EXPR" 1 "phiopt1" } } */
+/* { dg-final { scan-tree-dump-times "MAX_EXPR" 1 "phiopt1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/minmax-7.c b/gcc/testsuite/gcc.dg/tree-ssa/minmax-7.c
new file mode 100644
index 0000000..7e2a3f0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/minmax-7.c
@@ -0,0 +1,29 @@
+/* { dg-do run } */
+/* { dg-options "-O -fdump-tree-phiopt" } */
+
+#include <stdint.h>
+
+__attribute__ ((noipa, noinline))
+uint8_t three_minmax2 (uint8_t xc, uint8_t xm, uint8_t xy) {
+ uint8_t xk;
+ if (xc > xm) {
+ xk = (uint8_t) (xc > xy ? xc : xy);
+ } else {
+ xk = (uint8_t) (xm < xy ? xm : xy);
+ }
+ return xk;
+}
+
+int
+main (void)
+{
+ volatile uint8_t xy = 255;
+ volatile uint8_t xm = 0;
+ volatile uint8_t xc = 127;
+ if (three_minmax2 (xc, xm, xy) != 255)
+ __builtin_abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "MIN_EXPR" 1 "phiopt1" } } */
+/* { dg-final { scan-tree-dump-times "MAX_EXPR" 1 "phiopt1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/minmax-8.c b/gcc/testsuite/gcc.dg/tree-ssa/minmax-8.c
new file mode 100644
index 0000000..0160e57
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/minmax-8.c
@@ -0,0 +1,29 @@
+/* { dg-do run } */
+/* { dg-options "-O -fdump-tree-phiopt" } */
+
+#include <stdint.h>
+
+__attribute__ ((noinline, noipa))
+uint8_t three_minmax11 (uint8_t xc, uint8_t xm, uint8_t xy) {
+ uint8_t xk;
+ if (xc < xm) {
+ xk = (uint8_t) (xc > xy ? xc : xy);
+ } else {
+ xk = (uint8_t) (xm > xy ? xm : xy);
+ }
+ return xk;
+}
+
+int
+main (void)
+{
+ volatile uint8_t xy = 255;
+ volatile uint8_t xm = 0;
+ volatile uint8_t xc = 127;
+ if (three_minmax11 (xc, xm, xy) != 255)
+ __builtin_abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "MIN_EXPR" 1 "phiopt1" } } */
+/* { dg-final { scan-tree-dump-times "MAX_EXPR" 2 "phiopt1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/minmax-9.c b/gcc/testsuite/gcc.dg/tree-ssa/minmax-9.c
new file mode 100644
index 0000000..0cfb658
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/minmax-9.c
@@ -0,0 +1,32 @@
+/* { dg-do run } */
+/* { dg-options "-O -fdump-tree-optimized" } */
+
+#include <stdint.h>
+
+__attribute__ ((noipa, noinline))
+uint8_t three_min (uint8_t xc, uint8_t xm, uint8_t xy) {
+ uint8_t xk;
+ xc=~xc;
+ xm=~xm;
+ xy=~xy;
+ if (xc < xm) {
+ xk = (uint8_t) (xc < xy ? xc : xy);
+ } else {
+ xk = (uint8_t) (xm < xy ? xm : xy);
+ }
+ return xk;
+}
+
+int
+main (void)
+{
+ volatile uint8_t xy = 255;
+ volatile uint8_t xm = 0;
+ volatile uint8_t xc = 127;
+ if (three_min (xc, xm, xy) != 0)
+ __builtin_abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "= ~" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "MAX_EXPR" 2 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr106819.c b/gcc/testsuite/gcc.dg/tree-ssa/pr106819.c
new file mode 100644
index 0000000..1272d4b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr106819.c
@@ -0,0 +1,24 @@
+// { dg-do compile }
+// { dg-options "-O2 -fdump-tree-evrp-details" }
+
+static int isNaN(double x)
+{
+ return x != x;
+}
+
+static double opCmpProper(int lhs, double rhs)
+{
+ return lhs < rhs ? -1.0
+ : lhs > rhs ? 1.0
+ : lhs == rhs ? 0.0
+ : __builtin_nan("");
+}
+
+int main()
+{
+ if (!isNaN(opCmpProper(41, __builtin_nan(""))))
+ __builtin_abort();
+ return 0;
+}
+
+// { dg-final {scan-tree-dump-not "Folds to: 0.0" "evrp" } }
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr106867.c b/gcc/testsuite/gcc.dg/tree-ssa/pr106867.c
new file mode 100644
index 0000000..68773d9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr106867.c
@@ -0,0 +1,16 @@
+// { dg-do compile }
+// { dg-options "-O2 -fno-tree-fre" }
+
+double m;
+int n;
+
+void
+foo (void)
+{
+ static double a[] = { 0.0 / 0.0, 0.0 };
+ int i;
+
+ for (i = 0; i < n; ++i)
+ if (m >= a[i])
+ __builtin_abort ();
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr106967.c b/gcc/testsuite/gcc.dg/tree-ssa/pr106967.c
new file mode 100644
index 0000000..bff2795
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr106967.c
@@ -0,0 +1,16 @@
+// { dg-do compile }
+// { dg-options "-O2 -ffinite-math-only -fno-trapping-math -fno-tree-dominator-opts" }
+
+void
+foo (float x, int *y)
+{
+ int i;
+ float sum2 = 0.0;
+
+ for (i = 0; i < *y; ++i)
+ sum2 += x;
+
+ sum2 = 1.0 / sum2;
+ if (sum2 * 0.0 < 5.E-5)
+ *y = 0;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr106970.c b/gcc/testsuite/gcc.dg/tree-ssa/pr106970.c
new file mode 100644
index 0000000..cda9bd4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr106970.c
@@ -0,0 +1,9 @@
+// { dg-do compile }
+// { dg-options "-O1 -fno-signed-zeros" }
+
+void
+foo (double x, double y)
+{
+ if (!x == !y * -1.0)
+ __builtin_trap ();
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr93776.c b/gcc/testsuite/gcc.dg/tree-ssa/pr93776.c
deleted file mode 100644
index c407a62..0000000
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr93776.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-O1" } */
-
-struct empty {};
-struct s { int i; };
-struct z
-{
- int j;
- struct empty e;
- struct s s;
- int k;
-};
-
-void bar (struct z);
-void baz (int);
-
-void foo (void)
-{
- struct z z, z2;
-
- z.k = 8;
- z2.s.i = 1;
- z = z2;
- bar (z);
- z.e = (struct empty) {};
- baz (z.k);
-}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/recip-3.c b/gcc/testsuite/gcc.dg/tree-ssa/recip-3.c
index 410b280..036f32a 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/recip-3.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/recip-3.c
@@ -1,6 +1,11 @@
/* { dg-do compile } */
/* { dg-options "-O1 -fno-trapping-math -funsafe-math-optimizations -fdump-tree-recip" } */
+/* The recip pass has a threshold of 3 reciprocal operations before it attempts
+ to optimize a sequence. With a FP enabled ranger, we eliminate one of them
+ earlier, causing the pass to skip this optimization. */
+/* { dg-additional-options "-fno-thread-jumps -fno-tree-dominator-opts" } */
+
double F[5] = { 0.0, 0.0 }, e;
/* In this case the optimization is interesting. */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/split-path-1.c b/gcc/testsuite/gcc.dg/tree-ssa/split-path-1.c
index 8b23ef4..902dde4 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/split-path-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/split-path-1.c
@@ -1,5 +1,5 @@
/* { dg-do run } */
-/* { dg-options "-O2 -fsplit-paths -fdump-tree-split-paths-details --param max-jump-thread-duplication-stmts=20" } */
+/* { dg-options "-O2 -fsplit-paths -fdump-tree-split-paths-details --param max-jump-thread-duplication-stmts=20 -fno-ssa-phiopt" } */
#include <stdio.h>
#include <stdlib.h>
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c
index aa06db5..47b8fdf 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c
@@ -11,7 +11,7 @@
to change decisions in switch expansion which in turn can expose new
jump threading opportunities. Skip the later tests on aarch64. */
/* { dg-final { scan-tree-dump-not "Jumps threaded" "dom3" { target { ! aarch64*-*-* } } } } */
-/* { dg-final { scan-tree-dump "Jumps threaded: 8" "thread2" { target { ! aarch64*-*-* } } } } */
+/* { dg-final { scan-tree-dump "Jumps threaded: 9" "thread2" { target { ! aarch64*-*-* } } } } */
/* { dg-final { scan-tree-dump "Jumps threaded: 18" "thread2" { target { aarch64*-*-* } } } } */
enum STATE {
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-100.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-100.c
new file mode 100644
index 0000000..ead7654
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-100.c
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-fre1" } */
+
+float bar, baz;
+void foo (int *p, int n)
+{
+ *p = 0;
+ do
+ {
+ bar = 1.;
+ /* When iterating we should have optimistically value-numbered
+ *p to zero, on the second iteration we have to prove the
+ store below does not affect the value of this load though.
+ We can compare the stored value against the value from the
+ previous iteration instead relying on a non-walking lookup. */
+ if (*p)
+ {
+ baz = 2.;
+ *p = 0;
+ }
+ }
+ while (--n);
+}
+
+/* { dg-final { scan-tree-dump-not "baz" "fre1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-16.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-16.c
new file mode 100644
index 0000000..f96170b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-16.c
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-threadfull1-details" } */
+
+int res;
+void foo (int a, int b, int c, int d, int e)
+{
+ if (a > 100)
+ res = 3;
+ if (b != 5)
+ res = 5;
+ if (c == 29)
+ res = 7;
+ if (d < 2)
+ res = 9;
+ /* Accounting whoes makes this not catched. */
+#if 0
+ if (e != 37)
+ res = 11;
+#endif
+ if (a < 10)
+ res = 13;
+}
+
+/* { dg-final { scan-tree-dump "SUCCESS" "threadfull1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-17.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-17.c
new file mode 100644
index 0000000..94ee666
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-17.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-threadfull1-details --param max-jump-thread-paths=15" } */
+
+#include "ssa-thread-16.c"
+
+/* With limiting the search space we should no longer consider this path. */
+/* { dg-final { scan-tree-dump-not "SUCCESS" "threadfull1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-18.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-18.c
new file mode 100644
index 0000000..a899f4f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-18.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-threadfull1-stats" } */
+
+void foo (int nest, int print_nest)
+{
+ _Bool t0 = nest != 0;
+ _Bool t1 = nest == print_nest;
+ _Bool t2 = t0 & t1;
+ if (t2)
+ __builtin_puts ("x");
+ nest++;
+ if (nest > 2)
+ __builtin_abort ();
+ if (print_nest == nest)
+ __builtin_puts ("y");
+}
+
+/* We should be able to thread (t2) to !(print_nest == nest) using the
+ nest == print_nest relation implied by the entry block. */
+/* { dg-final { scan-tree-dump "Jumps threaded: 1" "threadfull1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-19.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-19.c
new file mode 100644
index 0000000..62912f3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-19.c
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-threadfull1-stats" } */
+
+struct S;
+struct S { struct S *next; };
+int foo (struct S *chain, _Bool is_ctor, _Bool is_dtor)
+{
+ int num_args = 0;
+ if (chain) /* A */
+ {
+ do {
+ num_args++;
+ chain = chain->next;
+ if (!chain)
+ break;
+ } while (1);
+ }
+ if (is_ctor)
+ num_args++; /* B */
+ if (is_dtor)
+ num_args++;
+ else
+ {
+ if (num_args > 2) /* C */
+ __builtin_puts ("x");
+ }
+ return num_args;
+}
+
+/* We want to thread both paths from A with NULL chain to C, the one through
+ B and one around it.
+ ??? Ideally we'd thread one "path" containing the half-diamond with B. */
+/* { dg-final { scan-tree-dump "Jumps threaded: 2" "threadfull1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-20.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-20.c
new file mode 100644
index 0000000..c652965
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-20.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fdump-tree-ethread-stats" } */
+
+struct S { int base; };
+void foo (struct S *p)
+{
+ if (p)
+ {
+ int *q = &p->base;
+ if (q)
+ __builtin_puts ("x");
+ }
+}
+
+/* { dg-final { scan-tree-dump "Jumps threaded: 1" "ethread" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-1.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-1.c
new file mode 100644
index 0000000..5be5426
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-1.c
@@ -0,0 +1,19 @@
+// { dg-do compile }
+// { dg-options "-O2 -fdisable-tree-ethread -fdisable-tree-fre1 -fdump-tree-evrp-details" }
+
+void bar ();
+void george ();
+
+float
+foo (float x, float y)
+{
+ if (x == x)
+ {
+ if (x > y)
+ bar();
+ if (x == x)
+ george();
+ }
+}
+
+// { dg-final { scan-tree-dump-times "Folded into: if \\(1 != 0\\)" 1 "evrp" } }
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-11.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-11.c
new file mode 100644
index 0000000..2f4dc87
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-11.c
@@ -0,0 +1,26 @@
+// { dg-do compile }
+// { dg-options "-O2 -fno-thread-jumps -fdump-tree-evrp" }
+
+extern void link_error ();
+
+void fast_sqrt (float);
+
+float test (float x)
+{
+ float y = x*x;
+ if (y >= 0.f)
+ {
+ if (__builtin_isnan (y))
+ link_error ();
+ else
+ fast_sqrt (y);
+
+ if (!__builtin_isnan (y))
+ fast_sqrt (y);
+ else
+ link_error ();
+ }
+}
+
+// { dg-final { scan-tree-dump-times "fast_sqrt" 2 "evrp" } }
+// { dg-final { scan-tree-dump-not "link_error" "evrp" } }
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-3.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-3.c
new file mode 100644
index 0000000..c659abb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-3.c
@@ -0,0 +1,18 @@
+// { dg-do compile }
+// { dg-options "-O2 -fdisable-tree-ethread -fdump-tree-evrp" }
+
+void link_error ();
+
+void
+foo (double x, double y)
+{
+ if (x == y)
+ {
+ if (__builtin_isnan (x))
+ link_error ();
+ if (__builtin_isnan (y))
+ link_error ();
+ }
+}
+
+// { dg-final { scan-tree-dump-not "link_error" "evrp" } }
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-4.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-4.c
new file mode 100644
index 0000000..8643674
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-4.c
@@ -0,0 +1,16 @@
+// { dg-do compile }
+// { dg-options "-O2 -fdisable-tree-ethread -fdump-tree-evrp" }
+
+void link_error ();
+
+void
+foo (double x, double y)
+{
+ if (x > y)
+ {
+ if (__builtin_isnan (x) || __builtin_isnan (y))
+ link_error ();
+ }
+}
+
+// { dg-final { scan-tree-dump-not "link_error" "evrp" } }
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-6.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-6.c
new file mode 100644
index 0000000..145d186
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-6.c
@@ -0,0 +1,20 @@
+// { dg-do compile }
+// { dg-options "-O2 -fdisable-tree-ethread -fdump-tree-evrp" }
+
+void bar ();
+
+void
+foo (double x, double y)
+{
+ if (x > y)
+ ;
+ else if (!__builtin_isnan (x) && !__builtin_isnan (y))
+ {
+ // If x and y are not NAN, the x <= y relationship holds, and the
+ // following conditional can be folded away.
+ if (x <= y)
+ bar ();
+ }
+}
+
+// { dg-final { scan-tree-dump-times "Folding predicate x_.* <= y_.* to 1" 1 "evrp" } }
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-7.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-7.c
new file mode 100644
index 0000000..92af870
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-7.c
@@ -0,0 +1,14 @@
+// { dg-do compile }
+// { dg-options "-O2 -fno-tree-forwprop -fno-tree-ccp -fno-tree-fre -fdump-tree-evrp" }
+
+extern void link_error ();
+
+void
+foo ()
+{
+ float z = 0.0;
+ if (__builtin_isnan (z))
+ link_error ();
+}
+
+// { dg-final { scan-tree-dump-not "link_error" "evrp" } }
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-8.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-8.c
new file mode 100644
index 0000000..9170150
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-8.c
@@ -0,0 +1,26 @@
+// { dg-do compile }
+// { dg-options "-O2 -fno-thread-jumps -fdump-tree-evrp" }
+
+extern void link_error ();
+
+void fast_sqrt (float);
+
+float test (float x)
+{
+ float y = x*x;
+ if (y >= 0.f)
+ {
+ if (__builtin_isnan (y))
+ link_error ();
+ else
+ fast_sqrt (y);
+
+ if (!__builtin_isnan (y))
+ fast_sqrt (y);
+ else
+ link_error ();
+ }
+}
+
+// { dg-final { scan-tree-dump-times "fast_sqrt" 2 "evrp" } }
+// { dg-final { scan-tree-dump-not "link_error" "evrp" } }
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-inf-1.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-inf-1.c
new file mode 100644
index 0000000..1d21cce4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-inf-1.c
@@ -0,0 +1,15 @@
+// { dg-do compile }
+// { dg-options "-O2 -fdump-tree-evrp-details" }
+
+void foo ();
+void bar (double);
+
+void funky(double f, double g)
+{
+ if (f <= __builtin_inf ())
+ foo ();
+ else
+ bar (f);
+}
+
+// { dg-final { scan-tree-dump-not " Inf, Inf" "evrp" } }
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-nan-1.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-nan-1.c
new file mode 100644
index 0000000..126949b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-nan-1.c
@@ -0,0 +1,18 @@
+// { dg-do compile }
+// { dg-options "-O2 -ffinite-math-only -fdump-tree-evrp" }
+
+void bar(float);
+
+void funk(int cond)
+{
+ float x;
+
+ if (cond)
+ x = __builtin_nan ("");
+ else
+ x = 1.24;
+
+ bar(x);
+}
+
+// { dg-final { scan-tree-dump-times "bar \\(1.24" 1 "evrp" } }
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-signbit-1.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-signbit-1.c
new file mode 100644
index 0000000..3fa783e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-signbit-1.c
@@ -0,0 +1,12 @@
+// { dg-do compile }
+// { dg-options "-O2 -fdump-tree-evrp" }
+
+int num;
+
+void func(float x)
+{
+ if (x > 5.0)
+ num = __builtin_signbit (x);
+}
+
+// { dg-final { scan-tree-dump-times "num = 0;" 1 "evrp" } }
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-signbit-2.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-signbit-2.c
new file mode 100644
index 0000000..954c7eb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-signbit-2.c
@@ -0,0 +1,24 @@
+// { dg-do compile }
+// { dg-options "-O2 -fdump-tree-evrp" }
+
+// Test that the only thing we know about the signbit about negative number is
+// that it's not 0.
+
+void link_error ();
+
+int num;
+
+void func(float x)
+{
+ if (x < -5.0)
+ {
+ num = __builtin_signbit (x);
+
+ // We may not know the exact signbit, but we know it's not 0.
+ if (!__builtin_signbit (x))
+ link_error ();
+ }
+}
+
+// { dg-final { scan-tree-dump-not "num = \[-0-9\];" "evrp" } }
+// { dg-final { scan-tree-dump-not "link_error" "evrp" } }