diff mbox

[testsuite] Add visium testsuite in gcc.target

Message ID 1639658.Eky7FiXZ3u@polaris
State New
Headers show

Commit Message

Eric Botcazou Jan. 16, 2015, 12:18 p.m. UTC
It contains only 8 tests that were written for specific features.

Tested on visium-elf, applied on the mainline.


2015-01-16  Eric Botcazou  <ebotcazou@adacore.com>

	* gcc.target/visium: New directory.
diff mbox

Patch

Index: gcc.target/visium/loop_clear.c
===================================================================
--- gcc.target/visium/loop_clear.c	(revision 0)
+++ gcc.target/visium/loop_clear.c	(revision 0)
@@ -0,0 +1,15 @@ 
+/* { dg-do compile } */
+/* { dg-options "-O" } */
+
+extern int a[];
+
+void loop_clear (int i)
+{
+  while (i > 0)
+    a[i--] = 0;
+}
+
+/* { dg-final { scan-assembler-times "cmp" 1 { xfail *-*-* } } } */
+
+/* FIXME: the redundant cmp is not eliminated because the compare-elim pass
+   is run before the dbr pass.  It's a regression wrt the cc0 port.  */
Index: gcc.target/visium/block_move.c
===================================================================
--- gcc.target/visium/block_move.c	(revision 0)
+++ gcc.target/visium/block_move.c	(revision 0)
@@ -0,0 +1,19 @@ 
+/* { dg-do compile } */
+/* { dg-options "-O -mcpu=gr6" } */
+
+extern void abort (void);
+
+#define LEN 256
+
+void foo (void)
+{
+  int dst[LEN], src[LEN];
+  unsigned int i;
+
+  __builtin_memset (src, 0, LEN * sizeof (int));
+  __builtin_memcpy (dst, src, LEN * sizeof (int));
+  if (__builtin_memcmp (dst, src, LEN * sizeof (int)) != 0)
+    abort ();
+}
+
+/* { dg-final { scan-assembler "bmd" } } */
Index: gcc.target/visium/cstore_fp.c
===================================================================
--- gcc.target/visium/cstore_fp.c	(revision 0)
+++ gcc.target/visium/cstore_fp.c	(revision 0)
@@ -0,0 +1,25 @@ 
+/* { dg-do compile } */
+/* { dg-options "-O -fno-trapping-math" } */
+
+int foo1 (float a, float b)
+{
+  return (a < b);
+}
+
+int foo2 (float a, float b)
+{
+  return (a > b);
+}
+
+int foo3 (float a, float b)
+{
+  return !(a < b);
+}
+
+int foo4 (float a, float b)
+{
+  return !(a > b);
+}
+
+/* { dg-final { scan-assembler-times "adc.l" 2 } } */
+/* { dg-final { scan-assembler-times "subc.l" 2 } } */
Index: gcc.target/visium/cstore_uns.c
===================================================================
--- gcc.target/visium/cstore_uns.c	(revision 0)
+++ gcc.target/visium/cstore_uns.c	(revision 0)
@@ -0,0 +1,25 @@ 
+/* { dg-do compile } */
+/* { dg-options "-O" } */
+
+int foo1 (unsigned a, unsigned b)
+{
+  return (a < b);
+}
+
+int foo2 (unsigned a, unsigned b)
+{
+  return (a > b);
+}
+
+int foo3 (unsigned a, unsigned b)
+{
+  return (a >= b);
+}
+
+int foo4 (unsigned a, unsigned b)
+{
+  return (a <= b);
+}
+
+/* { dg-final { scan-assembler-times "adc.l" 2 } } */
+/* { dg-final { scan-assembler-times "subc.l" 2 } } */
Index: gcc.target/visium/cstore_eq.c
===================================================================
--- gcc.target/visium/cstore_eq.c	(revision 0)
+++ gcc.target/visium/cstore_eq.c	(revision 0)
@@ -0,0 +1,25 @@ 
+/* { dg-do compile } */
+/* { dg-options "-O" } */
+
+int foo1 (int i)
+{
+  return (i != 0);
+}
+
+int foo2 (int i)
+{
+  return (i == 0);
+}
+
+int foo3 (int a, int b)
+{
+  return a != b;
+}
+
+int foo4 (int a, int b)
+{
+  return (a == b);
+}
+
+/* { dg-final { scan-assembler-times "adc.l" 2 } } */
+/* { dg-final { scan-assembler-times "subc.l" 2 } } */
Index: gcc.target/visium/visium.exp
===================================================================
--- gcc.target/visium/visium.exp	(revision 0)
+++ gcc.target/visium/visium.exp	(revision 0)
@@ -0,0 +1,44 @@ 
+#  Specific regression driver for Visium.
+#  Copyright (C) 2015 Free Software Foundation, Inc.
+#
+#  This file is part of GCC.
+#
+#  GCC is free software; you can redistribute it and/or modify it
+#  under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 3, or (at your option)
+#  any later version.
+#
+#  GCC is distributed in the hope that it will be useful, but
+#  WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#  General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with GCC; see the file COPYING3.  If not see
+#  <http://www.gnu.org/licenses/>.  */
+
+# GCC testsuite that uses the `dg.exp' driver.
+
+# Exit immediately if this isn't a Visium target.
+if {![istarget visium-*-*] } then {
+  return
+}
+
+# Load support procs.
+load_lib gcc-dg.exp
+
+# If a testcase doesn't have special options, use these.
+global DEFAULT_CFLAGS
+if ![info exists DEFAULT_CFLAGS] then {
+    set DEFAULT_CFLAGS " -ansi -pedantic-errors"
+}
+
+# Initialize `dg'.
+dg-init
+
+# Main loop.
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cCS\]]] \
+	"" $DEFAULT_CFLAGS
+
+# All done.
+dg-finish
Index: gcc.target/visium/bit_shift.c
===================================================================
--- gcc.target/visium/bit_shift.c	(revision 0)
+++ gcc.target/visium/bit_shift.c	(revision 0)
@@ -0,0 +1,13 @@ 
+/* { dg-do compile } */
+/* { dg-options "-O" } */
+
+int bit_shift (long int x)
+{
+  int i, n;
+
+  for (i = n = 0; x && (i < (sizeof(long) * 8)); ++i, x >>= 1)
+    n += (int)(x & 1L);
+  return n;
+}
+
+/* { dg-final { scan-assembler-not "cmp" } } */
Index: gcc.target/visium/long_branch.c
===================================================================
--- gcc.target/visium/long_branch.c	(revision 0)
+++ gcc.target/visium/long_branch.c	(revision 0)
@@ -0,0 +1,27 @@ 
+/* { dg-do assemble } */
+
+volatile int k = 0;
+
+#define ONE k++;
+#define TEN ONE ONE ONE ONE ONE ONE ONE ONE ONE ONE
+#define HUN TEN TEN TEN TEN TEN TEN TEN TEN TEN TEN
+#define THO HUN HUN HUN HUN HUN HUN HUN HUN HUN HUN
+#define TTH THO THO THO THO THO THO THO THO THO THO THO
+
+void foo (void)
+{
+  start:
+  TTH
+  __asm__ __volatile__ ("" : : : "r28");
+  goto start;
+}
+
+#ifndef __OPTIMIZE__
+void bar (int i)
+{
+  if (i > 0)
+    {
+      TTH
+    }
+}
+#endif
Index: gcc.target/visium/bit_test.c
===================================================================
--- gcc.target/visium/bit_test.c	(revision 0)
+++ gcc.target/visium/bit_test.c	(revision 0)
@@ -0,0 +1,31 @@ 
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+extern void bar (void);
+
+void foo1 (unsigned int i)
+{
+  if (i & 4)
+    bar ();
+}
+
+void foo2 (unsigned int i)
+{
+  if (i & 0x80000000)
+    bar ();
+}
+
+void foo3 (unsigned char c)
+{
+  if (c & 4)
+    bar ();
+}
+
+void foo4 (unsigned char c)
+{
+  if (c & 0x80)
+    bar ();
+}
+
+/* { dg-final { scan-assembler-times "lsr.l" 2 } } */
+/* { dg-final { scan-assembler-times "cmp" 2 } } */