aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.target/spu
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gcc.target/spu')
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/spu/Wmain.c7
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/spu/abi.c474
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/spu/compare-dp.c10
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/spu/cpat-1.c104
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/spu/cpat-2.c44
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/spu/cpat-3.c61
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/spu/cpat-4.c40
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/spu/dfcgt-nan.c31
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/spu/dfcmeq.c9
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/spu/dfcmgt.c10
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/spu/ea/cache1.c195
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/spu/ea/cast1.c43
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/spu/ea/cast2.c74
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/spu/ea/compile1.c109
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/spu/ea/compile2.c43
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/spu/ea/cppdefine.c36
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/spu/ea/ea.exp54
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/spu/ea/errors1.c67
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/spu/ea/errors2.c107
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/spu/ea/execute1.c41
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/spu/ea/execute2.c41
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/spu/ea/execute3.c39
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/spu/ea/ops1.c94
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/spu/ea/ops2.c94
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/spu/ea/options1.c22
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/spu/ea/pr41857.c29
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/spu/ea/test-sizes.c608
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/spu/fixed-range-bad.c5
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/spu/fixed-range.c8
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/spu/intrinsics-1.c19
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/spu/intrinsics-2.c305
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/spu/intrinsics-3.c42
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/spu/intrinsics-sr.c496
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/spu/muldivti3.c46
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/spu/pr40001.c17
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/spu/spu.exp41
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/spu/subti3.c45
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/spu/tag_manager.c312
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/spu/vector-ansi.c35
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/spu/vector.c32
40 files changed, 3889 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/Wmain.c b/gcc-4.9/gcc/testsuite/gcc.target/spu/Wmain.c
new file mode 100644
index 000000000..58eca021b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/Wmain.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-options "-Wmain -mstdmain" } */
+
+int main (void *wrong)/* { dg-warning "first argument of 'main' should be 'int'" "" } */
+{
+ /* { dg-warning "'main' takes only zero or two arguments" "" { target *-*-* } 4 } */
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/abi.c b/gcc-4.9/gcc/testsuite/gcc.target/spu/abi.c
new file mode 100644
index 000000000..b435f1ede
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/abi.c
@@ -0,0 +1,474 @@
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+/* Test that arguments are passed in the correct location according to the ABI. */
+
+#include <stdlib.h>
+
+/* Hack to allow calling func_asm which takes 84 arguments that are scalars.
+ The function func_call takes 84 union quadword arguments, so we can check to
+ see if each scalar is passed in the correct location. This asm glues the
+ two functions together, so that the compiler is not aware of the
+ aliasing. */
+__asm__ ("func_asm = func_call");
+
+typedef unsigned int uqword __attribute__((mode(TI)));
+typedef int qword __attribute__((mode(TI)));
+
+union u
+{
+ uqword uq;
+ qword sq;
+ double d[2];
+ float f[4];
+ unsigned long long ull[2];
+ long long sll[2];
+ unsigned long ul[4];
+ long sl[4];
+ unsigned int ui[4];
+ int si[4];
+ unsigned short us[8];
+ short ss[8];
+ unsigned char uc[16];
+ signed char sc[16];
+};
+
+
+extern void func_asm(signed char a1,
+ unsigned char a2,
+ short a3,
+ unsigned short a4,
+ int a5,
+ unsigned int a6,
+ long a7,
+ unsigned long a8,
+ long long a9,
+ unsigned long long a10,
+ float a11,
+ double a12,
+ int a13,
+ int a14,
+ int a15,
+ int a16,
+ int a17,
+ int a18,
+ int a19,
+ int a20,
+ int a21,
+ int a22,
+ int a23,
+ int a24,
+ int a25,
+ int a26,
+ int a27,
+ int a28,
+ int a29,
+ int a30,
+ int a31,
+ int a32,
+ int a33,
+ int a34,
+ int a35,
+ int a36,
+ int a37,
+ int a38,
+ int a39,
+ int a40,
+ int a41,
+ int a42,
+ int a43,
+ int a44,
+ int a45,
+ int a46,
+ int a47,
+ int a48,
+ int a49,
+ int a50,
+ int a51,
+ int a52,
+ int a53,
+ int a54,
+ int a55,
+ int a56,
+ int a57,
+ int a58,
+ int a59,
+ int a60,
+ int a61,
+ int a62,
+ int a63,
+ int a64,
+ int a65,
+ int a66,
+ int a67,
+ int a68,
+ int a69,
+ int a70,
+ int a71,
+ int a72,
+ signed char a73,
+ unsigned char a74,
+ short a75,
+ unsigned short a76,
+ int a77,
+ unsigned int a78,
+ long a79,
+ unsigned long a80,
+ long long a81,
+ unsigned long long a82,
+ float a83,
+ double a84);
+
+void func_call(union u a1,
+ union u a2,
+ union u a3,
+ union u a4,
+ union u a5,
+ union u a6,
+ union u a7,
+ union u a8,
+ union u a9,
+ union u a10,
+ union u a11,
+ union u a12,
+ union u a13,
+ union u a14,
+ union u a15,
+ union u a16,
+ union u a17,
+ union u a18,
+ union u a19,
+ union u a20,
+ union u a21,
+ union u a22,
+ union u a23,
+ union u a24,
+ union u a25,
+ union u a26,
+ union u a27,
+ union u a28,
+ union u a29,
+ union u a30,
+ union u a31,
+ union u a32,
+ union u a33,
+ union u a34,
+ union u a35,
+ union u a36,
+ union u a37,
+ union u a38,
+ union u a39,
+ union u a40,
+ union u a41,
+ union u a42,
+ union u a43,
+ union u a44,
+ union u a45,
+ union u a46,
+ union u a47,
+ union u a48,
+ union u a49,
+ union u a50,
+ union u a51,
+ union u a52,
+ union u a53,
+ union u a54,
+ union u a55,
+ union u a56,
+ union u a57,
+ union u a58,
+ union u a59,
+ union u a60,
+ union u a61,
+ union u a62,
+ union u a63,
+ union u a64,
+ union u a65,
+ union u a66,
+ union u a67,
+ union u a68,
+ union u a69,
+ union u a70,
+ union u a71,
+ union u a72,
+ union u a73,
+ union u a74,
+ union u a75,
+ union u a76,
+ union u a77,
+ union u a78,
+ union u a79,
+ union u a80,
+ union u a81,
+ union u a82,
+ union u a83,
+ union u a84)
+{
+ /* arguments passed in registers */
+ if (a1.sc[3] != -1) /* signed char */
+ abort ();
+
+ if (a2.uc[3] != +2) /* unsigned char */
+ abort ();
+
+ if (a3.ss[1] != -3) /* short */
+ abort ();
+
+ if (a4.us[1] != +4) /* unsigned short */
+ abort ();
+
+ if (a5.si[0] != -5) /* int */
+ abort ();
+
+ if (a6.ui[0] != +6) /* unsigned int */
+ abort ();
+
+ if (a7.sl[0] != -7) /* long */
+ abort ();
+
+ if (a8.ul[0] != +8) /* unsigned long */
+ abort ();
+
+ if (a9.sll[0] != -9) /* long long */
+ abort ();
+
+ if (a10.ull[0] != +10) /* unsigned long long */
+ abort ();
+
+ if (a11.f[0] != -11.0f) /* float */
+ abort ();
+
+ if (a12.d[0] != +12.0) /* double */
+ abort ();
+
+ if (a13.si[0] != -13) /* int */
+ abort ();
+
+ if (a14.si[0] != +14) /* int */
+ abort ();
+
+ if (a15.si[0] != -15) /* int */
+ abort ();
+
+ if (a16.si[0] != +16) /* int */
+ abort ();
+
+ if (a17.si[0] != -17) /* int */
+ abort ();
+
+ if (a18.si[0] != +18) /* int */
+ abort ();
+
+ if (a19.si[0] != -19) /* int */
+ abort ();
+
+ if (a20.si[0] != +20) /* int */
+ abort ();
+
+ if (a21.si[0] != -21) /* int */
+ abort ();
+
+ if (a22.si[0] != +22) /* int */
+ abort ();
+
+ if (a23.si[0] != -23) /* int */
+ abort ();
+
+ if (a24.si[0] != +24) /* int */
+ abort ();
+
+ if (a25.si[0] != -25) /* int */
+ abort ();
+
+ if (a26.si[0] != +26) /* int */
+ abort ();
+
+ if (a27.si[0] != -27) /* int */
+ abort ();
+
+ if (a28.si[0] != +28) /* int */
+ abort ();
+
+ if (a29.si[0] != -29) /* int */
+ abort ();
+
+ if (a30.si[0] != +30) /* int */
+ abort ();
+
+ if (a31.si[0] != -31) /* int */
+ abort ();
+
+ if (a32.si[0] != +32) /* int */
+ abort ();
+
+ if (a33.si[0] != -33) /* int */
+ abort ();
+
+ if (a34.si[0] != +34) /* int */
+ abort ();
+
+ if (a35.si[0] != -35) /* int */
+ abort ();
+
+ if (a36.si[0] != +36) /* int */
+ abort ();
+
+ if (a37.si[0] != -37) /* int */
+ abort ();
+
+ if (a38.si[0] != +38) /* int */
+ abort ();
+
+ if (a39.si[0] != -39) /* int */
+ abort ();
+
+ if (a40.si[0] != +40) /* int */
+ abort ();
+
+ if (a41.si[0] != -41) /* int */
+ abort ();
+
+ if (a42.si[0] != +42) /* int */
+ abort ();
+
+ if (a43.si[0] != -43) /* int */
+ abort ();
+
+ if (a44.si[0] != +44) /* int */
+ abort ();
+
+ if (a45.si[0] != -45) /* int */
+ abort ();
+
+ if (a46.si[0] != +46) /* int */
+ abort ();
+
+ if (a47.si[0] != -47) /* int */
+ abort ();
+
+ if (a48.si[0] != +48) /* int */
+ abort ();
+
+ if (a49.si[0] != -49) /* int */
+ abort ();
+
+ if (a50.si[0] != +50) /* int */
+ abort ();
+
+ if (a51.si[0] != -51) /* int */
+ abort ();
+
+ if (a52.si[0] != +52) /* int */
+ abort ();
+
+ if (a53.si[0] != -53) /* int */
+ abort ();
+
+ if (a54.si[0] != +54) /* int */
+ abort ();
+
+ if (a55.si[0] != -55) /* int */
+ abort ();
+
+ if (a56.si[0] != +56) /* int */
+ abort ();
+
+ if (a57.si[0] != -57) /* int */
+ abort ();
+
+ if (a58.si[0] != +58) /* int */
+ abort ();
+
+ if (a59.si[0] != -59) /* int */
+ abort ();
+
+ if (a60.si[0] != +60) /* int */
+ abort ();
+
+ if (a61.si[0] != -61) /* int */
+ abort ();
+
+ if (a62.si[0] != +62) /* int */
+ abort ();
+
+ if (a63.si[0] != -63) /* int */
+ abort ();
+
+ if (a64.si[0] != +64) /* int */
+ abort ();
+
+ if (a65.si[0] != -65) /* int */
+ abort ();
+
+ if (a66.si[0] != +66) /* int */
+ abort ();
+
+ if (a67.si[0] != -67) /* int */
+ abort ();
+
+ if (a68.si[0] != +68) /* int */
+ abort ();
+
+ if (a69.si[0] != -69) /* int */
+ abort ();
+
+ if (a70.si[0] != +70) /* int */
+ abort ();
+
+ if (a71.si[0] != -71) /* int */
+ abort ();
+
+ if (a72.si[0] != +72) /* int */
+ abort ();
+
+ /* arguments passed on the stack */
+ if (a73.sc[3] != -73) /* signed char */
+ abort ();
+
+ if (a74.uc[3] != 74) /* unsigned char */
+ abort ();
+
+ if (a75.ss[1] != -75) /* short */
+ abort ();
+
+ if (a76.us[1] != +76) /* unsigned short */
+ abort ();
+
+ if (a77.si[0] != -77) /* int */
+ abort ();
+
+ if (a78.ui[0] != +78) /* unsigned int */
+ abort ();
+
+ if (a79.sl[0] != -79) /* long */
+ abort ();
+
+ if (a80.ul[0] != +80) /* unsigned long */
+ abort ();
+
+ if (a81.sll[0] != -81) /* long long */
+ abort ();
+
+ if (a82.ull[0] != +82) /* unsigned long long */
+ abort ();
+
+ if (a83.f[0] != -83.0f) /* float */
+ abort ();
+
+ if (a84.d[0] != +84.0) /* double */
+ abort ();
+}
+
+int main(void)
+{
+ func_asm(-1, +2, -3, +4, -5, +6, -7, +8, -9, +10,
+ -11, +12, -13, +14, -15, +16, -17, +18, -19, +20,
+ -21, +22, -23, +24, -25, +26, -27, +28, -29, +30,
+ -31, +32, -33, +34, -35, +36, -37, +38, -39, +40,
+ -41, +42, -43, +44, -45, +46, -47, +48, -49, +50,
+ -51, +52, -53, +54, -55, +56, -57, +58, -59, +60,
+ -61, +62, -63, +64, -65, +66, -67, +68, -69, +70,
+ -71, +72, -73, +74, -75, +76, -77, +78, -79, +80,
+ -81, +82, -83, +84);
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/compare-dp.c b/gcc-4.9/gcc/testsuite/gcc.target/spu/compare-dp.c
new file mode 100644
index 000000000..cbc7663b9
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/compare-dp.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-final { scan-assembler-not "__eqdf2" } } */
+
+/* Ensure double precision comparisons are always inlined. */
+
+int test (double a, double b) __attribute__((noinline));
+int test (double a, double b)
+{
+ return a == b;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/cpat-1.c b/gcc-4.9/gcc/testsuite/gcc.target/spu/cpat-1.c
new file mode 100644
index 000000000..6fe292562
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/cpat-1.c
@@ -0,0 +1,104 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -w" } */
+/* { dg-final { scan-assembler-times "lqr\t.3,.LC" 4 } } */
+/* { dg-final { scan-assembler-times "cbd\t.3,0\\(.sp\\)" 1 } } */
+/* { dg-final { scan-assembler-times "cbd\t.3,1\\(.sp\\)" 1 } } */
+/* { dg-final { scan-assembler-times "cbd\t.3,2\\(.sp\\)" 1 } } */
+/* { dg-final { scan-assembler-times "cbd\t.3,3\\(.sp\\)" 1 } } */
+/* { dg-final { scan-assembler-times "cbd\t.3,4\\(.sp\\)" 1 } } */
+/* { dg-final { scan-assembler-times "cbd\t.3,5\\(.sp\\)" 1 } } */
+/* { dg-final { scan-assembler-times "cbd\t.3,6\\(.sp\\)" 1 } } */
+/* { dg-final { scan-assembler-times "cbd\t.3,7\\(.sp\\)" 1 } } */
+/* { dg-final { scan-assembler-times "cbd\t.3,8\\(.sp\\)" 1 } } */
+/* { dg-final { scan-assembler-times "cbd\t.3,9\\(.sp\\)" 1 } } */
+/* { dg-final { scan-assembler-times "cbd\t.3,10\\(.sp\\)" 1 } } */
+/* { dg-final { scan-assembler-times "cbd\t.3,11\\(.sp\\)" 1 } } */
+/* { dg-final { scan-assembler-times "cbd\t.3,12\\(.sp\\)" 1 } } */
+/* { dg-final { scan-assembler-times "cbd\t.3,13\\(.sp\\)" 1 } } */
+/* { dg-final { scan-assembler-times "cbd\t.3,14\\(.sp\\)" 1 } } */
+/* { dg-final { scan-assembler-times "cbd\t.3,15\\(.sp\\)" 1 } } */
+/* { dg-final { scan-assembler-times "chd\t.3,0\\(.sp\\)" 1 } } */
+/* { dg-final { scan-assembler-times "chd\t.3,2\\(.sp\\)" 1 } } */
+/* { dg-final { scan-assembler-times "chd\t.3,4\\(.sp\\)" 1 } } */
+/* { dg-final { scan-assembler-times "chd\t.3,6\\(.sp\\)" 1 } } */
+/* { dg-final { scan-assembler-times "chd\t.3,8\\(.sp\\)" 1 } } */
+/* { dg-final { scan-assembler-times "chd\t.3,10\\(.sp\\)" 1 } } */
+/* { dg-final { scan-assembler-times "chd\t.3,12\\(.sp\\)" 1 } } */
+/* { dg-final { scan-assembler-times "chd\t.3,14\\(.sp\\)" 1 } } */
+/* { dg-final { scan-assembler-times "cwd\t.3,0\\(.sp\\)" 1 } } */
+/* { dg-final { scan-assembler-times "cwd\t.3,4\\(.sp\\)" 1 } } */
+/* { dg-final { scan-assembler-times "cwd\t.3,8\\(.sp\\)" 1 } } */
+/* { dg-final { scan-assembler-times "cwd\t.3,12\\(.sp\\)" 1 } } */
+/* { dg-final { scan-assembler-times "cdd\t.3,0\\(.sp\\)" 1 } } */
+/* { dg-final { scan-assembler-times "cdd\t.3,8\\(.sp\\)" 1 } } */
+
+__vector unsigned char
+not_cpat0()
+{
+ /* Contains no runs */
+ return (__vector unsigned char) {
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F};
+}
+
+__vector unsigned char
+not_cpat1()
+{
+ /* Includes 1 run but not in the right place. */
+ return (__vector unsigned char) {
+ 0x10, 0x02, 0x03, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F};
+}
+
+__vector unsigned char
+not_cpat2()
+{
+ /* Includes 2 runs. */
+ return (__vector unsigned char) {
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x00, 0x01, 0x02, 0x03, 0x00, 0x01, 0x02, 0x03};
+}
+
+__vector unsigned char
+not_cpat3()
+{
+ /* Includes 1 incorrect run. */
+ return (__vector unsigned char) {
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x00, 0x01, 0x02, 0x03, 0x05, 0x06, 0x07, 0x1F};
+}
+
+__vector unsigned char cbd_0() { return (__vector unsigned char) { 0x03, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F}; }
+__vector unsigned char cbd_1() { return (__vector unsigned char) { 0x10, 0x03, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F}; }
+__vector unsigned char cbd_2() { return (__vector unsigned char) { 0x10, 0x11, 0x03, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F}; }
+__vector unsigned char cbd_3() { return (__vector unsigned char) { 0x10, 0x11, 0x12, 0x03, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F}; }
+__vector unsigned char cbd_4() { return (__vector unsigned char) { 0x10, 0x11, 0x12, 0x13, 0x03, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F}; }
+__vector unsigned char cbd_5() { return (__vector unsigned char) { 0x10, 0x11, 0x12, 0x13, 0x14, 0x03, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F}; }
+__vector unsigned char cbd_6() { return (__vector unsigned char) { 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x03, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F}; }
+__vector unsigned char cbd_7() { return (__vector unsigned char) { 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x03, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F}; }
+__vector unsigned char cbd_8() { return (__vector unsigned char) { 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x03, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F}; }
+__vector unsigned char cbd_9() { return (__vector unsigned char) { 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x03, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F}; }
+__vector unsigned char cbd_a() { return (__vector unsigned char) { 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x03, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F}; }
+__vector unsigned char cbd_b() { return (__vector unsigned char) { 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x03, 0x1C, 0x1D, 0x1E, 0x1F}; }
+__vector unsigned char cbd_c() { return (__vector unsigned char) { 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x03, 0x1D, 0x1E, 0x1F}; }
+__vector unsigned char cbd_d() { return (__vector unsigned char) { 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x03, 0x1E, 0x1F}; }
+__vector unsigned char cbd_e() { return (__vector unsigned char) { 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x03, 0x1F}; }
+__vector unsigned char cbd_f() { return (__vector unsigned char) { 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x03}; }
+
+__vector unsigned char chd_0() { return (__vector unsigned char) { 0x02, 0x03, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F}; }
+__vector unsigned char chd_2() { return (__vector unsigned char) { 0x10, 0x11, 0x02, 0x03, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F}; }
+__vector unsigned char chd_4() { return (__vector unsigned char) { 0x10, 0x11, 0x12, 0x13, 0x02, 0x03, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F}; }
+__vector unsigned char chd_6() { return (__vector unsigned char) { 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x02, 0x03, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F}; }
+__vector unsigned char chd_8() { return (__vector unsigned char) { 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x02, 0x03, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F}; }
+__vector unsigned char chd_a() { return (__vector unsigned char) { 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x02, 0x03, 0x1C, 0x1D, 0x1E, 0x1F}; }
+__vector unsigned char chd_c() { return (__vector unsigned char) { 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x02, 0x03, 0x1E, 0x1F}; }
+__vector unsigned char chd_e() { return (__vector unsigned char) { 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x02, 0x03}; }
+
+__vector unsigned char cwd_0() { return (__vector unsigned char) { 0x00, 0x01, 0x02, 0x03, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F}; }
+__vector unsigned char cwd_4() { return (__vector unsigned char) { 0x10, 0x11, 0x12, 0x13, 0x00, 0x01, 0x02, 0x03, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F}; }
+__vector unsigned char cwd_8() { return (__vector unsigned char) { 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x00, 0x01, 0x02, 0x03, 0x1C, 0x1D, 0x1E, 0x1F}; }
+__vector unsigned char cwd_c() { return (__vector unsigned char) { 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x00, 0x01, 0x02, 0x03}; }
+
+__vector unsigned char cdd_0() { return (__vector unsigned char) { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F}; }
+__vector unsigned char cdd_8() { return (__vector unsigned char) { 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}; }
+
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/cpat-2.c b/gcc-4.9/gcc/testsuite/gcc.target/spu/cpat-2.c
new file mode 100644
index 000000000..d5f86ed30
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/cpat-2.c
@@ -0,0 +1,44 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -w" } */
+/* { dg-final { scan-assembler-times "cbd .3,0\\(.sp\\)" 1 } } */
+/* { dg-final { scan-assembler-times "cbd .3,1\\(.sp\\)" 1 } } */
+/* { dg-final { scan-assembler-times "cbd .3,2\\(.sp\\)" 1 } } */
+/* { dg-final { scan-assembler-times "cbd .3,3\\(.sp\\)" 1 } } */
+/* { dg-final { scan-assembler-times "cbd .3,15\\(.sp\\)" 22 } } */
+/* { dg-final { scan-assembler-times "chd .3,0\\(.sp\\)" 1 } } */
+/* { dg-final { scan-assembler-times "chd .3,2\\(.sp\\)" 1 } } */
+/* { dg-final { scan-assembler-times "ila .3,66051" 2 } } */
+
+#define MAKE_UINT(a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,aA,aB,aC,aD,aE,aF) ((unsigned int)(a0 << 24 | a1 << 16 | a2 << 8 | a3))
+
+unsigned int cbd_0() { return MAKE_UINT( 0x03, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned int cbd_1() { return MAKE_UINT( 0x10, 0x03, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned int cbd_2() { return MAKE_UINT( 0x10, 0x11, 0x03, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned int cbd_3() { return MAKE_UINT( 0x10, 0x11, 0x12, 0x03, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned int cbd_4() { return MAKE_UINT( 0x10, 0x11, 0x12, 0x13, 0x03, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned int cbd_5() { return MAKE_UINT( 0x10, 0x11, 0x12, 0x13, 0x14, 0x03, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned int cbd_6() { return MAKE_UINT( 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x03, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned int cbd_7() { return MAKE_UINT( 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x03, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned int cbd_8() { return MAKE_UINT( 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x03, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned int cbd_9() { return MAKE_UINT( 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x03, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned int cbd_a() { return MAKE_UINT( 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x03, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned int cbd_b() { return MAKE_UINT( 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x03, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned int cbd_c() { return MAKE_UINT( 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x03, 0x1D, 0x1E, 0x1F); }
+unsigned int cbd_d() { return MAKE_UINT( 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x03, 0x1E, 0x1F); }
+unsigned int cbd_e() { return MAKE_UINT( 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x03, 0x1F); }
+unsigned int cbd_f() { return MAKE_UINT( 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x03); }
+unsigned int chd_0() { return MAKE_UINT( 0x02, 0x03, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned int chd_2() { return MAKE_UINT( 0x10, 0x11, 0x02, 0x03, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned int chd_4() { return MAKE_UINT( 0x10, 0x11, 0x12, 0x13, 0x02, 0x03, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned int chd_6() { return MAKE_UINT( 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x02, 0x03, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned int chd_8() { return MAKE_UINT( 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x02, 0x03, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned int chd_a() { return MAKE_UINT( 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x02, 0x03, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned int chd_c() { return MAKE_UINT( 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x02, 0x03, 0x1E, 0x1F); }
+unsigned int chd_e() { return MAKE_UINT( 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x02, 0x03); }
+unsigned int cwd_0() { return MAKE_UINT( 0x00, 0x01, 0x02, 0x03, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned int cwd_4() { return MAKE_UINT( 0x10, 0x11, 0x12, 0x13, 0x00, 0x01, 0x02, 0x03, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned int cwd_8() { return MAKE_UINT( 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x00, 0x01, 0x02, 0x03, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned int cwd_c() { return MAKE_UINT( 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x00, 0x01, 0x02, 0x03); }
+unsigned int cdd_0() { return MAKE_UINT( 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned int cdd_8() { return MAKE_UINT( 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07); }
+
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/cpat-3.c b/gcc-4.9/gcc/testsuite/gcc.target/spu/cpat-3.c
new file mode 100644
index 000000000..ced50111f
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/cpat-3.c
@@ -0,0 +1,61 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -w" } */
+/* { dg-final { scan-assembler-times "cbd .3,0\\(.sp\\)" 1 } } */
+/* { dg-final { scan-assembler-times "cbd .3,1\\(.sp\\)" 1 } } */
+/* { dg-final { scan-assembler-times "cbd .3,2\\(.sp\\)" 1 } } */
+/* { dg-final { scan-assembler-times "cbd .3,3\\(.sp\\)" 1 } } */
+/* { dg-final { scan-assembler-times "cbd .3,4\\(.sp\\)" 1 } } */
+/* { dg-final { scan-assembler-times "cbd .3,5\\(.sp\\)" 1 } } */
+/* { dg-final { scan-assembler-times "cbd .3,6\\(.sp\\)" 1 } } */
+/* { dg-final { scan-assembler-times "cbd .3,7\\(.sp\\)" 1 } } */
+/* { dg-final { scan-assembler-times "cbd .3,15\\(.sp\\)" 15 } } */
+/* { dg-final { scan-assembler-times "chd .3,0\\(.sp\\)" 1 } } */
+/* { dg-final { scan-assembler-times "chd .3,2\\(.sp\\)" 1 } } */
+/* { dg-final { scan-assembler-times "chd .3,4\\(.sp\\)" 1 } } */
+/* { dg-final { scan-assembler-times "chd .3,6\\(.sp\\)" 1 } } */
+/* { dg-final { scan-assembler-times "cwd .3,0\\(.sp\\)" 1 } } */
+/* { dg-final { scan-assembler-times "cwd .3,4\\(.sp\\)" 1 } } */
+/* { dg-final { scan-assembler-times "cdd .3,0\\(.sp\\)" 1 } } */
+
+#define MAKE_ULLONG(a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,aA,aB,aC,aD,aE,aF) \
+ ((unsigned long long) \
+ (a0##ull << 56 \
+ | a1##ull << 48 \
+ | a2##ull << 40 \
+ | a3##ull << 32\
+ | a4##ull << 24\
+ | a5##ull << 16 \
+ | a6##ull << 8 \
+ | a7##ull ))
+
+unsigned long long cbd_0() { return MAKE_ULLONG( 0x03, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned long long cbd_1() { return MAKE_ULLONG( 0x10, 0x03, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned long long cbd_2() { return MAKE_ULLONG( 0x10, 0x11, 0x03, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned long long cbd_3() { return MAKE_ULLONG( 0x10, 0x11, 0x12, 0x03, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned long long cbd_4() { return MAKE_ULLONG( 0x10, 0x11, 0x12, 0x13, 0x03, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned long long cbd_5() { return MAKE_ULLONG( 0x10, 0x11, 0x12, 0x13, 0x14, 0x03, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned long long cbd_6() { return MAKE_ULLONG( 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x03, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned long long cbd_7() { return MAKE_ULLONG( 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x03, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned long long cbd_8() { return MAKE_ULLONG( 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x03, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned long long cbd_9() { return MAKE_ULLONG( 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x03, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned long long cbd_a() { return MAKE_ULLONG( 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x03, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned long long cbd_b() { return MAKE_ULLONG( 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x03, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned long long cbd_c() { return MAKE_ULLONG( 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x03, 0x1D, 0x1E, 0x1F); }
+unsigned long long cbd_d() { return MAKE_ULLONG( 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x03, 0x1E, 0x1F); }
+unsigned long long cbd_e() { return MAKE_ULLONG( 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x03, 0x1F); }
+unsigned long long cbd_f() { return MAKE_ULLONG( 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x03); }
+unsigned long long chd_0() { return MAKE_ULLONG( 0x02, 0x03, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned long long chd_2() { return MAKE_ULLONG( 0x10, 0x11, 0x02, 0x03, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned long long chd_4() { return MAKE_ULLONG( 0x10, 0x11, 0x12, 0x13, 0x02, 0x03, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned long long chd_6() { return MAKE_ULLONG( 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x02, 0x03, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned long long chd_8() { return MAKE_ULLONG( 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x02, 0x03, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned long long chd_a() { return MAKE_ULLONG( 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x02, 0x03, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned long long chd_c() { return MAKE_ULLONG( 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x02, 0x03, 0x1E, 0x1F); }
+unsigned long long chd_e() { return MAKE_ULLONG( 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x02, 0x03); }
+unsigned long long cwd_0() { return MAKE_ULLONG( 0x00, 0x01, 0x02, 0x03, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned long long cwd_4() { return MAKE_ULLONG( 0x10, 0x11, 0x12, 0x13, 0x00, 0x01, 0x02, 0x03, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned long long cwd_8() { return MAKE_ULLONG( 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x00, 0x01, 0x02, 0x03, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned long long cwd_c() { return MAKE_ULLONG( 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x00, 0x01, 0x02, 0x03); }
+unsigned long long cdd_0() { return MAKE_ULLONG( 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned long long cdd_8() { return MAKE_ULLONG( 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07); }
+
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/cpat-4.c b/gcc-4.9/gcc/testsuite/gcc.target/spu/cpat-4.c
new file mode 100644
index 000000000..89110a66d
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/cpat-4.c
@@ -0,0 +1,40 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -w" } */
+/* { dg-final { scan-assembler-times "il\t.3,4611" 1 } } */
+/* { dg-final { scan-assembler-times "il\t.3,4627" 25 } } */
+/* { dg-final { scan-assembler-times "il\t.3,515" 3 } } */
+/* { dg-final { scan-assembler-times "il\t.3,787" 1 } } */
+
+#define MAKE_USHORT(a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,aA,aB,aC,aD,aE,aF) ((unsigned short)(a2 << 8 | a3))
+
+unsigned short cbd_0() { return MAKE_USHORT( 0x03, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned short cbd_1() { return MAKE_USHORT( 0x10, 0x03, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned short cbd_2() { return MAKE_USHORT( 0x10, 0x11, 0x03, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned short cbd_3() { return MAKE_USHORT( 0x10, 0x11, 0x12, 0x03, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned short cbd_4() { return MAKE_USHORT( 0x10, 0x11, 0x12, 0x13, 0x03, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned short cbd_5() { return MAKE_USHORT( 0x10, 0x11, 0x12, 0x13, 0x14, 0x03, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned short cbd_6() { return MAKE_USHORT( 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x03, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned short cbd_7() { return MAKE_USHORT( 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x03, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned short cbd_8() { return MAKE_USHORT( 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x03, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned short cbd_9() { return MAKE_USHORT( 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x03, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned short cbd_a() { return MAKE_USHORT( 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x03, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned short cbd_b() { return MAKE_USHORT( 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x03, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned short cbd_c() { return MAKE_USHORT( 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x03, 0x1D, 0x1E, 0x1F); }
+unsigned short cbd_d() { return MAKE_USHORT( 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x03, 0x1E, 0x1F); }
+unsigned short cbd_e() { return MAKE_USHORT( 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x03, 0x1F); }
+unsigned short cbd_f() { return MAKE_USHORT( 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x03); }
+unsigned short chd_0() { return MAKE_USHORT( 0x02, 0x03, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned short chd_2() { return MAKE_USHORT( 0x10, 0x11, 0x02, 0x03, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned short chd_4() { return MAKE_USHORT( 0x10, 0x11, 0x12, 0x13, 0x02, 0x03, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned short chd_6() { return MAKE_USHORT( 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x02, 0x03, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned short chd_8() { return MAKE_USHORT( 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x02, 0x03, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned short chd_a() { return MAKE_USHORT( 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x02, 0x03, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned short chd_c() { return MAKE_USHORT( 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x02, 0x03, 0x1E, 0x1F); }
+unsigned short chd_e() { return MAKE_USHORT( 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x02, 0x03); }
+unsigned short cwd_0() { return MAKE_USHORT( 0x00, 0x01, 0x02, 0x03, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned short cwd_4() { return MAKE_USHORT( 0x10, 0x11, 0x12, 0x13, 0x00, 0x01, 0x02, 0x03, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned short cwd_8() { return MAKE_USHORT( 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x00, 0x01, 0x02, 0x03, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned short cwd_c() { return MAKE_USHORT( 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x00, 0x01, 0x02, 0x03); }
+unsigned short cdd_0() { return MAKE_USHORT( 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); }
+unsigned short cdd_8() { return MAKE_USHORT( 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07); }
+
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/dfcgt-nan.c b/gcc-4.9/gcc/testsuite/gcc.target/spu/dfcgt-nan.c
new file mode 100644
index 000000000..18ce01356
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/dfcgt-nan.c
@@ -0,0 +1,31 @@
+/* { dg-do compile } */
+/* { dg-options "-march=celledp -O1" } */
+/* { dg-final { scan-assembler "dfceq" } } */
+
+/* GCC previously transformed an "a <= b" test into "! (a > b)" when
+ compiling with -march=celledp, so that the dfcgt instruction can be
+ used to implement the comparison.
+
+ However, this transformation violates the IEEE-754 standard in the
+ presence of NaN values. If either a or b is a NaN, a <= b should
+ evaluate to false according to IEEE rules. However, after the
+ transformation, a > b as implemented by dfcgt itself returns false,
+ so the transformed test returns true.
+
+ Note that the equivalent transformation is valid for single-
+ precision floating-point values on the Cell SPU, because the format
+ does not have NaNs. It is invalid for double-precision, even on
+ Cell, however. */
+
+int test (double a, double b) __attribute__ ((noinline));
+int test (double a, double b)
+{
+ return a <= b;
+}
+
+int main (void)
+{
+ double x = 0.0;
+ double y = 0.0/0.0;
+ return test (x, y);
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/dfcmeq.c b/gcc-4.9/gcc/testsuite/gcc.target/spu/dfcmeq.c
new file mode 100644
index 000000000..9286361b3
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/dfcmeq.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-march=celledp -O1" } */
+/* { dg-final { scan-assembler "dfcmeq" } } */
+
+int foo(double x, double y)
+{
+ if (__builtin_fabs(x) == __builtin_fabs(y))
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/dfcmgt.c b/gcc-4.9/gcc/testsuite/gcc.target/spu/dfcmgt.c
new file mode 100644
index 000000000..ef7ef5899
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/dfcmgt.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-march=celledp -O1" } */
+/* { dg-final { scan-assembler "dfcmgt" } } */
+
+int foo(double x, double y)
+{
+ if (__builtin_fabs(x) > __builtin_fabs(y))
+ return 0;
+}
+
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/cache1.c b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/cache1.c
new file mode 100644
index 000000000..3487ce980
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/cache1.c
@@ -0,0 +1,195 @@
+/* Copyright (C) 2009 Free Software Foundation, Inc.
+
+ This file 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 file 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 this file; see the file COPYING3. If not see
+ <http://www.gnu.org/licenses/>. */
+
+/* { dg-do run } */
+/* { dg-require-effective-target "ealib" } */
+
+#include <stdlib.h>
+#include <string.h>
+#include <ea.h>
+#include <spu_cache.h>
+
+#ifdef __EA64__
+#define addr unsigned long long
+#else
+#define addr unsigned long
+#endif
+
+static __ea void *bigblock;
+static __ea void *block;
+static int *ls_block;
+
+extern char __cache_tag_array_size[];
+#define CACHE_SIZE (4 * (int) &__cache_tag_array_size[0])
+#define LINE_SIZE ((addr)128)
+
+void
+init_mem (void)
+{
+ bigblock = malloc_ea (CACHE_SIZE + 2 * LINE_SIZE);
+ block = malloc_ea (2 * LINE_SIZE);
+ ls_block = malloc (LINE_SIZE);
+
+ memset_ea (bigblock, 0, CACHE_SIZE + 2 * LINE_SIZE);
+ memset_ea (block, -1, 2 * LINE_SIZE);
+ memset (ls_block, -1, LINE_SIZE);
+ cache_flush ();
+}
+
+/* Test 1: Simple cache fetching. */
+void
+test1 (void)
+{
+ addr aligned = ((((addr) block) + LINE_SIZE - 1) & -LINE_SIZE);
+ int *p1 = NULL;
+ int *p2 = NULL;
+ int i = 0;
+
+ /* First, check if the same addr give the same cache ptr. */
+ p1 = cache_fetch ((__ea void *) aligned);
+ p2 = cache_fetch ((__ea void *) aligned);
+
+ if (p1 != p2)
+ abort ();
+
+ /* Check that the data actually is in the cache. */
+ for (i = 0; i < LINE_SIZE / sizeof (int); i++)
+ {
+ if (p1[i] != -1)
+ abort ();
+ }
+
+ /* Check returning within the cache line. */
+ p2 = cache_fetch ((__ea void *) (aligned + sizeof (int)));
+
+ if (p2 - p1 != 1)
+ abort ();
+
+ /* Finally, check that fetching an LS pointer returns that pointer. */
+ p1 = cache_fetch ((__ea char *) ls_block);
+ if (p1 != ls_block)
+ abort ();
+}
+
+/* Test 2: Eviction testing. */
+void
+test2 (void)
+{
+ addr aligned = ((((addr) block) + LINE_SIZE - 1) & -LINE_SIZE);
+ int *p = NULL;
+ int i = 0;
+
+ /* First check that clean evictions don't write back. */
+ p = cache_fetch ((__ea void *) aligned);
+ for (i = 0; i < LINE_SIZE / sizeof (int); i++)
+ p[i] = 0;
+
+ cache_evict ((__ea void *) aligned);
+ memcpy_ea ((__ea char *) ls_block, (__ea void *) aligned, LINE_SIZE);
+
+ for (i = 0; i < LINE_SIZE / sizeof (int); i++)
+ {
+ if (ls_block[i] == 0)
+ abort ();
+ }
+
+ /* Now check that dirty evictions do write back. */
+ p = cache_fetch_dirty ((__ea void *) aligned, LINE_SIZE);
+ for (i = 0; i < LINE_SIZE / sizeof (int); i++)
+ p[i] = 0;
+
+ cache_evict ((__ea void *) aligned);
+ memcpy_ea ((__ea char *) ls_block, (__ea void *) aligned, LINE_SIZE);
+
+ for (i = 0; i < LINE_SIZE / sizeof (int); i++)
+ {
+ if (ls_block[i] != 0)
+ abort ();
+ }
+
+ /* Finally, check that non-atomic writeback only writes dirty bytes. */
+
+ for (i = 0; i < LINE_SIZE / sizeof (int); i++)
+ {
+ p = cache_fetch_dirty ((__ea void *) (aligned + i * sizeof (int)),
+ (i % 2) * sizeof (int));
+ p[0] = -1;
+ }
+
+ cache_evict ((__ea void *) aligned);
+ memcpy_ea ((__ea char *) ls_block, (__ea void *) aligned, LINE_SIZE);
+
+ for (i = 0; i < LINE_SIZE / sizeof (int); i++)
+ {
+ if ((ls_block[i] == -1) && (i % 2 == 0))
+ abort ();
+ if ((ls_block[i] == 0) && (i % 2 == 1))
+ abort ();
+ }
+}
+
+/* Test LS forced-eviction. */
+void
+test3 (void)
+{
+ addr aligned = ((((addr) bigblock) + LINE_SIZE - 1) & -LINE_SIZE);
+ char *test = NULL;
+ char *ls = NULL;
+ int i = 0;
+
+ /* Init memory, fill the cache to capacity. */
+ ls = cache_fetch_dirty ((__ea void *) aligned, LINE_SIZE);
+ for (i = 1; i < (CACHE_SIZE / LINE_SIZE); i++)
+ cache_fetch_dirty ((__ea void *) (aligned + i * LINE_SIZE), LINE_SIZE);
+
+ memset (ls, -1, LINE_SIZE);
+ test = cache_fetch ((__ea void *) (aligned + CACHE_SIZE));
+
+ /* test == ls indicates cache collision. */
+ if (test != ls)
+ abort ();
+
+ /* Make sure it actually wrote the cache line. */
+ for (i = 0; i < LINE_SIZE; i++)
+ {
+ if (ls[i] != 0)
+ abort ();
+ }
+
+ ls = cache_fetch ((__ea void *) aligned);
+
+ /* test != ls indicates another entry was evicted. */
+ if (test == ls)
+ abort ();
+
+ /* Make sure that the previous eviction actually wrote back. */
+ for (i = 0; i < LINE_SIZE; i++)
+ {
+ if (ls[i] != 0xFF)
+ abort ();
+ }
+}
+
+int
+main (int argc, char **argv)
+{
+ init_mem ();
+ test1 ();
+ test2 ();
+ test3 ();
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/cast1.c b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/cast1.c
new file mode 100644
index 000000000..9ec4e1546
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/cast1.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 2009 Free Software Foundation, Inc.
+
+ This file 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 file 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 this file; see the file COPYING3. If not see
+ <http://www.gnu.org/licenses/>. */
+
+/* { dg-do run } */
+
+extern void abort (void);
+extern unsigned long long __ea_local_store;
+
+__ea int *ppu;
+int x, *spu = &x, *spu2;
+
+int
+main (int argc, char **argv)
+{
+ ppu = (__ea int *) spu;
+ spu2 = (int *) ppu;
+
+#ifdef __EA32__
+ if ((int) ppu != (int) __ea_local_store + (int) spu)
+#else
+ if ((unsigned long long) ppu != __ea_local_store + (unsigned long long)(int) spu)
+#endif
+
+ abort ();
+
+ if (spu != spu2)
+ abort ();
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/cast2.c b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/cast2.c
new file mode 100644
index 000000000..6ce57dc4d
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/cast2.c
@@ -0,0 +1,74 @@
+/* Copyright (C) 2009 Free Software Foundation, Inc.
+
+ This file 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 file 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 this file; see the file COPYING3. If not see
+ <http://www.gnu.org/licenses/>. */
+
+/* { dg-do run } */
+
+extern void abort (void);
+
+int array[128];
+
+__ea int *ea;
+int *lm;
+
+void verify_ea (void) __attribute__ ((noinline));
+void
+verify_ea (void)
+{
+ if (ea != (__ea int *)lm)
+ abort ();
+}
+
+void verify_lm (void) __attribute__ ((noinline));
+void
+verify_lm (void)
+{
+ if ((int *)ea != lm)
+ abort ();
+}
+
+void verify_diff (int x) __attribute__ ((noinline));
+void
+verify_diff (int x)
+{
+ if (ea - lm != x)
+ abort ();
+}
+
+int
+main (int argc, char **argv)
+{
+ ea = 0;
+ lm = 0;
+ verify_ea ();
+ verify_lm ();
+ verify_diff (0);
+
+ ea = &array[64];
+ lm = &array[64];
+ verify_ea ();
+ verify_lm ();
+ verify_diff (0);
+
+ ea = &array[0];
+ lm = &array[64];
+ verify_diff (-64);
+
+ ea = &array[64];
+ lm = &array[0];
+ verify_diff (64);
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/compile1.c b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/compile1.c
new file mode 100644
index 000000000..ee7a32ad2
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/compile1.c
@@ -0,0 +1,109 @@
+/* Copyright (C) 2009 Free Software Foundation, Inc.
+
+ This file 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 file 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 this file; see the file COPYING3. If not see
+ <http://www.gnu.org/licenses/>. */
+
+/* Valid __ea declarations. */
+
+/* { dg-do compile } */
+
+/* Typedefs. */
+typedef __ea int ea_int_t;
+typedef __ea int *ea_int_star_t;
+typedef int outer_t;
+
+/* Externs. */
+
+__ea extern int i1;
+extern __ea int i2;
+extern int __ea i3;
+extern __ea ea_int_t i4; /* __ea qualifier permitted via typedef. */
+extern int __ea __ea __ea dupe; /* __ea duplicate permitted directly. */
+extern int __ea *ppu;
+
+/* Pointers. */
+__ea int *i4p;
+
+/* Structs. */
+struct st {
+ __ea int *p;
+};
+
+/* Variable definitions. */
+__ea int ii0;
+int *__ea ii1;
+static int __ea ii2;
+
+void
+f1 ()
+{
+ int *spu;
+ ppu = (ea_int_t *) spu;
+ ppu = (ea_int_star_t) spu;
+}
+
+void
+f2 ()
+{
+ int *spu;
+ spu = (int *) ppu;
+ ppu = (__ea int *) spu;
+}
+
+void
+f3 ()
+{
+ int i = sizeof (__ea int);
+}
+
+__ea int *f4 (void)
+{
+ return 0;
+}
+
+int f5 (__ea int *parm)
+{
+ static __ea int local4;
+ int tmp = local4;
+ local4 = *parm;
+ return tmp;
+}
+
+static inline __ea void *f6 (__ea void *start)
+{
+ return 0;
+}
+
+void f7 (void)
+{
+ __ea void *s1;
+ auto __ea void *s2;
+}
+
+__ea int *f8 (__ea int *x)
+{
+ register __ea int *y = x;
+ __ea int *z = y;
+ return z;
+}
+
+long long f9 (__ea long long x[2])
+{
+ return x[0] + x[1];
+}
+
+void f10 ()
+{
+ static __ea outer_t o;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/compile2.c b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/compile2.c
new file mode 100644
index 000000000..58e64890e
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/compile2.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 2009 Free Software Foundation, Inc.
+
+ This file 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 file 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 this file; see the file COPYING3. If not see
+ <http://www.gnu.org/licenses/>. */
+
+/* Make sure __ea structure references work. */
+
+/* { dg-do compile } */
+
+typedef unsigned long int uintptr_t;
+
+struct tostruct
+{
+ uintptr_t selfpc;
+ long count;
+ unsigned short link;
+};
+
+/* froms are indexing tos */
+static __ea unsigned short *froms;
+static __ea struct tostruct *tos = 0;
+
+void
+foo (uintptr_t frompc, uintptr_t selfpc)
+{
+ __ea unsigned short *frompcindex;
+
+ frompcindex = &froms[(frompc) / (4 * sizeof (*froms))];
+ *frompcindex = tos[0].link;
+
+ return;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/cppdefine.c b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/cppdefine.c
new file mode 100644
index 000000000..583635734
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/cppdefine.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 2009 Free Software Foundation, Inc.
+
+ This file 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 file 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 this file; see the file COPYING3. If not see
+ <http://www.gnu.org/licenses/>. */
+
+/* Test default __EA32__/__EA64__ define. */
+
+/* { dg-do compile } */
+
+#if !defined (__EA32__) && !defined (__EA64__)
+#error both __EA32__ and __EA64__ undefined
+#endif
+
+#if defined (__EA32__) && defined (__EA64__)
+#error both __EA32__ and __EA64__ defined
+#endif
+
+#ifdef __EA32__
+int x [ sizeof (__ea char *) == 4 ? 1 : -1 ];
+#endif
+
+#ifdef __EA64__
+int x [ sizeof (__ea char *) == 8 ? 1 : -1 ];
+#endif
+
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/ea.exp b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/ea.exp
new file mode 100644
index 000000000..2e04f9d77
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/ea.exp
@@ -0,0 +1,54 @@
+# Copyright (C) 2008-2014 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 SPU target.
+if { ![istarget spu-*-*] } then {
+ return
+}
+
+# Load support procs.
+load_lib gcc-dg.exp
+
+# Return 1 if target __ea library functions are available
+proc check_effective_target_ealib { } {
+ return [check_no_compiler_messages ealib executable {
+ #include <ea.h>
+ int main (void)
+ {
+ __ea void *ptr = malloc_ea (1024);
+ return 0;
+ }
+ }]
+}
+
+# If a testcase doesn't have special options, use these.
+# We do not use the global DEFAULT_CFLAGS as all test cases
+# in this directory use the __ea address space qualifier
+# extension and thus will not compile with -ansi.
+set DEFAULT_EA_CFLAGS "-std=gnu99 -pedantic-errors -O2"
+
+# Initialize `dg'.
+dg-init
+
+# Run all tests in both -mea32 and -mea64 mode.
+set tests [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]]
+dg-runtest $tests "-mea32" $DEFAULT_EA_CFLAGS
+dg-runtest $tests "-mea64" $DEFAULT_EA_CFLAGS
+
+# All done.
+dg-finish
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/errors1.c b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/errors1.c
new file mode 100644
index 000000000..7d0b5a11c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/errors1.c
@@ -0,0 +1,67 @@
+/* Copyright (C) 2009 Free Software Foundation, Inc.
+
+ This file 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 file 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 this file; see the file COPYING3. If not see
+ <http://www.gnu.org/licenses/>. */
+
+/* Invalid __ea declarations. */
+
+/* { dg-do compile } */
+
+typedef __ea int eaint;
+
+void func ()
+{
+ register __ea int local1; /* { dg-error "'__ea' combined with 'register' qualifier for 'local1'" } */
+ auto __ea int local2; /* { dg-error "'__ea' combined with 'auto' qualifier for 'local2'" } */
+ __ea int local3; /* { dg-error "'__ea' specified for auto variable 'local3'" } */
+ register int *__ea p1; /* { dg-error "'__ea' combined with 'register' qualifier for 'p1'" } */
+ auto char *__ea p2; /* { dg-error "'__ea' combined with 'auto' qualifier for 'p2'" } */
+ void *__ea p3; /* { dg-error "'__ea' specified for auto variable 'p3'" } */
+ register __ea int a1[2]; /* { dg-error "'__ea' combined with 'register' qualifier for 'a1'" } */
+ auto __ea char a2[1]; /* { dg-error "'__ea' combined with 'auto' qualifier for 'a2'" } */
+ __ea char a3[5]; /* { dg-error "'__ea' specified for auto variable 'a3'" } */
+ register eaint td1; /* { dg-error "'__ea' combined with 'register' qualifier for 'td1'" } */
+ auto eaint td2; /* { dg-error "'__ea' combined with 'auto' qualifier for 'td2'" } */
+ eaint td3; /* { dg-error "'__ea' specified for auto variable 'td3'" } */
+}
+
+void func2 (__ea int x) /* { dg-error "'__ea' specified for parameter 'x'" } */
+{ }
+
+void func2td (eaint x) /* { dg-error "'__ea' specified for parameter 'x'" } */
+{ }
+
+struct st {
+ __ea int x; /* { dg-error "'__ea' specified for structure field 'x'" } */
+ eaint td; /* { dg-error "'__ea' specified for structure field 'td'" } */
+ int *__ea q; /* { dg-error "'__ea' specified for structure field 'q'" } */
+ int __ea b : 7; /* { dg-error "'__ea' specified for structure field 'b'" } */
+ int __ea : 1; /* { dg-error "'__ea' specified for structure field" } */
+} s;
+
+struct A { int a; };
+
+int func3 (int *__ea); /* { dg-error "'__ea' specified for unnamed parameter" } */
+int func3 (int *__ea x) /* { dg-error "'__ea' specified for parameter 'x'" } */
+{
+ struct A i = (__ea struct A) { 1 }; /* { dg-error "compound literal qualified by address-space qualifier" } */
+ return i.a;
+}
+
+extern __ea int ea_var; /* { dg-message "note: previous declaration of 'ea_var' was here" } */
+int ea_var; /* { dg-error "conflicting named address spaces \\(generic vs __ea\\) for 'ea_var'" } */
+
+extern eaint ea_var_td; /* { dg-message "note: previous declaration of 'ea_var_td' was here" } */
+int ea_var_td; /* { dg-error "conflicting named address spaces \\(generic vs __ea\\) for 'ea_var_td'" } */
+
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/errors2.c b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/errors2.c
new file mode 100644
index 000000000..74a32ff5e
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/errors2.c
@@ -0,0 +1,107 @@
+/* Copyright (C) 2009 Free Software Foundation, Inc.
+
+ This file 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 file 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 this file; see the file COPYING3. If not see
+ <http://www.gnu.org/licenses/>. */
+
+/* Invalid __ea declarations. */
+
+/* { dg-do compile } */
+
+__ea char ea_str[] = "abc";
+char lm_str[] = "abc";
+
+__ea char *lm_ea_ptr1 = "abc"; /* { dg-error "initializer element is not computable at load time" } */
+__ea char *lm_ea_ptr2 = (__ea char *)"abc"; /* { dg-error "initializer element is not constant" } */
+__ea char *lm_ea_ptr3 = ea_str;
+__ea char *lm_ea_ptr4 = (__ea char *)ea_str;
+__ea char *lm_ea_ptr5 = lm_str; /* { dg-error "initializer element is not computable at load time" } */
+__ea char *lm_ea_ptr6 = (__ea char *)lm_str; /* { dg-error "initializer element is not constant" } */
+
+__ea char * __ea ea_ea_ptr1 = ea_str;
+__ea char * __ea ea_ea_ptr2 = (__ea char *)ea_str;
+
+char * __ea ea_lm_ptr1 = lm_str;
+char * __ea ea_lm_ptr2 = (char *)lm_str;
+
+struct foo {
+ int first;
+ __ea char *ptr;
+ int last;
+};
+
+__ea struct foo ea_struct1 = {
+ 10,
+ (__ea char *)0,
+ 11,
+};
+
+__ea struct foo ea_struct2 = {
+ 20,
+ 0,
+ 21,
+};
+
+struct foo ea_struct3 = {
+ 30,
+ ea_str,
+ 31,
+};
+
+struct foo ea_struct4 = {
+ 40,
+ (__ea char *)lm_str, /* { dg-error "(initializer element is not constant)|(near initialization)" "" } */
+ 41,
+};
+
+struct bar {
+ int first;
+ char *ptr;
+ int last;
+};
+
+__ea struct bar ea_struct5 = {
+ 50,
+ 0,
+ 51,
+};
+
+__ea struct bar ea_struct6 = {
+ 60,
+ (char *)0,
+ 61,
+};
+
+__ea struct bar ea_struct7 = {
+ 70,
+ lm_str,
+ 71,
+};
+
+struct bar lm_struct8 = {
+ 80,
+ 0,
+ 81,
+};
+
+struct bar lm_struct9 = {
+ 90,
+ (char *)0,
+ 91,
+};
+
+struct bar lm_struct10 = {
+ 100,
+ lm_str,
+ 101,
+};
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/execute1.c b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/execute1.c
new file mode 100644
index 000000000..99d6d6918
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/execute1.c
@@ -0,0 +1,41 @@
+/* Copyright (C) 2009 Free Software Foundation, Inc.
+
+ This file 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 file 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 this file; see the file COPYING3. If not see
+ <http://www.gnu.org/licenses/>. */
+
+/* { dg-do compile } */
+
+#include <stdlib.h>
+
+__ea char str[] = "abc";
+
+int
+main (void)
+{
+ __ea char *p = str;
+
+ if (*p++ != 'a')
+ abort ();
+
+ if (*p++ != 'b')
+ abort ();
+
+ if (*p++ != 'c')
+ abort ();
+
+ if (*p++ != '\0')
+ abort ();
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/execute2.c b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/execute2.c
new file mode 100644
index 000000000..5fce4e673
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/execute2.c
@@ -0,0 +1,41 @@
+/* Copyright (C) 2009 Free Software Foundation, Inc.
+
+ This file 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 file 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 this file; see the file COPYING3. If not see
+ <http://www.gnu.org/licenses/>. */
+
+/* { dg-do run } */
+
+#include <stdlib.h>
+
+char str[] = "abc";
+
+int
+main (void)
+{
+ __ea char *p = (__ea char *)str;
+
+ if (*p++ != 'a')
+ abort ();
+
+ if (*p++ != 'b')
+ abort ();
+
+ if (*p++ != 'c')
+ abort ();
+
+ if (*p++ != '\0')
+ abort ();
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/execute3.c b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/execute3.c
new file mode 100644
index 000000000..1b8c139d7
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/execute3.c
@@ -0,0 +1,39 @@
+/* Copyright (C) 2009 Free Software Foundation, Inc.
+
+ This file 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 file 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 this file; see the file COPYING3. If not see
+ <http://www.gnu.org/licenses/>. */
+
+/* { dg-do run } */
+
+#include <stdlib.h>
+
+int
+main (void)
+{
+ __ea char *p = (__ea char *)"abc";
+
+ if (*p++ != 'a')
+ abort ();
+
+ if (*p++ != 'b')
+ abort ();
+
+ if (*p++ != 'c')
+ abort ();
+
+ if (*p++ != '\0')
+ abort ();
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/ops1.c b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/ops1.c
new file mode 100644
index 000000000..0d162f218
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/ops1.c
@@ -0,0 +1,94 @@
+/* Copyright (C) 2009 Free Software Foundation, Inc.
+
+ This file 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 file 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 this file; see the file COPYING3. If not see
+ <http://www.gnu.org/licenses/>. */
+
+/* This is the same as ops2.c except for the compile option.
+ If you modify this code, please modify ops2.c as well. */
+
+/* { dg-do compile } */
+/* { dg-options "-O2 -std=gnu99 -pedantic-errors -maddress-space-conversion" } */
+
+#define __lm
+
+__ea int ea_var = 1;
+__lm int lm_var = 2;
+
+typedef __ea int *ea_ptr_t;
+typedef __lm int *lm_ptr_t;
+
+typedef __ea void *ea_vptr_t;
+typedef __lm void *lm_vptr_t;
+
+ea_ptr_t ea, ea2;
+lm_ptr_t lm, lm2;
+
+ea_vptr_t eav;
+lm_vptr_t lmv;
+
+extern void call_ea (ea_ptr_t);
+extern void call_lm (lm_ptr_t);
+
+/* Assignment, initialization, argument passing, and return. */
+void to_ea (void) { ea = lm; }
+void to_lm (void) { lm = ea; } /* { dg-error "assignment from pointer to non-enclosed address space" } */
+void init_ea (void) { ea_ptr_t l_ea = lm; }
+void init_lm (void) { lm_ptr_t l_lm = ea; } /* { dg-error "initialization from pointer to non-enclosed address space" } */
+ea_ptr_t ret_ea (void) { return lm; }
+lm_ptr_t ret_lm (void) { return ea; } /* { dg-error "return from pointer to non-enclosed address space" } */
+void call_ea2 (void) { call_ea (lm); }
+void call_lm2 (void) { call_lm (ea); } /* { dg-error "passing argument 1 of 'call_lm' from pointer to non-enclosed address space" } */
+
+/* Explicit casts. */
+void to_ea_with_cast (void) { ea = (ea_ptr_t)lm; }
+void to_lm_with_cast (void) { lm = (lm_ptr_t)ea; }
+void init_ea_with_cast (void) { ea_ptr_t l_ea = (ea_ptr_t)lm; }
+void init_lm_with_cast (void) { lm_ptr_t l_lm = (lm_ptr_t)ea; }
+ea_ptr_t ret_ea_with_cast (void) { return (ea_ptr_t)lm; }
+lm_ptr_t ret_lm_with_cast (void) { return (lm_ptr_t)ea; }
+void call_ea2_with_cast (void) { call_ea ((ea_ptr_t)lm); }
+void call_lm2_with_cast (void) { call_lm ((lm_ptr_t)ea); }
+
+/* Arithmetic operators. */
+int sub_eaea (void) { return ea - ea2; }
+int sub_ealm (void) { return ea - lm2; }
+int sub_lmea (void) { return lm - ea2; }
+int sub_lmlm (void) { return lm - lm2; }
+ea_ptr_t if_eaea1 (int test) { return test? ea : ea2; }
+lm_ptr_t if_eaea2 (int test) { return test? ea : ea2; } /* { dg-error "return from pointer to non-enclosed address space" } */
+ea_ptr_t if_ealm1 (int test) { return test? ea : lm2; }
+lm_ptr_t if_ealm2 (int test) { return test? ea : lm2; } /* { dg-error "return from pointer to non-enclosed address space" } */
+ea_ptr_t if_lmea1 (int test) { return test? lm : ea2; }
+lm_ptr_t if_lmea2 (int test) { return test? lm : ea2; } /* { dg-error "return from pointer to non-enclosed address space" } */
+ea_ptr_t if_lmlm1 (int test) { return test? lm : lm2; }
+lm_ptr_t if_lmlm2 (int test) { return test? lm : lm2; }
+
+/* Relational operators. */
+int eq_eaea (void) { return ea == ea2; }
+int eq_ealm (void) { return ea == lm2; }
+int eq_lmea (void) { return lm == ea2; }
+int eq_lmlm (void) { return lm == lm2; }
+int lt_eaea (void) { return ea < ea2; }
+int lt_ealm (void) { return ea < lm2; }
+int lt_lmea (void) { return lm < ea2; }
+int lt_lmlm (void) { return lm < lm2; }
+
+/* Null pointer. */
+void null_ea1 (void) { ea = 0; }
+void null_ea2 (void) { ea = (void *)0; }
+void null_ea3 (void) { ea = (__ea void *)0; }
+void null_lm1 (void) { lm = 0; }
+void null_lm2 (void) { lm = (void *)0; }
+void null_lm3 (void) { lm = (__ea void *)0; } /* { dg-error "assignment from pointer to non-enclosed address space" } */
+
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/ops2.c b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/ops2.c
new file mode 100644
index 000000000..2514e6b20
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/ops2.c
@@ -0,0 +1,94 @@
+/* Copyright (C) 2009 Free Software Foundation, Inc.
+
+ This file 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 file 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 this file; see the file COPYING3. If not see
+ <http://www.gnu.org/licenses/>. */
+
+/* This is the same as ops1.c except for the compile option.
+ If you modify this code, please modify ops1.c as well. */
+
+/* { dg-do compile } */
+/* { dg-options "-O2 -std=gnu99 -pedantic-errors -mno-address-space-conversion" } */
+
+#define __lm
+
+__ea int ea_var = 1;
+__lm int lm_var = 2;
+
+typedef __ea int *ea_ptr_t;
+typedef __lm int *lm_ptr_t;
+
+typedef __ea void *ea_vptr_t;
+typedef __lm void *lm_vptr_t;
+
+ea_ptr_t ea, ea2;
+lm_ptr_t lm, lm2;
+
+ea_vptr_t eav;
+lm_vptr_t lmv;
+
+extern void call_ea (ea_ptr_t);
+extern void call_lm (lm_ptr_t);
+
+/* Assignment, initialization, argument passing, and return. */
+void to_ea (void) { ea = lm; } /* { dg-error "assignment from pointer to non-enclosed address space" } */
+void to_lm (void) { lm = ea; } /* { dg-error "assignment from pointer to non-enclosed address space" } */
+void init_ea (void) { ea_ptr_t l_ea = lm; } /* { dg-error "initialization from pointer to non-enclosed address space" } */
+void init_lm (void) { lm_ptr_t l_lm = ea; } /* { dg-error "initialization from pointer to non-enclosed address space" } */
+ea_ptr_t ret_ea (void) { return lm; } /* { dg-error "return from pointer to non-enclosed address space" } */
+lm_ptr_t ret_lm (void) { return ea; } /* { dg-error "return from pointer to non-enclosed address space" } */
+void call_ea2 (void) { call_ea (lm); } /* { dg-error "passing argument 1 of 'call_ea' from pointer to non-enclosed address space" } */
+void call_lm2 (void) { call_lm (ea); } /* { dg-error "passing argument 1 of 'call_lm' from pointer to non-enclosed address space" } */
+
+/* Explicit casts. */
+void to_ea_with_cast (void) { ea = (ea_ptr_t)lm; } /* { dg-warning "cast to __ea address space pointer" } */
+void to_lm_with_cast (void) { lm = (lm_ptr_t)ea; } /* { dg-warning "cast to generic address space pointer" } */
+void init_ea_with_cast (void) { ea_ptr_t l_ea = (ea_ptr_t)lm; } /* { dg-warning "cast to __ea address space pointer" } */
+void init_lm_with_cast (void) { lm_ptr_t l_lm = (lm_ptr_t)ea; } /* { dg-warning "cast to generic address space pointer" } */
+ea_ptr_t ret_ea_with_cast (void) { return (ea_ptr_t)lm; } /* { dg-warning "cast to __ea address space pointer" } */
+lm_ptr_t ret_lm_with_cast (void) { return (lm_ptr_t)ea; } /* { dg-warning "cast to generic address space pointer" } */
+void call_ea2_with_cast (void) { call_ea ((ea_ptr_t)lm); } /* { dg-warning "cast to __ea address space pointer" } */
+void call_lm2_with_cast (void) { call_lm ((lm_ptr_t)ea); } /* { dg-warning "cast to generic address space pointer" } */
+
+/* Arithmetic operators. */
+int sub_eaea (void) { return ea - ea2; }
+int sub_ealm (void) { return ea - lm2; } /* { dg-error "invalid operands to binary -" } */
+int sub_lmea (void) { return lm - ea2; } /* { dg-error "invalid operands to binary -" } */
+int sub_lmlm (void) { return lm - lm2; }
+ea_ptr_t if_eaea1 (int test) { return test? ea : ea2; }
+lm_ptr_t if_eaea2 (int test) { return test? ea : ea2; } /* { dg-error "return from pointer to non-enclosed address space" } */
+ea_ptr_t if_ealm1 (int test) { return test? ea : lm2; } /* { dg-error "pointers to disjoint address spaces used in conditional expression" } */
+lm_ptr_t if_ealm2 (int test) { return test? ea : lm2; } /* { dg-error "pointers to disjoint address spaces used in conditional expression" } */
+ea_ptr_t if_lmea1 (int test) { return test? lm : ea2; } /* { dg-error "pointers to disjoint address spaces used in conditional expression" } */
+lm_ptr_t if_lmea2 (int test) { return test? lm : ea2; } /* { dg-error "pointers to disjoint address spaces used in conditional expression" } */
+ea_ptr_t if_lmlm1 (int test) { return test? lm : lm2; } /* { dg-error "return from pointer to non-enclosed address space" } */
+lm_ptr_t if_lmlm2 (int test) { return test? lm : lm2; }
+
+/* Relational operators. */
+int eq_eaea (void) { return ea == ea2; }
+int eq_ealm (void) { return ea == lm2; } /* { dg-error "comparison of pointers to disjoint address spaces" } */
+int eq_lmea (void) { return lm == ea2; } /* { dg-error "comparison of pointers to disjoint address spaces" } */
+int eq_lmlm (void) { return lm == lm2; }
+int lt_eaea (void) { return ea < ea2; }
+int lt_ealm (void) { return ea < lm2; } /* { dg-error "comparison of pointers to disjoint address spaces" } */
+int lt_lmea (void) { return lm < ea2; } /* { dg-error "comparison of pointers to disjoint address spaces" } */
+int lt_lmlm (void) { return lm < lm2; }
+
+/* Null pointer. */
+void null_ea1 (void) { ea = 0; }
+void null_ea2 (void) { ea = (void *)0; }
+void null_ea3 (void) { ea = (__ea void *)0; }
+void null_lm1 (void) { lm = 0; }
+void null_lm2 (void) { lm = (void *)0; }
+void null_lm3 (void) { lm = (__ea void *)0; } /* { dg-error "assignment from pointer to non-enclosed address space" } */
+
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/options1.c b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/options1.c
new file mode 100644
index 000000000..190400902
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/options1.c
@@ -0,0 +1,22 @@
+/* Copyright (C) 2009 Free Software Foundation, Inc.
+
+ This file 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 file 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 this file; see the file COPYING3. If not see
+ <http://www.gnu.org/licenses/>. */
+
+/* Test -mcache-size. */
+
+/* { dg-do compile } */
+/* { dg-options "-mcache-size=128" } */
+
+int x;
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/pr41857.c b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/pr41857.c
new file mode 100644
index 000000000..17710674c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/pr41857.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 2009 Free Software Foundation, Inc.
+
+ This file 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 file 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 this file; see the file COPYING3. If not see
+ <http://www.gnu.org/licenses/>. */
+
+/* { dg-do compile } */
+
+__ea char *strchr_ea (__ea const char *s, int c);
+__ea char *foo (__ea char *s)
+{
+ __ea char *ret = s;
+ int i;
+
+ for (i = 0; i < 3; i++)
+ ret = strchr_ea (ret, s[i]);
+
+ return ret;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/test-sizes.c b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/test-sizes.c
new file mode 100644
index 000000000..e467616b6
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/test-sizes.c
@@ -0,0 +1,608 @@
+/* Copyright (C) 2009 Free Software Foundation, Inc.
+
+ This file 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 file 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 this file; see the file COPYING3. If not see
+ <http://www.gnu.org/licenses/>. */
+
+/* { dg-do run } */
+
+#ifdef __EA32__
+#define EA_PTRSIZE 4
+#endif
+#ifdef __EA64__
+#define EA_PTRSIZE 8
+#endif
+
+#if !defined(LEVEL1) && !defined(LEVEL2) && !defined(LEVEL3)
+#define LEVEL1 1 /* single pointer indirection */
+#define LEVEL2 1 /* 2 levels of pointer indirection */
+#define LEVEL3 1 /* 3 levels of pointer indirection */
+
+#else
+#ifndef LEVEL1
+#define LEVEL1 0
+#endif
+
+#ifndef LEVEL2
+#define LEVEL2 0
+#endif
+
+#ifndef LEVEL3
+#define LEVEL3 0
+#endif
+#endif
+
+#if !defined(USE_SIMPLE) && !defined(USE_COMPLEX)
+#define USE_SIMPLE 1 /* build up pointers via multiple typedefs */
+#define USE_COMPLEX 1 /* single typedef for pointer indirections */
+
+#else
+#ifndef USE_SIMPLE
+#define USE_SIMPLE 0
+#endif
+
+#ifndef USE_COMPLEX
+#define USE_COMPLEX 0
+#endif
+#endif
+
+#if !defined(USE_LOCAL_VAR) && !defined(USE_EA_VAR)
+#define USE_LOCAL_VAR 1 /* use variables declared locally */
+#define USE_EA_VAR 1 /* use variables on the host */
+
+#else
+#ifndef USE_LOCAL_VAR
+#define USE_LOCAL_VAR 0
+#endif
+
+#ifndef USE_EA_VAR
+#define USE_EA_VAR 0
+#endif
+#endif
+
+static int errors;
+
+#ifdef USE_PRINTF /* print results via printf */
+#include <stdio.h>
+#include <stdlib.h>
+
+static int num_tests;
+
+#define TEST_SIZE(EXPR, EXPECTED) \
+do { \
+ char *msg; \
+ \
+ if (sizeof (EXPR) != EXPECTED) \
+ { \
+ msg = ", FAIL"; \
+ errors++; \
+ } \
+ else \
+ msg = ""; \
+ \
+ num_tests++; \
+ printf ("sizeof %-20s = %2u, expected = %2u%s\n", \
+ #EXPR, \
+ (unsigned) sizeof (EXPR), \
+ (unsigned) EXPECTED, \
+ msg); \
+} while (0)
+
+#define PRINT1(FMT) printf (FMT)
+#define PRINT2(FMT,A1) printf (FMT,A1)
+#define PRINT3(FMT,A1,A2) printf (FMT,A1,A2)
+
+#else /* standalone */
+extern void abort (void);
+
+#define TEST_SIZE(EXPR, EXPECTED) \
+do { \
+ if (sizeof (EXPR) != EXPECTED) \
+ abort (); \
+} while (0)
+
+#define PRINT1(FMT)
+#define PRINT2(FMT,ARG)
+#define PRINT3(FMT,A1,A2)
+#endif
+
+/* 'local memory' hack to keep the same spacing. */
+#define __lm
+
+#if USE_SIMPLE
+#if (LEVEL1 || LEVEL2 || LEVEL3)
+typedef __lm char *lm_ptr_t;
+typedef __ea char *ea_ptr_t;
+#endif
+
+#if LEVEL1
+#if USE_LOCAL_VAR
+__lm lm_ptr_t lm_ptr;
+__lm ea_ptr_t ea_ptr;
+#endif
+
+#if USE_EA_VAR
+__ea lm_ptr_t lm_ptr_ea;
+__ea ea_ptr_t ea_ptr_ea;
+#endif
+#endif
+
+#if (LEVEL2 || LEVEL3)
+typedef __lm lm_ptr_t *lm_lm_ptr_t;
+typedef __ea lm_ptr_t *ea_lm_ptr_t;
+typedef __lm ea_ptr_t *lm_ea_ptr_t;
+typedef __ea ea_ptr_t *ea_ea_ptr_t;
+#endif
+
+#if LEVEL2
+#if USE_LOCAL_VAR
+__lm lm_lm_ptr_t lm_lm_ptr;
+__lm ea_lm_ptr_t ea_lm_ptr;
+__lm lm_ea_ptr_t lm_ea_ptr;
+__lm ea_ea_ptr_t ea_ea_ptr;
+#endif
+
+#if USE_EA_VAR
+__ea lm_lm_ptr_t lm_lm_ptr_ea;
+__ea ea_lm_ptr_t ea_lm_ptr_ea;
+__ea lm_ea_ptr_t lm_ea_ptr_ea;
+__ea ea_ea_ptr_t ea_ea_ptr_ea;
+#endif
+#endif
+
+#if LEVEL3
+typedef __lm lm_lm_ptr_t *lm_lm_lm_ptr_t;
+typedef __ea lm_lm_ptr_t *ea_lm_lm_ptr_t;
+typedef __lm ea_lm_ptr_t *lm_ea_lm_ptr_t;
+typedef __ea ea_lm_ptr_t *ea_ea_lm_ptr_t;
+typedef __lm lm_ea_ptr_t *lm_lm_ea_ptr_t;
+typedef __ea lm_ea_ptr_t *ea_lm_ea_ptr_t;
+typedef __lm ea_ea_ptr_t *lm_ea_ea_ptr_t;
+typedef __ea ea_ea_ptr_t *ea_ea_ea_ptr_t;
+
+#if USE_LOCAL_VAR
+__lm lm_lm_lm_ptr_t lm_lm_lm_ptr;
+__lm ea_lm_lm_ptr_t ea_lm_lm_ptr;
+__lm lm_ea_lm_ptr_t lm_ea_lm_ptr;
+__lm ea_ea_lm_ptr_t ea_ea_lm_ptr;
+__lm lm_lm_ea_ptr_t lm_lm_ea_ptr;
+__lm ea_lm_ea_ptr_t ea_lm_ea_ptr;
+__lm lm_ea_ea_ptr_t lm_ea_ea_ptr;
+__lm ea_ea_ea_ptr_t ea_ea_ea_ptr;
+#endif
+
+#if USE_EA_VAR
+__ea lm_lm_lm_ptr_t lm_lm_lm_ptr_ea;
+__ea ea_lm_lm_ptr_t ea_lm_lm_ptr_ea;
+__ea lm_ea_lm_ptr_t lm_ea_lm_ptr_ea;
+__ea ea_ea_lm_ptr_t ea_ea_lm_ptr_ea;
+__ea lm_lm_ea_ptr_t lm_lm_ea_ptr_ea;
+__ea ea_lm_ea_ptr_t ea_lm_ea_ptr_ea;
+__ea lm_ea_ea_ptr_t lm_ea_ea_ptr_ea;
+__ea ea_ea_ea_ptr_t ea_ea_ea_ptr_ea;
+#endif
+#endif
+#endif
+
+#if USE_COMPLEX
+#if LEVEL1
+#if USE_LOCAL_VAR
+__lm char *__lm lm_cptr;
+__ea char *__lm ea_cptr;
+#endif
+
+#if USE_EA_VAR
+__lm char *__ea lm_cptr_ea;
+__ea char *__ea ea_cptr_ea;
+#endif
+#endif
+
+#if LEVEL2
+#if USE_LOCAL_VAR
+__lm char *__lm *__lm lm_lm_cptr;
+__lm char *__ea *__lm ea_lm_cptr;
+__ea char *__lm *__lm lm_ea_cptr;
+__ea char *__ea *__lm ea_ea_cptr;
+#endif
+
+#if USE_EA_VAR
+__lm char *__lm *__ea lm_lm_cptr_ea;
+__lm char *__ea *__ea ea_lm_cptr_ea;
+__ea char *__lm *__ea lm_ea_cptr_ea;
+__ea char *__ea *__ea ea_ea_cptr_ea;
+#endif
+#endif
+
+#if LEVEL3
+#if USE_LOCAL_VAR
+__lm char *__lm *__lm *__lm lm_lm_lm_cptr;
+__lm char *__ea *__lm *__lm lm_ea_lm_cptr;
+__ea char *__lm *__lm *__lm lm_lm_ea_cptr;
+__ea char *__ea *__lm *__lm lm_ea_ea_cptr;
+__lm char *__lm *__ea *__lm ea_lm_lm_cptr;
+__lm char *__ea *__ea *__lm ea_ea_lm_cptr;
+__ea char *__lm *__ea *__lm ea_lm_ea_cptr;
+__ea char *__ea *__ea *__lm ea_ea_ea_cptr;
+#endif
+
+#if USE_EA_VAR
+__lm char *__lm *__lm *__ea lm_lm_lm_cptr_ea;
+__lm char *__ea *__lm *__ea lm_ea_lm_cptr_ea;
+__ea char *__lm *__lm *__ea lm_lm_ea_cptr_ea;
+__ea char *__ea *__lm *__ea lm_ea_ea_cptr_ea;
+__lm char *__lm *__ea *__ea ea_lm_lm_cptr_ea;
+__lm char *__ea *__ea *__ea ea_ea_lm_cptr_ea;
+__ea char *__lm *__ea *__ea ea_lm_ea_cptr_ea;
+__ea char *__ea *__ea *__ea ea_ea_ea_cptr_ea;
+#endif
+#endif
+#endif
+
+int
+main ()
+{
+ PRINT2 ("LEVEL1 = %d\n", LEVEL1);
+ PRINT2 ("LEVEL2 = %d\n", LEVEL2);
+ PRINT2 ("LEVEL3 = %d\n", LEVEL3);
+ PRINT2 ("USE_SIMPLE = %d\n", USE_SIMPLE);
+ PRINT2 ("USE_COMPLEX = %d\n", USE_COMPLEX);
+ PRINT2 ("USE_LOCAL_VAR = %d\n", USE_LOCAL_VAR);
+ PRINT2 ("USE_EA_VAR = %d\n", USE_EA_VAR);
+ PRINT1 ("\n");
+
+#if USE_SIMPLE
+#if LEVEL1
+#if USE_LOCAL_VAR
+ TEST_SIZE ( lm_ptr, 4);
+ TEST_SIZE (*lm_ptr, 1);
+ TEST_SIZE ( ea_ptr, EA_PTRSIZE);
+ TEST_SIZE (*ea_ptr, 1);
+ PRINT1 ("\n");
+#endif
+
+#if USE_EA_VAR
+ TEST_SIZE ( lm_ptr_ea, 4);
+ TEST_SIZE (*lm_ptr_ea, 1);
+ TEST_SIZE ( ea_ptr_ea, EA_PTRSIZE);
+ TEST_SIZE (*ea_ptr_ea, 1);
+ PRINT1 ("\n");
+#endif
+#endif
+
+#if LEVEL2
+#if USE_LOCAL_VAR
+ TEST_SIZE ( lm_lm_ptr, 4);
+ TEST_SIZE ( *lm_lm_ptr, 4);
+ TEST_SIZE (**lm_lm_ptr, 1);
+ PRINT1 ("\n");
+
+ TEST_SIZE ( lm_ea_ptr, 4);
+ TEST_SIZE ( *lm_ea_ptr, EA_PTRSIZE);
+ TEST_SIZE (**lm_ea_ptr, 1);
+ PRINT1 ("\n");
+
+ TEST_SIZE ( ea_lm_ptr, EA_PTRSIZE);
+ TEST_SIZE ( *ea_lm_ptr, 4);
+ TEST_SIZE (**ea_lm_ptr, 1);
+ PRINT1 ("\n");
+
+ TEST_SIZE ( ea_ea_ptr, EA_PTRSIZE);
+ TEST_SIZE ( *ea_ea_ptr, EA_PTRSIZE);
+ TEST_SIZE (**ea_ea_ptr, 1);
+ PRINT1 ("\n");
+#endif
+
+#if USE_EA_VAR
+ TEST_SIZE ( lm_lm_ptr_ea, 4);
+ TEST_SIZE ( *lm_lm_ptr_ea, 4);
+ TEST_SIZE (**lm_lm_ptr_ea, 1);
+ PRINT1 ("\n");
+
+ TEST_SIZE ( lm_ea_ptr_ea, 4);
+ TEST_SIZE ( *lm_ea_ptr_ea, EA_PTRSIZE);
+ TEST_SIZE (**lm_ea_ptr_ea, 1);
+ PRINT1 ("\n");
+
+ TEST_SIZE ( ea_lm_ptr_ea, EA_PTRSIZE);
+ TEST_SIZE ( *ea_lm_ptr_ea, 4);
+ TEST_SIZE (**ea_lm_ptr_ea, 1);
+ PRINT1 ("\n");
+
+ TEST_SIZE ( ea_ea_ptr_ea, EA_PTRSIZE);
+ TEST_SIZE ( *ea_ea_ptr_ea, EA_PTRSIZE);
+ TEST_SIZE (**ea_ea_ptr_ea, 1);
+ PRINT1 ("\n");
+#endif
+#endif
+
+#if LEVEL3
+#if USE_LOCAL_VAR
+ TEST_SIZE ( lm_lm_lm_ptr, 4);
+ TEST_SIZE ( *lm_lm_lm_ptr, 4);
+ TEST_SIZE ( **lm_lm_lm_ptr, 4);
+ TEST_SIZE (***lm_lm_lm_ptr, 1);
+ PRINT1 ("\n");
+
+ TEST_SIZE ( lm_lm_ea_ptr, 4);
+ TEST_SIZE ( *lm_lm_ea_ptr, 4);
+ TEST_SIZE ( **lm_lm_ea_ptr, EA_PTRSIZE);
+ TEST_SIZE (***lm_lm_ea_ptr, 1);
+ PRINT1 ("\n");
+
+ TEST_SIZE ( lm_ea_lm_ptr, 4);
+ TEST_SIZE ( *lm_ea_lm_ptr, EA_PTRSIZE);
+ TEST_SIZE ( **lm_ea_lm_ptr, 4);
+ TEST_SIZE (***lm_ea_lm_ptr, 1);
+ PRINT1 ("\n");
+
+ TEST_SIZE ( lm_ea_ea_ptr, 4);
+ TEST_SIZE ( *lm_ea_ea_ptr, EA_PTRSIZE);
+ TEST_SIZE ( **lm_ea_ea_ptr, EA_PTRSIZE);
+ TEST_SIZE (***lm_ea_ea_ptr, 1);
+ PRINT1 ("\n");
+
+ TEST_SIZE ( ea_lm_lm_ptr, EA_PTRSIZE);
+ TEST_SIZE ( *ea_lm_lm_ptr, 4);
+ TEST_SIZE ( **ea_lm_lm_ptr, 4);
+ TEST_SIZE (***ea_lm_lm_ptr, 1);
+ PRINT1 ("\n");
+
+ TEST_SIZE ( ea_lm_ea_ptr, EA_PTRSIZE);
+ TEST_SIZE ( *ea_lm_ea_ptr, 4);
+ TEST_SIZE ( **ea_lm_ea_ptr, EA_PTRSIZE);
+ TEST_SIZE (***ea_lm_ea_ptr, 1);
+ PRINT1 ("\n");
+
+ TEST_SIZE ( ea_ea_lm_ptr, EA_PTRSIZE);
+ TEST_SIZE ( *ea_ea_lm_ptr, EA_PTRSIZE);
+ TEST_SIZE ( **ea_ea_lm_ptr, 4);
+ TEST_SIZE (***ea_ea_lm_ptr, 1);
+ PRINT1 ("\n");
+
+ TEST_SIZE ( ea_ea_ea_ptr, EA_PTRSIZE);
+ TEST_SIZE ( *ea_ea_ea_ptr, EA_PTRSIZE);
+ TEST_SIZE ( **ea_ea_ea_ptr, EA_PTRSIZE);
+ TEST_SIZE (***ea_ea_ea_ptr, 1);
+ PRINT1 ("\n");
+#endif
+
+#if USE_EA_VAR
+ TEST_SIZE ( lm_lm_lm_ptr_ea, 4);
+ TEST_SIZE ( *lm_lm_lm_ptr_ea, 4);
+ TEST_SIZE ( **lm_lm_lm_ptr_ea, 4);
+ TEST_SIZE (***lm_lm_lm_ptr_ea, 1);
+ PRINT1 ("\n");
+
+ TEST_SIZE ( lm_lm_ea_ptr_ea, 4);
+ TEST_SIZE ( *lm_lm_ea_ptr_ea, 4);
+ TEST_SIZE ( **lm_lm_ea_ptr_ea, EA_PTRSIZE);
+ TEST_SIZE (***lm_lm_ea_ptr_ea, 1);
+ PRINT1 ("\n");
+
+ TEST_SIZE ( lm_ea_lm_ptr_ea, 4);
+ TEST_SIZE ( *lm_ea_lm_ptr_ea, EA_PTRSIZE);
+ TEST_SIZE ( **lm_ea_lm_ptr_ea, 4);
+ TEST_SIZE (***lm_ea_lm_ptr_ea, 1);
+ PRINT1 ("\n");
+
+ TEST_SIZE ( lm_ea_ea_ptr_ea, 4);
+ TEST_SIZE ( *lm_ea_ea_ptr_ea, EA_PTRSIZE);
+ TEST_SIZE ( **lm_ea_ea_ptr_ea, EA_PTRSIZE);
+ TEST_SIZE (***lm_ea_ea_ptr_ea, 1);
+ PRINT1 ("\n");
+
+ TEST_SIZE ( ea_lm_lm_ptr_ea, EA_PTRSIZE);
+ TEST_SIZE ( *ea_lm_lm_ptr_ea, 4);
+ TEST_SIZE ( **ea_lm_lm_ptr_ea, 4);
+ TEST_SIZE (***ea_lm_lm_ptr_ea, 1);
+ PRINT1 ("\n");
+
+ TEST_SIZE ( ea_lm_ea_ptr_ea, EA_PTRSIZE);
+ TEST_SIZE ( *ea_lm_ea_ptr_ea, 4);
+ TEST_SIZE ( **ea_lm_ea_ptr_ea, EA_PTRSIZE);
+ TEST_SIZE (***ea_lm_ea_ptr_ea, 1);
+ PRINT1 ("\n");
+
+ TEST_SIZE ( ea_ea_lm_ptr_ea, EA_PTRSIZE);
+ TEST_SIZE ( *ea_ea_lm_ptr_ea, EA_PTRSIZE);
+ TEST_SIZE ( **ea_ea_lm_ptr_ea, 4);
+ TEST_SIZE (***ea_ea_lm_ptr_ea, 1);
+ PRINT1 ("\n");
+
+ TEST_SIZE ( ea_ea_ea_ptr_ea, EA_PTRSIZE);
+ TEST_SIZE ( *ea_ea_ea_ptr_ea, EA_PTRSIZE);
+ TEST_SIZE ( **ea_ea_ea_ptr_ea, EA_PTRSIZE);
+ TEST_SIZE (***ea_ea_ea_ptr_ea, 1);
+ PRINT1 ("\n");
+#endif
+#endif
+#endif
+
+#if USE_COMPLEX
+#if LEVEL1
+#if USE_LOCAL_VAR
+ TEST_SIZE ( lm_cptr, 4);
+ TEST_SIZE (*lm_cptr, 1);
+ TEST_SIZE ( ea_cptr, EA_PTRSIZE);
+ TEST_SIZE (*ea_cptr, 1);
+ PRINT1 ("\n");
+#endif
+
+#if USE_EA_VAR
+ TEST_SIZE ( lm_cptr_ea, 4);
+ TEST_SIZE (*lm_cptr_ea, 1);
+ TEST_SIZE ( ea_cptr_ea, EA_PTRSIZE);
+ TEST_SIZE (*ea_cptr_ea, 1);
+ PRINT1 ("\n");
+#endif
+#endif
+
+#if LEVEL2
+#if USE_LOCAL_VAR
+ TEST_SIZE ( lm_lm_cptr, 4);
+ TEST_SIZE ( *lm_lm_cptr, 4);
+ TEST_SIZE (**lm_lm_cptr, 1);
+ PRINT1 ("\n");
+
+ TEST_SIZE ( lm_ea_cptr, 4);
+ TEST_SIZE ( *lm_ea_cptr, EA_PTRSIZE);
+ TEST_SIZE (**lm_ea_cptr, 1);
+ PRINT1 ("\n");
+
+ TEST_SIZE ( ea_lm_cptr, EA_PTRSIZE);
+ TEST_SIZE ( *ea_lm_cptr, 4);
+ TEST_SIZE (**ea_lm_cptr, 1);
+ PRINT1 ("\n");
+
+ TEST_SIZE ( ea_ea_cptr, EA_PTRSIZE);
+ TEST_SIZE ( *ea_ea_cptr, EA_PTRSIZE);
+ TEST_SIZE (**ea_ea_cptr, 1);
+ PRINT1 ("\n");
+#endif
+
+#if USE_EA_VAR
+ TEST_SIZE ( lm_lm_cptr_ea, 4);
+ TEST_SIZE ( *lm_lm_cptr_ea, 4);
+ TEST_SIZE (**lm_lm_cptr_ea, 1);
+ PRINT1 ("\n");
+
+ TEST_SIZE ( lm_ea_cptr_ea, 4);
+ TEST_SIZE ( *lm_ea_cptr_ea, EA_PTRSIZE);
+ TEST_SIZE (**lm_ea_cptr_ea, 1);
+ PRINT1 ("\n");
+
+ TEST_SIZE ( ea_lm_cptr_ea, EA_PTRSIZE);
+ TEST_SIZE ( *ea_lm_cptr_ea, 4);
+ TEST_SIZE (**ea_lm_cptr_ea, 1);
+ PRINT1 ("\n");
+
+ TEST_SIZE ( ea_ea_cptr_ea, EA_PTRSIZE);
+ TEST_SIZE ( *ea_ea_cptr_ea, EA_PTRSIZE);
+ TEST_SIZE (**ea_ea_cptr_ea, 1);
+ PRINT1 ("\n");
+#endif
+#endif
+
+#if LEVEL3
+#if USE_LOCAL_VAR
+ TEST_SIZE ( lm_lm_lm_cptr, 4);
+ TEST_SIZE ( *lm_lm_lm_cptr, 4);
+ TEST_SIZE ( **lm_lm_lm_cptr, 4);
+ TEST_SIZE (***lm_lm_lm_cptr, 1);
+ PRINT1 ("\n");
+
+ TEST_SIZE ( lm_lm_ea_cptr, 4);
+ TEST_SIZE ( *lm_lm_ea_cptr, 4);
+ TEST_SIZE ( **lm_lm_ea_cptr, EA_PTRSIZE);
+ TEST_SIZE (***lm_lm_ea_cptr, 1);
+ PRINT1 ("\n");
+
+ TEST_SIZE ( lm_ea_lm_cptr, 4);
+ TEST_SIZE ( *lm_ea_lm_cptr, EA_PTRSIZE);
+ TEST_SIZE ( **lm_ea_lm_cptr, 4);
+ TEST_SIZE (***lm_ea_lm_cptr, 1);
+ PRINT1 ("\n");
+
+ TEST_SIZE ( lm_ea_ea_cptr, 4);
+ TEST_SIZE ( *lm_ea_ea_cptr, EA_PTRSIZE);
+ TEST_SIZE ( **lm_ea_ea_cptr, EA_PTRSIZE);
+ TEST_SIZE (***lm_ea_ea_cptr, 1);
+ PRINT1 ("\n");
+
+ TEST_SIZE ( ea_lm_lm_cptr, EA_PTRSIZE);
+ TEST_SIZE ( *ea_lm_lm_cptr, 4);
+ TEST_SIZE ( **ea_lm_lm_cptr, 4);
+ TEST_SIZE (***ea_lm_lm_cptr, 1);
+ PRINT1 ("\n");
+
+ TEST_SIZE ( ea_lm_ea_cptr, EA_PTRSIZE);
+ TEST_SIZE ( *ea_lm_ea_cptr, 4);
+ TEST_SIZE ( **ea_lm_ea_cptr, EA_PTRSIZE);
+ TEST_SIZE (***ea_lm_ea_cptr, 1);
+ PRINT1 ("\n");
+
+ TEST_SIZE ( ea_ea_lm_cptr, EA_PTRSIZE);
+ TEST_SIZE ( *ea_ea_lm_cptr, EA_PTRSIZE);
+ TEST_SIZE ( **ea_ea_lm_cptr, 4);
+ TEST_SIZE (***ea_ea_lm_cptr, 1);
+ PRINT1 ("\n");
+
+ TEST_SIZE ( ea_ea_ea_cptr, EA_PTRSIZE);
+ TEST_SIZE ( *ea_ea_ea_cptr, EA_PTRSIZE);
+ TEST_SIZE ( **ea_ea_ea_cptr, EA_PTRSIZE);
+ TEST_SIZE (***ea_ea_ea_cptr, 1);
+ PRINT1 ("\n");
+#endif
+
+#if USE_EA_VAR
+ TEST_SIZE ( lm_lm_lm_cptr_ea, 4);
+ TEST_SIZE ( *lm_lm_lm_cptr_ea, 4);
+ TEST_SIZE ( **lm_lm_lm_cptr_ea, 4);
+ TEST_SIZE (***lm_lm_lm_cptr_ea, 1);
+ PRINT1 ("\n");
+
+ TEST_SIZE ( lm_lm_ea_cptr_ea, 4);
+ TEST_SIZE ( *lm_lm_ea_cptr_ea, 4);
+ TEST_SIZE ( **lm_lm_ea_cptr_ea, EA_PTRSIZE);
+ TEST_SIZE (***lm_lm_ea_cptr_ea, 1);
+ PRINT1 ("\n");
+
+ TEST_SIZE ( lm_ea_lm_cptr_ea, 4);
+ TEST_SIZE ( *lm_ea_lm_cptr_ea, EA_PTRSIZE);
+ TEST_SIZE ( **lm_ea_lm_cptr_ea, 4);
+ TEST_SIZE (***lm_ea_lm_cptr_ea, 1);
+ PRINT1 ("\n");
+
+ TEST_SIZE ( lm_ea_ea_cptr_ea, 4);
+ TEST_SIZE ( *lm_ea_ea_cptr_ea, EA_PTRSIZE);
+ TEST_SIZE ( **lm_ea_ea_cptr_ea, EA_PTRSIZE);
+ TEST_SIZE (***lm_ea_ea_cptr_ea, 1);
+ PRINT1 ("\n");
+
+ TEST_SIZE ( ea_lm_lm_cptr_ea, EA_PTRSIZE);
+ TEST_SIZE ( *ea_lm_lm_cptr_ea, 4);
+ TEST_SIZE ( **ea_lm_lm_cptr_ea, 4);
+ TEST_SIZE (***ea_lm_lm_cptr_ea, 1);
+ PRINT1 ("\n");
+
+ TEST_SIZE ( ea_lm_ea_cptr_ea, EA_PTRSIZE);
+ TEST_SIZE ( *ea_lm_ea_cptr_ea, 4);
+ TEST_SIZE ( **ea_lm_ea_cptr_ea, EA_PTRSIZE);
+ TEST_SIZE (***ea_lm_ea_cptr_ea, 1);
+ PRINT1 ("\n");
+
+ TEST_SIZE ( ea_ea_lm_cptr_ea, EA_PTRSIZE);
+ TEST_SIZE ( *ea_ea_lm_cptr_ea, EA_PTRSIZE);
+ TEST_SIZE ( **ea_ea_lm_cptr_ea, 4);
+ TEST_SIZE (***ea_ea_lm_cptr_ea, 1);
+ PRINT1 ("\n");
+
+ TEST_SIZE ( ea_ea_ea_cptr_ea, EA_PTRSIZE);
+ TEST_SIZE ( *ea_ea_ea_cptr_ea, EA_PTRSIZE);
+ TEST_SIZE ( **ea_ea_ea_cptr_ea, EA_PTRSIZE);
+ TEST_SIZE (***ea_ea_ea_cptr_ea, 1);
+ PRINT1 ("\n");
+#endif
+#endif
+#endif
+
+ if (errors)
+ {
+ PRINT3 ("%d error(s), %d test(s)\n", errors, num_tests);
+ abort ();
+ }
+ else
+ PRINT2 ("No errors, %d test(s)\n", num_tests);
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/fixed-range-bad.c b/gcc-4.9/gcc/testsuite/gcc.target/spu/fixed-range-bad.c
new file mode 100644
index 000000000..099328378
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/fixed-range-bad.c
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+/* { dg-options "-mfixed-range=1-x" } */
+/* { dg-warning "unknown register name" "" { target spu-*-* } 0 } */
+
+int i;
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/fixed-range.c b/gcc-4.9/gcc/testsuite/gcc.target/spu/fixed-range.c
new file mode 100644
index 000000000..8dcb7fe4c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/fixed-range.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-mfixed-range=1-20" } */
+/* { dg-final { scan-assembler "lqd.*21" } } */
+
+int foo (int i)
+{
+ return i;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/intrinsics-1.c b/gcc-4.9/gcc/testsuite/gcc.target/spu/intrinsics-1.c
new file mode 100644
index 000000000..2720889f0
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/intrinsics-1.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-std=c99 -pedantic-errors" } */
+#include <spu_intrinsics.h>
+/* With this intrinsics section, we used to ICE as we would try
+ to convert from an vector to an integer type. */
+void f(void)
+{
+ vec_uint4 gt, N;
+ vec_int4 a;
+ int *a1;
+ _Complex double b;
+ gt = spu_cmpgt(a, N); /* { dg-error "parameter list" } */
+ gt = spu_cmpgt(a, a1); /* { dg-error "integer from pointer without a cast" } */
+ gt = spu_cmpgt(a, b); /* { dg-error "parameter list" } */
+ gt = spu_cmpgt(a, a);
+ a = spu_cmpgt(a, a); /* { dg-message "note: use -flax-vector-conversions to permit conversions between vectors with differing element types or numbers of subparts" } */
+/* { dg-message "note: expected 'int'" "" { target *-*-* } 13 } */
+/* { dg-error "incompatible types when assigning" "" { target *-*-* } 16 } */
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/intrinsics-2.c b/gcc-4.9/gcc/testsuite/gcc.target/spu/intrinsics-2.c
new file mode 100644
index 000000000..43a272b91
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/intrinsics-2.c
@@ -0,0 +1,305 @@
+/* { dg-do run } */
+/* { dg-options "-std=c99" } */
+#include <vec_types.h>
+extern void abort (void);
+extern void exit (int);
+
+typedef union {
+ vec_ullong2 vull;
+ vec_double2 vd;
+ unsigned int ui[4];
+ unsigned long long ull[2];
+ double d[2];
+} v128;
+
+static v128 a, b, c, d, a0, b0, a1, b1;
+static int samples = 10;
+unsigned int seed = 0;
+
+unsigned int rand_local()
+{
+ seed = seed * 69607 + 54329;
+ return (seed);
+}
+
+double rand_double(double min, double max)
+{
+ union {
+ unsigned int ui[2];
+ double d;
+ } x;
+
+ x.ui[0] = (rand_local() & 0x000FFFFF) | 0x3FF00000;
+ x.ui[1] = rand_local();
+ x.d -= 1.0;
+ x.d *= max - min;
+ x.d += min;
+ return (x.d);
+}
+
+vec_double2 rand_vd(double min, double max)
+{
+ int i;
+ static v128 val;
+
+ for (i=0; i<2; i++) val.d[i] = rand_double(min, max);
+ return (val.vd);
+}
+
+int test_spu_cmpeq()
+{
+ int i, j;
+ unsigned long long exp;
+
+ /* double */
+ for (i=0; i<samples; i++) {
+ a.vd = rand_vd(-4.0, 4.0);
+ b.vd = rand_vd(-4.0, 4.0);
+ d.vull = spu_cmpeq(a.vd, b.vd);
+ for (j=0; j<2; j++) {
+ exp = (a.d[j] == b.d[j]) ?
+ (((unsigned long long)(0xFFFFFFFF) << 32)
+ | (unsigned long long)(0xFFFFFFFF)) : 0;
+ if (exp != d.ull[j]) abort();
+ }
+ }
+
+ /* compare zeros */
+ d.vull = spu_cmpeq(a0.vd, b0.vd);
+ for (j=0; j<2; j++) {
+ exp = (a0.d[j] == b0.d[j]) ?
+ (((unsigned long long)(0xFFFFFFFF) << 32)
+ | (unsigned long long)(0xFFFFFFFF)) : 0;
+ if (exp != d.ull[j]) abort();
+ }
+
+ /* compare NaNs */
+ d.vull = spu_cmpeq(a1.vd, b1.vd);
+ for (j=0; j<2; j++) {
+ exp = (a1.d[j] == b1.d[j]) ?
+ (((unsigned long long)(0xFFFFFFFF) << 32)
+ | (unsigned long long)(0xFFFFFFFF)) : 0;
+ if (exp != d.ull[j]) abort();
+ }
+ return 0;
+}
+
+int test_spu_cmpgt()
+{
+ int i, j;
+ unsigned long long exp;
+
+ /* double */
+ for (i=0; i<samples; i++) {
+ a.vd = rand_vd(-4.0, 4.0);
+ b.vd = rand_vd(-4.0, 4.0);
+ d.vull = spu_cmpgt(a.vd, b.vd);
+ for (j=0; j<2; j++) {
+ exp = (a.d[j] > b.d[j]) ?
+ (((unsigned long long)(0xFFFFFFFF) << 32)
+ | (unsigned long long)(0xFFFFFFFF)) : 0;
+ if (exp != d.ull[j]) abort();
+ }
+ }
+
+ /* compare zeros */
+ d.vull = spu_cmpgt(a0.vd, b0.vd);
+ for (j=0; j<2; j++) {
+ exp = (a0.d[j] > b0.d[j]) ?
+ (((unsigned long long)(0xFFFFFFFF) << 32)
+ | (unsigned long long)(0xFFFFFFFF)) : 0;
+ if (exp != d.ull[j]) abort();
+ }
+ /* compare NaNs */
+ d.vull = spu_cmpgt(a1.vd, b1.vd);
+ for (j=0; j<2; j++) {
+ exp = (a1.d[j] > b1.d[j]) ?
+ (((unsigned long long)(0xFFFFFFFF) << 32)
+ | (unsigned long long)(0xFFFFFFFF)) : 0;
+ if (exp != d.ull[j]) abort();
+ }
+ return 0;
+}
+
+int test_spu_cmpabseq()
+{
+ int i, j;
+ unsigned long long exp;
+
+ /* double */
+ for (i=0; i<samples; i++) {
+ a.vd = rand_vd(-4.0, 4.0);
+ b.vd = rand_vd(-4.0, 4.0);
+ d.vull = spu_cmpabseq(a.vd, b.vd);
+ for (j=0; j<2; j++) {
+ exp = ((a.d[j] == b.d[j]) || (-a.d[j] == b.d[j]) || (a.d[j] == -b.d[j])) ?
+ (((unsigned long long)(0xFFFFFFFF) << 32)
+ | (unsigned long long)(0xFFFFFFFF)) : 0;
+ if (exp != d.ull[j]) abort();
+ }
+ }
+
+ /* compare zeros */
+ d.vull = spu_cmpabseq(a0.vd, b0.vd);
+ for (j=0; j<2; j++) {
+ exp = ((a0.d[j] == b0.d[j]) || (-a0.d[j] == b0.d[j]) || (a0.d[j] == -b0.d[j])) ?
+ (((unsigned long long)(0xFFFFFFFF) << 32)
+ | (unsigned long long)(0xFFFFFFFF)) : 0;
+ if (exp != d.ull[j]) abort();
+ }
+
+ /* compare NaNs */
+ d.vull = spu_cmpabseq(a1.vd, b1.vd);
+ for (j=0; j<2; j++) {
+ exp = ((a1.d[j] == b1.d[j]) || (-a1.d[j] == b1.d[j]) || (a1.d[j] == -b1.d[j])) ?
+ (((unsigned long long)(0xFFFFFFFF) << 32)
+ | (unsigned long long)(0xFFFFFFFF)) : 0;
+ if (exp != d.ull[j]) abort();
+ }
+ return 0;
+}
+
+int test_spu_cmpabsgt()
+{
+ int i, j;
+ unsigned long long exp;
+ double abs_a, abs_b;
+
+ /* double */
+ for (i=0; i<samples; i++) {
+ a.vd = rand_vd(-4.0, 4.0);
+ b.vd = rand_vd(-4.0, 4.0);
+ d.vull = spu_cmpabsgt(a.vd, b.vd);
+ for (j=0; j<2; j++) {
+ double abs_a = (a.d[j] < 0.0) ? -a.d[j] : a.d[j];
+ double abs_b = (b.d[j] < 0.0) ? -b.d[j] : b.d[j];
+ exp = (abs_a > abs_b) ?
+ (((unsigned long long)(0xFFFFFFFF) << 32)
+ | (unsigned long long)(0xFFFFFFFF)) : 0;
+ if (exp != d.ull[j]) abort();
+ }
+ }
+
+ /* compare zeros */
+ d.vull = spu_cmpabsgt(a0.vd, b0.vd);
+ for (j=0; j<2; j++) {
+ abs_a = (a0.d[j] < 0.0) ? -a0.d[j] : a0.d[j];
+ abs_b = (b0.d[j] < 0.0) ? -b0.d[j] : b0.d[j];
+ exp = (abs_a > abs_b) ?
+ (((unsigned long long)(0xFFFFFFFF) << 32)
+ | (unsigned long long)(0xFFFFFFFF)) : 0;
+ if (exp != d.ull[j]) abort();
+ }
+ /* compare NaNs */
+ d.vull = spu_cmpabsgt(a1.vd, b1.vd);
+ for (j=0; j<2; j++) {
+ abs_a = (a1.d[j] < 0.0) ? -a1.d[j] : a1.d[j];
+ abs_b = (b1.d[j] < 0.0) ? -b1.d[j] : b1.d[j];
+ exp = (abs_a > abs_b) ?
+ (((unsigned long long)(0xFFFFFFFF) << 32)
+ | (unsigned long long)(0xFFFFFFFF)) : 0;
+ if (exp != d.ull[j]) abort();
+ }
+ return 0;
+}
+
+int test_spu_testsv()
+{
+ int i, j;
+ unsigned long long exp;
+ struct _samples {
+ unsigned long long v;
+ unsigned int sv;
+ } samples[] = {
+ {0x0000000000000000ULL, SPU_SV_POS_ZERO},
+ {0x8000000000000000ULL, SPU_SV_NEG_ZERO},
+ {0x0000000000000001ULL, SPU_SV_POS_DENORM},
+ {0x0000000080000000ULL, SPU_SV_POS_DENORM},
+ {0x0000000100000000ULL, SPU_SV_POS_DENORM},
+ {0x0008000000000000ULL, SPU_SV_POS_DENORM},
+ {0x000FFFFFFFFFFFFFULL, SPU_SV_POS_DENORM},
+ {0x00000000FFF00000ULL, SPU_SV_POS_DENORM},
+ {0x8000000000000001ULL, SPU_SV_NEG_DENORM},
+ {0x8000000080000000ULL, SPU_SV_NEG_DENORM},
+ {0x8000000100000000ULL, SPU_SV_NEG_DENORM},
+ {0x8008000000000000ULL, SPU_SV_NEG_DENORM},
+ {0x800FFFFFFFFFFFFFULL, SPU_SV_NEG_DENORM},
+ {0x80000000FFF00000ULL, SPU_SV_NEG_DENORM},
+ {0x0010000000000000ULL, 0},
+ {0x0010000000000001ULL, 0},
+ {0x3FF0000000000000ULL, 0},
+ {0x3FF00000FFF00000ULL, 0},
+ {0xBFF0000000000000ULL, 0},
+ {0xBFF00000FFF00000ULL, 0},
+ {0x7FE0000000000000ULL, 0},
+ {0x7FEFFFFFFFFFFFFFULL, 0},
+ {0x8010000000000000ULL, 0},
+ {0x8010000000000001ULL, 0},
+ {0xFFE0000000000000ULL, 0},
+ {0xFFEFFFFFFFFFFFFFULL, 0},
+ {0x7FF0000000000000ULL, SPU_SV_POS_INFINITY},
+ {0xFFF0000000000000ULL, SPU_SV_NEG_INFINITY},
+ {0x7FF0000000000001ULL, SPU_SV_NAN},
+ {0x7FF0000080000000ULL, SPU_SV_NAN},
+ {0x7FF0000100000000ULL, SPU_SV_NAN},
+ {0x7FFFFFFFFFFFFFFFULL, SPU_SV_NAN},
+ {0xFFF0000000000001ULL, SPU_SV_NAN},
+ {0xFFF0000080000000ULL, SPU_SV_NAN},
+ {0xFFF0000100000000ULL, SPU_SV_NAN},
+ {0xFFFFFFFFFFFFFFFFULL, SPU_SV_NAN}
+ };
+
+ unsigned char cnt = sizeof(samples)/sizeof(struct _samples);
+ int e0;
+ for (e0=0; e0<cnt; e0++)
+ {
+ a.ull[0] = samples[e0].v;
+ a.d[1] = rand_double(-1, -4);
+
+ d.vull = spu_testsv(a.vd, SPU_SV_NEG_DENORM);
+ exp = (SPU_SV_NEG_DENORM & samples[e0].sv) ? 0xFFFFFFFFFFFFFFFFULL : 0ULL;
+ if (exp != d.ull[0] || d.ull[1] != 0) abort();
+
+ d.vull = spu_testsv(a.vd, SPU_SV_POS_DENORM);
+ exp = (SPU_SV_POS_DENORM & samples[e0].sv) ? 0xFFFFFFFFFFFFFFFFULL : 0ULL;
+ if (exp != d.ull[0] || d.ull[1] != 0) abort();
+
+ d.vull = spu_testsv(a.vd, SPU_SV_NEG_ZERO);
+ exp = (SPU_SV_NEG_ZERO & samples[e0].sv) ? 0xFFFFFFFFFFFFFFFFULL : 0ULL;
+ if (exp != d.ull[0] || d.ull[1] != 0) abort();
+
+ d.vull = spu_testsv(a.vd, SPU_SV_POS_ZERO);
+ exp = (SPU_SV_POS_ZERO & samples[e0].sv) ? 0xFFFFFFFFFFFFFFFFULL : 0ULL;
+ if (exp != d.ull[0] || d.ull[1] != 0) abort();
+
+ d.vull = spu_testsv(a.vd, SPU_SV_NEG_INFINITY);
+ exp = (SPU_SV_NEG_INFINITY & samples[e0].sv) ? 0xFFFFFFFFFFFFFFFFULL : 0ULL;
+ if (exp != d.ull[0] || d.ull[1] != 0) abort();
+
+ d.vull = spu_testsv(a.vd, SPU_SV_POS_INFINITY);
+ exp = (SPU_SV_POS_INFINITY & samples[e0].sv) ? 0xFFFFFFFFFFFFFFFFULL : 0ULL;
+ if (exp != d.ull[0] || d.ull[1] != 0) abort();
+
+ d.vull = spu_testsv(a.vd, SPU_SV_NAN);
+ exp = (SPU_SV_NAN & samples[e0].sv) ? 0xFFFFFFFFFFFFFFFFULL : 0ULL;
+ if (exp != d.ull[0] || d.ull[1] != 0) abort();
+ }
+ return 0;
+}
+
+int main()
+{
+ /* +0.0 and -0.0 */
+ a0.d[0] = 0.0; a0.d[1] = -0.0; b0.d[0] = -0.0; b0.d[1] = 0.0;
+ /* NaN */
+ a1.d[0] = 0.0/0.0; a1.d[1] = 0.0/-0.0; b1.d[0] = -0.0/0.0; b1.d[1] = -0.0/-0.0;
+
+ test_spu_cmpeq();
+ test_spu_cmpabseq();
+ test_spu_cmpgt();
+ test_spu_cmpabsgt();
+ test_spu_testsv();
+ return 0;
+}
+
+
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/intrinsics-3.c b/gcc-4.9/gcc/testsuite/gcc.target/spu/intrinsics-3.c
new file mode 100644
index 000000000..3d3946641
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/intrinsics-3.c
@@ -0,0 +1,42 @@
+/* { dg-do compile } */
+#include <spu_intrinsics.h>
+void f0 (vec_uint4 *in)
+{
+ vec_float4 out = spu_convtf (in[0], 128); /* { dg-error "expects an integer literal in the range" "0, 127" }*/
+}
+
+void f1 (vec_int4 *in)
+{
+ vec_float4 out = spu_convtf (in[0], 128); /* { dg-error "expects an integer literal in the range" "0, 127" }*/
+}
+
+void f2 (vec_float4 *in)
+{
+ vec_int4 out = spu_convts (in[0], 128); /* { dg-error "expects an integer literal in the range" "0, 127" }*/
+}
+
+void f3 (vec_float4 *in)
+{
+ vec_uint4 out = spu_convtu (in[0], 128); /* { dg-error "expects an integer literal in the range" "0, 127" }*/
+}
+
+/* Test that these intrinsics accept non-literal arguments */
+void f4 (vec_uint4 *in, int n)
+{
+ vec_float4 out = spu_convtf (in[0], n);
+}
+
+void f5 (vec_int4 *in, int n)
+{
+ vec_float4 out = spu_convtf (in[0], n);
+}
+
+void f6 (vec_float4 *in, int n)
+{
+ vec_int4 out = spu_convts (in[0], n);
+}
+
+void f7 (vec_float4 *in, int n)
+{
+ vec_uint4 out = spu_convtu (in[0], n);
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/intrinsics-sr.c b/gcc-4.9/gcc/testsuite/gcc.target/spu/intrinsics-sr.c
new file mode 100644
index 000000000..f7c62ddcb
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/intrinsics-sr.c
@@ -0,0 +1,496 @@
+/* { dg-do compile } */
+/* { dg-options "-std=c99" } */
+
+#include <spu_intrinsics.h>
+
+/* spu_sr */
+
+vector unsigned short test_sr_1 (vector unsigned short ra, vector unsigned short count)
+{
+ return spu_sr (ra, count);
+}
+
+vector signed short test_sr_2 (vector signed short ra, vector unsigned short count)
+{
+ return spu_sr (ra, count);
+}
+
+vector unsigned int test_sr_3 (vector unsigned int ra, vector unsigned int count)
+{
+ return spu_sr (ra, count);
+}
+
+vector signed int test_sr_4 (vector signed int ra, vector unsigned int count)
+{
+ return spu_sr (ra, count);
+}
+
+vector unsigned short test_sr_5 (vector unsigned short ra)
+{
+ return spu_sr (ra, 11);
+}
+
+vector signed short test_sr_6 (vector signed short ra)
+{
+ return spu_sr (ra, 11);
+}
+
+vector unsigned short test_sr_7 (vector unsigned short ra, unsigned int count)
+{
+ return spu_sr (ra, count);
+}
+
+vector signed short test_sr_8 (vector signed short ra, unsigned int count)
+{
+ return spu_sr (ra, count);
+}
+
+vector unsigned int test_sr_9 (vector unsigned int ra)
+{
+ return spu_sr (ra, 11);
+}
+
+vector signed int test_sr_10 (vector signed int ra)
+{
+ return spu_sr (ra, 11);
+}
+
+vector unsigned int test_sr_11 (vector unsigned int ra, unsigned int count)
+{
+ return spu_sr (ra, count);
+}
+
+vector signed int test_sr_12 (vector signed int ra, unsigned int count)
+{
+ return spu_sr (ra, count);
+}
+
+
+/* spu_sra */
+
+vector unsigned short test_sra_1 (vector unsigned short ra, vector unsigned short count)
+{
+ return spu_sra (ra, count);
+}
+
+vector signed short test_sra_2 (vector signed short ra, vector unsigned short count)
+{
+ return spu_sra (ra, count);
+}
+
+vector unsigned int test_sra_3 (vector unsigned int ra, vector unsigned int count)
+{
+ return spu_sra (ra, count);
+}
+
+vector signed int test_sra_4 (vector signed int ra, vector unsigned int count)
+{
+ return spu_sra (ra, count);
+}
+
+vector unsigned short test_sra_5 (vector unsigned short ra)
+{
+ return spu_sra (ra, 11);
+}
+
+vector signed short test_sra_6 (vector signed short ra)
+{
+ return spu_sra (ra, 11);
+}
+
+vector unsigned short test_sra_7 (vector unsigned short ra, unsigned int count)
+{
+ return spu_sra (ra, count);
+}
+
+vector signed short test_sra_8 (vector signed short ra, unsigned int count)
+{
+ return spu_sra (ra, count);
+}
+
+vector unsigned int test_sra_9 (vector unsigned int ra)
+{
+ return spu_sra (ra, 11);
+}
+
+vector signed int test_sra_10 (vector signed int ra)
+{
+ return spu_sra (ra, 11);
+}
+
+vector unsigned int test_sra_11 (vector unsigned int ra, unsigned int count)
+{
+ return spu_sra (ra, count);
+}
+
+vector signed int test_sra_12 (vector signed int ra, unsigned int count)
+{
+ return spu_sra (ra, count);
+}
+
+/* spu_srqw */
+
+vector unsigned char test_srqw_1 (vector unsigned char ra)
+{
+ return spu_srqw (ra, 5);
+}
+
+vector signed char test_srqw_2 (vector signed char ra)
+{
+ return spu_srqw (ra, 5);
+}
+
+vector unsigned short test_srqw_3 (vector unsigned short ra)
+{
+ return spu_srqw (ra, 5);
+}
+
+vector signed short test_srqw_4 (vector signed short ra)
+{
+ return spu_srqw (ra, 5);
+}
+
+vector unsigned int test_srqw_5 (vector unsigned int ra)
+{
+ return spu_srqw (ra, 5);
+}
+
+vector signed int test_srqw_6 (vector signed int ra)
+{
+ return spu_srqw (ra, 5);
+}
+
+vector unsigned long test_srqw_7 (vector unsigned long ra)
+{
+ return spu_srqw (ra, 5);
+}
+
+vector signed long test_srqw_8 (vector signed long ra)
+{
+ return spu_srqw (ra, 5);
+}
+
+vector unsigned long long test_srqw_9 (vector unsigned long long ra)
+{
+ return spu_srqw (ra, 5);
+}
+
+vector signed long long test_srqw_10 (vector signed long long ra)
+{
+ return spu_srqw (ra, 5);
+}
+
+vector float test_srqw_11 (vector float ra)
+{
+ return spu_srqw (ra, 5);
+}
+
+vector double test_srqw_12 (vector double ra)
+{
+ return spu_srqw (ra, 5);
+}
+
+vector unsigned char test_srqw_13 (vector unsigned char ra, unsigned int count)
+{
+ return spu_srqw (ra, count);
+}
+
+vector signed char test_srqw_14 (vector signed char ra, unsigned int count)
+{
+ return spu_srqw (ra, count);
+}
+
+vector unsigned short test_srqw_15 (vector unsigned short ra, unsigned int count)
+{
+ return spu_srqw (ra, count);
+}
+
+vector signed short test_srqw_16 (vector signed short ra, unsigned int count)
+{
+ return spu_srqw (ra, count);
+}
+
+vector unsigned int test_srqw_17 (vector unsigned int ra, unsigned int count)
+{
+ return spu_srqw (ra, count);
+}
+
+vector signed int test_srqw_18 (vector signed int ra, unsigned int count)
+{
+ return spu_srqw (ra, count);
+}
+
+vector unsigned long test_srqw_19 (vector unsigned long ra, unsigned int count)
+{
+ return spu_srqw (ra, count);
+}
+
+vector signed long test_srqw_20 (vector signed long ra, unsigned int count)
+{
+ return spu_srqw (ra, count);
+}
+
+vector unsigned long long test_srqw_21 (vector unsigned long long ra, unsigned int count)
+{
+ return spu_srqw (ra, count);
+}
+
+vector signed long long test_srqw_22 (vector signed long long ra, unsigned int count)
+{
+ return spu_srqw (ra, count);
+}
+
+vector float test_srqw_23 (vector float ra, unsigned int count)
+{
+ return spu_srqw (ra, count);
+}
+
+vector double test_srqw_24 (vector double ra, unsigned int count)
+{
+ return spu_srqw (ra, count);
+}
+
+/* spu_srqwbyte */
+
+vector unsigned char test_srqwbyte_1 (vector unsigned char ra)
+{
+ return spu_srqwbyte (ra, 5);
+}
+
+vector signed char test_srqwbyte_2 (vector signed char ra)
+{
+ return spu_srqwbyte (ra, 5);
+}
+
+vector unsigned short test_srqwbyte_3 (vector unsigned short ra)
+{
+ return spu_srqwbyte (ra, 5);
+}
+
+vector signed short test_srqwbyte_4 (vector signed short ra)
+{
+ return spu_srqwbyte (ra, 5);
+}
+
+vector unsigned int test_srqwbyte_5 (vector unsigned int ra)
+{
+ return spu_srqwbyte (ra, 5);
+}
+
+vector signed int test_srqwbyte_6 (vector signed int ra)
+{
+ return spu_srqwbyte (ra, 5);
+}
+
+vector unsigned long test_srqwbyte_7 (vector unsigned long ra)
+{
+ return spu_srqwbyte (ra, 5);
+}
+
+vector signed long test_srqwbyte_8 (vector signed long ra)
+{
+ return spu_srqwbyte (ra, 5);
+}
+
+vector unsigned long long test_srqwbyte_9 (vector unsigned long long ra)
+{
+ return spu_srqwbyte (ra, 5);
+}
+
+vector signed long long test_srqwbyte_10 (vector signed long long ra)
+{
+ return spu_srqwbyte (ra, 5);
+}
+
+vector float test_srqwbyte_11 (vector float ra)
+{
+ return spu_srqwbyte (ra, 5);
+}
+
+vector double test_srqwbyte_12 (vector double ra)
+{
+ return spu_srqwbyte (ra, 5);
+}
+
+vector unsigned char test_srqwbyte_13 (vector unsigned char ra, unsigned int count)
+{
+ return spu_srqwbyte (ra, count);
+}
+
+vector signed char test_srqwbyte_14 (vector signed char ra, unsigned int count)
+{
+ return spu_srqwbyte (ra, count);
+}
+
+vector unsigned short test_srqwbyte_15 (vector unsigned short ra, unsigned int count)
+{
+ return spu_srqwbyte (ra, count);
+}
+
+vector signed short test_srqwbyte_16 (vector signed short ra, unsigned int count)
+{
+ return spu_srqwbyte (ra, count);
+}
+
+vector unsigned int test_srqwbyte_17 (vector unsigned int ra, unsigned int count)
+{
+ return spu_srqwbyte (ra, count);
+}
+
+vector signed int test_srqwbyte_18 (vector signed int ra, unsigned int count)
+{
+ return spu_srqwbyte (ra, count);
+}
+
+vector unsigned long test_srqwbyte_19 (vector unsigned long ra, unsigned int count)
+{
+ return spu_srqwbyte (ra, count);
+}
+
+vector signed long test_srqwbyte_20 (vector signed long ra, unsigned int count)
+{
+ return spu_srqwbyte (ra, count);
+}
+
+vector unsigned long long test_srqwbyte_21 (vector unsigned long long ra, unsigned int count)
+{
+ return spu_srqwbyte (ra, count);
+}
+
+vector signed long long test_srqwbyte_22 (vector signed long long ra, unsigned int count)
+{
+ return spu_srqwbyte (ra, count);
+}
+
+vector float test_srqwbyte_23 (vector float ra, unsigned int count)
+{
+ return spu_srqwbyte (ra, count);
+}
+
+vector double test_srqwbyte_24 (vector double ra, unsigned int count)
+{
+ return spu_srqwbyte (ra, count);
+}
+
+/* spu_srqwbytebc */
+
+vector unsigned char test_srqwbytebc_1 (vector unsigned char ra)
+{
+ return spu_srqwbytebc (ra, 40);
+}
+
+vector signed char test_srqwbytebc_2 (vector signed char ra)
+{
+ return spu_srqwbytebc (ra, 40);
+}
+
+vector unsigned short test_srqwbytebc_3 (vector unsigned short ra)
+{
+ return spu_srqwbytebc (ra, 40);
+}
+
+vector signed short test_srqwbytebc_4 (vector signed short ra)
+{
+ return spu_srqwbytebc (ra, 40);
+}
+
+vector unsigned int test_srqwbytebc_5 (vector unsigned int ra)
+{
+ return spu_srqwbytebc (ra, 40);
+}
+
+vector signed int test_srqwbytebc_6 (vector signed int ra)
+{
+ return spu_srqwbytebc (ra, 40);
+}
+
+vector unsigned long test_srqwbytebc_7 (vector unsigned long ra)
+{
+ return spu_srqwbytebc (ra, 40);
+}
+
+vector signed long test_srqwbytebc_8 (vector signed long ra)
+{
+ return spu_srqwbytebc (ra, 40);
+}
+
+vector unsigned long long test_srqwbytebc_9 (vector unsigned long long ra)
+{
+ return spu_srqwbytebc (ra, 40);
+}
+
+vector signed long long test_srqwbytebc_10 (vector signed long long ra)
+{
+ return spu_srqwbytebc (ra, 40);
+}
+
+vector float test_srqwbytebc_11 (vector float ra)
+{
+ return spu_srqwbytebc (ra, 40);
+}
+
+vector double test_srqwbytebc_12 (vector double ra)
+{
+ return spu_srqwbytebc (ra, 40);
+}
+
+vector unsigned char test_srqwbytebc_13 (vector unsigned char ra, unsigned int count)
+{
+ return spu_srqwbytebc (ra, count);
+}
+
+vector signed char test_srqwbytebc_14 (vector signed char ra, unsigned int count)
+{
+ return spu_srqwbytebc (ra, count);
+}
+
+vector unsigned short test_srqwbytebc_15 (vector unsigned short ra, unsigned int count)
+{
+ return spu_srqwbytebc (ra, count);
+}
+
+vector signed short test_srqwbytebc_16 (vector signed short ra, unsigned int count)
+{
+ return spu_srqwbytebc (ra, count);
+}
+
+vector unsigned int test_srqwbytebc_17 (vector unsigned int ra, unsigned int count)
+{
+ return spu_srqwbytebc (ra, count);
+}
+
+vector signed int test_srqwbytebc_18 (vector signed int ra, unsigned int count)
+{
+ return spu_srqwbytebc (ra, count);
+}
+
+vector unsigned long test_srqwbytebc_19 (vector unsigned long ra, unsigned int count)
+{
+ return spu_srqwbytebc (ra, count);
+}
+
+vector signed long test_srqwbytebc_20 (vector signed long ra, unsigned int count)
+{
+ return spu_srqwbytebc (ra, count);
+}
+
+vector unsigned long long test_srqwbytebc_21 (vector unsigned long long ra, unsigned int count)
+{
+ return spu_srqwbytebc (ra, count);
+}
+
+vector signed long long test_srqwbytebc_22 (vector signed long long ra, unsigned int count)
+{
+ return spu_srqwbytebc (ra, count);
+}
+
+vector float test_srqwbytebc_23 (vector float ra, unsigned int count)
+{
+ return spu_srqwbytebc (ra, count);
+}
+
+vector double test_srqwbytebc_24 (vector double ra, unsigned int count)
+{
+ return spu_srqwbytebc (ra, count);
+}
+
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/muldivti3.c b/gcc-4.9/gcc/testsuite/gcc.target/spu/muldivti3.c
new file mode 100644
index 000000000..0363e3420
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/muldivti3.c
@@ -0,0 +1,46 @@
+/* { dg-do run } */
+/* { dg-options "-std=c99" } */
+#include <stdlib.h>
+typedef unsigned int uqword __attribute__((mode(TI)));
+typedef int qword __attribute__((mode(TI)));
+
+typedef union
+{
+ uqword uq;
+ qword q;
+ unsigned long long ull[2];
+} u;
+
+int main(void)
+{
+ uqword e, f;
+ qword g, h;
+
+ e = 0x1111111111111111ULL;
+ f = 0xFULL;
+ g = 0x0000000000111100ULL;
+ h = 0x0000000000000000ULL;
+
+ u m, n, o, p, q;
+
+ m.ull[0] = f;
+ m.ull[1] = e;
+ n.ull[0] = h;
+ n.ull[1] = g;
+
+ /* __multi3 */
+ o.q = m.q * n.q;
+
+ o.q = o.q + n.q + 0x1110FF;
+ /* __udivti3, __umodti3 */
+ p.uq = o.uq / n.uq;
+ q.uq = o.uq % n.uq;
+ if (p.uq != (m.uq+1)) abort();
+ if (q.uq != 0x1110FF) abort();
+ /* __divti3, __modti3 */
+ p.q = -o.q / n.q;
+ q.q = -o.q % n.q;
+ if ((-p.q * n.q - q.q) != o.q) abort();
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/pr40001.c b/gcc-4.9/gcc/testsuite/gcc.target/spu/pr40001.c
new file mode 100644
index 000000000..442f72d4f
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/pr40001.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O" } */
+
+void *
+sbrk (unsigned int increment)
+{
+ volatile register
+ __attribute__ ((__spu_vector__)) unsigned int sp_r1 __asm__ ("1");
+ unsigned int sps;
+
+ sps = __builtin_spu_extract (sp_r1, 0);
+ if (sps - 4096 >= increment)
+ return 0;
+ else
+ return ((void *) -1);
+}
+
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/spu.exp b/gcc-4.9/gcc/testsuite/gcc.target/spu/spu.exp
new file mode 100644
index 000000000..ea99c5802
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/spu.exp
@@ -0,0 +1,41 @@
+# Copyright (C) 2005-2014 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 SPU target.
+if { ![istarget spu-*-*] } 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/*.\[cS\]]] \
+ "" $DEFAULT_CFLAGS
+
+# All done.
+dg-finish
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/subti3.c b/gcc-4.9/gcc/testsuite/gcc.target/spu/subti3.c
new file mode 100644
index 000000000..4112c958c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/subti3.c
@@ -0,0 +1,45 @@
+/* { dg-do run } */
+/* { dg-options "-std=c99" } */
+#include <stdlib.h>
+typedef int TItype __attribute__ ((mode (TI)));
+typedef int DItype __attribute__ ((mode (DI)));
+typedef unsigned int UDItype __attribute__ ((mode (DI)));
+
+struct DIstruct {DItype high, low;};
+typedef union
+{
+ struct DIstruct s;
+ TItype t;
+} TIunion;
+
+static
+void sub_ddmmss (UDItype *sh, UDItype *sl, UDItype ah, UDItype al, UDItype bh, UDItype bl)
+{
+ UDItype x;
+ x = al - bl;
+ *sh = ah - bh - (x > al);
+ *sl = x;
+}
+
+int main(void)
+{
+ TIunion aa, bb, cc;
+ TItype m = 0x1111111111111110ULL;
+ TItype n = 0x1111111111111111ULL;
+ TItype d;
+
+ aa.s.high = m;
+ aa.s.low = m;
+ bb.s.high = n;
+ bb.s.low = n;
+
+
+ sub_ddmmss (&cc.s.high, &cc.s.low, aa.s.high, aa.s.low, bb.s.high, bb.s.low);
+ d = aa.t - bb.t;
+ if (d != cc.t)
+ abort();
+ cc.t = aa.t -d;
+ if (cc.t != bb.t)
+ abort();
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/tag_manager.c b/gcc-4.9/gcc/testsuite/gcc.target/spu/tag_manager.c
new file mode 100644
index 000000000..4b3ab9f8d
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/tag_manager.c
@@ -0,0 +1,312 @@
+/* Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+
+ This file 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 file 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 this file; see the file COPYING3. If not see
+ <http://www.gnu.org/licenses/>. */
+
+/* { dg-do run } */
+
+#include <spu_mfcio.h>
+#include <stdlib.h>
+
+/* This test directly accesses the internal table used
+ by the MFC tag manager. */
+extern vector unsigned int __mfc_tag_table;
+
+
+/* This tag tests invalid tag release. Invalid tag release does
+ nothing to the tag table. */
+void
+test_tag_release01 (void)
+{
+ unsigned int copy;
+ copy = spu_extract (__mfc_tag_table, 0);
+
+ mfc_tag_release (35);
+ if (copy != spu_extract (__mfc_tag_table, 0))
+ abort ();
+}
+
+/* More invalid release tests. */
+void
+test_tag_release_invalid (void)
+{
+ unsigned int copy;
+ copy = spu_extract (__mfc_tag_table, 0);
+
+ if (mfc_tag_release (32) != MFC_TAG_INVALID)
+ abort ();
+ if (copy != spu_extract (__mfc_tag_table, 0))
+ abort ();
+
+ if (mfc_tag_release (17) != MFC_TAG_INVALID)
+ abort ();
+ if (copy != spu_extract (__mfc_tag_table, 0))
+ abort ();
+}
+
+/* Invalid multiple-tag release tests. */
+void
+test_tag_group_release_invalid (void)
+{
+ unsigned int copy;
+ copy = spu_extract (__mfc_tag_table, 0);
+
+ if (mfc_multi_tag_release (32, 10) != MFC_TAG_INVALID)
+ abort ();
+ if (copy != spu_extract (__mfc_tag_table, 0))
+ abort ();
+
+ if (mfc_multi_tag_release (28, 10) != MFC_TAG_INVALID)
+ abort ();
+ if (copy != spu_extract (__mfc_tag_table, 0))
+ abort ();
+
+ if (mfc_multi_tag_release (17, 10) != MFC_TAG_INVALID)
+ abort ();
+ if (copy != spu_extract (__mfc_tag_table, 0))
+ abort ();
+
+ if (mfc_multi_tag_release (32, 10) != MFC_TAG_INVALID)
+ abort ();
+ if (copy != spu_extract (__mfc_tag_table, 0))
+ abort ();
+}
+
+/* The tag table should be in a pristine mode to run this test. */
+void
+test_tag_reserve01 (void)
+{
+ unsigned int correct_table[32] =
+ {
+ 0x80000000, 0xC0000000, 0xE0000000,
+ 0xF0000000, 0xF8000000, 0xFC000000, 0xFE000000,
+ 0xFF000000, 0xFF800000, 0xFFC00000, 0xFFE00000,
+ 0xFFF00000, 0xFFF80000, 0xFFFC0000, 0xFFFE0000,
+ 0xFFFF0000, 0xFFFF8000, 0xFFFFC000, 0xFFFFE000,
+ 0xFFFFF000, 0xFFFFF800, 0xFFFFFC00, 0xFFFFFE00,
+ 0xFFFFFF00, 0xFFFFFF80, 0xFFFFFFC0, 0xFFFFFFE0,
+ 0xFFFFFFF0, 0xFFFFFFF8, 0xFFFFFFFC, 0xFFFFFFFE,
+ 0xFFFFFFFF
+ };
+
+ unsigned int tag;
+ unsigned int i;
+
+ for (i = 0; i < 32; i++)
+ {
+ tag = mfc_tag_reserve ();
+ if (tag != i)
+ abort ();
+ }
+
+ for (i = 0; i < 32; i++)
+ {
+ tag = mfc_tag_reserve ();
+ if (tag != MFC_TAG_INVALID)
+ abort ();
+ }
+
+ for (i = 0; i < 32; i++)
+ {
+ mfc_tag_release (i);
+ if (spu_extract (__mfc_tag_table, 0) != correct_table[i])
+ abort ();
+ }
+}
+
+/* The tag table should be in a pristine mode to run this test. */
+void
+test_tag_reserve02 (void)
+{
+ unsigned int correct_table[32] =
+ {
+ 0x80000000, 0xC0000000, 0xA0000000, 0xF0000000,
+ 0xA8000000, 0xFC000000, 0xAA000000, 0xFF000000,
+ 0xAA800000, 0xFFC00000, 0xAAA00000, 0xFFF00000,
+ 0xAAA80000, 0xFFFC0000, 0xAAAA0000, 0xFFFF0000,
+ 0xAAAA8000, 0xFFFFC000, 0xAAAAA000, 0xFFFFF000,
+ 0xAAAAA800, 0xFFFFFC00, 0xAAAAAA00, 0xFFFFFF00,
+ 0xAAAAAA80, 0xFFFFFFC0, 0xAAAAAAA0, 0xFFFFFFF0,
+ 0xAAAAAAA8, 0xFFFFFFFC, 0xAAAAAAAA, 0xFFFFFFFF
+ };
+
+ unsigned int correct_table2[32] =
+ {
+ 0x80000000, 0xEAAAAAAA, 0xA0000000, 0xFAAAAAAA,
+ 0xA8000000, 0xFEAAAAAA, 0xAA000000, 0xFFAAAAAA,
+ 0xAA800000, 0xFFEAAAAA, 0xAAA00000, 0xFFFAAAAA,
+ 0xAAA80000, 0xFFFEAAAA, 0xAAAA0000, 0xFFFFAAAA,
+ 0xAAAA8000, 0xFFFFEAAA, 0xAAAAA000, 0xFFFFFAAA,
+ 0xAAAAA800, 0xFFFFFEAA, 0xAAAAAA00, 0xFFFFFFAA,
+ 0xAAAAAA80, 0xFFFFFFEA, 0xAAAAAAA0, 0xFFFFFFFA,
+ 0xAAAAAAA8, 0xFFFFFFFE, 0xAAAAAAAA, 0xFFFFFFFF
+ };
+
+ unsigned int tag;
+ unsigned int i;
+
+ /* Reserve all 32 tags. */
+ for (i = 0; i < 32; i++)
+ {
+ tag = mfc_tag_reserve();
+ if (tag != i)
+ abort ();
+ }
+
+ for (i = 0; i < 32; i++)
+ {
+ tag = mfc_tag_reserve();
+ if (tag != MFC_TAG_INVALID)
+ abort ();
+ }
+
+ /* Release only 16 tags with a stride of 2. */
+ for (i = 0; i < 32; i += 2)
+ {
+ mfc_tag_release (i);
+ if (spu_extract (__mfc_tag_table, 0) != correct_table[i])
+ abort ();
+ }
+
+ /* Release the other 16 tags with a stride of 2. */
+ for (i = 1; i < 32; i += 2)
+ {
+ mfc_tag_release (i);
+ if (spu_extract (__mfc_tag_table, 0) != correct_table2[i])
+ abort ();
+ }
+}
+
+/* The tag table should be in a pristine mode to run this test. */
+void
+test_tag_reserve03 (void)
+{
+ unsigned int tag;
+ unsigned int i;
+
+ /* Reserve all 32 tags. */
+ for (i = 0; i < 32; i++)
+ {
+ tag = mfc_tag_reserve ();
+ if (tag != i)
+ abort ();
+ }
+
+ for (i = 0; i < 32; i++)
+ {
+ tag = mfc_tag_reserve ();
+ if (tag != MFC_TAG_INVALID)
+ abort ();
+ }
+
+ /* Release only 16 tags with a stride of 2. */
+ for (i = 0; i < 32; i += 2)
+ mfc_tag_release (i);
+
+ /* Now let's re-reserve those tags. */
+ for (i = 0; i < 32; i += 2)
+ {
+ tag = mfc_tag_reserve ();
+ if (tag != i)
+ abort ();
+ }
+
+ /* Release all tags. */
+ for (i = 0; i < 32; i++)
+ mfc_tag_release (i);
+
+ if (spu_extract (__mfc_tag_table,0) != 0xFFFFFFFF)
+ abort ();
+}
+
+
+void
+test_tag_group_reserve (void)
+{
+ unsigned int tag;
+ unsigned int i;
+ unsigned int copy;
+
+ /* Reserve all tags. */
+ for (i = 0; i < 32; i++)
+ mfc_tag_reserve();
+
+ /* Release the first 4. */
+ for (i = 0; i < 4; i++)
+ mfc_tag_release (i);
+
+ /* Release tag 5 to 7. */
+ for (i = 5; i < 8; i++)
+ mfc_tag_release (i);
+
+ /* Release tag 9 to 19. */
+ for (i = 9; i < 20; i++)
+ mfc_tag_release (i);
+
+ /* Tag table should be 0xF77FF000. */
+ if (spu_extract (__mfc_tag_table, 0) != 0xF77FF000)
+ abort ();
+
+
+ /* Verify invalid release is detected. */
+ copy = spu_extract (__mfc_tag_table, 0);
+ if (mfc_multi_tag_release (1, 5) != MFC_TAG_INVALID)
+ abort ();
+ if (copy != spu_extract (__mfc_tag_table, 0))
+ abort ();
+
+
+ /* Reserve multiple tags. */
+ tag = mfc_multi_tag_reserve (5);
+ if (tag != 9)
+ abort ();
+
+ /* Tag table should be 0xF703F000. */
+ if (spu_extract (__mfc_tag_table, 0) != 0xF703F000)
+ abort ();
+
+
+ /* Release 5 tags in the group. */
+ mfc_multi_tag_release (tag, 5);
+
+ /* Tag table should be 0xF77FF000. */
+ if (spu_extract (__mfc_tag_table, 0) != 0xF77FF000)
+ abort ();
+
+
+ /* This call should not do anything. */
+ mfc_multi_tag_release (32, 5);
+
+ /* Tag table should be 0xF77FF000. */
+ if (spu_extract (__mfc_tag_table, 0) != 0xF77FF000)
+ abort ();
+}
+
+
+int
+main (void)
+{
+ test_tag_release01 ();
+ test_tag_release_invalid ();
+ test_tag_group_release_invalid ();
+
+ test_tag_reserve01 ();
+ test_tag_reserve02 ();
+ test_tag_reserve03 ();
+
+ test_tag_group_reserve ();
+
+ return 0;
+}
+
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/vector-ansi.c b/gcc-4.9/gcc/testsuite/gcc.target/spu/vector-ansi.c
new file mode 100644
index 000000000..3c0861699
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/vector-ansi.c
@@ -0,0 +1,35 @@
+/* { dg-do compile } */
+/* { dg-options "-ansi" } */
+
+/* This is done by spu_internals.h, but we not include it here to keep
+ down the dependencies. */
+
+#ifndef __VECTOR_KEYWORD_SUPPORTED__
+#define vector __vector
+#endif
+
+/* __vector is expanded unconditionally by the preprocessor. */
+__vector int vi;
+__vector unsigned char vuc;
+__vector signed char vsc;
+__vector unsigned short vus;
+__vector signed short vss;
+__vector unsigned int vui;
+__vector signed int vsi;
+__vector unsigned long long ull;
+__vector signed long long sll;
+__vector float vf;
+__vector double vd;
+
+/* vector is expanded by the define above, regardless of context. */
+vector int vi;
+vector unsigned char vuc;
+vector signed char vsc;
+vector unsigned short vus;
+vector signed short vss;
+vector unsigned int vui;
+vector signed int vsi;
+vector unsigned long long ull;
+vector signed long long sll;
+vector float vf;
+vector double vd;
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/vector.c b/gcc-4.9/gcc/testsuite/gcc.target/spu/vector.c
new file mode 100644
index 000000000..237f93b7e
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/vector.c
@@ -0,0 +1,32 @@
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+#ifndef __VECTOR_KEYWORD_SUPPORTED__
+#error __VECTOR_KEYWORD_SUPPORTED__ is not defined
+#endif
+
+/* __vector is expanded unconditionally. */
+__vector int vi;
+__vector unsigned char vuc;
+__vector signed char vsc;
+__vector unsigned short vus;
+__vector signed short vss;
+__vector unsigned int vui;
+__vector signed int vsi;
+__vector unsigned long long ull;
+__vector signed long long sll;
+__vector float vf;
+__vector double vd;
+
+/* vector is expanded conditionally, based on the context. */
+vector int vi;
+vector unsigned char vuc;
+vector signed char vsc;
+vector unsigned short vus;
+vector signed short vss;
+vector unsigned int vui;
+vector signed int vsi;
+vector unsigned long long ull;
+vector signed long long sll;
+vector float vf;
+vector double vd;