summaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorolegendo <olegendo@138bc75d-0d04-0410-961f-82ee72b054a4>2014-12-30 19:11:42 +0000
committerolegendo <olegendo@138bc75d-0d04-0410-961f-82ee72b054a4>2014-12-30 19:11:42 +0000
commit1e0cf2e8f35281090e34078fc96c5d3a69ee6df8 (patch)
tree2736b4eecfbc8451fa724ce21446edec5c6d9c69 /gcc/testsuite
parentbf219fe07c54cea650c6e398cfa35a8ed5604b27 (diff)
downloadgcc-1e0cf2e8f35281090e34078fc96c5d3a69ee6df8.tar.gz
gcc/testsuite/
PR target/49263 * gcc.target/sh/sh.exp (check_effective_target_sh2a): New. * gcc.target/sh/pr49263-3.c: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@219113 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gcc.target/sh/pr49263-3.c176
-rw-r--r--gcc/testsuite/gcc.target/sh/sh.exp9
3 files changed, 191 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index aaab82f2d42..667b95d23f4 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,6 +1,12 @@
2014-12-30 Oleg Endo <olegendo@gcc.gnu.org>
PR target/49263
+ * gcc.target/sh/sh.exp (check_effective_target_sh2a): New.
+ * gcc.target/sh/pr49263-3.c: New.
+
+2014-12-30 Oleg Endo <olegendo@gcc.gnu.org>
+
+ PR target/49263
* gcc.target/sh/pr49263-1.c: New.
* gcc.target/sh/pr49263-2.c: New.
diff --git a/gcc/testsuite/gcc.target/sh/pr49263-3.c b/gcc/testsuite/gcc.target/sh/pr49263-3.c
new file mode 100644
index 00000000000..1edfe876715
--- /dev/null
+++ b/gcc/testsuite/gcc.target/sh/pr49263-3.c
@@ -0,0 +1,176 @@
+/* Verify that TST #imm, R0 instruction is generated when the tested reg
+ is shifted by a constant amount. */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-not "and|shl|sha|exts" { xfail *-*-* } } } */
+
+/* { dg-final { scan-assembler-times "tst\t#7,r0" 3 { xfail *-*-* } } } */
+/* { dg-final { scan-assembler-times "tst\t#12,r0" 1 { xfail *-*-* } } } */
+/* { dg-final { scan-assembler-times "tst\t#24,r0" 6 { xfail *-*-* } } } */
+/* { dg-final { scan-assembler-times "tst\t#13,r0" 3 { xfail *-*-* } } } */
+/* { dg-final { scan-assembler-times "tst\t#242,r0" 3 { xfail *-*-* } } } */
+/* { dg-final { scan-assembler-times "tst\t#252,r0" 1 } } */
+
+/* { dg-final { scan-assembler-times "tst\t#64,r0" 6 { target { ! sh2a } xfail *-*-* } } } */
+/* { dg-final { scan-assembler-times "tst\t#64,r0" 4 { target { sh2a } xfail *-*-* } } } */
+/* { dg-final { scan-assembler-times "bld\t#6" 2 { target { sh2a } xfail *-*-* } } } */
+
+int
+test_00 (unsigned char* x, int y, int z)
+{
+ /* 1x tst #12 */
+ return (x[0] << 4) & 192 ? y : z;
+}
+
+int
+test_01 (unsigned char* x, int y, int z)
+{
+ /* 1x tst #24 */
+ return (x[0] << 3) & 192 ? y : z;
+}
+
+int
+test_02 (unsigned char* x, int y, int z)
+{
+ /* 1x tst #24 */
+ return ((x[0] << 3) & 192) != 0;
+}
+
+int
+test_03 (unsigned char* x, int y, int z)
+{
+ /* 1x tst #24 */
+ return ((x[0] << 3) & 192) == 0;
+}
+
+int
+test_04 (unsigned char x, int y, int z)
+{
+ /* 1x tst #24 */
+ return (x << 3) & 192 ? y : z;
+}
+
+int
+test_05 (unsigned char x, int y, int z)
+{
+ /* 1x tst #24 */
+ return ((x << 3) & 192) != 0;
+}
+
+int
+test_06 (unsigned char x, int y, int z)
+{
+ /* 1x tst #24 */
+ return ((x << 3) & 192) == 0;
+}
+
+int
+test_07 (unsigned char x, int y, int z)
+{
+ /* 1x tst #13 */
+ return (x << 3) & 111 ? y : z;
+}
+
+int
+test_08 (unsigned char x, int y, int z)
+{
+ /* 1x tst #13 */
+ return ((x << 3) & 111) != 0;
+}
+
+int
+test_09 (unsigned char x, int y, int z)
+{
+ /* 1x tst #13 */
+ return ((x << 3) & 111) == 0;
+}
+
+int
+test_10 (unsigned char x, int y, int z)
+{
+ /* 1x tst #242 */
+ return (x << 3) & -111 ? y : z;
+}
+
+int
+test_11 (unsigned char x, int y, int z)
+{
+ /* 1x tst #242 */
+ return ((x << 3) & -111) != 0;
+}
+
+int
+test_12 (unsigned char x, int y, int z)
+{
+ /* 1x tst #242 */
+ return ((x << 3) & -111) == 0;
+}
+
+int
+test_13 (unsigned char* x, int y, int z)
+{
+ /* 1x tst #64 */
+ return (x[0] >> 2) & 16 ? y : z;
+}
+
+int
+test_14 (unsigned char* x, int y, int z)
+{
+ /* 1x tst #64 / 1x bld #6*/
+ return ((x[0] >> 2) & 16) != 0;
+}
+int
+test_15 (unsigned char* x, int y, int z)
+{
+ /* 1x tst #64 */
+ return ((x[0] >> 2) & 16) == 0;
+}
+
+int
+test_16 (unsigned char x, int y, int z)
+{
+ /* 1x tst #64 */
+ return (x >> 2) & 16 ? y : z;
+}
+
+int
+test_17 (unsigned char x, int y, int z)
+{
+ /* 1x tst #64 / 1x bld #6*/
+ return ((x >> 2) & 16) != 0;
+}
+
+int
+test_18 (unsigned char x, int y, int z)
+{
+ /* 1x tst #64 */
+ return ((x >> 2) & 16) == 0;
+}
+
+int
+test_19 (signed char x, int y, int z)
+{
+ /* 1x tst #7 */
+ return (x << 1) & 0x0F ? y : z;
+}
+
+int
+test_20 (signed char x, int y, int z)
+{
+ /* 1x tst #7 */
+ return ((x << 1) & 0x0F) != 0;
+}
+
+int
+test_21 (signed char x, int y, int z)
+{
+ /* 1x tst #7 */
+ return ((x << 1) & 0x0F) == 0;
+}
+
+int
+test_22 (unsigned char* x, int y, int z)
+{
+ /* 1x tst #252 */
+ return (x[0] >> 2) ? y : z;
+}
diff --git a/gcc/testsuite/gcc.target/sh/sh.exp b/gcc/testsuite/gcc.target/sh/sh.exp
index ac428cde5b3..6f7d35d61bb 100644
--- a/gcc/testsuite/gcc.target/sh/sh.exp
+++ b/gcc/testsuite/gcc.target/sh/sh.exp
@@ -24,6 +24,15 @@ if ![istarget sh*-*-*] then {
# Load support procs.
load_lib gcc-dg.exp
+# Return 1 if target is SH2A
+proc check_effective_target_sh2a { } {
+ return [check_no_compiler_messages sh2a object {
+ #ifndef __SH2A__
+ #error ""
+ #endif
+ } ""]
+}
+
# If a testcase doesn't have special options, use these.
global DEFAULT_CFLAGS
if ![info exists DEFAULT_CFLAGS] then {