Patchwork [3/5] Altera Nios II: testsuite patches

login
register
mail settings
Submitter Chung-Lin Tang
Date April 18, 2013, 1:49 p.m.
Message ID <516FF9E6.6000406@codesourcery.com>
Download mbox | patch
Permalink /patch/237643/
State New
Headers show

Comments

Chung-Lin Tang - April 18, 2013, 1:49 p.m.
Testsuite changes, including gcc.target tests, plus some selected
filtering of some other tests.

2013-04-18  Sandra Loosemore  <sandra@codesourcery.com>
            Chung-Lin Tang  <cltang@codesourcery.com>
            Based on patches from Altera Corporation

        * gcc.dg/stack-usage-1.c (SIZE): Define case for __nios2__.
        * gcc.dg/20040813-1.c: Skip for nios2-*-*.
        * gcc.dg/20020312-2.c: Add __nios2__ case.
        * g++.dg/other/PR23205.C: Skip for nios2-*-*.
        * g++.dg/other/pr23205-2.C: Skip for nios2-*-*.
        * g++.dg/cpp0x/constexpr-rom.C: Skip for nios2-*-*.
        * g++.dg/cpp0x/alias-decl-debug-0.C: Skip for nios2-*-*.
        * g++.old-deja/g++.jason/thunk3.C: Skip for nios2-*-*.
        * lib/target-supports.exp (check_profiling_available): Check for
        nios2-*-elf.
        * gcc.c-torture/execute/pr47237.x:: Skip for nios2-*-*.
        * gcc.c-torture/execute/20101011-1.c: Skip for nios2-*-*.
        * gcc.c-torture/execute/builtins/lib/chk.c
        * gcc.target/nios2/nios2.exp: New DejaGNU file.
        * gcc.target/nios2/nios2-custom-1.c: New test.
        * gcc.target/nios2/nios2-trap-insn.c: New test.
        * gcc.target/nios2/nios2-builtin-io.c: New test.
        * gcc.target/nios2/nios2-stack-check-1.c: New test.
        * gcc.target/nios2/nios2-stack-check-2.c: New test.
        * gcc.target/nios2/nios2-rdctl.c: New test.
        * gcc.target/nios2/nios2-wrctl.c: New test.
        * gcc.target/nios2/nios2-wrctl-zero.c: New test.
        * gcc.target/nios2/nios2-wrctl-not-zero.c: New test.
        * gcc.target/nios2/nios2-rdwrctl-1.c: New test.
        * gcc.target/nios2/nios2-reg-constraints.c: New test.
        * gcc.target/nios2/nios2-ashlsi3-one_shift.c: New test.
        * gcc.target/nios2/nios2-mul-options-1.c: New test.
        * gcc.target/nios2/nios2-mul-options-2.c: New test.
        * gcc.target/nios2/nios2-mul-options-3.c: New test.
        * gcc.target/nios2/nios2-mul-options-4.c: New test.
        * gcc.target/nios2/nios2-nor.c: New test.
        * gcc.target/nios2/custom-fp-1.c: New test.
        * gcc.target/nios2/custom-fp-2.c: New test.
        * gcc.target/nios2/custom-fp-3.c: New test.
        * gcc.target/nios2/custom-fp-4.c: New test.
        * gcc.target/nios2/custom-fp-5.c: New test.
        * gcc.target/nios2/custom-fp-6.c: New test.
        * gcc.target/nios2/custom-fp-7.c: New test.
        * gcc.target/nios2/custom-fp-conversion.c: New test.
        * gcc.target/nios2/custom-fp-double.c: New test.
        * gcc.target/nios2/custom-fp-float.c: New test.
        * gcc.target/nios2/nios2-int-types.c: New test.
        * gcc.target/nios2/nios2-cache-1.c: New test.
        * gcc.target/nios2/nios2-cache-2.c: New test.
Chung-Lin Tang - April 18, 2013, 1:55 p.m.
On 2013/4/18 09:49 PM, Chung-Lin Tang wrote:
> Testsuite changes, including gcc.target tests, plus some selected
> filtering of some other tests.
> 
> 2013-04-18  Sandra Loosemore  <sandra@codesourcery.com>
>             Chung-Lin Tang  <cltang@codesourcery.com>
>             Based on patches from Altera Corporation

Missed filling in one ChangeLog entry in last post:

	* gcc.c-torture/execute/builtins/lib/chk.c (memset): Place
	char-based memset loop before inline check, to prevent
	problems when called to initialize .bss. Update comments.

Patch

Index: gcc/testsuite/gcc.dg/stack-usage-1.c
===================================================================
--- gcc/testsuite/gcc.dg/stack-usage-1.c	(revision 407083)
+++ gcc/testsuite/gcc.dg/stack-usage-1.c	(revision 409063)
@@ -68,6 +68,8 @@ 
 #  define SIZE 248
 #elif defined (xstormy16)
 #  define SIZE 254
+#elif defined (__nios2__)
+#  define SIZE 252
 #else
 #  define SIZE 256
 #endif
Index: gcc/testsuite/gcc.dg/20040813-1.c
===================================================================
--- gcc/testsuite/gcc.dg/20040813-1.c	(revision 407083)
+++ gcc/testsuite/gcc.dg/20040813-1.c	(revision 409063)
@@ -2,7 +2,7 @@ 
 /* Contributed by Devang Patel  <dpatel@apple.com>  */
 
 /* { dg-do compile } */
-/* { dg-skip-if "No stabs" { aarch64*-*-* mmix-*-* *-*-aix* alpha*-*-* hppa*64*-*-* ia64-*-* tile*-*-* *-*-vxworks* } { "*" } { "" } } */
+/* { dg-skip-if "No stabs" { aarch64*-*-* mmix-*-* *-*-aix* alpha*-*-* hppa*64*-*-* ia64-*-* tile*-*-* nios2-*-* *-*-vxworks* } { "*" } { "" } } */
 /* { dg-options "-gstabs" } */
 
 int
Index: gcc/testsuite/gcc.dg/20020312-2.c
===================================================================
--- gcc/testsuite/gcc.dg/20020312-2.c	(revision 407083)
+++ gcc/testsuite/gcc.dg/20020312-2.c	(revision 409063)
@@ -52,6 +52,8 @@ 
 /* No pic register.  */
 #elif defined(__moxie__)
 /* No pic register.  */
+#elif defined(__nios2__)
+/* No pic register.  */
 #elif defined(__hppa__)
 /* PIC register is %r27 or %r19, but is used even without -fpic.  */
 #elif defined(__pdp11__)
Index: gcc/testsuite/g++.dg/other/PR23205.C
===================================================================
--- gcc/testsuite/g++.dg/other/PR23205.C	(revision 407083)
+++ gcc/testsuite/g++.dg/other/PR23205.C	(revision 409063)
@@ -1,5 +1,5 @@ 
 /* { dg-do compile } */
