diff options
author | Jakub Jelinek <jakub@redhat.com> | 2013-05-13 13:04:26 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2013-05-13 13:04:26 +0200 |
commit | ae6fa899e7000352aa8573a23b1e92c225337ea1 (patch) | |
tree | 6346bea605532f76d3b46ee9bfb0d6588ee811de /gcc/testsuite/c-c++-common/rotate-2.c | |
parent | 4502fe8dfcb1cc2c59b50b868ac75fb5cdd742fc (diff) | |
download | gcc-ae6fa899e7000352aa8573a23b1e92c225337ea1.zip gcc-ae6fa899e7000352aa8573a23b1e92c225337ea1.tar.gz gcc-ae6fa899e7000352aa8573a23b1e92c225337ea1.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): Only recognize
the (-Y) & (B - 1) variant if OP is |.
* expmed.c (expand_shift_1): For rotations by const0_rtx just
return shifted. Use (-op1) & (prec - 1) as other_amount
instead of prec - op1.
* c-c++-common/rotate-1.c: Add 32 tests with +.
* c-c++-common/rotate-1a.c: Adjust.
* c-c++-common/rotate-2.c: Add 32 tests with +, expect
only 48 rotates.
* c-c++-common/rotate-2b.c: New test.
* c-c++-common/rotate-3.c: Add 32 tests with +.
* c-c++-common/rotate-4.c: Add 32 tests with +, expect
only 48 rotates.
* c-c++-common/rotate-4b.c: New test.
* c-c++-common/rotate-5.c: New test.
From-SVN: r198823
Diffstat (limited to 'gcc/testsuite/c-c++-common/rotate-2.c')
-rw-r--r-- | gcc/testsuite/c-c++-common/rotate-2.c | 196 |
1 files changed, 195 insertions, 1 deletions
diff --git a/gcc/testsuite/c-c++-common/rotate-2.c b/gcc/testsuite/c-c++-common/rotate-2.c index d853866..109fd32 100644 --- a/gcc/testsuite/c-c++-common/rotate-2.c +++ b/gcc/testsuite/c-c++-common/rotate-2.c @@ -1,7 +1,9 @@ /* Check rotate pattern detection. */ /* { dg-do compile } */ /* { dg-options "-O2 -fdump-tree-optimized" } */ -/* { dg-final { scan-tree-dump-times "r\[<>]\[<>]" 64 "optimized" } } */ +/* Rotates should be recognized only in functions with | instead of + or ^, + or in functions that have constant shift counts (unused attribute on y). */ +/* { dg-final { scan-tree-dump-times "r\[<>]\[<>]" 48 "optimized" } } */ /* { dg-final { cleanup-tree-dump "optimized" } } */ unsigned int @@ -387,3 +389,195 @@ f64 (unsigned char x, unsigned long int y) { return (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1))) ^ (x >> y); } + +unsigned int +f65 (unsigned int x, unsigned int y) +{ + return (x << y) + (x >> ((-y) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))); +} + +unsigned int +f66 (unsigned int x, unsigned long int y) +{ + return (x << y) + (x >> ((-y) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))); +} + +unsigned int +f67 (unsigned int x, int y __attribute__((unused))) +{ + return (x << 1) + (x >> ((-1) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))); +} + +unsigned int +f68 (unsigned int x, int y __attribute__((unused))) +{ + return (x << ((-1) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))) + (x >> 1); +} + +unsigned short int +f69 (unsigned short int x, unsigned int y) +{ + return (x << y) + (x >> ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1))); +} + +unsigned short int +f70 (unsigned short int x, unsigned long int y) +{ + return (x << y) + (x >> ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1))); +} + +unsigned char +f71 (unsigned char x, unsigned int y) +{ + return (x << y) + (x >> ((-y) & (__CHAR_BIT__ - 1))); +} + +unsigned char +f72 (unsigned char x, unsigned long int y) +{ + return (x << y) + (x >> ((-y) & (__CHAR_BIT__ - 1))); +} + +unsigned int +f73 (unsigned int x, unsigned int y) +{ + return (x << y) + (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))); +} + +unsigned int +f74 (unsigned int x, unsigned long int y) +{ + return (x << y) + (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))); +} + +unsigned int +f75 (unsigned int x, int y __attribute__((unused))) +{ + return (x << 1) + (x >> ((-1) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))); +} + +unsigned int +f76 (unsigned int x, int y __attribute__((unused))) +{ + return (x << ((-1) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))) + (x >> 1); +} + +unsigned short int +f77 (unsigned short int x, unsigned int y) +{ + return (x << y) + (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1))); +} + +unsigned short int +f78 (unsigned short int x, unsigned long int y) +{ + return (x << y) + (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1))); +} + +unsigned char +f79 (unsigned char x, unsigned int y) +{ + return (x << y) + (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1))); +} + +unsigned char +f80 (unsigned char x, unsigned long int y) +{ + return (x << y) + (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1))); +} + +unsigned int +f81 (unsigned int x, unsigned int y) +{ + return (x << ((-y) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))) + (x >> y); +} + +unsigned int +f82 (unsigned int x, unsigned long int y) +{ + return (x << ((-y) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))) + (x >> y); +} + +unsigned int +f83 (unsigned int x, int y __attribute__((unused))) +{ + return (x << ((-1) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))) + (x >> 1); +} + +unsigned int +f84 (unsigned int x, int y __attribute__((unused))) +{ + return (x << 1) + (x >> ((-1) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))); +} + +unsigned short int +f85 (unsigned short int x, unsigned int y) +{ + return (x << ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1))) + (x >> y); +} + +unsigned short int +f86 (unsigned short int x, unsigned long int y) +{ + return (x << ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1))) + (x >> y); +} + +unsigned char +f87 (unsigned char x, unsigned int y) +{ + return (x << ((-y) & (__CHAR_BIT__ - 1))) + (x >> y); +} + +unsigned char +f88 (unsigned char x, unsigned long int y) +{ + return (x << ((-y) & (__CHAR_BIT__ - 1))) + (x >> y); +} + +unsigned int +f89 (unsigned int x, unsigned int y) +{ + return (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))) + (x >> y); +} + +unsigned int +f90 (unsigned int x, unsigned long int y) +{ + return (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))) + (x >> y); +} + +unsigned int +f91 (unsigned int x, int y __attribute__((unused))) +{ + return (x << ((-1) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))) + (x >> 1); +} + +unsigned int +f92 (unsigned int x, int y __attribute__((unused))) +{ + return (x << 1) + (x >> ((-1) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))); +} + +unsigned short int +f93 (unsigned short int x, unsigned int y) +{ + return (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1))) + (x >> y); +} + +unsigned short int +f94 (unsigned short int x, unsigned long int y) +{ + return (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1))) + (x >> y); +} + +unsigned char +f95 (unsigned char x, unsigned int y) +{ + return (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1))) + (x >> y); +} + +unsigned char +f96 (unsigned char x, unsigned long int y) +{ + return (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1))) + (x >> y); +} |