aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2020-12-04 18:44:31 +0100
committerJakub Jelinek <jakub@redhat.com>2020-12-04 18:44:31 +0100
commitac2a6962b91128e700ee52db686dcdb2bab93790 (patch)
treecf15a76a7c3fff60cad9088ca46693240a9ad595 /gcc/testsuite
parent33be07be9e46f15b9556521050356c47460651ee (diff)
downloadgcc-ac2a6962b91128e700ee52db686dcdb2bab93790.zip
gcc-ac2a6962b91128e700ee52db686dcdb2bab93790.tar.gz
gcc-ac2a6962b91128e700ee52db686dcdb2bab93790.tar.bz2
i386: Add combine splitters to allow combining multiple insns into reg1 = const; reg2 = rotate (reg1, reg3 & cst) [PR96226]
As mentioned in the PR, we can combine ~(1 << x) into -2 r<< x, but we give up in the ~(1 << (x & 31)) cases, as *<rotate_insn><mode>3_mask* don't allow immediate operand 1 and find_split_point prefers to split (x & 31) instead of the constant. With these combine splitters we help combine decide how to split those insns. 2020-12-04 Jakub Jelinek <jakub@redhat.com> PR target/96226 * config/i386/i386.md (splitter after *<rotate_insn><mode>3_mask, splitter after *<rotate_insn><mode>3_mask_1): New combine splitters. * gcc.target/i386/pr96226.c: New test.
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/gcc.target/i386/pr96226.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/i386/pr96226.c b/gcc/testsuite/gcc.target/i386/pr96226.c
new file mode 100644
index 0000000..cc010fa
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr96226.c
@@ -0,0 +1,16 @@
+/* PR target/96226 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-times "\troll\t" 4 } } */
+/* { dg-final { scan-assembler-times "\trolq\t" 4 { target { ! ia32 } } } } */
+
+int f1 (int x) { return ~(1U << (x & 0x1f)); }
+int f2 (int x) { return ~(1U << x); }
+int f3 (unsigned char *x) { return ~(1U << (x[0] & 0x1f)); }
+int f4 (unsigned char *x) { return ~(1U << x[0]); }
+#ifdef __x86_64__
+long int f5 (int x) { return ~(1ULL << (x & 0x3f)); }
+long int f6 (int x) { return ~(1ULL << x); }
+long int f7 (unsigned char *x) { return ~(1ULL << (x[0] & 0x3f)); }
+long int f8 (unsigned char *x) { return ~(1ULL << x[0]); }
+#endif