aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/guality/rotatetest.c
diff options
context:
space:
mode:
authorBen Cheng <bccheng@google.com>2014-03-25 22:37:19 -0700
committerBen Cheng <bccheng@google.com>2014-03-25 22:37:19 -0700
commit1bc5aee63eb72b341f506ad058502cd0361f0d10 (patch)
treec607e8252f3405424ff15bc2d00aa38dadbb2518 /gcc-4.9/gcc/testsuite/gcc.dg/guality/rotatetest.c
parent283a0bf58fcf333c58a2a92c3ebbc41fb9eb1fdb (diff)
downloadtoolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.gz
toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.bz2
toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.zip
Initial checkin of GCC 4.9.0 from trunk (r208799).
Change-Id: I48a3c08bb98542aa215912a75f03c0890e497dba
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gcc.dg/guality/rotatetest.c')
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/guality/rotatetest.c76
1 files changed, 76 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/guality/rotatetest.c b/gcc-4.9/gcc/testsuite/gcc.dg/guality/rotatetest.c
new file mode 100644
index 000000000..64f5340a0
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/guality/rotatetest.c
@@ -0,0 +1,76 @@
+/* { dg-do run { target { x86_64-*-* && lp64 } } } */
+/* { dg-options "-g" } */
+
+volatile int vv;
+
+__attribute__((noclone, noinline)) long
+f1 (unsigned long x)
+{
+ long f = (x << 12) | (x >> (64 - 12));
+ long g = f;
+ asm volatile ("" : "+r" (f));
+ vv++; /* { dg-final { gdb-test 12 "g" "f" } } */
+ return f;
+}
+
+__attribute__((noclone, noinline)) long
+f2 (unsigned long x, int y)
+{
+ long f = (x << y) | (x >> (64 - y));
+ long g = f;
+ asm volatile ("" : "+r" (f));
+ vv++; /* { dg-final { gdb-test 22 "g" "f" } } */
+ return f;
+}
+
+__attribute__((noclone, noinline)) long
+f3 (unsigned long x, int y)
+{
+ long f = (x >> y) | (x << (64 - y));
+ long g = f;
+ asm volatile ("" : "+r" (f));
+ vv++; /* { dg-final { gdb-test 32 "g" "f" } } */
+ return f;
+}
+
+__attribute__((noclone, noinline)) unsigned int
+f4 (unsigned int x)
+{
+ unsigned int f = (x << 12) | (x >> (32 - 12));
+ unsigned int g = f;
+ asm volatile ("" : "+r" (f));
+ vv++; /* { dg-final { gdb-test 42 "g" "f" } } */
+ return f;
+}
+
+__attribute__((noclone, noinline)) unsigned int
+f5 (unsigned int x, int y)
+{
+ unsigned int f = (x << y) | (x >> (32 - y));
+ unsigned int g = f;
+ asm volatile ("" : "+r" (f));
+ vv++; /* { dg-final { gdb-test 52 "g" "f" } } */
+ return f;
+}
+
+__attribute__((noclone, noinline)) unsigned int
+f6 (unsigned int x, int y)
+{
+ unsigned int f = (x >> y) | (x << (32 - y));
+ unsigned int g = f;
+ asm volatile ("" : "+r" (f));
+ vv++; /* { dg-final { gdb-test 62 "g" "f" } } */
+ return f;
+}
+
+int
+main ()
+{
+ f1 (0x123456789abcde0fUL);
+ f2 (0x123456789abcde0fUL, 18);
+ f3 (0x123456789abcde0fUL, 17);
+ f4 (0x12345678);
+ f5 (0x12345678, 18);
+ f6 (0x12345678, 17);
+ return 0;
+}