aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorSegher Boessenkool <segher@kernel.crashing.org>2015-07-03 16:37:26 +0200
committerSegher Boessenkool <segher@gcc.gnu.org>2015-07-03 16:37:26 +0200
commitab1d746dcedf646029bbbfbb7f85156e8dc63c1e (patch)
treed9bc9e4d6bba935d16a93352112cf875a52ad20b /gcc
parented3caa8c2aceecd0b1e4f0eb06f723f7849f8183 (diff)
downloadgcc-ab1d746dcedf646029bbbfbb7f85156e8dc63c1e.zip
gcc-ab1d746dcedf646029bbbfbb7f85156e8dc63c1e.tar.gz
gcc-ab1d746dcedf646029bbbfbb7f85156e8dc63c1e.tar.bz2
re PR rtl-optimization/66706 (Redundant bitmask instruction on x >> (n & 32))
PR rtl-optimization/66706 * gcc.target/powerpc/shift-int.c: New testcase. From-SVN: r225382
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/shift-int.c23
2 files changed, 28 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 05344971..493b730 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2015-07-03 Segher Boessenkool <segher@kernel.crashing.org>
+
+ PR rtl-optimization/66706
+ * gcc.target/powerpc/shift-int.c: New testcase.
+
2015-07-03 H.J. Lu <hongjiu.lu@intel.com>
PR target/66746.
diff --git a/gcc/testsuite/gcc.target/powerpc/shift-int.c b/gcc/testsuite/gcc.target/powerpc/shift-int.c
new file mode 100644
index 0000000..fe696ea
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/shift-int.c
@@ -0,0 +1,23 @@
+/* Check that shifts do not get unnecessary extends.
+ See PR66706 for a case where this failed. */
+
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+/* Each function should compile to exactly two instructions. */
+/* { dg-final { scan-assembler-times {(?n)^\s+[a-z]} 16 } } */
+/* { dg-final { scan-assembler-times {(?n)^\s+blr} 8 } } */
+
+
+typedef unsigned u;
+typedef signed s;
+
+u rot(u x, u n) { return (x << n) | (x >> (32 - n)); }
+u shl(u x, u n) { return x << n; }
+u shr(u x, u n) { return x >> n; }
+s asr(s x, u n) { return x >> n; }
+
+u roti(u x) { return (x << 23) | (x >> 9); }
+u shli(u x) { return x << 23; }
+u shri(u x) { return x >> 23; }
+s asri(s x) { return x >> 23; }