aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2023-05-09 12:14:18 +0200
committerJakub Jelinek <jakub@redhat.com>2023-05-09 12:19:16 +0200
commitc2cf2dc988eb93551fa1c01d3f8d73ef21f39dc5 (patch)
tree189adebe5ee198c7dab1f92bec611d1b0890a658 /gcc
parenta8302d2a4669984c7c287d12ef5b37cde6699c80 (diff)
downloadgcc-c2cf2dc988eb93551fa1c01d3f8d73ef21f39dc5.zip
gcc-c2cf2dc988eb93551fa1c01d3f8d73ef21f39dc5.tar.gz
gcc-c2cf2dc988eb93551fa1c01d3f8d73ef21f39dc5.tar.bz2
testsuite: Add further testcase for already fixed PR [PR109778]
I came up with a testcase which reproduces all the way to r10-7469. LTO to avoid early inlining it, so that ccp handles rotates and not shifts before they are turned into rotates. 2023-05-09 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/109778 * gcc.dg/lto/pr109778_0.c: New test. * gcc.dg/lto/pr109778_1.c: New file.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/gcc.dg/lto/pr109778_0.c22
-rw-r--r--gcc/testsuite/gcc.dg/lto/pr109778_1.c7
2 files changed, 29 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/lto/pr109778_0.c b/gcc/testsuite/gcc.dg/lto/pr109778_0.c
new file mode 100644
index 0000000..3c6e1b8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/pr109778_0.c
@@ -0,0 +1,22 @@
+/* PR tree-optimization/109778 */
+/* { dg-lto-do run } */
+/* { dg-lto-options { "-O2 -flto" } } */
+/* { dg-require-effective-target int32 } */
+
+int bar (int);
+
+__attribute__((noipa)) int
+foo (int x)
+{
+ x = bar (x);
+ x = (x << 16) | (int) ((unsigned) x >> 16);
+ return x & 0x10000000;
+}
+
+int
+main ()
+{
+ if (foo (0) || foo (-1))
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/lto/pr109778_1.c b/gcc/testsuite/gcc.dg/lto/pr109778_1.c
new file mode 100644
index 0000000..d18a720
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/pr109778_1.c
@@ -0,0 +1,7 @@
+int
+bar (int x)
+{
+ x &= 0x22222222;
+ x |= (int) 0xf1234567U;
+ return x;
+}