diff options
author | Jakub Jelinek <jakub@redhat.com> | 2013-05-10 10:40:10 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2013-05-10 10:40:10 +0200 |
commit | cb3b8d33faa3a649b02827649f9c76e40edace15 (patch) | |
tree | 48fdd5402146ff7985941320929c5cda2e1a1c90 /gcc/testsuite/c-c++-common | |
parent | fb7f649d713491d28fd41f3ce12e474af03617df (diff) | |
download | gcc-cb3b8d33faa3a649b02827649f9c76e40edace15.zip gcc-cb3b8d33faa3a649b02827649f9c76e40edace15.tar.gz gcc-cb3b8d33faa3a649b02827649f9c76e40edace15.tar.bz2 |
re PR tree-optimization/45216 (Rotate expressions not recognized at tree level)
PR tree-optimization/45216
PR tree-optimization/57157
* tree-ssa-forwprop.c (simplify_rotate): New function.
(ssa_forward_propagate_and_combine): Call it.
* c-c++-common/rotate-1.c: New test.
* c-c++-common/rotate-1a.c: New test.
* c-c++-common/rotate-2.c: New test.
* c-c++-common/rotate-2a.c: New test.
* c-c++-common/rotate-3.c: New test.
* c-c++-common/rotate-3a.c: New test.
* c-c++-common/rotate-4.c: New test.
* c-c++-common/rotate-4a.c: New test.
From-SVN: r198769
Diffstat (limited to 'gcc/testsuite/c-c++-common')
-rw-r--r-- | gcc/testsuite/c-c++-common/rotate-1.c | 389 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/rotate-1a.c | 44 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/rotate-2.c | 389 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/rotate-2a.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/rotate-3.c | 389 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/rotate-3a.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/rotate-4.c | 389 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/rotate-4a.c | 6 |
8 files changed, 1618 insertions, 0 deletions
diff --git a/gcc/testsuite/c-c++-common/rotate-1.c b/gcc/testsuite/c-c++-common/rotate-1.c new file mode 100644 index 0000000..ec3e90b --- /dev/null +++ b/gcc/testsuite/c-c++-common/rotate-1.c @@ -0,0 +1,389 @@ +/* Check rotate pattern detection. */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ +/* { dg-final { scan-tree-dump-times "r\[<>]\[<>]" 64 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ + +unsigned int +f1 (unsigned int x, unsigned int y) +{ + return (x << y) | (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - y)); +} + +unsigned int +f2 (unsigned int x, unsigned long int y) +{ + return (x << y) | (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - y)); +} + +unsigned int +f3 (unsigned int x, int y __attribute__((unused))) +{ + return (x << 1) | (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - 1)); +} + +unsigned int +f4 (unsigned int x, int y __attribute__((unused))) +{ + return (x << (__CHAR_BIT__ * __SIZEOF_INT__ - 1)) | (x >> 1); +} + +unsigned short int +f5 (unsigned short int x, unsigned int y) +{ + return (x << y) | (x >> (__CHAR_BIT__ * __SIZEOF_SHORT__ - y)); +} + +unsigned short int +f6 (unsigned short int x, unsigned long int y) +{ + return (x << y) | (x >> (__CHAR_BIT__ * __SIZEOF_SHORT__ - y)); +} + +unsigned char +f7 (unsigned char x, unsigned int y) +{ + return (x << y) | (x >> (__CHAR_BIT__ - y)); +} + +unsigned char +f8 (unsigned char x, unsigned long int y) +{ + return (x << y) | (x >> (__CHAR_BIT__ - y)); +} + +unsigned int +f9 (unsigned int x, unsigned int y) +{ + return (x << y) | (x >> (__CHAR_BIT__ * sizeof (unsigned int) - y)); +} + +unsigned int +f10 (unsigned int x, unsigned long int y) +{ + return (x << y) | (x >> (__CHAR_BIT__ * sizeof (unsigned int) - y)); +} + +unsigned int +f11 (unsigned int x, int y __attribute__((unused))) +{ + return (x << 1) | (x >> (__CHAR_BIT__ * sizeof (unsigned int) - 1)); +} + +unsigned int +f12 (unsigned int x, int y __attribute__((unused))) +{ + return (x << (__CHAR_BIT__ * sizeof (unsigned int) - 1)) | (x >> 1); +} + +unsigned short int +f13 (unsigned short int x, unsigned int y) +{ + return (x << y) | (x >> (__CHAR_BIT__ * sizeof (unsigned short) - y)); +} + +unsigned short int +f14 (unsigned short int x, unsigned long int y) +{ + return (x << y) | (x >> (__CHAR_BIT__ * sizeof (unsigned short) - y)); +} + +unsigned char +f15 (unsigned char x, unsigned int y) +{ + return (x << y) | (x >> (__CHAR_BIT__ * sizeof (unsigned char) - y)); +} + +unsigned char +f16 (unsigned char x, unsigned long int y) +{ + return (x << y) | (x >> (__CHAR_BIT__ * sizeof (unsigned char) - y)); +} + +unsigned int +f17 (unsigned int x, unsigned int y) +{ + return (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - y)) ^ (x << y); +} + +unsigned int +f18 (unsigned int x, unsigned long int y) +{ + return (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - y)) ^ (x << y); +} + +unsigned int +f19 (unsigned int x, int y __attribute__((unused))) +{ + return (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - 1)) ^ (x << 1); +} + +unsigned int +f20 (unsigned int x, int y __attribute__((unused))) +{ + return (x >> 1) ^ (x << (__CHAR_BIT__ * __SIZEOF_INT__ - 1)); +} + +unsigned short int +f21 (unsigned short int x, unsigned int y) +{ + return (x >> (__CHAR_BIT__ * __SIZEOF_SHORT__ - y)) ^ (x << y); +} + +unsigned short int +f22 (unsigned short int x, unsigned long int y) +{ + return (x >> (__CHAR_BIT__ * __SIZEOF_SHORT__ - y)) ^ (x << y); +} + +unsigned char +f23 (unsigned char x, unsigned int y) +{ + return (x >> (__CHAR_BIT__ - y)) ^ (x << y); +} + +unsigned char +f24 (unsigned char x, unsigned long int y) +{ + return (x >> (__CHAR_BIT__ - y)) ^ (x << y); +} + +unsigned int +f25 (unsigned int x, unsigned int y) +{ + return (x >> (__CHAR_BIT__ * sizeof (unsigned int) - y)) ^ (x << y); +} + +unsigned int +f26 (unsigned int x, unsigned long int y) +{ + return (x >> (__CHAR_BIT__ * sizeof (unsigned int) - y)) ^ (x << y); +} + +unsigned int +f27 (unsigned int x, int y __attribute__((unused))) +{ + return (x >> (__CHAR_BIT__ * sizeof (unsigned int) - 1)) ^ (x << 1); +} + +unsigned int +f28 (unsigned int x, int y __attribute__((unused))) +{ + return (x >> 1) ^ (x << (__CHAR_BIT__ * sizeof (unsigned int) - 1)); +} + +unsigned short int +f29 (unsigned short int x, unsigned int y) +{ + return (x >> (__CHAR_BIT__ * sizeof (unsigned short) - y)) ^ (x << y); +} + +unsigned short int +f30 (unsigned short int x, unsigned long int y) +{ + return (x >> (__CHAR_BIT__ * sizeof (unsigned short) - y)) ^ (x << y); +} + +unsigned char +f31 (unsigned char x, unsigned int y) +{ + return (x >> (__CHAR_BIT__ * sizeof (unsigned char) - y)) ^ (x << y); +} + +unsigned char +f32 (unsigned char x, unsigned long int y) +{ + return (x >> (__CHAR_BIT__ * sizeof (unsigned char) - y)) ^ (x << y); +} + +unsigned int +f33 (unsigned int x, unsigned int y) +{ + return (x >> y) | (x << (__CHAR_BIT__ * __SIZEOF_INT__ - y)); +} + +unsigned int +f34 (unsigned int x, unsigned long int y) +{ + return (x >> y) | (x << (__CHAR_BIT__ * __SIZEOF_INT__ - y)); +} + +unsigned int +f35 (unsigned int x, int y __attribute__((unused))) +{ + return (x >> 1) | (x << (__CHAR_BIT__ * __SIZEOF_INT__ - 1)); +} + +unsigned int +f36 (unsigned int x, int y __attribute__((unused))) +{ + return (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - 1)) | (x << 1); +} + +unsigned short int +f37 (unsigned short int x, unsigned int y) +{ + return (x >> y) | (x << (__CHAR_BIT__ * __SIZEOF_SHORT__ - y)); +} + +unsigned short int +f38 (unsigned short int x, unsigned long int y) +{ + return (x >> y) | (x << (__CHAR_BIT__ * __SIZEOF_SHORT__ - y)); +} + +unsigned char +f39 (unsigned char x, unsigned int y) +{ + return (x >> y) | (x << (__CHAR_BIT__ - y)); +} + +unsigned char +f40 (unsigned char x, unsigned long int y) +{ + return (x >> y) | (x << (__CHAR_BIT__ - y)); +} + +unsigned int +f41 (unsigned int x, unsigned int y) +{ + return (x >> y) | (x << (__CHAR_BIT__ * sizeof (unsigned int) - y)); +} + +unsigned int +f42 (unsigned int x, unsigned long int y) +{ + return (x >> y) | (x << (__CHAR_BIT__ * sizeof (unsigned int) - y)); +} + +unsigned int +f43 (unsigned int x, int y __attribute__((unused))) +{ + return (x >> 1) | (x << (__CHAR_BIT__ * sizeof (unsigned int) - 1)); +} + +unsigned int +f44 (unsigned int x, int y __attribute__((unused))) +{ + return (x >> (__CHAR_BIT__ * sizeof (unsigned int) - 1)) | (x << 1); +} + +unsigned short int +f45 (unsigned short int x, unsigned int y) +{ + return (x >> y) | (x << (__CHAR_BIT__ * sizeof (unsigned short) - y)); +} + +unsigned short int +f46 (unsigned short int x, unsigned long int y) +{ + return (x >> y) | (x << (__CHAR_BIT__ * sizeof (unsigned short) - y)); +} + +unsigned char +f47 (unsigned char x, unsigned int y) +{ + return (x >> y) | (x << (__CHAR_BIT__ * sizeof (unsigned char) - y)); +} + +unsigned char +f48 (unsigned char x, unsigned long int y) +{ + return (x >> y) | (x << (__CHAR_BIT__ * sizeof (unsigned char) - y)); +} + +unsigned int +f49 (unsigned int x, unsigned int y) +{ + return (x << (__CHAR_BIT__ * __SIZEOF_INT__ - y)) ^ (x >> y); +} + +unsigned int +f50 (unsigned int x, unsigned long int y) +{ + return (x << (__CHAR_BIT__ * __SIZEOF_INT__ - y)) ^ (x >> y); +} + +unsigned int +f51 (unsigned int x, int y __attribute__((unused))) +{ + return (x << (__CHAR_BIT__ * __SIZEOF_INT__ - 1)) ^ (x >> 1); +} + +unsigned int +f52 (unsigned int x, int y __attribute__((unused))) +{ + return (x << 1) ^ (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - 1)); +} + +unsigned short int +f53 (unsigned short int x, unsigned int y) +{ + return (x << (__CHAR_BIT__ * __SIZEOF_SHORT__ - y)) ^ (x >> y); +} + +unsigned short int +f54 (unsigned short int x, unsigned long int y) +{ + return (x << (__CHAR_BIT__ * __SIZEOF_SHORT__ - y)) ^ (x >> y); +} + +unsigned char +f55 (unsigned char x, unsigned int y) +{ + return (x << (__CHAR_BIT__ - y)) ^ (x >> y); +} + +unsigned char +f56 (unsigned char x, unsigned long int y) +{ + return (x << (__CHAR_BIT__ - y)) ^ (x >> y); +} + +unsigned int +f57 (unsigned int x, unsigned int y) +{ + return (x << (__CHAR_BIT__ * sizeof (unsigned int) - y)) ^ (x >> y); +} + +unsigned int +f58 (unsigned int x, unsigned long int y) +{ + return (x << (__CHAR_BIT__ * sizeof (unsigned int) - y)) ^ (x >> y); +} + +unsigned int +f59 (unsigned int x, int y __attribute__((unused))) +{ + return (x << (__CHAR_BIT__ * sizeof (unsigned int) - 1)) ^ (x >> 1); +} + +unsigned int +f60 (unsigned int x, int y __attribute__((unused))) +{ + return (x << 1) ^ (x >> (__CHAR_BIT__ * sizeof (unsigned int) - 1)); +} + +unsigned short int +f61 (unsigned short int x, unsigned int y) +{ + return (x << (__CHAR_BIT__ * sizeof (unsigned short) - y)) ^ (x >> y); +} + +unsigned short int +f62 (unsigned short int x, unsigned long int y) +{ + return (x << (__CHAR_BIT__ * sizeof (unsigned short) - y)) ^ (x >> y); +} + +unsigned char +f63 (unsigned char x, unsigned int y) +{ + return (x << (__CHAR_BIT__ * sizeof (unsigned char) - y)) ^ (x >> y); +} + +unsigned char +f64 (unsigned char x, unsigned long int y) +{ + return (x << (__CHAR_BIT__ * sizeof (unsigned char) - y)) ^ (x >> y); +} diff --git a/gcc/testsuite/c-c++-common/rotate-1a.c b/gcc/testsuite/c-c++-common/rotate-1a.c new file mode 100644 index 0000000..fc838a8 --- /dev/null +++ b/gcc/testsuite/c-c++-common/rotate-1a.c @@ -0,0 +1,44 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -Wno-overflow" } */ + +extern +#ifdef __cplusplus +"C" +#endif +void abort (void); + +#ifndef ROTATE_N +#define ROTATE_N "rotate-1.c" +#endif + +#include ROTATE_N + +unsigned int expected[] = { +0x91a2b3c0, 0x91a2b3c0, 0x2468acf0, 0x91a2b3c, 0xb3c2, 0xb3c2, 0xc3, 0xc3, +0x91a2b3c0, 0x91a2b3c0, 0x2468acf0, 0x91a2b3c, 0xb3c2, 0xb3c2, 0xc3, 0xc3, +0x91a2b3c0, 0x91a2b3c0, 0x2468acf0, 0x91a2b3c, 0xb3c2, 0xb3c2, 0xc3, 0xc3, +0x91a2b3c0, 0x91a2b3c0, 0x2468acf0, 0x91a2b3c, 0xb3c2, 0xb3c2, 0xc3, 0xc3, +0x2468acf, 0x2468acf, 0x91a2b3c, 0x2468acf0, 0xacf, 0xacf, 0xf, 0xf, +0x2468acf, 0x2468acf, 0x91a2b3c, 0x2468acf0, 0xacf, 0xacf, 0xf, 0xf, +0x2468acf, 0x2468acf, 0x91a2b3c, 0x2468acf0, 0xacf, 0xacf, 0xf, 0xf, +0x2468acf, 0x2468acf, 0x91a2b3c, 0x2468acf0, 0xacf, 0xacf, 0xf, 0xf }; + +#define F(n) __typeof (f##n) f##n __attribute__((noinline, noclone)); +#define D(n) F(n##0) F(n##1) F(n##2) F(n##3) F(n##4) F(n##5) F(n##6) F(n##7) F(n##8) F(n##9) +#define ALL \ +F(1) F(2) F(3) F(4) F(5) F(6) F(7) F(8) F(9) \ +D(1) D(2) D(3) D(4) D(5) F(60) F(61) F(62) F(63) F(64) +ALL + +int +main () +{ +#if __CHAR_BIT__ != 8 || __SIZEOF_SHORT__ != 2 || __SIZEOF_INT__ != 4 + return 0; +#else +#undef F +#define F(n) if ((unsigned int) f##n (0x12345678U, 3) != expected[n - 1]) abort (); + ALL + return 0; +#endif +} diff --git a/gcc/testsuite/c-c++-common/rotate-2.c b/gcc/testsuite/c-c++-common/rotate-2.c new file mode 100644 index 0000000..d853866 --- /dev/null +++ b/gcc/testsuite/c-c++-common/rotate-2.c @@ -0,0 +1,389 @@ +/* Check rotate pattern detection. */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ +/* { dg-final { scan-tree-dump-times "r\[<>]\[<>]" 64 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ + +unsigned int +f1 (unsigned int x, unsigned int y) +{ + return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))); +} + +unsigned int +f2 (unsigned int x, unsigned long int y) +{ + return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))); +} + +unsigned int +f3 (unsigned int x, int y __attribute__((unused))) +{ + return (x << 1) | (x >> ((-1) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))); +} + +unsigned int +f4 (unsigned int x, int y __attribute__((unused))) +{ + return (x << ((-1) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))) | (x >> 1); +} + +unsigned short int +f5 (unsigned short int x, unsigned int y) +{ + return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1))); +} + +unsigned short int +f6 (unsigned short int x, unsigned long int y) +{ + return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1))); +} + +unsigned char +f7 (unsigned char x, unsigned int y) +{ + return (x << y) | (x >> ((-y) & (__CHAR_BIT__ - 1))); +} + +unsigned char +f8 (unsigned char x, unsigned long int y) +{ + return (x << y) | (x >> ((-y) & (__CHAR_BIT__ - 1))); +} + +unsigned int +f9 (unsigned int x, unsigned int y) +{ + return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))); +} + +unsigned int +f10 (unsigned int x, unsigned long int y) +{ + return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))); +} + +unsigned int +f11 (unsigned int x, int y __attribute__((unused))) +{ + return (x << 1) | (x >> ((-1) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))); +} + +unsigned int +f12 (unsigned int x, int y __attribute__((unused))) +{ + return (x << ((-1) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))) | (x >> 1); +} + +unsigned short int +f13 (unsigned short int x, unsigned int y) +{ + return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1))); +} + +unsigned short int +f14 (unsigned short int x, unsigned long int y) +{ + return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1))); +} + +unsigned char +f15 (unsigned char x, unsigned int y) +{ + return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1))); +} + +unsigned char +f16 (unsigned char x, unsigned long int y) +{ + return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1))); +} + +unsigned int +f17 (unsigned int x, unsigned int y) +{ + return (x >> ((-y) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))) ^ (x << y); +} + +unsigned int +f18 (unsigned int x, unsigned long int y) +{ + return (x >> ((-y) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))) ^ (x << y); +} + +unsigned int +f19 (unsigned int x, int y __attribute__((unused))) +{ + return (x >> ((-1) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))) ^ (x << 1); +} + +unsigned int +f20 (unsigned int x, int y __attribute__((unused))) +{ + return (x >> 1) ^ (x << ((-1) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))); +} + +unsigned short int +f21 (unsigned short int x, unsigned int y) +{ + return (x >> ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1))) ^ (x << y); +} + +unsigned short int +f22 (unsigned short int x, unsigned long int y) +{ + return (x >> ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1))) ^ (x << y); +} + +unsigned char +f23 (unsigned char x, unsigned int y) +{ + return (x >> ((-y) & (__CHAR_BIT__ - 1))) ^ (x << y); +} + +unsigned char +f24 (unsigned char x, unsigned long int y) +{ + return (x >> ((-y) & (__CHAR_BIT__ - 1))) ^ (x << y); +} + +unsigned int +f25 (unsigned int x, unsigned int y) +{ + return (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))) ^ (x << y); +} + +unsigned int +f26 (unsigned int x, unsigned long int y) +{ + return (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))) ^ (x << y); +} + +unsigned int +f27 (unsigned int x, int y __attribute__((unused))) +{ + return (x >> ((-1) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))) ^ (x << 1); +} + +unsigned int +f28 (unsigned int x, int y __attribute__((unused))) +{ + return (x >> 1) ^ (x << ((-1) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))); +} + +unsigned short int +f29 (unsigned short int x, unsigned int y) +{ + return (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1))) ^ (x << y); +} + +unsigned short int +f30 (unsigned short int x, unsigned long int y) +{ + return (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1))) ^ (x << y); +} + +unsigned char +f31 (unsigned char x, unsigned int y) +{ + return (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1))) ^ (x << y); +} + +unsigned char +f32 (unsigned char x, unsigned long int y) +{ + return (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1))) ^ (x << y); +} + +unsigned int +f33 (unsigned int x, unsigned int y) +{ + return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))); +} + +unsigned int +f34 (unsigned int x, unsigned long int y) +{ + return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))); +} + +unsigned int +f35 (unsigned int x, int y __attribute__((unused))) +{ + return (x >> 1) | (x << ((-1) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))); +} + +unsigned int +f36 (unsigned int x, int y __attribute__((unused))) +{ + return (x >> ((-1) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))) | (x << 1); +} + +unsigned short int +f37 (unsigned short int x, unsigned int y) +{ + return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1))); +} + +unsigned short int +f38 (unsigned short int x, unsigned long int y) +{ + return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1))); +} + +unsigned char +f39 (unsigned char x, unsigned int y) +{ + return (x >> y) | (x << ((-y) & (__CHAR_BIT__ - 1))); +} + +unsigned char +f40 (unsigned char x, unsigned long int y) +{ + return (x >> y) | (x << ((-y) & (__CHAR_BIT__ - 1))); +} + +unsigned int +f41 (unsigned int x, unsigned int y) +{ + return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))); +} + +unsigned int +f42 (unsigned int x, unsigned long int y) +{ + return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))); +} + +unsigned int +f43 (unsigned int x, int y __attribute__((unused))) +{ + return (x >> 1) | (x << ((-1) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))); +} + +unsigned int +f44 (unsigned int x, int y __attribute__((unused))) +{ + return (x >> ((-1) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))) | (x << 1); +} + +unsigned short int +f45 (unsigned short int x, unsigned int y) +{ + return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1))); +} + +unsigned short int +f46 (unsigned short int x, unsigned long int y) +{ + return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1))); +} + +unsigned char +f47 (unsigned char x, unsigned int y) +{ + return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1))); +} + +unsigned char +f48 (unsigned char x, unsigned long int y) +{ + return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1))); +} + +unsigned int +f49 (unsigned int x, unsigned int y) +{ + return (x << ((-y) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))) ^ (x >> y); +} + +unsigned int +f50 (unsigned int x, unsigned long int y) +{ + return (x << ((-y) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))) ^ (x >> y); +} + +unsigned int +f51 (unsigned int x, int y __attribute__((unused))) +{ + return (x << ((-1) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))) ^ (x >> 1); +} + +unsigned int +f52 (unsigned int x, int y __attribute__((unused))) +{ + return (x << 1) ^ (x >> ((-1) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))); +} + +unsigned short int +f53 (unsigned short int x, unsigned int y) +{ + return (x << ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1))) ^ (x >> y); +} + +unsigned short int +f54 (unsigned short int x, unsigned long int y) +{ + return (x << ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1))) ^ (x >> y); +} + +unsigned char +f55 (unsigned char x, unsigned int y) +{ + return (x << ((-y) & (__CHAR_BIT__ - 1))) ^ (x >> y); +} + +unsigned char +f56 (unsigned char x, unsigned long int y) +{ + return (x << ((-y) & (__CHAR_BIT__ - 1))) ^ (x >> y); +} + +unsigned int +f57 (unsigned int x, unsigned int y) +{ + return (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))) ^ (x >> y); +} + +unsigned int +f58 (unsigned int x, unsigned long int y) +{ + return (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))) ^ (x >> y); +} + +unsigned int +f59 (unsigned int x, int y __attribute__((unused))) +{ + return (x << ((-1) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))) ^ (x >> 1); +} + +unsigned int +f60 (unsigned int x, int y __attribute__((unused))) +{ + return (x << 1) ^ (x >> ((-1) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))); +} + +unsigned short int +f61 (unsigned short int x, unsigned int y) +{ + return (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1))) ^ (x >> y); +} + +unsigned short int +f62 (unsigned short int x, unsigned long int y) +{ + return (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1))) ^ (x >> y); +} + +unsigned char +f63 (unsigned char x, unsigned int y) +{ + return (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1))) ^ (x >> y); +} + +unsigned char +f64 (unsigned char x, unsigned long int y) +{ + return (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1))) ^ (x >> y); +} diff --git a/gcc/testsuite/c-c++-common/rotate-2a.c b/gcc/testsuite/c-c++-common/rotate-2a.c new file mode 100644 index 0000000..d709c0d --- /dev/null +++ b/gcc/testsuite/c-c++-common/rotate-2a.c @@ -0,0 +1,6 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -Wno-overflow" } */ + +#define ROTATE_N "rotate-2.c" + +#include "rotate-1a.c" diff --git a/gcc/testsuite/c-c++-common/rotate-3.c b/gcc/testsuite/c-c++-common/rotate-3.c new file mode 100644 index 0000000..a7d138f --- /dev/null +++ b/gcc/testsuite/c-c++-common/rotate-3.c @@ -0,0 +1,389 @@ +/* Check rotate pattern detection. */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ +/* { dg-final { scan-tree-dump-times "r\[<>]\[<>]" 64 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ + +unsigned int +f1 (unsigned int x, int y) +{ + return (x << y) | (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - y)); +} + +unsigned int +f2 (unsigned int x, long int y) +{ + return (x << y) | (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - y)); +} + +unsigned int +f3 (unsigned int x, int y __attribute__((unused))) +{ + return (x << 1) | (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - 1)); +} + +unsigned int +f4 (unsigned int x, int y __attribute__((unused))) +{ + return (x << (__CHAR_BIT__ * __SIZEOF_INT__ - 1)) | (x >> 1); +} + +unsigned short int +f5 (unsigned short int x, int y) +{ + return (x << y) | (x >> (__CHAR_BIT__ * __SIZEOF_SHORT__ - y)); +} + +unsigned short int +f6 (unsigned short int x, long int y) +{ + return (x << y) | (x >> (__CHAR_BIT__ * __SIZEOF_SHORT__ - y)); +} + +unsigned char +f7 (unsigned char x, int y) +{ + return (x << y) | (x >> (__CHAR_BIT__ - y)); +} + +unsigned char +f8 (unsigned char x, long int y) +{ + return (x << y) | (x >> (__CHAR_BIT__ - y)); +} + +unsigned int +f9 (unsigned int x, int y) +{ + return (x << y) | (x >> (__CHAR_BIT__ * sizeof (unsigned int) - y)); +} + +unsigned int +f10 (unsigned int x, long int y) +{ + return (x << y) | (x >> (__CHAR_BIT__ * sizeof (unsigned int) - y)); +} + +unsigned int +f11 (unsigned int x, int y __attribute__((unused))) +{ + return (x << 1) | (x >> (__CHAR_BIT__ * sizeof (unsigned int) - 1)); +} + +unsigned int +f12 (unsigned int x, int y __attribute__((unused))) +{ + return (x << (__CHAR_BIT__ * sizeof (unsigned int) - 1)) | (x >> 1); +} + +unsigned short int +f13 (unsigned short int x, int y) +{ + return (x << y) | (x >> (__CHAR_BIT__ * sizeof (unsigned short) - y)); +} + +unsigned short int +f14 (unsigned short int x, long int y) +{ + return (x << y) | (x >> (__CHAR_BIT__ * sizeof (unsigned short) - y)); +} + +unsigned char +f15 (unsigned char x, int y) +{ + return (x << y) | (x >> (__CHAR_BIT__ * sizeof (unsigned char) - y)); +} + +unsigned char +f16 (unsigned char x, long int y) +{ + return (x << y) | (x >> (__CHAR_BIT__ * sizeof (unsigned char) - y)); +} + +unsigned int +f17 (unsigned int x, int y) +{ + return (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - y)) ^ (x << y); +} + +unsigned int +f18 (unsigned int x, long int y) +{ + return (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - y)) ^ (x << y); +} + +unsigned int +f19 (unsigned int x, int y __attribute__((unused))) +{ + return (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - 1)) ^ (x << 1); +} + +unsigned int +f20 (unsigned int x, int y __attribute__((unused))) +{ + return (x >> 1) ^ (x << (__CHAR_BIT__ * __SIZEOF_INT__ - 1)); +} + +unsigned short int +f21 (unsigned short int x, int y) +{ + return (x >> (__CHAR_BIT__ * __SIZEOF_SHORT__ - y)) ^ (x << y); +} + +unsigned short int +f22 (unsigned short int x, long int y) +{ + return (x >> (__CHAR_BIT__ * __SIZEOF_SHORT__ - y)) ^ (x << y); +} + +unsigned char +f23 (unsigned char x, int y) +{ + return (x >> (__CHAR_BIT__ - y)) ^ (x << y); +} + +unsigned char +f24 (unsigned char x, long int y) +{ + return (x >> (__CHAR_BIT__ - y)) ^ (x << y); +} + +unsigned int +f25 (unsigned int x, int y) +{ + return (x >> (__CHAR_BIT__ * sizeof (unsigned int) - y)) ^ (x << y); +} + +unsigned int +f26 (unsigned int x, long int y) +{ + return (x >> (__CHAR_BIT__ * sizeof (unsigned int) - y)) ^ (x << y); +} + +unsigned int +f27 (unsigned int x, int y __attribute__((unused))) +{ + return (x >> (__CHAR_BIT__ * sizeof (unsigned int) - 1)) ^ (x << 1); +} + +unsigned int +f28 (unsigned int x, int y __attribute__((unused))) +{ + return (x >> 1) ^ (x << (__CHAR_BIT__ * sizeof (unsigned int) - 1)); +} + +unsigned short int +f29 (unsigned short int x, int y) +{ + return (x >> (__CHAR_BIT__ * sizeof (unsigned short) - y)) ^ (x << y); +} + +unsigned short int +f30 (unsigned short int x, long int y) +{ + return (x >> (__CHAR_BIT__ * sizeof (unsigned short) - y)) ^ (x << y); +} + +unsigned char +f31 (unsigned char x, int y) +{ + return (x >> (__CHAR_BIT__ * sizeof (unsigned char) - y)) ^ (x << y); +} + +unsigned char +f32 (unsigned char x, long int y) +{ + return (x >> (__CHAR_BIT__ * sizeof (unsigned char) - y)) ^ (x << y); +} + +unsigned int +f33 (unsigned int x, int y) +{ + return (x >> y) | (x << (__CHAR_BIT__ * __SIZEOF_INT__ - y)); +} + +unsigned int +f34 (unsigned int x, long int y) +{ + return (x >> y) | (x << (__CHAR_BIT__ * __SIZEOF_INT__ - y)); +} + +unsigned int +f35 (unsigned int x, int y __attribute__((unused))) +{ + return (x >> 1) | (x << (__CHAR_BIT__ * __SIZEOF_INT__ - 1)); +} + +unsigned int +f36 (unsigned int x, int y __attribute__((unused))) +{ + return (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - 1)) | (x << 1); +} + +unsigned short int +f37 (unsigned short int x, int y) +{ + return (x >> y) | (x << (__CHAR_BIT__ * __SIZEOF_SHORT__ - y)); +} + +unsigned short int +f38 (unsigned short int x, long int y) +{ + return (x >> y) | (x << (__CHAR_BIT__ * __SIZEOF_SHORT__ - y)); +} + +unsigned char +f39 (unsigned char x, int y) +{ + return (x >> y) | (x << (__CHAR_BIT__ - y)); +} + +unsigned char +f40 (unsigned char x, long int y) +{ + return (x >> y) | (x << (__CHAR_BIT__ - y)); +} + +unsigned int +f41 (unsigned int x, int y) +{ + return (x >> y) | (x << (__CHAR_BIT__ * sizeof (unsigned int) - y)); +} + +unsigned int +f42 (unsigned int x, long int y) +{ + return (x >> y) | (x << (__CHAR_BIT__ * sizeof (unsigned int) - y)); +} + +unsigned int +f43 (unsigned int x, int y __attribute__((unused))) +{ + return (x >> 1) | (x << (__CHAR_BIT__ * sizeof (unsigned int) - 1)); +} + +unsigned int +f44 (unsigned int x, int y __attribute__((unused))) +{ + return (x >> (__CHAR_BIT__ * sizeof (unsigned int) - 1)) | (x << 1); +} + +unsigned short int +f45 (unsigned short int x, int y) +{ + return (x >> y) | (x << (__CHAR_BIT__ * sizeof (unsigned short) - y)); +} + +unsigned short int +f46 (unsigned short int x, long int y) +{ + return (x >> y) | (x << (__CHAR_BIT__ * sizeof (unsigned short) - y)); +} + +unsigned char +f47 (unsigned char x, int y) +{ + return (x >> y) | (x << (__CHAR_BIT__ * sizeof (unsigned char) - y)); +} + +unsigned char +f48 (unsigned char x, long int y) +{ + return (x >> y) | (x << (__CHAR_BIT__ * sizeof (unsigned char) - y)); +} + +unsigned int +f49 (unsigned int x, int y) +{ + return (x << (__CHAR_BIT__ * __SIZEOF_INT__ - y)) ^ (x >> y); +} + +unsigned int +f50 (unsigned int x, long int y) +{ + return (x << (__CHAR_BIT__ * __SIZEOF_INT__ - y)) ^ (x >> y); +} + +unsigned int +f51 (unsigned int x, int y __attribute__((unused))) +{ + return (x << (__CHAR_BIT__ * __SIZEOF_INT__ - 1)) ^ (x >> 1); +} + +unsigned int +f52 (unsigned int x, int y __attribute__((unused))) +{ + return (x << 1) ^ (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - 1)); +} + +unsigned short int +f53 (unsigned short int x, int y) +{ + return (x << (__CHAR_BIT__ * __SIZEOF_SHORT__ - y)) ^ (x >> y); +} + +unsigned short int +f54 (unsigned short int x, long int y) +{ + return (x << (__CHAR_BIT__ * __SIZEOF_SHORT__ - y)) ^ (x >> y); +} + +unsigned char +f55 (unsigned char x, int y) +{ + return (x << (__CHAR_BIT__ - y)) ^ (x >> y); +} + +unsigned char +f56 (unsigned char x, long int y) +{ + return (x << (__CHAR_BIT__ - y)) ^ (x >> y); +} + +unsigned int +f57 (unsigned int x, int y) +{ + return (x << (__CHAR_BIT__ * sizeof (unsigned int) - y)) ^ (x >> y); +} + +unsigned int +f58 (unsigned int x, long int y) +{ + return (x << (__CHAR_BIT__ * sizeof (unsigned int) - y)) ^ (x >> y); +} + +unsigned int +f59 (unsigned int x, int y __attribute__((unused))) +{ + return (x << (__CHAR_BIT__ * sizeof (unsigned int) - 1)) ^ (x >> 1); +} + +unsigned int +f60 (unsigned int x, int y __attribute__((unused))) +{ + return (x << 1) ^ (x >> (__CHAR_BIT__ * sizeof (unsigned int) - 1)); +} + +unsigned short int +f61 (unsigned short int x, int y) +{ + return (x << (__CHAR_BIT__ * sizeof (unsigned short) - y)) ^ (x >> y); +} + +unsigned short int +f62 (unsigned short int x, long int y) +{ + return (x << (__CHAR_BIT__ * sizeof (unsigned short) - y)) ^ (x >> y); +} + +unsigned char +f63 (unsigned char x, int y) +{ + return (x << (__CHAR_BIT__ * sizeof (unsigned char) - y)) ^ (x >> y); +} + +unsigned char +f64 (unsigned char x, long int y) +{ + return (x << (__CHAR_BIT__ * sizeof (unsigned char) - y)) ^ (x >> y); +} diff --git a/gcc/testsuite/c-c++-common/rotate-3a.c b/gcc/testsuite/c-c++-common/rotate-3a.c new file mode 100644 index 0000000..450fc22 --- /dev/null +++ b/gcc/testsuite/c-c++-common/rotate-3a.c @@ -0,0 +1,6 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -Wno-overflow" } */ + +#define ROTATE_N "rotate-4.c" + +#include "rotate-1a.c" diff --git a/gcc/testsuite/c-c++-common/rotate-4.c b/gcc/testsuite/c-c++-common/rotate-4.c new file mode 100644 index 0000000..705fece --- /dev/null +++ b/gcc/testsuite/c-c++-common/rotate-4.c @@ -0,0 +1,389 @@ +/* Check rotate pattern detection. */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ +/* { dg-final { scan-tree-dump-times "r\[<>]\[<>]" 64 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ + +unsigned int +f1 (unsigned int x, int y) +{ + return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))); +} + +unsigned int +f2 (unsigned int x, long int y) +{ + return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))); +} + +unsigned int +f3 (unsigned int x, int y __attribute__((unused))) +{ + return (x << 1) | (x >> ((-1) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))); +} + +unsigned int +f4 (unsigned int x, int y __attribute__((unused))) +{ + return (x << ((-1) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))) | (x >> 1); +} + +unsigned short int +f5 (unsigned short int x, int y) +{ + return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1))); +} + +unsigned short int +f6 (unsigned short int x, long int y) +{ + return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1))); +} + +unsigned char +f7 (unsigned char x, int y) +{ + return (x << y) | (x >> ((-y) & (__CHAR_BIT__ - 1))); +} + +unsigned char +f8 (unsigned char x, long int y) +{ + return (x << y) | (x >> ((-y) & (__CHAR_BIT__ - 1))); +} + +unsigned int +f9 (unsigned int x, int y) +{ + return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))); +} + +unsigned int +f10 (unsigned int x, long int y) +{ + return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))); +} + +unsigned int +f11 (unsigned int x, int y __attribute__((unused))) +{ + return (x << 1) | (x >> ((-1) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))); +} + +unsigned int +f12 (unsigned int x, int y __attribute__((unused))) +{ + return (x << ((-1) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))) | (x >> 1); +} + +unsigned short int +f13 (unsigned short int x, int y) +{ + return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1))); +} + +unsigned short int +f14 (unsigned short int x, long int y) +{ + return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1))); +} + +unsigned char +f15 (unsigned char x, int y) +{ + return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1))); +} + +unsigned char +f16 (unsigned char x, long int y) +{ + return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1))); +} + +unsigned int +f17 (unsigned int x, int y) +{ + return (x >> ((-y) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))) ^ (x << y); +} + +unsigned int +f18 (unsigned int x, long int y) +{ + return (x >> ((-y) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))) ^ (x << y); +} + +unsigned int +f19 (unsigned int x, int y __attribute__((unused))) +{ + return (x >> ((-1) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))) ^ (x << 1); +} + +unsigned int +f20 (unsigned int x, int y __attribute__((unused))) +{ + return (x >> 1) ^ (x << ((-1) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))); +} + +unsigned short int +f21 (unsigned short int x, int y) +{ + return (x >> ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1))) ^ (x << y); +} + +unsigned short int +f22 (unsigned short int x, long int y) +{ + return (x >> ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1))) ^ (x << y); +} + +unsigned char +f23 (unsigned char x, int y) +{ + return (x >> ((-y) & (__CHAR_BIT__ - 1))) ^ (x << y); +} + +unsigned char +f24 (unsigned char x, long int y) +{ + return (x >> ((-y) & (__CHAR_BIT__ - 1))) ^ (x << y); +} + +unsigned int +f25 (unsigned int x, int y) +{ + return (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))) ^ (x << y); +} + +unsigned int +f26 (unsigned int x, long int y) +{ + return (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))) ^ (x << y); +} + +unsigned int +f27 (unsigned int x, int y __attribute__((unused))) +{ + return (x >> ((-1) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))) ^ (x << 1); +} + +unsigned int +f28 (unsigned int x, int y __attribute__((unused))) +{ + return (x >> 1) ^ (x << ((-1) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))); +} + +unsigned short int +f29 (unsigned short int x, int y) +{ + return (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1))) ^ (x << y); +} + +unsigned short int +f30 (unsigned short int x, long int y) +{ + return (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1))) ^ (x << y); +} + +unsigned char +f31 (unsigned char x, int y) +{ + return (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1))) ^ (x << y); +} + +unsigned char +f32 (unsigned char x, long int y) +{ + return (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1))) ^ (x << y); +} + +unsigned int +f33 (unsigned int x, int y) +{ + return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))); +} + +unsigned int +f34 (unsigned int x, long int y) +{ + return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))); +} + +unsigned int +f35 (unsigned int x, int y __attribute__((unused))) +{ + return (x >> 1) | (x << ((-1) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))); +} + +unsigned int +f36 (unsigned int x, int y __attribute__((unused))) +{ + return (x >> ((-1) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))) | (x << 1); +} + +unsigned short int +f37 (unsigned short int x, int y) +{ + return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1))); +} + +unsigned short int +f38 (unsigned short int x, long int y) +{ + return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1))); +} + +unsigned char +f39 (unsigned char x, int y) +{ + return (x >> y) | (x << ((-y) & (__CHAR_BIT__ - 1))); +} + +unsigned char +f40 (unsigned char x, long int y) +{ + return (x >> y) | (x << ((-y) & (__CHAR_BIT__ - 1))); +} + +unsigned int +f41 (unsigned int x, int y) +{ + return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))); +} + +unsigned int +f42 (unsigned int x, long int y) +{ + return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))); +} + +unsigned int +f43 (unsigned int x, int y __attribute__((unused))) +{ + return (x >> 1) | (x << ((-1) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))); +} + +unsigned int +f44 (unsigned int x, int y __attribute__((unused))) +{ + return (x >> ((-1) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))) | (x << 1); +} + +unsigned short int +f45 (unsigned short int x, int y) +{ + return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1))); +} + +unsigned short int +f46 (unsigned short int x, long int y) +{ + return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1))); +} + +unsigned char +f47 (unsigned char x, int y) +{ + return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1))); +} + +unsigned char +f48 (unsigned char x, long int y) +{ + return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1))); +} + +unsigned int +f49 (unsigned int x, int y) +{ + return (x << ((-y) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))) ^ (x >> y); +} + +unsigned int +f50 (unsigned int x, long int y) +{ + return (x << ((-y) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))) ^ (x >> y); +} + +unsigned int +f51 (unsigned int x, int y __attribute__((unused))) +{ + return (x << ((-1) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))) ^ (x >> 1); +} + +unsigned int +f52 (unsigned int x, int y __attribute__((unused))) +{ + return (x << 1) ^ (x >> ((-1) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))); +} + +unsigned short int +f53 (unsigned short int x, int y) +{ + return (x << ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1))) ^ (x >> y); +} + +unsigned short int +f54 (unsigned short int x, long int y) +{ + return (x << ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1))) ^ (x >> y); +} + +unsigned char +f55 (unsigned char x, int y) +{ + return (x << ((-y) & (__CHAR_BIT__ - 1))) ^ (x >> y); +} + +unsigned char +f56 (unsigned char x, long int y) +{ + return (x << ((-y) & (__CHAR_BIT__ - 1))) ^ (x >> y); +} + +unsigned int +f57 (unsigned int x, int y) +{ + return (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))) ^ (x >> y); +} + +unsigned int +f58 (unsigned int x, long int y) +{ + return (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))) ^ (x >> y); +} + +unsigned int +f59 (unsigned int x, int y __attribute__((unused))) +{ + return (x << ((-1) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))) ^ (x >> 1); +} + +unsigned int +f60 (unsigned int x, int y __attribute__((unused))) +{ + return (x << 1) ^ (x >> ((-1) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))); +} + +unsigned short int +f61 (unsigned short int x, int y) +{ + return (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1))) ^ (x >> y); +} + +unsigned short int +f62 (unsigned short int x, long int y) +{ + return (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1))) ^ (x >> y); +} + +unsigned char +f63 (unsigned char x, int y) +{ + return (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1))) ^ (x >> y); +} + +unsigned char +f64 (unsigned char x, long int y) +{ + return (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1))) ^ (x >> y); +} diff --git a/gcc/testsuite/c-c++-common/rotate-4a.c b/gcc/testsuite/c-c++-common/rotate-4a.c new file mode 100644 index 0000000..450fc22 --- /dev/null +++ b/gcc/testsuite/c-c++-common/rotate-4a.c @@ -0,0 +1,6 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -Wno-overflow" } */ + +#define ROTATE_N "rotate-4.c" + +#include "rotate-1a.c" |