diff options
author | olegendo <olegendo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-03-21 20:27:50 +0000 |
---|---|---|
committer | olegendo <olegendo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-03-21 20:27:50 +0000 |
commit | b8d6d8988d877654f38d8652fb4797fcce161035 (patch) | |
tree | 7a24fd6dfb2d98c44e541d7e54ee5fdf5d4cc373 | |
parent | b45e64348801f34ec1c23e4b226ab6c30b9cb05b (diff) | |
download | gcc-b8d6d8988d877654f38d8652fb4797fcce161035.tar.gz |
PR target/50751
* gcc/target/sh/pr50751-1.c: New.
* gcc/target/sh/pr50751-2.c: New.
* gcc/target/sh/pr50751-3.c: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@185619 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/testsuite/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/sh/pr50751-1.c | 30 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/sh/pr50751-2.c | 27 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/sh/pr50751-3.c | 26 |
4 files changed, 90 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index eec8dea62ef..473b0188cfc 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,12 @@ 2012-03-21 Oleg Endo <olegendo@gcc.gnu.org> + PR target/50751 + * gcc/target/sh/pr50751-1.c: New. + * gcc/target/sh/pr50751-2.c: New. + * gcc/target/sh/pr50751-3.c: New. + +2012-03-21 Oleg Endo <olegendo@gcc.gnu.org> + PR target/52479 * gcc.target/sh/sh4a-cos.c: Remove. * gcc.target/sh/sh4a-sin.c: Remove. diff --git a/gcc/testsuite/gcc.target/sh/pr50751-1.c b/gcc/testsuite/gcc.target/sh/pr50751-1.c new file mode 100644 index 00000000000..3793bd0d4eb --- /dev/null +++ b/gcc/testsuite/gcc.target/sh/pr50751-1.c @@ -0,0 +1,30 @@ +/* Check that the mov.b displacement addressing insn is generated. + If the insn is generated as expected, there should be no address + calculations outside the mov insns. */ +/* { dg-do compile { target "sh*-*-*" } } */ +/* { dg-options "-O1" } */ +/* { dg-skip-if "" { "sh*-*-*" } { "-m5*"} { "" } } */ +/* { dg-final { scan-assembler-not "add|sub" } } */ + +void +testfunc_00 (const char* ap, char* bp, char val) +{ + bp[0] = ap[15]; + bp[2] = ap[5]; + bp[9] = ap[7]; + bp[0] = ap[15]; + bp[4] = val; + bp[14] = val; +} + +void +testfunc_01 (volatile const char* ap, volatile char* bp, char val) +{ + bp[0] = ap[15]; + bp[2] = ap[5]; + bp[9] = ap[7]; + bp[0] = ap[15]; + bp[4] = val; + bp[14] = val; +} + diff --git a/gcc/testsuite/gcc.target/sh/pr50751-2.c b/gcc/testsuite/gcc.target/sh/pr50751-2.c new file mode 100644 index 00000000000..ae4b0af5d41 --- /dev/null +++ b/gcc/testsuite/gcc.target/sh/pr50751-2.c @@ -0,0 +1,27 @@ +/* Check that the mov.b displacement addressing insn is generated and the + base address is adjusted only once. On SH2A this test is skipped because + there is a 4 byte mov.b insn that can handle larger displacements. Thus + on SH2A the base address will not be adjusted in this case. */ +/* { dg-do compile { target "sh*-*-*" } } */ +/* { dg-options "-O1" } */ +/* { dg-skip-if "" { "sh*-*-*" } { "-m5*" "-m2a*" } { "" } } */ +/* { dg-final { scan-assembler-times "add" 2 } } */ + +void +testfunc_00 (const char* ap, char* bp) +{ + bp[0] = ap[15]; + bp[2] = ap[5]; + bp[9] = ap[7]; + bp[0] = ap[25]; +} + +void +testfunc_01 (volatile const char* ap, volatile char* bp) +{ + bp[0] = ap[15]; + bp[2] = ap[5]; + bp[9] = ap[7]; + bp[0] = ap[25]; +} + diff --git a/gcc/testsuite/gcc.target/sh/pr50751-3.c b/gcc/testsuite/gcc.target/sh/pr50751-3.c new file mode 100644 index 00000000000..58c85f83312 --- /dev/null +++ b/gcc/testsuite/gcc.target/sh/pr50751-3.c @@ -0,0 +1,26 @@ +/* Check that on SH2A the 4 byte mov.b displacement insn is generated to + handle larger displacements. If it is generated correctly, there should + be no base address adjustments outside the mov.b insns. */ +/* { dg-do compile { target "sh*-*-*" } } */ +/* { dg-options "-O1" } */ +/* { dg-skip-if "" { "sh*-*-*" } { "*" } { "-m2a*" } } */ +/* { dg-final { scan-assembler-not "add|sub" } } */ + +void +testfunc_00 (const char* ap, char* bp) +{ + bp[100] = ap[15]; + bp[200] = ap[50]; + bp[900] = ap[71]; + bp[0] = ap[25]; +} + +void +testfunc_01 (volatile const char* ap, volatile char* bp) +{ + bp[100] = ap[15]; + bp[200] = ap[50]; + bp[900] = ap[71]; + bp[0] = ap[25]; +} + |