aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/c-c++-common/rotate-5.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/c-c++-common/rotate-5.c')
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/rotate-5.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/rotate-5.c b/gcc-4.9/gcc/testsuite/c-c++-common/rotate-5.c
new file mode 100644
index 000000000..35b14b86c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/rotate-5.c
@@ -0,0 +1,43 @@
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+extern
+#ifdef __cplusplus
+"C"
+#endif
+void abort (void);
+
+#if __CHAR_BIT__ * __SIZEOF_LONG_LONG__ == 64
+__attribute__((noinline, noclone))
+unsigned long long
+f1 (unsigned long long x, unsigned int y)
+{
+ return (x << y) | (x >> ((-y) & 63));
+}
+
+#if __CHAR_BIT__ * __SIZEOF_INT128__ == 128
+__attribute__((noinline, noclone))
+unsigned __int128
+f2 (unsigned __int128 x, unsigned int y)
+{
+ return (x << y) | (x >> ((-y) & 128));
+}
+#endif
+#endif
+
+int
+main ()
+{
+#if __CHAR_BIT__ * __SIZEOF_LONG_LONG__ == 64
+ if (f1 (0x123456789abcdef0ULL, 0) != 0x123456789abcdef0ULL)
+ abort ();
+#if __CHAR_BIT__ * __SIZEOF_INT128__ == 128
+ if (f2 ((((unsigned __int128) 0x123456789abcdef0ULL) << 64)
+ | 0x0fedcba987654321ULL, 0)
+ != ((((unsigned __int128) 0x123456789abcdef0ULL) << 64)
+ | 0x0fedcba987654321ULL))
+ abort ();
+#endif
+#endif
+ return 0;
+}