public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [SH][committed] PR 53987 - Add some known to work tests
@ 2014-12-30 18:20 Oleg Endo
  0 siblings, 0 replies; only message in thread
From: Oleg Endo @ 2014-12-30 18:20 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 319 bytes --]

Hi,

This adds some known to work SH tests for PR 53987.
Tested with
make -k check-gcc RUNTESTFLAGS="sh.exp=pr53987-1.c --target_board=sh-sim
\{-m2/-ml,-m2/-mb,-m2a/-mb,-m4/-ml,-m4/-mb,-m4a/-ml,-m4a/-mb}"
Committed as r219110.

Cheers,
Oleg

gcc/testsuite/ChangeLog:
	PR target/53987
	* gcc.target/sh/pr53987-1.c: New.

[-- Attachment #2: sh_pr53987_0.patch --]
[-- Type: text/x-patch, Size: 1798 bytes --]

Index: gcc/testsuite/gcc.target/sh/pr53987-1.c
===================================================================
--- gcc/testsuite/gcc.target/sh/pr53987-1.c	(revision 0)
+++ gcc/testsuite/gcc.target/sh/pr53987-1.c	(revision 0)
@@ -0,0 +1,66 @@
+/* Check that no unnecessary sign/zero extensions are being emitted.  */
+/* { dg-do compile }  */
+/* { dg-options "-O2" }  */
+/* { dg-final { scan-assembler-times "extu.b" 2 } }  */
+/* { dg-final { scan-assembler-not "extu.w" } }  */
+/* { dg-final { scan-assembler-not "exts.b" } }  */
+/* { dg-final { scan-assembler-not "exts.w" } }  */
+/* { dg-final { scan-assembler-not "movu" } }  */
+/* { dg-final { scan-assembler-not "tst\t#255" { xfail *-*-*} } }  */
+
+int
+test_00 (unsigned char* x, char* xx, int y, int z)
+{
+  /* If x[0] / b is treated as a non-extended QImode subreg the zero
+     test will be a QImode subreg test, which is supposed to ignore
+     bits[31:8].  However, since the QImode memory load always sign
+     extends, it's also OK to test all the bits.  Thus we don't want
+     to see a tst #255 here.  */
+  int b = x[0];
+  xx[0] = b;
+  return b ? y : z;
+}
+
+int
+test_01 (unsigned char a, unsigned char b, int c, int d)
+{
+  /* 2x extu.b  */
+  if (a == b)
+    return c;
+  return d;
+}
+
+int
+test_02 (unsigned char* a, unsigned char* b, int c, int d)
+{
+  /* 2x mov.b  */
+  if (*a != 0 && *b == 0)
+    return c;
+  return d;
+}
+
+int
+test_03 (unsigned char* a)
+{
+  /* 1x mov.b  */
+  return *a == 0;
+}
+
+int
+test_04 (unsigned short* a)
+{
+  /* 1x mov.w  */
+  return *a == 0;
+}
+
+unsigned char test_05_var;
+int
+test_05 (int a, int b, int c, int d)
+{
+  /* Must not see sign/zero extension here.  */
+  test_05_var = (a == b) | (b == c);
+  if (test_05_var)
+    return d;
+
+  return 0;
+}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-12-30 17:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-30 18:20 [SH][committed] PR 53987 - Add some known to work tests Oleg Endo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).