-/* { dg-skip-if "No stabs" { aarch64*-*-* mmix-*-* *-*-aix* alpha*-*-* hppa*64*-*-* ia64-*-* tile*-*-* *-*-vxworks } { "*" } { "" } } */
+/* { dg-skip-if "No stabs" { aarch64*-*-* mmix-*-* *-*-aix* alpha*-*-* hppa*64*-*-* ia64-*-* nios2-*-* tile*-*-* *-*-vxworks } { "*" } { "" } } */
 /* { dg-options "-gstabs+ -fno-eliminate-unused-debug-types" } */
 
 const int foobar = 4;
Index: gcc/testsuite/g++.dg/other/pr23205-2.C
===================================================================
--- gcc/testsuite/g++.dg/other/pr23205-2.C	(revision 407083)
+++ gcc/testsuite/g++.dg/other/pr23205-2.C	(revision 409063)
@@ -1,5 +1,5 @@ 
 /* { dg-do compile } */
-/* { dg-skip-if "No stabs" { aarch64*-*-* mmix-*-* *-*-aix* alpha*-*-* hppa*64*-*-* ia64-*-* tile*-*-* } { "*" } { "" } } */
+/* { dg-skip-if "No stabs" { aarch64*-*-* mmix-*-* *-*-aix* alpha*-*-* hppa*64*-*-* ia64-*-* tile*-*-* nios2-*-* } { "*" } { "" } } */
 /* { dg-options "-gstabs+ -fno-eliminate-unused-debug-types -ftoplevel-reorder" } */
 
 const int foobar = 4;
Index: gcc/testsuite/g++.dg/cpp0x/constexpr-rom.C
===================================================================
--- gcc/testsuite/g++.dg/cpp0x/constexpr-rom.C	(revision 407083)
+++ gcc/testsuite/g++.dg/cpp0x/constexpr-rom.C	(revision 409063)
@@ -1,6 +1,6 @@ 
 // PR c++/49673: check that test_data goes into .rodata
 // { dg-options -std=c++0x }
-// { dg-additional-options -G0 { target { { alpha*-*-* frv*-*-* ia64-*-* lm32*-*-* m32r*-*-* microblaze*-*-* mips*-*-* powerpc*-*-* rs6000*-*-* score*-*-* } && { ! { *-*-darwin* *-*-aix* alpha*-*-*vms* } } } } }
+// { dg-additional-options -G0 { target { { alpha*-*-* frv*-*-* ia64-*-* lm32*-*-* m32r*-*-* microblaze*-*-* mips*-*-* nios2-*-* powerpc*-*-* rs6000*-*-* score*-*-* } && { ! { *-*-darwin* *-*-aix* alpha*-*-*vms* } } } } }
 // { dg-final { scan-assembler "\\.rdata" { target mips*-*-* } } }
 // { dg-final { scan-assembler "rodata" { target { { *-*-linux-gnu || *-*-elf } && { ! mips*-*-* } } } } }
 
Index: gcc/testsuite/g++.dg/cpp0x/alias-decl-debug-0.C
===================================================================
--- gcc/testsuite/g++.dg/cpp0x/alias-decl-debug-0.C	(revision 407083)
+++ gcc/testsuite/g++.dg/cpp0x/alias-decl-debug-0.C	(revision 409063)
@@ -1,5 +1,5 @@ 
 // Origin: PR c++/51032
-// { dg-skip-if "No stabs" { mmix-*-* *-*-aix* alpha*-*-* hppa*64*-*-* ia64-*-* *-*-vxworks* } { "*" } { "" } }
+// { dg-skip-if "No stabs" { mmix-*-* *-*-aix* alpha*-*-* hppa*64*-*-* ia64-*-* *-*-vxworks* nios2-*-* } { "*" } { "" } }
 // { dg-options "-std=c++0x -gstabs+" }
 
 template <class C>
Index: gcc/testsuite/lib/target-supports.exp
===================================================================
--- gcc/testsuite/lib/target-supports.exp	(revision 407083)
+++ gcc/testsuite/lib/target-supports.exp	(revision 409063)
@@ -529,6 +529,7 @@ 
 	     || [istarget mmix-*-*]
 	     || [istarget mn10300-*-elf*]
 	     || [istarget moxie-*-elf*]
+	     || [istarget nios2-*-elf]
 	     || [istarget picochip-*-*]
 	     || [istarget powerpc-*-eabi*]
 	     || [istarget powerpc-*-elf]
Index: gcc/testsuite/gcc.c-torture/execute/pr47237.x
===================================================================
--- gcc/testsuite/gcc.c-torture/execute/pr47237.x	(revision 0)
+++ gcc/testsuite/gcc.c-torture/execute/pr47237.x	(revision 409063)
@@ -0,0 +1,6 @@ 
+if { [istarget "nios2-*-*"] } {
+    # This test can cause the stack to underflow on Nios II.
+    set torture_execute_xfail [istarget]
+}
+
+return 0
Index: gcc/testsuite/gcc.c-torture/execute/20101011-1.c
===================================================================
--- gcc/testsuite/gcc.c-torture/execute/20101011-1.c	(revision 407083)
+++ gcc/testsuite/gcc.c-torture/execute/20101011-1.c	(revision 409063)
@@ -61,6 +61,10 @@ 
 }
 #  define DO_TEST 1
 # endif
+#elif defined (__nios2__)
+  /* Nios II requires both hardware support and user configuration to
+     raise an exception on divide by zero.  */
+# define DO_TEST 0
 #else
 # define DO_TEST 1
 #endif
Index: gcc/testsuite/gcc.c-torture/execute/builtins/lib/chk.c
===================================================================
--- gcc/testsuite/gcc.c-torture/execute/builtins/lib/chk.c	(revision 407083)
+++ gcc/testsuite/gcc.c-torture/execute/builtins/lib/chk.c	(revision 409063)
@@ -124,16 +124,17 @@ 
 void *
 memset (void *dst, int c, __SIZE_TYPE__ n)
 {
+  while (n-- != 0)
+    n[(char *) dst] = c;
+
   /* Single-byte memsets should be done inline when optimisation
-     is enabled.  */
+     is enabled.  Do this after the copy in case we're being called to
+     initialize bss.  */
 #ifdef __OPTIMIZE__
   if (memset_disallowed && inside_main && n < 2)
     abort ();
 #endif
 
-  while (n-- != 0)
-    n[(char *) dst] = c;
-
   return dst;
 }
 
