diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-11-19 08:18:53 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-11-19 08:18:53 +0000 |
commit | 3118c58cf122fb1449089e0a10899e9632d4c45a (patch) | |
tree | add405212855dc07bdc60d4afe8c74e3fe7767ca /gcc/testsuite/gcc.c-torture | |
parent | b0dc530832b05a89ee2570131eac1b2a05a9ab4e (diff) | |
download | gcc-3118c58cf122fb1449089e0a10899e9632d4c45a.tar.gz |
PR rtl-optimization/63843
* simplify-rtx.c (simplify_binary_operation_1) <case ASHIFTRT>: For
optimization of ashiftrt of subreg of lshiftrt, check that code
is ASHIFTRT.
* gcc.c-torture/execute/pr63843.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@217753 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.c-torture')
-rw-r--r-- | gcc/testsuite/gcc.c-torture/execute/pr63843.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr63843.c b/gcc/testsuite/gcc.c-torture/execute/pr63843.c new file mode 100644 index 00000000000..9f6c7b06c39 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr63843.c @@ -0,0 +1,31 @@ +/* PR rtl-optimization/63843 */ + +static inline __attribute__ ((always_inline)) +unsigned short foo (unsigned short v) +{ + return (v << 8) | (v >> 8); +} + +unsigned short __attribute__ ((noinline, noclone, hot)) +bar (unsigned char *x) +{ + unsigned int a; + unsigned short b; + __builtin_memcpy (&a, &x[0], sizeof (a)); + a ^= 0x80808080U; + __builtin_memcpy (&x[0], &a, sizeof (a)); + __builtin_memcpy (&b, &x[2], sizeof (b)); + return foo (b); +} + +int +main () +{ + unsigned char x[8] = { 0x01, 0x01, 0x01, 0x01 }; + if (__CHAR_BIT__ == 8 + && sizeof (short) == 2 + && sizeof (int) == 4 + && bar (x) != 0x8181U) + __builtin_abort (); + return 0; +} |