]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gcc/testsuite/
authorolegendo <olegendo@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 30 Dec 2014 19:11:42 +0000 (19:11 +0000)
committerolegendo <olegendo@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 30 Dec 2014 19:11:42 +0000 (19:11 +0000)
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

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/sh/pr49263-3.c [new file with mode: 0644]
gcc/testsuite/gcc.target/sh/sh.exp

index aaab82f2d42f4fb4cab9c7e384834f1e65707418..667b95d23f490d91c8b7bd7d57df903b54fda10f 100644 (file)
@@ -1,3 +1,9 @@
+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
diff --git a/gcc/testsuite/gcc.target/sh/pr49263-3.c b/gcc/testsuite/gcc.target/sh/pr49263-3.c
new file mode 100644 (file)
index 0000000..1edfe87
--- /dev/null
@@ -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;
+}
index ac428cde5b35083814735e2707e391a665290245..6f7d35d61bbaab000a51eab6792623605314003f 100644 (file)
@@ -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 {