aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg')
-rw-r--r--gcc/testsuite/gcc.dg/pr122947.c45
-rw-r--r--gcc/testsuite/gcc.dg/tls/data-sections-1.c14
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr99782-1.c4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr46555.c28
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr123038.c8
5 files changed, 97 insertions, 2 deletions
diff --git a/gcc/testsuite/gcc.dg/pr122947.c b/gcc/testsuite/gcc.dg/pr122947.c
new file mode 100644
index 0000000..945a61a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr122947.c
@@ -0,0 +1,45 @@
+/* PR rtl-optimization/122947 based on PR 117239 */
+/* { dg-do run } */
+/* { dg-options "-fno-inline -O2" } */
+/* { dg-additional-options "-fschedule-insns -mno-accumulate-outgoing-args" { target x86 } } */
+
+int c = 1;
+
+struct A {
+ int e, f, g, h;
+ short i;
+ int j;
+};
+
+void
+bar (int x, struct A y)
+{
+ if (y.j == 1)
+ c = 0;
+}
+
+/* Simplest pure way to force baz's x.j back to memory.
+ So simple that IPA "inlines" it, so we disable IPA and mark as pure. */
+int __attribute__ ((noipa, pure))
+bad (struct A const *x)
+{
+ return x->j;
+}
+
+int
+baz (struct A x)
+{
+ x.j = 0;
+ return bad (&x);
+}
+
+int
+main ()
+{
+ struct A k = { 0, 0, 0, 0, 0, 1 };
+ int d = baz (k);
+ bar (0, k);
+ if (c + d != 0)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/tls/data-sections-1.c b/gcc/testsuite/gcc.dg/tls/data-sections-1.c
new file mode 100644
index 0000000..c829256
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tls/data-sections-1.c
@@ -0,0 +1,14 @@
+/* { dg-do run } */
+/* { dg-require-effective-target tls_runtime } */
+/* { dg-options "-fdata-sections" } */
+/* { dg-add-options tls } */
+
+__thread int i = 1;
+
+int main (void)
+{
+ if (i != 1)
+ __builtin_abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr99782-1.c b/gcc/testsuite/gcc.dg/torture/pr99782-1.c
index 76aab18..45fb93e 100644
--- a/gcc/testsuite/gcc.dg/torture/pr99782-1.c
+++ b/gcc/testsuite/gcc.dg/torture/pr99782-1.c
@@ -1,6 +1,6 @@
-/* { dg-compile } */
-/* { dg-additional-options "-mapxf" { target { { i?86-*-* x86_64-*-* } && { ! ia32 } } } } */
/* PR middle-end/99782 */
+/* { dg-do compile { target int128 } } */
+/* { dg-additional-options "-mapxf" { target { { i?86-*-* x86_64-*-* } && { ! ia32 } } } } */
int hb;
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr46555.c b/gcc/testsuite/gcc.dg/tree-ssa/pr46555.c
new file mode 100644
index 0000000..d4de7c2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr46555.c
@@ -0,0 +1,28 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized-details -fdump-rtl-pro_and_epilogue" } */
+/* PR tree-optimization/46555 */
+/* Here should not remove the forwarder block (or rather recreate it and not
+ remove it again). This improves expansion to RTL as there is one less copy
+ (or constant formation) in some cases. In this case we also get the ability
+ to shrink wrap the function. */
+
+int h(void);
+int f(int a, int b, int c)
+{
+ if (a)
+ return 2;
+ h();
+ if (b)
+ return 2;
+ h();
+ if (c)
+ return 2;
+ h();
+ return 4;
+}
+
+/* { dg-final { scan-tree-dump-times "New forwarder block for edge" 1 "optimized" } } */
+/* Make sure we only have a PHI with 2 arguments here, 2 and 4. */
+/* { dg-final { scan-tree-dump "PHI <2..., 4...>|PHI <4..., 2...>" "optimized" } } */
+/* Make sure we can shrink wrap the function now too. */
+/* { dg-final { scan-rtl-dump "Performing shrink-wrapping" "pro_and_epilogue" { target { { { i?86-*-* x86_64-*-* } && { ! ia32 } } || { powerpc*-*-* aarch64*-*-* riscv*-*-* arm*-*-* } } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/pr123038.c b/gcc/testsuite/gcc.dg/vect/pr123038.c
new file mode 100644
index 0000000..bca831f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr123038.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+
+unsigned char f(int b)
+{
+ for (int a = 0; a < 10; a += 1)
+ b = __builtin_ffs(b);
+ return b;
+}