summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/shift_mask.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.target/i386/shift_mask.c')
-rw-r--r--gcc/testsuite/gcc.target/i386/shift_mask.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/i386/shift_mask.c b/gcc/testsuite/gcc.target/i386/shift_mask.c
new file mode 100644
index 000000000..29c84bd1d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/shift_mask.c
@@ -0,0 +1,31 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int test_sal (int a, int c)
+{
+ return a << (c & 0x1f);
+}
+
+int test_sar (int a, int c)
+{
+ return a >> (c & 0x1f);
+}
+
+unsigned int test_shr (unsigned int a, int c)
+{
+ return a >> (c & 0x1f);
+}
+
+unsigned int test_rol (unsigned int a, int c)
+{
+ int z = c & 0x1f;
+ return (a << z) | (a >> (32 - z));
+}
+
+unsigned int test_ror (unsigned int a, int c)
+{
+ int z = c & 0x1f;
+ return (a >> z) | (a << (32 - z));
+}
+
+/* { dg-final { scan-assembler-not "and" } } */