Index: gcc/testsuite/gcc.target/nios2/nios2-wrctl-zero.c
===================================================================
--- gcc/testsuite/gcc.target/nios2/nios2-wrctl-zero.c	(revision 0)
+++ gcc/testsuite/gcc.target/nios2/nios2-wrctl-zero.c	(revision 409063)
@@ -0,0 +1,7 @@ 
+/* { dg-do compile { target nios2-*-* } } */
+/* { dg-options "-O1" } */
+/* { dg-final { scan-assembler "wrctl\\tctl6, zero" } } */
+
+void foo(void){
+  __builtin_wrctl(6,0);
+}
Index: gcc/testsuite/gcc.target/nios2/nios2-rdctl.c
===================================================================
--- gcc/testsuite/gcc.target/nios2/nios2-rdctl.c	(revision 0)
+++ gcc/testsuite/gcc.target/nios2/nios2-rdctl.c	(revision 409063)
@@ -0,0 +1,8 @@ 
+/* { dg-do compile { target nios2-*-* } } */
+/* { dg-final { scan-assembler "rdctl" } } */
+
+int x ()
+{
+  __builtin_rdctl (0);
+  return 0;
+} 
Index: gcc/testsuite/gcc.target/nios2/custom-fp-conversion.c
===================================================================
--- gcc/testsuite/gcc.target/nios2/custom-fp-conversion.c	(revision 0)
+++ gcc/testsuite/gcc.target/nios2/custom-fp-conversion.c	(revision 409063)
@@ -0,0 +1,66 @@ 
+/* Test generation of conversion custom instructions.  */
+
+/* { dg-do compile } */
+/* { dg-options "-O1 -ffinite-math-only -funsafe-math-optimizations" } */
+
+/* -O1 in the options is significant.  Without it FP operations may not be
+   optimized to custom instructions.  */
+
+#include <stdio.h> 
+#include <math.h>
+
+#pragma GCC target ("custom-frdxhi=40")
+#pragma GCC target ("custom-frdxlo=41")
+#pragma GCC target ("custom-frdy=42")
+#pragma GCC target ("custom-fwrx=43")
+#pragma GCC target ("custom-fwry=44")
+
+#pragma GCC target ("custom-fextsd=100")
+#pragma GCC target ("custom-fixdi=101")
+#pragma GCC target ("custom-fixdu=102")
+#pragma GCC target ("custom-fixsi=103")
+#pragma GCC target ("custom-fixsu=104")
+#pragma GCC target ("custom-floatid=105")
+#pragma GCC target ("custom-floatis=106")
+#pragma GCC target ("custom-floatud=107")
+#pragma GCC target ("custom-floatus=108")
+#pragma GCC target ("custom-ftruncds=109")
+
+typedef struct data {
+  double fextsd;
+  int fixdi;
+  unsigned fixdu;
+  int fixsi;
+  unsigned fixsu;
+  double floatid;
+  float floatis;
+  double floatud;
+  float floatus;
+  float ftruncds;
+} data_t;
+
+void
+custom_fp (int i, unsigned u, float f, double d, data_t *out)
+{
+  out->fextsd = (double) f;
+  out->fixdi = (int) d;
+  out->fixdu = (unsigned) d;
+  out->fixsi = (int) f;
+  out->fixsu = (unsigned) f;
+  out->floatid = (double) i;
+  out->floatis = (float) i;
+  out->floatud = (double) u;
+  out->floatus = (float) u;
+  out->ftruncds = (float) d;
+}
+
+/* { dg-final { scan-assembler "custom\\t100, .* # fextsd .*" } } */
+/* { dg-final { scan-assembler "custom\\t101, .* # fixdi .*" } } */
+/* { dg-final { scan-assembler "custom\\t102, .* # fixdu .*" } } */
+/* { dg-final { scan-assembler "custom\\t103, .* # fixsi .*" } } */
+/* { dg-final { scan-assembler "custom\\t104, .* # fixsu .*" } } */
+/* { dg-final { scan-assembler "custom\\t105, .* # floatid .*" } } */
+/* { dg-final { scan-assembler "custom\\t106, .* # floatis .*" } } */
+/* { dg-final { scan-assembler "custom\\t107, .* # floatud .*" } } */
+/* { dg-final { scan-assembler "custom\\t108, .* # floatus .*" } } */
+/* { dg-final { scan-assembler "custom\\t109, .* # ftruncds .*" } } */
Index: gcc/testsuite/gcc.target/nios2/nios2-custom-1.c
===================================================================
--- gcc/testsuite/gcc.target/nios2/nios2-custom-1.c	(revision 0)
+++ gcc/testsuite/gcc.target/nios2/nios2-custom-1.c	(revision 409063)
@@ -0,0 +1,64 @@ 
+/* { dg-do compile { target nios2-*-* } } */
+
+float fres, f1, f2;
+int ires, i1, i2;
+void *pres, *p1, *p2;
+
+void x ()
+{
+  __builtin_custom_n (0);
+  __builtin_custom_ni (1, i1);
+  __builtin_custom_nf (2, f1);
+  __builtin_custom_np (3, p1);
+  __builtin_custom_nii (4, i1, i2);
+  __builtin_custom_nif (5, i1, f2);
+  __builtin_custom_nip (6, i1, p2);
+  __builtin_custom_nfi (7, f1, i2);
+  __builtin_custom_nff (8, f1, f2);
+  __builtin_custom_nfp (9, f1, p2);
+  __builtin_custom_npi (10, p1, i2);
+  __builtin_custom_npf (11, p1, f2);
+  __builtin_custom_npp (12, p1, p2);
+
+  ires = __builtin_custom_in (13+0);
+  ires = __builtin_custom_ini (13+1, i1);
+  ires = __builtin_custom_inf (13+2, f1);
+  ires = __builtin_custom_inp (13+3, p1);
+  ires = __builtin_custom_inii (13+4, i1, i2);
+  ires = __builtin_custom_inif (13+5, i1, f2);
+  ires = __builtin_custom_inip (13+6, i1, p2);
+  ires = __builtin_custom_infi (13+7, f1, i2);
+  ires = __builtin_custom_inff (13+8, f1, f2);
+  ires = __builtin_custom_infp (13+9, f1, p2);
+  ires = __builtin_custom_inpi (13+10, p1, i2);
+  ires = __builtin_custom_inpf (13+11, p1, f2);
+  ires = __builtin_custom_inpp (13+12, p1, p2);
+
+  fres = __builtin_custom_fn (26+0);
+  fres = __builtin_custom_fni (26+1, i1);
+  fres = __builtin_custom_fnf (26+2, f1);
+  fres = __builtin_custom_fnp (26+3, p1);
+  fres = __builtin_custom_fnii (26+4, i1, i2);
+  fres = __builtin_custom_fnif (26+5, i1, f2);
+  fres = __builtin_custom_fnip (26+6, i1, p2);
+  fres = __builtin_custom_fnfi (26+7, f1, i2);
+  fres = __builtin_custom_fnff (26+8, f1, f2);
+  fres = __builtin_custom_fnfp (26+9, f1, p2);
+  fres = __builtin_custom_fnpi (26+10, p1, i2);
+  fres = __builtin_custom_fnpf (26+11, p1, f2);
+  fres = __builtin_custom_fnpp (26+12, p1, p2);
+
+  pres = __builtin_custom_pn (39+0);
+  pres = __builtin_custom_pni (39+1, i1);
+  pres = __builtin_custom_pnf (39+2, f1);
+  pres = __builtin_custom_pnp (39+3, p1);
+  pres = __builtin_custom_pnii (39+4, i1, i2);
+  pres = __builtin_custom_pnif (39+5, i1, f2);
+  pres = __builtin_custom_pnip (39+6, i1, p2);
+  pres = __builtin_custom_pnfi (39+7, f1, i2);
+  pres = __builtin_custom_pnff (39+8, f1, f2);
+  pres = __builtin_custom_pnfp (39+9, f1, p2);
+  pres = __builtin_custom_pnpi (39+10, p1, i2);
+  pres = __builtin_custom_pnpf (39+11, p1, f2);
+  pres = __builtin_custom_pnpp (39+12, p1, p2);
+} 
Index: gcc/testsuite/gcc.target/nios2/nios2-trap-insn.c
===================================================================
--- gcc/testsuite/gcc.target/nios2/nios2-trap-insn.c	(revision 0)
+++ gcc/testsuite/gcc.target/nios2/nios2-trap-insn.c	(revision 409063)
@@ -0,0 +1,7 @@ 
+/* { dg-do compile { target nios2-*-* } } */
+/* { dg-final { scan-assembler "break\\t3" } } */
+
+/* Test the nios2 trap instruction */
+void foo(void){
+  __builtin_trap();
+}
Index: gcc/testsuite/gcc.target/nios2/nios2-builtin-io.c
===================================================================
--- gcc/testsuite/gcc.target/nios2/nios2-builtin-io.c	(revision 0)
+++ gcc/testsuite/gcc.target/nios2/nios2-builtin-io.c	(revision 409063)
@@ -0,0 +1,26 @@ 
+/* { dg-do compile { target nios2-*-* } } */
+/* { dg-final { scan-assembler "ldbio" } } */
+/* { dg-final { scan-assembler "ldbuio" } } */
+/* { dg-final { scan-assembler "ldhio" } } */
+/* { dg-final { scan-assembler "ldhuio" } } */
+/* { dg-final { scan-assembler "ldwio" } } */
+/* { dg-final { scan-assembler "stbio" } } */
+/* { dg-final { scan-assembler "sthio" } } */
+/* { dg-final { scan-assembler "stwio" } } */
+
+volatile char b;
+volatile short h;
+volatile int w;
+
+void x ()
+{
+  __builtin_ldbio (&b);
+  __builtin_ldbuio (&b);
+  __builtin_ldhio (&h);
+  __builtin_ldhuio (&h);
+  __builtin_ldwio (&w);
+
+  __builtin_stbio (&b, 42);
+  __builtin_sthio (&h, 43);
+  __builtin_stwio (&w, 44);
+} 
Index: gcc/testsuite/gcc.target/nios2/nios2.exp
===================================================================
--- gcc/testsuite/gcc.target/nios2/nios2.exp	(revision 0)
+++ gcc/testsuite/gcc.target/nios2/nios2.exp	(revision 409063)
@@ -0,0 +1,41 @@ 
+# Copyright (C) 2012 Free Software Foundation, Inc.
+
+# This program 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 of the License, or
+# (at your option) any later version.
+# 
+# This program 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 Nios II target.
+if ![istarget nios2*-*-*] 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/testsuite/gcc.target/nios2/nios2-stack-check-1.c
===================================================================
--- gcc/testsuite/gcc.target/nios2/nios2-stack-check-1.c	(revision 0)
+++ gcc/testsuite/gcc.target/nios2/nios2-stack-check-1.c	(revision 409063)
@@ -0,0 +1,9 @@ 
+/* { dg-do compile { target nios2-*-* } } */
+/* { dg-options "-fstack-limit-register=et" } */
+/* { dg-final { scan-assembler "bgeu\\tsp, et" } } */
+/* { dg-final { scan-assembler "break\\t3" } } */
+/* check stack checking */
+void test()
+{
+  int a, b, c;
+}
Index: gcc/testsuite/gcc.target/nios2/nios2-stack-check-2.c
===================================================================
--- gcc/testsuite/gcc.target/nios2/nios2-stack-check-2.c	(revision 0)
+++ gcc/testsuite/gcc.target/nios2/nios2-stack-check-2.c	(revision 409063)
@@ -0,0 +1,9 @@ 
+/* { dg-do compile { target nios2-*-* } } */
+/* { dg-options " " } */
+/* { dg-final { scan-assembler-not "bgeu\\tsp, et" } } */
+/* { dg-final { scan-assembler-not "break\\t3" } } */
+/* check stack checking */
+void test()
+{
+  int a, b, c;
+}
Index: gcc/testsuite/gcc.target/nios2/nios2-rdwrctl-1.c
===================================================================
--- gcc/testsuite/gcc.target/nios2/nios2-rdwrctl-1.c	(revision 0)
+++ gcc/testsuite/gcc.target/nios2/nios2-rdwrctl-1.c	(revision 409063)
@@ -0,0 +1,14 @@ 
+/* { dg-do compile { target nios2-*-* } } */
+
+volatile int res;
+
+void x ()
+{
+  __builtin_wrctl (0, res);
+  __builtin_wrctl (15, res);
+  __builtin_wrctl (31, res);
+
+  res = __builtin_rdctl (0);
+  res = __builtin_rdctl (15);
+  res = __builtin_rdctl (31);
+} 
Index: gcc/testsuite/gcc.target/nios2/nios2-reg-constraints.c
===================================================================
--- gcc/testsuite/gcc.target/nios2/nios2-reg-constraints.c	(revision 0)
+++ gcc/testsuite/gcc.target/nios2/nios2-reg-constraints.c	(revision 409063)
@@ -0,0 +1,11 @@ 
+/* { dg-do compile { target nios2-*-* } } */
+/* { dg-final { scan-assembler "screwy r2 r3 r4 r5 r6 r7" } } */
+
+int a, b, c, x, y, z;
+
+void test()
+{
+  __asm__ ("#screwy %0 %1 %2 %3 %4 %5" : "=D02" (a), "=D03" (b), "=D04" (c) : 
+           "D05" (x), "D06" (y), "D07" (z));
+}
+  
Index: gcc/testsuite/gcc.target/nios2/nios2-ashlsi3-one_shift.c
===================================================================
--- gcc/testsuite/gcc.target/nios2/nios2-ashlsi3-one_shift.c	(revision 0)
+++ gcc/testsuite/gcc.target/nios2/nios2-ashlsi3-one_shift.c	(revision 409063)
@@ -0,0 +1,10 @@ 
+/* { dg-do compile { target nios2-*-* } } */
+/* { dg-options " " } */
+/* { dg-final { scan-assembler-not "slli" } } */
+
+int x;
+
+void foo(void)
+{
+  x <<= 1;
+}
Index: gcc/testsuite/gcc.target/nios2/custom-fp-1.c
===================================================================
--- gcc/testsuite/gcc.target/nios2/custom-fp-1.c	(revision 0)
+++ gcc/testsuite/gcc.target/nios2/custom-fp-1.c	(revision 409063)
@@ -0,0 +1,22 @@ 
+/* Test specification of custom instructions via command-line options.  */
+
+/* { dg-do compile } */
+/* { dg-options "-O1 -ffinite-math-only -mcustom-fmaxs=246 -mcustom-fmins=247 -mcustom-fsqrts=251" } */
+
+/* -O1 in the options is significant.  Without it FP operations may not be
+   optimized to custom instructions.  */
+
+#include <stdio.h> 
+#include <math.h>
+
+void
+custom_fp (float operand_a, float operand_b, float *result)
+{
+  result[0] = fmaxf (operand_a, operand_b);
+  result[1] = fminf (operand_a, operand_b);
+  result[2] = sqrtf (operand_a);
+}
+
+/* { dg-final { scan-assembler "custom\\t246, .* # fmaxs .*" } } */
+/* { dg-final { scan-assembler "custom\\t247, .* # fmins .*" } } */
+/* { dg-final { scan-assembler "custom\\t251, .* # fsqrts .*" } } */
Index: gcc/testsuite/gcc.target/nios2/custom-fp-2.c
===================================================================
--- gcc/testsuite/gcc.target/nios2/custom-fp-2.c	(revision 0)
+++ gcc/testsuite/gcc.target/nios2/custom-fp-2.c	(revision 409063)
@@ -0,0 +1,26 @@ 
+/* Test specification of custom instructions via pragmas.  */
+
+/* { dg-do compile } */
+/* { dg-options "-O1 -ffinite-math-only" } */
+
+/* -O1 in the options is significant.  Without it FP operations may not be
+   optimized to custom instructions.  */
+
+#include <stdio.h> 
+#include <math.h>
+
+#pragma GCC target ("custom-fmaxs=246")
+#pragma GCC target ("custom-fmins=247")
+#pragma GCC target ("custom-fsqrts=251")
+
+void
+custom_fp (float operand_a, float operand_b, float *result)
+{
+  result[0] = fmaxf (operand_a, operand_b);
+  result[1] = fminf (operand_a, operand_b);
+  result[2] = sqrtf (operand_a);
+}
+
+/* { dg-final { scan-assembler "custom\\t246, .* # fmaxs .*" } } */
+/* { dg-final { scan-assembler "custom\\t247, .* # fmins .*" } } */
+/* { dg-final { scan-assembler "custom\\t251, .* # fsqrts .*" } } */
Index: gcc/testsuite/gcc.target/nios2/nios2-mul-options-1.c
===================================================================
--- gcc/testsuite/gcc.target/nios2/nios2-mul-options-1.c	(revision 0)
+++ gcc/testsuite/gcc.target/nios2/nios2-mul-options-1.c	(revision 409063)
@@ -0,0 +1,11 @@ 
+/* { dg-do compile { target nios2-*-* } } */
+/* { dg-options "" } */
+/* { dg-final { scan-assembler "__muldi3" } } */
+
+long long x, y, z;
+
+void test()
+{
+  x = y * z;
+}
+  
Index: gcc/testsuite/gcc.target/nios2/custom-fp-3.c
===================================================================
--- gcc/testsuite/gcc.target/nios2/custom-fp-3.c	(revision 0)
+++ gcc/testsuite/gcc.target/nios2/custom-fp-3.c	(revision 409063)
@@ -0,0 +1,26 @@ 
+/* Test specification of custom instructions via function attributes.  */
+
+/* { dg-do compile } */
+/* { dg-options "-O1 -ffinite-math-only" } */
+
+/* -O1 in the options is significant.  Without it FP operations may not be
+   optimized to custom instructions.  */
+
+#include <stdio.h> 
+#include <math.h>
+
+extern void
+custom_fp (float operand_a, float operand_b, float *result)
+  __attribute__ ((target ("custom-fmaxs=246,custom-fmins=247,custom-fsqrts=251")));
+
+void
+custom_fp (float operand_a, float operand_b, float *result)
+{
+  result[0] = fmaxf (operand_a, operand_b);
+  result[1] = fminf (operand_a, operand_b);
+  result[2] = sqrtf (operand_a);
+}
+
+/* { dg-final { scan-assembler "custom\\t246, .* # fmaxs .*" } } */
+/* { dg-final { scan-assembler "custom\\t247, .* # fmins .*" } } */
+/* { dg-final { scan-assembler "custom\\t251, .* # fsqrts .*" } } */
Index: gcc/testsuite/gcc.target/nios2/nios2-mul-options-2.c
===================================================================
--- gcc/testsuite/gcc.target/nios2/nios2-mul-options-2.c	(revision 0)
+++ gcc/testsuite/gcc.target/nios2/nios2-mul-options-2.c	(revision 409063)
@@ -0,0 +1,11 @@ 
+/* { dg-do compile { target nios2-*-* } } */
+/* { dg-options "-mhw-mulx" } */
+/* { dg-final { scan-assembler-not "__muldi3" } } */
+
+long long x, y, z;
+
+void test()
+{
+  x = y * z;
+}
+  
Index: gcc/testsuite/gcc.target/nios2/custom-fp-4.c
===================================================================
--- gcc/testsuite/gcc.target/nios2/custom-fp-4.c	(revision 0)
+++ gcc/testsuite/gcc.target/nios2/custom-fp-4.c	(revision 409063)
@@ -0,0 +1,29 @@ 
+/* Test conflict between pragma and attribute specification of custom
+   instructions.  */
+
+/* { dg-do compile } */
+/* { dg-options "-O1 -ffinite-math-only" } */
+
+/* -O1 in the options is significant.  Without it FP operations may not be
+   optimized to custom instructions.  */
+
+#include <stdio.h> 
+#include <math.h>
+
+/* This test case is expected to cause an error because GCC does not know
+   how to merge different custom instruction attribute sets.  The extern
+   declaration sees the options specified by both the pragma and the function
+   attribute, but the function definition sees only the pragma options.  */
+
+#pragma GCC target ("custom-fmaxs=246")
+
+extern void
+custom_fp (float operand_a, float operand_b, float *result)
+  __attribute__ ((target ("custom-fmins=247")));
+
+void
+custom_fp (float operand_a, float operand_b, float *result)
+{   /* { dg-error "conflicting" } */
+  result[0] = fmaxf (operand_a, operand_b);
+  result[1] = fminf (operand_a, operand_b);
+}
Index: gcc/testsuite/gcc.target/nios2/nios2-mul-options-3.c
===================================================================
--- gcc/testsuite/gcc.target/nios2/nios2-mul-options-3.c	(revision 0)
+++ gcc/testsuite/gcc.target/nios2/nios2-mul-options-3.c	(revision 409063)
@@ -0,0 +1,11 @@ 
+/* { dg-do compile { target nios2-*-* } } */
+/* { dg-options "" } */
+/* { dg-final { scan-assembler-not "__mulsi3" } } */
+
+int x, y, z;
+
+void test()
+{
+  x = y * z;
+}
+  
Index: gcc/testsuite/gcc.target/nios2/custom-fp-5.c
===================================================================
--- gcc/testsuite/gcc.target/nios2/custom-fp-5.c	(revision 0)
+++ gcc/testsuite/gcc.target/nios2/custom-fp-5.c	(revision 409063)
@@ -0,0 +1,26 @@ 
+/* Test that forward declaration and definition don't conflict when used
+   with pragma specification of custom instructions.  */
+
+/* { dg-do compile } */
+/* { dg-options "-O1 -ffinite-math-only" } */
+
+/* -O1 in the options is significant.  Without it FP operations may not be
+   optimized to custom instructions.  */
+
+#include <stdio.h> 
+#include <math.h>
+
+#pragma GCC target ("custom-fmaxs=246,custom-fmins=247")
+
+extern void
+custom_fp (float operand_a, float operand_b, float *result);
+
+void
+custom_fp (float operand_a, float operand_b, float *result)
+{
+  result[0] = fmaxf (operand_a, operand_b);
+  result[1] = fminf (operand_a, operand_b);
+}
+
+/* { dg-final { scan-assembler "custom\\t246, .* # fmaxs .*" } } */
+/* { dg-final { scan-assembler "custom\\t247, .* # fmins .*" } } */
Index: gcc/testsuite/gcc.target/nios2/nios2-mul-options-4.c
===================================================================
--- gcc/testsuite/gcc.target/nios2/nios2-mul-options-4.c	(revision 0)
+++ gcc/testsuite/gcc.target/nios2/nios2-mul-options-4.c	(revision 409063)
@@ -0,0 +1,11 @@ 
+/* { dg-do compile { target nios2-*-* } } */
+/* { dg-options "-mno-hw-mul" } */
+/* { dg-final { scan-assembler "__mulsi3" } } */
+
+int x, y, z;
+
+void test()
+{
+  x = y * z;
+}
+  
Index: gcc/testsuite/gcc.target/nios2/custom-fp-float.c
===================================================================
--- gcc/testsuite/gcc.target/nios2/custom-fp-float.c	(revision 0)
+++ gcc/testsuite/gcc.target/nios2/custom-fp-float.c	(revision 409063)
@@ -0,0 +1,80 @@ 
+/* Test generation of all single-float custom instructions.  */
+
+/* { dg-do compile } */
+/* { dg-options "-O1 -ffinite-math-only -funsafe-math-optimizations" } */
+
+/* -O1 in the options is significant.  Without it FP operations may not be
+   optimized to custom instructions.  */
+
+#include <stdio.h> 
+#include <math.h>
+
+#pragma GCC target ("custom-fabss=100")
+#pragma GCC target ("custom-fadds=101")
+#pragma GCC target ("custom-fatans=102")
+#pragma GCC target ("custom-fcoss=103")
+#pragma GCC target ("custom-fdivs=104")
+#pragma GCC target ("custom-fexps=105")
+#pragma GCC target ("custom-flogs=106")
+#pragma GCC target ("custom-fmaxs=107")
+#pragma GCC target ("custom-fmins=108")
+#pragma GCC target ("custom-fmuls=109")
+#pragma GCC target ("custom-fnegs=110")
+#pragma GCC target ("custom-fsins=111")
+#pragma GCC target ("custom-fsqrts=112")
+#pragma GCC target ("custom-fsubs=113")
+#pragma GCC target ("custom-ftans=114")
+#pragma GCC target ("custom-fcmpeqs=200")
+#pragma GCC target ("custom-fcmpges=201")
+#pragma GCC target ("custom-fcmpgts=202")
+#pragma GCC target ("custom-fcmples=203")
+#pragma GCC target ("custom-fcmplts=204")
+#pragma GCC target ("custom-fcmpnes=205")
+
+void
+custom_fp (float a, float b, float *fp, int *ip)
+{
+  fp[0] = fabsf (a);
+  fp[1] = a + b;
+  fp[2] = atanf (a);
+  fp[3] = cosf (a);
+  fp[4] = a / b;
+  fp[5] = expf (a);
+  fp[6] = logf (a);
+  fp[7] = fmaxf (a, b);
+  fp[8] = fminf (a, b);
+  fp[9] = a * b;
+  fp[10] = -b;
+  fp[11] = sinf (b);
+  fp[12] = sqrtf (a);
+  fp[13] = a - b;
+  fp[14] = tanf (a);
+  ip[0] = (a == fp[0]);
+  ip[1] = (a >= fp[1]);
+  ip[2] = (a > fp[2]);
+  ip[3] = (a <= fp[3]);
+  ip[4] = (a < fp[4]);
+  ip[5] = (a != fp[5]);
+}
+
+/* { dg-final { scan-assembler "custom\\t100, .* # fabss .*" } } */
+/* { dg-final { scan-assembler "custom\\t101, .* # fadds .*" } } */
+/* { dg-final { scan-assembler "custom\\t102, .* # fatans .*" } } */
+/* { dg-final { scan-assembler "custom\\t103, .* # fcoss .*" } } */
+/* { dg-final { scan-assembler "custom\\t104, .* # fdivs .*" } } */
+/* { dg-final { scan-assembler "custom\\t105, .* # fexps .*" } } */
+/* { dg-final { scan-assembler "custom\\t106, .* # flogs .*" } } */
+/* { dg-final { scan-assembler "custom\\t107, .* # fmaxs .*" } } */
+/* { dg-final { scan-assembler "custom\\t108, .* # fmins .*" } } */
+/* { dg-final { scan-assembler "custom\\t109, .* # fmuls .*" } } */
+/* { dg-final { scan-assembler "custom\\t110, .* # fnegs .*" } } */
+/* { dg-final { scan-assembler "custom\\t111, .* # fsins .*" } } */
+/* { dg-final { scan-assembler "custom\\t112, .* # fsqrts .*" } } */
+/* { dg-final { scan-assembler "custom\\t113, .* # fsubs .*" } } */
+/* { dg-final { scan-assembler "custom\\t114, .* # ftans .*" } } */
+/* { dg-final { scan-assembler "custom\\t200, .* # fcmpeqs .*" } } */
+/* { dg-final { scan-assembler "custom\\t201, .* # fcmpges .*" } } */
+/* { dg-final { scan-assembler "custom\\t202, .* # fcmpgts .*" } } */
+/* { dg-final { scan-assembler "custom\\t203, .* # fcmples .*" } } */
+/* { dg-final { scan-assembler "custom\\t204, .* # fcmplts .*" } } */
+/* { dg-final { scan-assembler "custom\\t205, .* # fcmpnes .*" } } */
Index: gcc/testsuite/gcc.target/nios2/custom-fp-6.c
===================================================================
--- gcc/testsuite/gcc.target/nios2/custom-fp-6.c	(revision 0)
+++ gcc/testsuite/gcc.target/nios2/custom-fp-6.c	(revision 409063)
@@ -0,0 +1,30 @@ 
+/* Test conflict between pragma and attribute specification of custom
+   instructions.  */
+
+/* { dg-do compile } */
+/* { dg-options "-O1 -ffinite-math-only" } */
+
+/* -O1 in the options is significant.  Without it FP operations may not be
+   optimized to custom instructions.  */
+
+#include <stdio.h> 
+#include <math.h>
+
+/* This test case is expected to cause an error because GCC does not know
+   how to merge different custom instruction attribute sets, even if they
+   do not overlap.  */
+
+extern void
+custom_fp (float operand_a, float operand_b, float *result)
+  __attribute__ ((target ("custom-fmaxs=246")));
+
+extern void
+custom_fp (float operand_a, float operand_b, float *result)
+  __attribute__ ((target ("custom-fmins=247")));    /* { dg-error "conflicting" } */
+
+void
+custom_fp (float operand_a, float operand_b, float *result)
+{
+  result[0] = fmaxf (operand_a, operand_b);
+  result[1] = fminf (operand_a, operand_b);
+}
Index: gcc/testsuite/gcc.target/nios2/custom-fp-7.c
===================================================================
--- gcc/testsuite/gcc.target/nios2/custom-fp-7.c	(revision 0)
+++ gcc/testsuite/gcc.target/nios2/custom-fp-7.c	(revision 409063)
@@ -0,0 +1,33 @@ 
+/* Test that duplicate declarations with the same custom insn attributes
+   don't cause an error.  */
+
+/* { dg-do compile } */
+/* { dg-options "-O1 -ffinite-math-only" } */
+
+/* -O1 in the options is significant.  Without it FP operations may not be
+   optimized to custom instructions.  */
+
+#include <stdio.h> 
+#include <math.h>
+
+/* This test case is expected to cause an error because GCC does not know
+   how to merge different custom instruction attribute sets, even if they
+   do not overlap.  */
+
+extern void
+custom_fp (float operand_a, float operand_b, float *result)
+  __attribute__ ((target ("custom-fmaxs=246,custom-fmins=247")));
+
+extern void
+custom_fp (float operand_a, float operand_b, float *result)
+  __attribute__ ((target ("custom-fmaxs=246,custom-fmins=247")));
+
+void
+custom_fp (float operand_a, float operand_b, float *result)
+{
+  result[0] = fmaxf (operand_a, operand_b);
+  result[1] = fminf (operand_a, operand_b);
+}
+
+/* { dg-final { scan-assembler "custom\\t246, .* # fmaxs .*" } } */
+/* { dg-final { scan-assembler "custom\\t247, .* # fmins .*" } } */
Index: gcc/testsuite/gcc.target/nios2/nios2-wrctl.c
===================================================================
--- gcc/testsuite/gcc.target/nios2/nios2-wrctl.c	(revision 0)
+++ gcc/testsuite/gcc.target/nios2/nios2-wrctl.c	(revision 409063)
@@ -0,0 +1,7 @@ 
+/* { dg-do compile { target nios2-*-* } } */
+/* { dg-options "" } */
+/* { dg-final { scan-assembler "wrctl" } } */
+
+void foo(void){
+  __builtin_wrctl(6,4);
+}
Index: gcc/testsuite/gcc.target/nios2/nios2-int-types.c
===================================================================
--- gcc/testsuite/gcc.target/nios2/nios2-int-types.c	(revision 0)
+++ gcc/testsuite/gcc.target/nios2/nios2-int-types.c	(revision 409063)
@@ -0,0 +1,34 @@ 
+/* Test that various types are all derived from int.  */
+/* { dg-do compile { target nios2-*-* } } */
+
+#include <stddef.h>
+#include <stdint.h>
+#include <sys/types.h>
+
+extern size_t a;
+unsigned int a;
+extern unsigned int aa;
+size_t aa;
+
+extern ssize_t b;
+int b;
+extern int bb;
+ssize_t bb;
+
+extern ptrdiff_t c;
+int c;
+extern int cc;
+ptrdiff_t cc;
+
+extern intptr_t d;
+int d;
+extern int dd;
+intptr_t dd;
+
+extern uintptr_t e;
+unsigned int e;
+extern unsigned int ee;
+uintptr_t ee;
+
+
+
Index: gcc/testsuite/gcc.target/nios2/custom-fp-double.c
===================================================================
--- gcc/testsuite/gcc.target/nios2/custom-fp-double.c	(revision 0)
+++ gcc/testsuite/gcc.target/nios2/custom-fp-double.c	(revision 409063)
@@ -0,0 +1,86 @@ 
+/* Test generation of all double-float custom instructions.  */
+
+/* { dg-do compile } */
+/* { dg-options "-O1 -ffinite-math-only -funsafe-math-optimizations" } */
+
+/* -O1 in the options is significant.  Without it FP operations may not be
+   optimized to custom instructions.  */
+
+#include <stdio.h> 
+#include <math.h>
+
+#pragma GCC target ("custom-frdxhi=40")
+#pragma GCC target ("custom-frdxlo=41")
+#pragma GCC target ("custom-frdy=42")
+#pragma GCC target ("custom-fwrx=43")
+#pragma GCC target ("custom-fwry=44")
+
+#pragma GCC target ("custom-fabsd=100")
+#pragma GCC target ("custom-faddd=101")
+#pragma GCC target ("custom-fatand=102")
+#pragma GCC target ("custom-fcosd=103")
+#pragma GCC target ("custom-fdivd=104")
+#pragma GCC target ("custom-fexpd=105")
+#pragma GCC target ("custom-flogd=106")
+#pragma GCC target ("custom-fmaxd=107")
+#pragma GCC target ("custom-fmind=108")
+#pragma GCC target ("custom-fmuld=109")
+#pragma GCC target ("custom-fnegd=110")
+#pragma GCC target ("custom-fsind=111")
+#pragma GCC target ("custom-fsqrtd=112")
+#pragma GCC target ("custom-fsubd=113")
+#pragma GCC target ("custom-ftand=114")
+#pragma GCC target ("custom-fcmpeqd=200")
+#pragma GCC target ("custom-fcmpged=201")
+#pragma GCC target ("custom-fcmpgtd=202")
+#pragma GCC target ("custom-fcmpled=203")
+#pragma GCC target ("custom-fcmpltd=204")
+#pragma GCC target ("custom-fcmpned=205")
+
+void
+custom_fp (double a, double b, double *fp, int *ip)
+{
+  fp[0] = fabs (a);
+  fp[1] = a + b;
+  fp[2] = atan (a);
+  fp[3] = cos (a);
+  fp[4] = a / b;
+  fp[5] = exp (a);
+  fp[6] = log (a);
+  fp[7] = fmax (a, b);
+  fp[8] = fmin (a, b);
+  fp[9] = a * b;
+  fp[10] = -b;
+  fp[11] = sin (b);
+  fp[12] = sqrt (a);
+  fp[13] = a - b;
+  fp[14] = tan (a);
+  ip[0] = (a == fp[0]);
+  ip[1] = (a >= fp[1]);
+  ip[2] = (a > fp[2]);
+  ip[3] = (a <= fp[3]);
+  ip[4] = (a < fp[4]);
+  ip[5] = (a != fp[5]);
+}
+
+/* { dg-final { scan-assembler "custom\\t100, .* # fabsd .*" } } */
+/* { dg-final { scan-assembler "custom\\t101, .* # faddd .*" } } */
+/* { dg-final { scan-assembler "custom\\t102, .* # fatand .*" } } */
+/* { dg-final { scan-assembler "custom\\t103, .* # fcosd .*" } } */
+/* { dg-final { scan-assembler "custom\\t104, .* # fdivd .*" } } */
+/* { dg-final { scan-assembler "custom\\t105, .* # fexpd .*" } } */
+/* { dg-final { scan-assembler "custom\\t106, .* # flogd .*" } } */
+/* { dg-final { scan-assembler "custom\\t107, .* # fmaxd .*" } } */
+/* { dg-final { scan-assembler "custom\\t108, .* # fmind .*" } } */
+/* { dg-final { scan-assembler "custom\\t109, .* # fmuld .*" } } */
+/* { dg-final { scan-assembler "custom\\t110, .* # fnegd .*" } } */
+/* { dg-final { scan-assembler "custom\\t111, .* # fsind .*" } } */
+/* { dg-final { scan-assembler "custom\\t112, .* # fsqrtd .*" } } */
+/* { dg-final { scan-assembler "custom\\t113, .* # fsubd .*" } } */
+/* { dg-final { scan-assembler "custom\\t114, .* # ftand .*" } } */
+/* { dg-final { scan-assembler "custom\\t200, .* # fcmpeqd .*" } } */
+/* { dg-final { scan-assembler "custom\\t201, .* # fcmpged .*" } } */
+/* { dg-final { scan-assembler "custom\\t202, .* # fcmpgtd .*" } } */
+/* { dg-final { scan-assembler "custom\\t203, .* # fcmpled .*" } } */
+/* { dg-final { scan-assembler "custom\\t204, .* # fcmpltd .*" } } */
+/* { dg-final { scan-assembler "custom\\t205, .* # fcmpned .*" } } */
Index: gcc/testsuite/gcc.target/nios2/nios2-nor.c
===================================================================
--- gcc/testsuite/gcc.target/nios2/nios2-nor.c	(revision 0)
+++ gcc/testsuite/gcc.target/nios2/nios2-nor.c	(revision 409063)
@@ -0,0 +1,8 @@ 
+/* { dg-do compile { target nios2-*-* } } */
+/* { dg-options "-O" } */
+/* { dg-final { scan-assembler "nor" } } */
+
+int foo (int x, int y)
+{
+  return ~(x | y);
+}
Index: gcc/testsuite/gcc.target/nios2/nios2-cache-1.c
===================================================================
--- gcc/testsuite/gcc.target/nios2/nios2-cache-1.c	(revision 0)
+++ gcc/testsuite/gcc.target/nios2/nios2-cache-1.c	(revision 409063)
@@ -0,0 +1,21 @@ 
+/* { dg-do compile { target nios2-*-* } } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-not "ldwio" } } */
+/* { dg-final { scan-assembler-not "stwio" } } */
+
+/* Make sure the default behavior is not to generate I/O variants of
+   the load and stores to foo.  */
+
+extern volatile int foo;
+
+int
+read_foo (void)
+{
+  return foo;
+}
+
+void
+write_foo (int x)
+{
+  foo = x;
+}
Index: gcc/testsuite/gcc.target/nios2/nios2-cache-2.c
===================================================================
--- gcc/testsuite/gcc.target/nios2/nios2-cache-2.c	(revision 0)
+++ gcc/testsuite/gcc.target/nios2/nios2-cache-2.c	(revision 409063)
@@ -0,0 +1,21 @@ 
+/* { dg-do compile { target nios2-*-* } } */
+/* { dg-options "-O2 -mno-cache-volatile" } */
+/* { dg-final { scan-assembler "ldwio" } } */
+/* { dg-final { scan-assembler "stwio" } } */
+
+/* Make sure -mno-cache-volatile generates I/O variants of the load and
+   stores to foo.  */
+
+extern volatile int foo;
+
+int
+read_foo (void)
+{
+  return foo;
+}
+
+void
+write_foo (int x)
+{
+  foo = x;
+}
Index: gcc/testsuite/gcc.target/nios2/nios2-wrctl-not-zero.c
===================================================================
--- gcc/testsuite/gcc.target/nios2/nios2-wrctl-not-zero.c	(revision 0)
+++ gcc/testsuite/gcc.target/nios2/nios2-wrctl-not-zero.c	(revision 409063)
@@ -0,0 +1,7 @@ 
+/* { dg-do compile { target nios2-*-* } } */
+/* { dg-options " " } */
+/* { dg-final { scan-assembler-not "wrctl\\tctl6, zero" } } */
+
+void foo(void){
+  __builtin_wrctl(6,4);
+}
Index: gcc/testsuite/g++.old-deja/g++.jason/thunk3.C
===================================================================
--- gcc/testsuite/g++.old-deja/g++.jason/thunk3.C	(revision 407083)
+++ gcc/testsuite/g++.old-deja/g++.jason/thunk3.C	(revision 409063)
@@ -1,5 +1,5 @@ 
 // { dg-do run }
-// { dg-skip-if "fails with generic thunk support" { rs6000-*-* powerpc-*-eabi v850-*-* sh-*-* sh64-*-* h8*-*-* xtensa*-*-* m32r*-*-* lm32-*-* } { "*" } { "" } }
+// { dg-skip-if "fails with generic thunk support" { rs6000-*-* powerpc-*-eabi v850-*-* sh-*-* sh64-*-* h8*-*-* xtensa*-*-* m32r*-*-* lm32-*-* nios2-*-* } { "*" } { "" } }
 // Test that variadic function calls using thunks work right.
 // Note that this will break on any target that uses the generic thunk
 //  support, because it doesn't support variadic functions.