Commit 1333282d by Sandra Loosemore Committed by Sandra Loosemore

mipscop-1.c: Add nomips16 attributes.

2007-09-05  Sandra Loosemore  <sandra@codesourcery.com>
	    David Ung  <davidu@mips.com>
            Nigel Stephens <nigel@mips.com>

	gcc/testsuite/
	* gcc.c-torture/compile/mipscop-1.c: Add nomips16 attributes.
	* gcc.c-torture/compile/mipscop-2.c: Likewise.
	* gcc.c-torture/compile/mipscop-3.c: Likewise.
	* gcc.c-torture/compile/mipscop-4.c: Likewise.
	* gcc.dg/torture/mips-hilo-1.c: Likewise.
	* gcc.dg/torture/mips-hilo-2.c: Likewise.
	* gcc.dg/torture/pr19683-1.c: Likewise.
	* gcc.target/mips/madd-3.c: Likewise.
	* gcc.target/mips/maddu-3.c: Likewise.
	* gcc.target/mips/msub-3.c: Likewise.
	* gcc.target/mips/msubu-3.c: Likewise.
	* gcc.target/mips/asm-1.c: Likewise.
	* gcc.target/mips/branch-1.c: Likewise.
	* gcc.target/mips/ins-1.c: Likewise.
	* gcc.target/mips/near-far-3.c: Likewise.
	* gcc.target/mips/near-far-4.c: Likewise.
	* gcc.target/mips/smartmips-lwxs.c: Likewise.
	* gcc.target/mips/smartmips-ror-1.c: Likewise.
	* gcc.target/mips/smartmips-ror-2.c: Likewise.
	* gcc.target/mips/smartmips-ror-3.c: Likewise.
	* gcc.target/mips/smartmips-ror-4.c: Likewise.
	* gcc.target/mips/dspr2-MULT.c: Likewise.
	* gcc.target/mips/dspr2-MULTU.c: Likewise.
	* gcc.target/mips/mips32-dsp-run.c: Likewise.
	* gcc.target/mips/mips32-dspr2-type.c: Likewise.
	* gcc.target/mips/code-readable-1.c: Add mips16 attributes.
	* gcc.target/mips/code-readable-2.c: Likewise.
	* gcc.target/mips/code-readable-3.c: Likewise.

Co-Authored-By: David Ung <davidu@mips.com>
Co-Authored-By: Nigel Stephens <nigel@mips.com>

