]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gcc/testsuite/
authorolegendo <olegendo@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 30 Dec 2014 18:44:27 +0000 (18:44 +0000)
committerolegendo <olegendo@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 30 Dec 2014 18:44:27 +0000 (18:44 +0000)
PR target/49263
* gcc.target/sh/pr49263-1.c: New.
* gcc.target/sh/pr49263-2.c: New.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@219111 138bc75d-0d04-0410-961f-82ee72b054a4

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

index f72bb697c96565f15ed15eadd617951364e0f05a..aaab82f2d42f4fb4cab9c7e384834f1e65707418 100644 (file)
@@ -1,3 +1,9 @@
+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.
+
 2014-12-30  Oleg Endo  <olegendo@gcc.gnu.org>
 
        PR target/53987
diff --git a/gcc/testsuite/gcc.target/sh/pr49263-1.c b/gcc/testsuite/gcc.target/sh/pr49263-1.c
new file mode 100644 (file)
index 0000000..fd3cb4b
--- /dev/null
@@ -0,0 +1,62 @@
+/* Verify that TST #imm, R0 instruction is generated when QImode or HImode
+   values are tested against a negative constant.  */
+/* { dg-do compile }  */
+/* { dg-options "-O2" }  */
+/* { dg-final { scan-assembler-not "and" } }  */
+/* { dg-final { scan-assembler-not "bclr" { xfail *-*-* } } }  */
+/* { dg-final { scan-assembler-times "extu" 1 { xfail *-*-* } } }  */
+/* { dg-final { scan-assembler-times "exts" 1 { xfail *-*-* } } }  */
+
+#define make_func(__valtype__, __valget__, __tstval__, __suff__)\
+  int test_imm_##__tstval__##__suff__ (__valtype__ val) \
+    {\
+      return ((__valget__) & (- 0x##__tstval__  << 0)) ? -20 : -40;\
+    }
+
+#define make_func_0_F(__valtype__, __valget__, __y__, __suff__)\
+  make_func (__valtype__, __valget__, __y__##0, __suff__)\
+  make_func (__valtype__, __valget__, __y__##1, __suff__)\
+  make_func (__valtype__, __valget__, __y__##2, __suff__)\
+  make_func (__valtype__, __valget__, __y__##3, __suff__)\
+  make_func (__valtype__, __valget__, __y__##4, __suff__)\
+  make_func (__valtype__, __valget__, __y__##5, __suff__)\
+  make_func (__valtype__, __valget__, __y__##6, __suff__)\
+  make_func (__valtype__, __valget__, __y__##7, __suff__)\
+  make_func (__valtype__, __valget__, __y__##8, __suff__)\
+  make_func (__valtype__, __valget__, __y__##9, __suff__)\
+  make_func (__valtype__, __valget__, __y__##A, __suff__)\
+  make_func (__valtype__, __valget__, __y__##B, __suff__)\
+  make_func (__valtype__, __valget__, __y__##C, __suff__)\
+  make_func (__valtype__, __valget__, __y__##D, __suff__)\
+  make_func (__valtype__, __valget__, __y__##E, __suff__)\
+  make_func (__valtype__, __valget__, __y__##F, __suff__)\
+
+#define make_funcs_0_FF(__valtype__, __valget__, __suff__)\
+  make_func_0_F (__valtype__, __valget__, 0, __suff__)\
+  make_func_0_F (__valtype__, __valget__, 1, __suff__)\
+  make_func_0_F (__valtype__, __valget__, 2, __suff__)\
+  make_func_0_F (__valtype__, __valget__, 3, __suff__)\
+  make_func_0_F (__valtype__, __valget__, 4, __suff__)\
+  make_func_0_F (__valtype__, __valget__, 5, __suff__)\
+  make_func_0_F (__valtype__, __valget__, 6, __suff__)\
+  make_func_0_F (__valtype__, __valget__, 7, __suff__)\
+  make_func_0_F (__valtype__, __valget__, 8, __suff__)\
+  make_func_0_F (__valtype__, __valget__, 9, __suff__)\
+  make_func_0_F (__valtype__, __valget__, A, __suff__)\
+  make_func_0_F (__valtype__, __valget__, B, __suff__)\
+  make_func_0_F (__valtype__, __valget__, C, __suff__)\
+  make_func_0_F (__valtype__, __valget__, D, __suff__)\
+  make_func_0_F (__valtype__, __valget__, E, __suff__)\
+  make_func_0_F (__valtype__, __valget__, F, __suff__)\
+
+make_funcs_0_FF (signed char*, *val, int8_mem)
+make_funcs_0_FF (signed char, val, int8_reg)
+
+make_funcs_0_FF (unsigned char*, *val, uint8_mem)
+make_funcs_0_FF (unsigned char, val, uint8_reg)
+
+make_funcs_0_FF (short*, *val, int16_mem)
+make_funcs_0_FF (short, val, int16_reg)
+
+make_funcs_0_FF (unsigned short*, *val, uint16_mem)
+make_funcs_0_FF (unsigned short, val, uint16_reg)
diff --git a/gcc/testsuite/gcc.target/sh/pr49263-2.c b/gcc/testsuite/gcc.target/sh/pr49263-2.c
new file mode 100644 (file)
index 0000000..3385161
--- /dev/null
@@ -0,0 +1,54 @@
+/* Verify that TST #imm, R0 instruction is generated when QImode or HImode
+   values are tested against a negative constant.  */
+/* { dg-do compile }  */
+/* { dg-options "-O2" }  */
+/* { dg-final { scan-assembler-not "and" } }  */
+/* { dg-final { scan-assembler-not "exts" { xfail *-*-* } } }  */
+
+/* { dg-final { scan-assembler-times "tst\t#127,r0" 2 } }  */
+/* { dg-final { scan-assembler-times "tst\t#255,r0" 1 { xfail *-*-* } } }  */
+/* { dg-final { scan-assembler-times "65407" 1 { xfail *-*-* } } }  */
+/* { dg-final { scan-assembler-times "-129" 2 { xfail *-*-* } } }  */
+/* { dg-final { scan-assembler-times "extu" 1 { xfail *-*-* } } }  */
+
+int
+test_00 (unsigned char x)
+{
+  /* 1x tst #127  */
+  return x & -129 ? -20 : -40;
+}
+
+int
+test_01 (signed char x)
+{
+  /* 1x tst #255  */
+  return x & -129 ? -20 : -40;
+}
+
+int
+test_02 (unsigned short x)
+{
+  /* 1x tst 65407  */
+  return x & -129 ? -20 : -40;
+}
+
+int
+test_03 (unsigned short* x)
+{
+  /* 1x tst -129  */
+  return x[0] & -129 ? -20 : -40;
+}
+
+int
+test_04 (unsigned short x)
+{
+  /* 1x extu.w, 1x tst -129  */
+  return x & -129 ? x : -1;
+}
+
+int
+test_05 (unsigned char* x)
+{
+  /* 1x tst #127  */
+  return x[0] & -129 ? -20 : -40;
+}