diff options
author | Oleg Endo <olegendo@gcc.gnu.org> | 2012-09-10 20:35:25 +0000 |
---|---|---|
committer | Oleg Endo <olegendo@gcc.gnu.org> | 2012-09-10 20:35:25 +0000 |
commit | aadb5b43aed03688d8dd9875de09b8e1e65cb989 (patch) | |
tree | 438d32c35f3976d35bb70d589d71f65510a0510e /gcc/testsuite | |
parent | d5d66749a315a4f515f0d77d2a4f74aa19697d64 (diff) | |
download | gcc-aadb5b43aed03688d8dd9875de09b8e1e65cb989.zip gcc-aadb5b43aed03688d8dd9875de09b8e1e65cb989.tar.gz gcc-aadb5b43aed03688d8dd9875de09b8e1e65cb989.tar.bz2 |
re PR target/54089 ([SH] Refactor shift patterns)
PR target/54089
* config/sh/sh.h (SH_DYNAMIC_SHIFT_COST): Set always to 1 if
dynamic shifts are available.
(SHIFT_COUNT_TRUNCATED): Always define to 0. Correct comment.
* config/sh/sh.c (ashl_lshr_seq, ext_ashl_lshr_seq): Add comments.
* config/sh/predicates.md (shift_count_operand): Allow
arith_reg_operand even if TARGET_DYNSHIFT is false.
* config/sh/sh.md (ashlsi3, lshrsi3): Expand library call patterns
if needed.
(ashlsi3_d_call, lshrsi3_d_call): New insns.
PR target/54089
* config/sh/lib1funcs.S (ashlsi3): Reimplement as ashlsi3_r0.
(lshrsi3): Reimplement as lshrsi3_r0.
PR target/54089
* gcc.target/sh/pr54089-3.c: New.
From-SVN: r191161
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/sh/pr54089-3.c | 40 |
2 files changed, 46 insertions, 1 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index dc35774..1f8edec 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,11 @@ +2012-09-10 Oleg Endo <olegendo@gcc.gnu.org> + + PR target/54089 + * gcc.target/sh/pr54089-3.c: New. + 2012-09-10 Marc Glisse <marc.glisse@inria.fr> - * gcc.dg/tree-ssa/forwprop-21.c: New testcase. + * gcc.dg/tree-ssa/forwprop-21.c: New testcase. 2012-09-10 Aldy Hernandez <aldyh@redhat.com> diff --git a/gcc/testsuite/gcc.target/sh/pr54089-3.c b/gcc/testsuite/gcc.target/sh/pr54089-3.c new file mode 100644 index 0000000..ffb976b --- /dev/null +++ b/gcc/testsuite/gcc.target/sh/pr54089-3.c @@ -0,0 +1,40 @@ +/* The dynamic shift library functions truncate the shift count to 5 bits. + Verify that this is taken into account and no extra shift count + truncations are generated before the library call. */ +/* { dg-do compile { target "sh*-*-*" } } */ +/* { dg-options "-O1" } */ +/* { dg-skip-if "" { "sh*-*-*" } { "*" } { "-m1*" "-m2" "-m2e*" } } */ +/* { dg-final { scan-assembler-not "and" } } */ +/* { dg-final { scan-assembler-not "31" } } */ + +int +test00 (unsigned int a, int* b, int c, int* d, unsigned int e) +{ + int s = 0; + int i; + for (i = 0; i < c; ++i) + s += d[i] + b[i] + (e << (i & 31)); + return s; +} + +int +test01 (unsigned int a, int* b, int c, int* d, unsigned int e) +{ + int s = 0; + int i; + for (i = 0; i < c; ++i) + s += d[i] + b[i] + (e >> (i & 31)); + return s; +} + +int +test03 (unsigned int a, unsigned int b) +{ + return b << (a & 31); +} + +unsigned int +test04 (unsigned int a, int b) +{ + return a >> (b & 31); +} |