From-SVN: r128135
parent f9e4a411
......@@ -2,6 +2,39 @@
David Ung <davidu@mips.com>
Nigel Stephens <nigel@mips.com>
* gcc.c-torture/compile/mipscop-1.c: Add nomips16 attributes.
* gcc.c-torture/compile/mipscop-2.c: Likewise.
* gcc.c-torture/compile/mipscop-3.c: Likewise.
* gcc.c-torture/compile/mipscop-4.c: Likewise.
* gcc.dg/torture/mips-hilo-1.c: Likewise.
* gcc.dg/torture/mips-hilo-2.c: Likewise.
* gcc.dg/torture/pr19683-1.c: Likewise.
* gcc.target/mips/madd-3.c: Likewise.
* gcc.target/mips/maddu-3.c: Likewise.
* gcc.target/mips/msub-3.c: Likewise.
* gcc.target/mips/msubu-3.c: Likewise.
* gcc.target/mips/asm-1.c: Likewise.
* gcc.target/mips/branch-1.c: Likewise.
* gcc.target/mips/ins-1.c: Likewise.
* gcc.target/mips/near-far-3.c: Likewise.
* gcc.target/mips/near-far-4.c: Likewise.
* gcc.target/mips/smartmips-lwxs.c: Likewise.
* gcc.target/mips/smartmips-ror-1.c: Likewise.
* gcc.target/mips/smartmips-ror-2.c: Likewise.
* gcc.target/mips/smartmips-ror-3.c: Likewise.
* gcc.target/mips/smartmips-ror-4.c: Likewise.
* gcc.target/mips/dspr2-MULT.c: Likewise.
* gcc.target/mips/dspr2-MULTU.c: Likewise.
* gcc.target/mips/mips32-dsp-run.c: Likewise.
* gcc.target/mips/mips32-dspr2-type.c: Likewise.
* gcc.target/mips/code-readable-1.c: Add mips16 attributes.
* gcc.target/mips/code-readable-2.c: Likewise.
* gcc.target/mips/code-readable-3.c: Likewise.
2007-09-05 Sandra Loosemore <sandra@codesourcery.com>
David Ung <davidu@mips.com>
Nigel Stephens <nigel@mips.com>
* gcc.target/mips/mips16-attributes.c: New.
2007-09-05 Paul Thomas <pault@gcc.gnu.org>
/* { dg-do compile { target mips*-*-* } } */
#ifndef __mips16
register unsigned int cp0count asm ("$c0r1");
int
int __attribute__ ((nomips16))
main (int argc, char *argv[])
{
unsigned int d;
......@@ -11,4 +10,3 @@ main (int argc, char *argv[])
d = cp0count + 3;
printf ("%d\n", d);
}
#endif
/* { dg-do compile { target mips*-*-* } } */
#ifndef __mips16
register unsigned int c3r1 asm ("$c3r1");
extern unsigned int b, c;
void
void __attribute__ ((nomips16))
foo ()
{
unsigned int a, d;
......@@ -17,4 +16,3 @@ foo ()
d = c3r1;
printf ("%d\n", d);
}
#endif
/* { dg-do compile { target mips*-*-* } } */
#ifndef __mips16
register unsigned int c3r1 asm ("$c3r1"), c3r2 asm ("$c3r2");
extern unsigned int b, c;
void
void __attribute__ ((nomips16))
foo ()
{
unsigned int a, d;
......@@ -17,4 +16,3 @@ foo ()
d = c3r1;
printf ("%d\n", d);
}
#endif
/* { dg-do compile { target mips*-*-* } } */
#ifndef __mips16
register unsigned long c3r1 asm ("$c3r1"), c3r2 asm ("$c3r2");
extern unsigned long b, c;
void
void __attribute__ ((nomips16))
foo ()
{
unsigned long a, d;
......@@ -17,4 +16,4 @@ foo ()
d = c3r1;
printf ("%d\n", d);
}
#endif
......@@ -6,10 +6,8 @@
extern void abort (void);
extern void exit (int);
#if !defined(__mips16)
#define DECLARE(TYPE) \
TYPE __attribute__ ((noinline)) \
TYPE __attribute__ ((noinline)) __attribute__ ((nomips16)) \
f1##TYPE (TYPE x1, TYPE x2, TYPE x3) \
{ \
TYPE t1, t2; \
......@@ -19,7 +17,7 @@ extern void exit (int);
return t1 + t2; \
} \
\
TYPE __attribute__ ((noinline)) \
TYPE __attribute__ ((noinline)) __attribute__ ((nomips16)) \
f2##TYPE (TYPE x1, TYPE x2, TYPE x3) \
{ \
TYPE t1, t2; \
......@@ -73,6 +71,3 @@ main ()
#endif
exit (0);
}
#else
int main () { exit (0); }
#endif
......@@ -5,10 +5,9 @@
extern void abort (void);
extern void exit (int);
#if !defined(__mips16)
unsigned int g;
unsigned long long f (unsigned int x)
unsigned __attribute__ ((nomips16)) long long f (unsigned int x)
{
union { unsigned long long ll; unsigned int parts[2]; } u;
......@@ -17,7 +16,7 @@ unsigned long long f (unsigned int x)
return u.ll;
}
int main ()
int __attribute__ ((nomips16)) main ()
{
union { unsigned long long ll; unsigned int parts[2]; } u;
......@@ -26,6 +25,3 @@ int main ()
abort ();
exit (0);
}
#else
int main () { exit (0); }
#endif
......@@ -6,7 +6,6 @@
extern void abort (void);
extern void exit (int);
#ifndef __mips16
#define REPEAT10(X, Y) \
X(Y##0); X(Y##1); X(Y##2); X(Y##3); X(Y##4); \
X(Y##5); X(Y##6); X(Y##7); X(Y##8); X(Y##9)
......@@ -17,7 +16,7 @@ extern void exit (int);
union u { unsigned long long ll; unsigned int i[2]; };
unsigned int
unsigned int __attribute__ ((nomips16))
foo (volatile unsigned int *ptr)
{
union u u;
......@@ -30,7 +29,7 @@ foo (volatile unsigned int *ptr)
return result;
}
int
int __attribute__ ((nomips16))
main (void)
{
unsigned int array[] = { 1000 * 1000 * 1000 };
......@@ -41,10 +40,3 @@ main (void)
abort ();
exit (0);
}
#else
int
main (void)
{
exit (0);
}
#endif
/* PR target/17565. GCC used to put the asm into the delay slot
of the call. */
/* { dg-do assemble } */
/* { dg-mips-options "-O -mno-mips16" } */
int foo (int n)
/* { dg-mips-options "-O" } */
#define NOMIPS16 __attribute__ ((nomips16))
NOMIPS16 int foo (int n)
{
register int k asm ("$16") = n;
if (k > 0)
......
/* We should implement these "if" statements using an "andi" instruction
followed by a branch on zero. */
/* { dg-mips-options "-O2 -mno-mips16" } */
/* { dg-mips-options "-O2" } */
#define NOMIPS16 __attribute__ ((nomips16))
void bar (void);
void f1 (int x) { if (x & 4) bar (); }
void f2 (int x) { if ((x >> 2) & 1) bar (); }
void f3 (unsigned int x) { if (x & 0x10) bar (); }
void f4 (unsigned int x) { if ((x >> 4) & 1) bar (); }
NOMIPS16 void f1 (int x) { if (x & 4) bar (); }
NOMIPS16 void f2 (int x) { if ((x >> 2) & 1) bar (); }
NOMIPS16 void f3 (unsigned int x) { if (x & 0x10) bar (); }
NOMIPS16 void f4 (unsigned int x) { if ((x >> 4) & 1) bar (); }
/* { dg-final { scan-assembler "\tandi\t.*\tandi\t.*\tandi\t.*\tandi\t" } } */
/* { dg-final { scan-assembler-not "\tsrl\t" } } */
/* { dg-final { scan-assembler-not "\tsra\t" } } */
/* { dg-mips-options "-mips16 -mcode-readable=yes -mgp32" } */
/* { dg-mips-options "-mcode-readable=yes -mgp32" } */
int
#define MIPS16 __attribute__ ((mips16))
MIPS16 int
foo (int i)
{
switch (i)
......@@ -18,7 +20,7 @@ foo (int i)
extern int k[];
int *
MIPS16 int *
bar (void)
{
return k;
......
/* { dg-mips-options "-mips16 -mcode-readable=pcrel -mgp32" } */
/* { dg-mips-options "-mcode-readable=pcrel -mgp32" } */
int
#define MIPS16 __attribute__ ((mips16))
MIPS16 int
foo (int i)
{
switch (i)
......@@ -18,7 +20,7 @@ foo (int i)
extern int k[];
int *
MIPS16 int *
bar (void)
{
return k;
......
/* { dg-mips-options "-mips16 -mcode-readable=no -mgp32" } */
/* { dg-mips-options "-mcode-readable=no -mgp32" } */
int
#define MIPS16 __attribute__ ((mips16))
MIPS16 int
foo (int i)
{
switch (i)
......@@ -18,7 +20,7 @@ foo (int i)
extern int k[];
int *
MIPS16 int *
bar (void)
{
return k;
......
......@@ -7,11 +7,13 @@
/* { dg-final { scan-assembler "ac2" } } */
/* { dg-final { scan-assembler "ac3" } } */
#define NOMIPS16 __attribute__ ((nomips16))
typedef long long a64;
a64 a[4];
int b[4], c[4];
void test ()
NOMIPS16 void test ()
{
a[0] = (a64) b[0] * c[0];
a[1] = (a64) b[1] * c[1];
......
......@@ -7,11 +7,13 @@
/* { dg-final { scan-assembler "ac2" } } */
/* { dg-final { scan-assembler "ac3" } } */
#define NOMIPS16 __attribute__ ((nomips16))
typedef long long a64;
a64 a[4];
unsigned int b[4], c[4];
void test ()
NOMIPS16 void test ()
{
a[0] = (a64) b[0] * c[0];
a[1] = (a64) b[1] * c[1];
......
/* { dg-do compile } */
/* { dg-mips-options "-O -march=mips32r2 -mno-mips16" } */
/* { dg-mips-options "-O -march=mips32r2" } */
/* { dg-final { scan-assembler "\tins\t" } } */
#define NOMIPS16 __attribute__ ((nomips16))
struct
{
unsigned int i : 2;
......@@ -9,7 +11,7 @@ struct
unsigned int k : 4;
} s;
void
NOMIPS16 void
foo (void)
{
s.j = 1;
......
......@@ -2,19 +2,21 @@
/* { dg-mips-options "-O2 -mips32 -mgp32" } */
/* { dg-final { scan-assembler-times "\tmadd\t" 3 } } */
long long
#define NOMIPS16 __attribute__ ((nomips16))
NOMIPS16 long long
f1 (int x, int y, long long z)
{
return (long long) x * y + z;
}
long long
NOMIPS16 long long
f2 (int x, int y, long long z)
{
return z + (long long) y * x;
}
long long
NOMIPS16 long long
f3 (int x, int y, long long z)
{
long long t = (long long) x * y;
......
......@@ -2,22 +2,24 @@
/* { dg-mips-options "-O2 -mips32 -mgp32" } */
/* { dg-final { scan-assembler-times "\tmaddu\t" 3 } } */
#define NOMIPS16 __attribute__ ((nomips16))
typedef unsigned int ui;
typedef unsigned long long ull;
ull
NOMIPS16 ull
f1 (ui x, ui y, ull z)
{
return (ull) x * y + z;
}
ull
NOMIPS16 ull
f2 (ui x, ui y, ull z)
{
return z + (ull) y * x;
}
ull
NOMIPS16 ull
f3 (ui x, ui y, ull z)
{
ull t = (ull) x * y;
......
......@@ -2,6 +2,8 @@
/* { dg-do run { target mipsisa32r2*-*-* } } */
/* { dg-mips-options "-march=mips32r2 -mdsp -O2" } */
#define NOMIPS16 __attribute__ ((nomips16))
#include <stdlib.h>
#include <stdio.h>
......@@ -12,7 +14,7 @@ typedef int q31;
typedef int i32;
typedef long long a64;
void test_MIPS_DSP (void);
NOMIPS16 void test_MIPS_DSP (void);
char array[100];
int little_endian;
......@@ -33,27 +35,27 @@ int main ()
exit (0);
}
v2q15 add_v2q15 (v2q15 a, v2q15 b)
NOMIPS16 v2q15 add_v2q15 (v2q15 a, v2q15 b)
{
return __builtin_mips_addq_ph (a, b);
}
v4i8 add_v4i8 (v4i8 a, v4i8 b)
NOMIPS16 v4i8 add_v4i8 (v4i8 a, v4i8 b)
{
return __builtin_mips_addu_qb (a, b);
}
v2q15 sub_v2q15 (v2q15 a, v2q15 b)
NOMIPS16 v2q15 sub_v2q15 (v2q15 a, v2q15 b)
{
return __builtin_mips_subq_ph (a, b);
}
v4i8 sub_v4i8 (v4i8 a, v4i8 b)
NOMIPS16 v4i8 sub_v4i8 (v4i8 a, v4i8 b)
{
return __builtin_mips_subu_qb (a, b);
}
void test_MIPS_DSP ()
NOMIPS16 void test_MIPS_DSP ()
{
v4i8 v4i8_a,v4i8_b,v4i8_c,v4i8_r,v4i8_s;
v2q15 v2q15_a,v2q15_b,v2q15_c,v2q15_r,v2q15_s;
......
......@@ -3,9 +3,11 @@
/* { dg-mips-options "-march=mips32r2 -mdspr2" } */
/* { dg-final { scan-assembler "\tmul.ph\t" } } */
#define NOMIPS16 __attribute__ ((nomips16))
typedef short v2hi __attribute__ ((vector_size(4)));
v2hi mul_v2hi (v2hi a, v2hi b)
NOMIPS16 v2hi mul_v2hi (v2hi a, v2hi b)
{
return a * b;
}
......
......@@ -2,13 +2,15 @@
/* { dg-mips-options "-O2 -mips32 -mgp32" } */
/* { dg-final { scan-assembler-times "\tmsub\t" 2 } } */
long long
#define NOMIPS16 __attribute__ ((nomips16))
NOMIPS16 long long
f1 (int x, int y, long long z)
{
return z - (long long) y * x;
}
long long
NOMIPS16 long long
f2 (int x, int y, long long z)
{
long long t = (long long) x * y;
......
......@@ -2,16 +2,18 @@
/* { dg-mips-options "-O2 -mips32 -mgp32" } */
/* { dg-final { scan-assembler-times "\tmsubu\t" 2 } } */
#define NOMIPS16 __attribute__ ((nomips16))
typedef unsigned int ui;
typedef unsigned long long ull;
ull
NOMIPS16 ull
f1 (ui x, ui y, ull z)
{
return z - (ull) y * x;
}
ull
NOMIPS16 ull
f2 (ui x, ui y, ull z)
{
ull t = (ull) x * y;
......
/* { dg-do compile } */
/* { dg-mips-options "-mlong-calls -O2 -mno-mips16" } */
/* { dg-mips-options "-mlong-calls -O2" } */
/* { dg-require-effective-target nonpic } */
extern int long_call_func () __attribute__((long_call));
extern int far_func () __attribute__((far));
extern int near_func () __attribute__((near));
extern int normal_func ();
#define NOMIPS16 __attribute__ ((nomips16))
int test1 () { return long_call_func (); }
int test2 () { return far_func (); }
int test3 () { return near_func (); }
int test4 () { return normal_func (); }
NOMIPS16 extern int long_call_func () __attribute__((long_call));
NOMIPS16 extern int far_func () __attribute__((far));
NOMIPS16 extern int near_func () __attribute__((near));
NOMIPS16 extern int normal_func ();
NOMIPS16 int test1 () { return long_call_func (); }
NOMIPS16 int test2 () { return far_func (); }
NOMIPS16 int test3 () { return near_func (); }
NOMIPS16 int test4 () { return normal_func (); }
/* { dg-final { scan-assembler-not "\tj\tlong_call_func\n" } } */
/* { dg-final { scan-assembler-not "\tj\tfar_func\n" } } */
......
/* { dg-do compile } */
/* { dg-mips-options "-mno-long-calls -O2 -mno-mips16" } */
/* { dg-mips-options "-mno-long-calls -O2" } */
/* { dg-require-effective-target nonpic } */
extern int long_call_func () __attribute__((long_call));
extern int far_func () __attribute__((far));
extern int near_func () __attribute__((near));
extern int normal_func ();
#define NOMIPS16 __attribute__ ((nomips16))
int test1 () { return long_call_func (); }
int test2 () { return far_func (); }
int test3 () { return near_func (); }
int test4 () { return normal_func (); }
NOMIPS16 extern int long_call_func () __attribute__((long_call));
NOMIPS16 extern int far_func () __attribute__((far));
NOMIPS16 extern int near_func () __attribute__((near));
NOMIPS16 extern int normal_func ();
NOMIPS16 int test1 () { return long_call_func (); }
NOMIPS16 int test2 () { return far_func (); }
NOMIPS16 int test3 () { return near_func (); }
NOMIPS16 int test4 () { return normal_func (); }
/* { dg-final { scan-assembler-not "\tj\tlong_call_func\n" } } */
/* { dg-final { scan-assembler-not "\tj\tfar_func\n" } } */
......
/* { dg-do compile } */
/* { dg-mips-options "-O -msmartmips -mno-mips16" } */
/* { dg-mips-options "-O -msmartmips" } */
int scaled_indexed_word_load (int a[], int b)
#define NOMIPS16 __attribute__ ((nomips16))
NOMIPS16 int scaled_indexed_word_load (int a[], int b)
{
return a[b];
}
......
/* { dg-do compile } */
/* { dg-mips-options "-O -msmartmips -mno-mips16" } */
/* { dg-mips-options "-O -msmartmips" } */
int rotate_left (unsigned a, unsigned s)
#define NOMIPS16 __attribute__ ((nomips16))
NOMIPS16 int rotate_left (unsigned a, unsigned s)
{
return (a << s) | (a >> (32 - s));
}
......
/* { dg-do compile } */
/* { dg-mips-options "-O -msmartmips -mno-mips16" } */
/* { dg-mips-options "-O -msmartmips" } */
int rotate_right (unsigned a, unsigned s)
#define NOMIPS16 __attribute__ ((nomips16))
NOMIPS16 int rotate_right (unsigned a, unsigned s)
{
return (a >> s) | (a << (32 - s));
}
......
/* { dg-do compile } */
/* { dg-mips-options "-O -msmartmips -mno-mips16" } */
/* { dg-mips-options "-O -msmartmips" } */
#define NOMIPS16 __attribute__ ((nomips16))
#define S 13
int rotate_left_constant (unsigned a)
NOMIPS16 int rotate_left_constant (unsigned a)
{
return (a << S) | (a >> (32 - S));
}
......
/* { dg-do compile } */
/* { dg-mips-options "-O -msmartmips -mno-mips16" } */
/* { dg-mips-options "-O -msmartmips" } */
#define NOMIPS16 __attribute__ ((nomips16))
#define S 13
int rotate_right_constant (unsigned a)
NOMIPS16 int rotate_right_constant (unsigned a)
{
return (a >> S) | (a << (32 - S));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment