diff options
author | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
---|---|---|
committer | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
commit | 554fd8c5195424bdbcabf5de30fdc183aba391bd (patch) | |
tree | 976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/gcc.target/frv | |
download | cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2 cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz |
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig;
imported gcc-4.6.4 source tree from verified upstream tarball.
downloading a git-generated archive based on the 'upstream' tag
should provide you with a source tree that is binary identical
to the one extracted from the above tarball.
if you have obtained the source via the command 'git clone',
however, do note that line-endings of files in your working
directory might differ from line-endings of the respective
files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/gcc.target/frv')
32 files changed, 862 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/frv/all-accs-1.c b/gcc/testsuite/gcc.target/frv/all-accs-1.c new file mode 100644 index 000000000..cb4232b3c --- /dev/null +++ b/gcc/testsuite/gcc.target/frv/all-accs-1.c @@ -0,0 +1,65 @@ +/* Check that ACCs and ACCGs are treated as global variables even if + media.h isn't included. */ +/* { dg-do run } */ +extern void abort (void); +extern void exit (int); + +void +set () +{ +#define SET(X) __MWTACC (X, (X) | 0x100), __MWTACCG (X, X) + SET (0); + SET (1); + SET (2); + SET (3); +#if defined (__CPU_FR450__) + SET (8); + SET (9); + SET (10); + SET (11); +#elif __FRV_ACC__ > 4 + SET (4); + SET (5); + SET (6); + SET (7); +#endif +#undef SET +} + +void +check () +{ + int diff1, diff2; + + diff1 = diff2 = 0; + +#define CHECK(X) \ + (diff1 |= (__MRDACC (X) ^ (X | 0x100)), \ + diff2 |= (__MRDACCG (X) ^ X)) + CHECK (0); + CHECK (1); + CHECK (2); + CHECK (3); +#if defined (__CPU_FR450__) + CHECK (8); + CHECK (9); + CHECK (10); + CHECK (11); +#elif __FRV_ACC__ > 4 + CHECK (4); + CHECK (5); + CHECK (6); + CHECK (7); +#endif +#undef CHECK + if ((diff1 | diff2) != 0) + abort (); +} + +int +main () +{ + set (); + check (); + exit (0); +} diff --git a/gcc/testsuite/gcc.target/frv/all-mclracca-1.c b/gcc/testsuite/gcc.target/frv/all-mclracca-1.c new file mode 100644 index 000000000..28ab497ca --- /dev/null +++ b/gcc/testsuite/gcc.target/frv/all-mclracca-1.c @@ -0,0 +1,24 @@ +/* GCSE used to reuse the value of __MRDACC. */ +/* { dg-do run } */ +extern void abort (void); +extern void exit (int); + +void foo (int *z) +{ + __MWTACC (3, 1); + if (__MRDACC (3) != 1) + *z = 1; + __MCLRACCA (); + if (__MRDACC (3) != 1) + *z = 2; +} + +int main () +{ + int z = 3; + + foo (&z); + if (z != 2) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.target/frv/all-mdpackh-1.c b/gcc/testsuite/gcc.target/frv/all-mdpackh-1.c new file mode 100644 index 000000000..837423773 --- /dev/null +++ b/gcc/testsuite/gcc.target/frv/all-mdpackh-1.c @@ -0,0 +1,16 @@ +/* Test the new (Fujitsu-compatible) __MDPACKH() interface. */ +/* { dg-do run } */ +extern void exit (int); +extern void abort (void); + +unsigned short x[] = { 0x8765, 0x1234, 0x2222, 0xeeee }; + +int +main () +{ + if (__MDPACKH (x[0], x[1], x[2], x[3]) != 0x876522221234eeeeULL) + abort (); + if (__MDPACKH (0x1111, 0x8001, 0xeeee, 0x7002) != 0x1111eeee80017002ULL) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.target/frv/all-read-write-1.c b/gcc/testsuite/gcc.target/frv/all-read-write-1.c new file mode 100644 index 000000000..8496a58ed --- /dev/null +++ b/gcc/testsuite/gcc.target/frv/all-read-write-1.c @@ -0,0 +1,34 @@ +/* { dg-do run } */ +extern void abort (void); +extern void exit (int); + +volatile unsigned long long x[2]; + +int main () +{ + volatile char *addr = (volatile char *) &x[0]; + + x[0] = ~0ULL; + x[1] = ~0ULL; + __builtin_write64 (addr, 0x1122334455667788ULL); + __builtin_write32 (addr + 8, 0x12345678); + __builtin_write16 (addr + 12, 0xaabb); + __builtin_write8 (addr + 14, 0xcc); + + if (x[0] != 0x1122334455667788ULL + || x[1] != 0x12345678aabbccffULL + || __builtin_read8 (addr) != 0x11 + || __builtin_read16 (addr + 2) != 0x3344 + || __builtin_read32 (addr + 4) != 0x55667788 + || __builtin_read64 (addr + 8) != 0x12345678aabbccffULL) + abort (); + + __builtin_write64 (addr, 0); + __builtin_write32 (addr + 8, 0); + __builtin_write16 (addr + 12, 0); + __builtin_write8 (addr + 14, 0); + if (x[0] != 0 || x[1] != 0xff) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.target/frv/all-tls-global-dynamic.c b/gcc/testsuite/gcc.target/frv/all-tls-global-dynamic.c new file mode 100644 index 000000000..2135090f1 --- /dev/null +++ b/gcc/testsuite/gcc.target/frv/all-tls-global-dynamic.c @@ -0,0 +1,12 @@ +/* { dg-options "-ftls-model=global-dynamic -fpic -mfdpic -mno-inline-plt" } */ +/* { dg-do compile } */ +extern __thread int x; +extern void bar (); +int *y; + +void foo (void) +{ + bar (); + y = &x; +} +/* { dg-final { scan-assembler "call #gettlsoff.x." } } */ diff --git a/gcc/testsuite/gcc.target/frv/all-tls-initial-exec-pic.c b/gcc/testsuite/gcc.target/frv/all-tls-initial-exec-pic.c new file mode 100644 index 000000000..b51e34df6 --- /dev/null +++ b/gcc/testsuite/gcc.target/frv/all-tls-initial-exec-pic.c @@ -0,0 +1,12 @@ +/* { dg-options "-ftls-model=initial-exec -fpic -mfdpic" } */ +/* { dg-do compile } */ +extern __thread int x; +extern void bar (); +int *y; + +void foo (void) +{ + bar (); + y = &x; +} +/* { dg-final { scan-assembler "ld.*#gottlsoff12" } } */ diff --git a/gcc/testsuite/gcc.target/frv/all-tls-initial-exec.c b/gcc/testsuite/gcc.target/frv/all-tls-initial-exec.c new file mode 100644 index 000000000..fa755a299 --- /dev/null +++ b/gcc/testsuite/gcc.target/frv/all-tls-initial-exec.c @@ -0,0 +1,12 @@ +/* { dg-options "-ftls-model=initial-exec -mfdpic" } */ +/* { dg-do compile } */ +extern __thread int x; +extern void bar (); +int *y; + +void foo (void) +{ + bar (); + y = &x; +} +/* { dg-final { scan-assembler "ld.*#tlsoff.x.@" } } */ diff --git a/gcc/testsuite/gcc.target/frv/all-tls-local-dynamic-plt-pic.c b/gcc/testsuite/gcc.target/frv/all-tls-local-dynamic-plt-pic.c new file mode 100644 index 000000000..3eabe1c6b --- /dev/null +++ b/gcc/testsuite/gcc.target/frv/all-tls-local-dynamic-plt-pic.c @@ -0,0 +1,13 @@ +/* { dg-options "-ftls-model=local-dynamic -minline-plt -fpic -mfdpic" } */ +/* { dg-do compile } */ +static __thread int x; +extern void bar (); +int *y; + +void foo (void) +{ + bar (); + y = &x; +} +/* { dg-final { scan-assembler "lddi.*gottlsdesc12" } } */ +/* { dg-final { scan-assembler "calll.*#gettlsoff\\(0\\)" } } */ diff --git a/gcc/testsuite/gcc.target/frv/all-tls-local-dynamic-plt.c b/gcc/testsuite/gcc.target/frv/all-tls-local-dynamic-plt.c new file mode 100644 index 000000000..5c2de9384 --- /dev/null +++ b/gcc/testsuite/gcc.target/frv/all-tls-local-dynamic-plt.c @@ -0,0 +1,12 @@ +/* { dg-options "-ftls-model=local-dynamic -minline-plt -fPIC -mfdpic" } */ +/* { dg-do compile } */ +static __thread int x; +extern void bar (); +int *y; + +void foo (void) +{ + bar (); + y = &x; +} +/* { dg-final { scan-assembler "ldd.*tlsdesc\\(0\\)@" } } */ diff --git a/gcc/testsuite/gcc.target/frv/all-tls-local-dynamic.c b/gcc/testsuite/gcc.target/frv/all-tls-local-dynamic.c new file mode 100644 index 000000000..4680a98f4 --- /dev/null +++ b/gcc/testsuite/gcc.target/frv/all-tls-local-dynamic.c @@ -0,0 +1,13 @@ +/* { dg-options "-ftls-model=local-dynamic -fpic -mfdpic" } */ +/* { dg-do compile } */ +static __thread int x; +extern void bar (); +int *y; + +void foo (void) +{ + bar (); + y = &x; +} +/* { dg-final { scan-assembler "gettlsoff\\(0\\)" } } */ +/* { dg-final { scan-assembler "tlsmoff12" } } */ diff --git a/gcc/testsuite/gcc.target/frv/all-tls-local-exec-TLS.c b/gcc/testsuite/gcc.target/frv/all-tls-local-exec-TLS.c new file mode 100644 index 000000000..83f78de4e --- /dev/null +++ b/gcc/testsuite/gcc.target/frv/all-tls-local-exec-TLS.c @@ -0,0 +1,12 @@ +/* { dg-options "-ftls-model=local-exec -mfdpic -mTLS" } */ +/* { dg-do compile } */ +static __thread int x; +extern void bar (); +int *y; + +void foo (void) +{ + bar (); + y = &x; +} +/* { dg-final { scan-assembler "sethi.*tlsmoffhi\\(x\\)," } } */ diff --git a/gcc/testsuite/gcc.target/frv/all-tls-local-exec.c b/gcc/testsuite/gcc.target/frv/all-tls-local-exec.c new file mode 100644 index 000000000..dd1b86a05 --- /dev/null +++ b/gcc/testsuite/gcc.target/frv/all-tls-local-exec.c @@ -0,0 +1,12 @@ +/* { dg-options "-ftls-model=local-exec -mfdpic" } */ +/* { dg-do compile } */ +static __thread int x; +extern void bar (); +int *y; + +void foo (void) +{ + bar (); + y = &x; +} +/* { dg-final { scan-assembler ".*tlsmoff12" } } */ diff --git a/gcc/testsuite/gcc.target/frv/fr400-builtins-1.c b/gcc/testsuite/gcc.target/frv/fr400-builtins-1.c new file mode 100644 index 000000000..85ca7cfbf --- /dev/null +++ b/gcc/testsuite/gcc.target/frv/fr400-builtins-1.c @@ -0,0 +1,28 @@ +/* Test prefetch support. */ +/* { dg-options "-mcpu=fr400" } */ +/* { dg-do run } */ + +unsigned char global[64]; + +int foo (unsigned int *x, int n) +{ + unsigned short local[16]; + + __data_prefetch0 (x); + __data_prefetch0 (&x[8]); + __data_prefetch0 (&x[n]); + __data_prefetch0 (local); + __data_prefetch0 (&local[16]); + __data_prefetch0 (&local[n]); + __data_prefetch0 (global); + __data_prefetch0 (&global[32]); + __data_prefetch0 (&global[n]); +} + +int main () +{ + unsigned int i[16]; + + foo (i, 2); + return 0; +} diff --git a/gcc/testsuite/gcc.target/frv/fr400-builtins-2.c b/gcc/testsuite/gcc.target/frv/fr400-builtins-2.c new file mode 100644 index 000000000..66f30055e --- /dev/null +++ b/gcc/testsuite/gcc.target/frv/fr400-builtins-2.c @@ -0,0 +1,10 @@ +/* Test prefetch support. */ +/* { dg-options "-mcpu=fr400" } */ +/* { dg-do compile } */ + +void foo (void *x) +{ + __data_prefetch0 (x); +} + +/* { dg-final { scan-assembler "\tdcpl " } } */ diff --git a/gcc/testsuite/gcc.target/frv/fr405-builtins-1.c b/gcc/testsuite/gcc.target/frv/fr405-builtins-1.c new file mode 100644 index 000000000..98e304e27 --- /dev/null +++ b/gcc/testsuite/gcc.target/frv/fr405-builtins-1.c @@ -0,0 +1,39 @@ +/* Test the IACC multiply/accumulate instructions. Also test the IACC + read/write functions. */ +/* { dg-options "-mcpu=fr405" } */ +/* { dg-do run } */ +extern void abort (void); +extern void exit (int); + +int main () +{ + long long res, res1, res2, res3; + + __SMU (0x12345678, 0x40004000); + __SMASS (0x12000000, 0x11223344); + __SMSSS (0x01020304, 0x54321000); + + res = __IACCreadll (0); + res1 = 0x12345678LL * 0x40004000LL; + res2 = 0x12000000LL * 0x11223344LL; + res3 = 0x01020304LL * 0x54321000LL; + if (res != res1 + res2 - res3) + abort (); + + __IACCsetll (0, 0x7ffffffffffffff0LL); + __SMASS (0x100, 0x100); + if (__IACCreadll (0) != 0x7fffffffffffffffLL) + abort (); + + __IACCsetl (0, -0x7ffffffe); + __IACCsetl (1, 0); + __SMSSS (0x10001, 0x10000); + if (__IACCreadl (0) != -0x7fffffff - 1 || __IACCreadl (1) != -0x10000) + abort (); + + __SMSSS (0x10001, 0x10000); + if (__IACCreadl (0) != -0x7fffffff - 1 || __IACCreadl (1) != 0) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.target/frv/fr405-builtins-2.c b/gcc/testsuite/gcc.target/frv/fr405-builtins-2.c new file mode 100644 index 000000000..778547c4d --- /dev/null +++ b/gcc/testsuite/gcc.target/frv/fr405-builtins-2.c @@ -0,0 +1,69 @@ +/* Test the SCUTSS instruction. */ +/* { dg-options "-mcpu=fr405" } */ +/* { dg-do run } */ +extern void abort (void); +extern void exit (int); + +int main () +{ + struct { + long long value; + int cut_point; + int result; + } values[] = { + /* Non-saturating values */ + + { +0x0000000000001234LL, 44, +0x01234000 }, + { ~0x0000000000001234LL, 44, ~0x01234fff }, + + { +0x0000011223300fffLL, 20, +0x11223301 }, + { ~0x0000011223300fffLL, 20, ~0x11223300 }, + { +0x0000011223300800LL, 20, +0x11223301 }, + { ~0x0000011223300800LL, 20, ~0x11223300 }, + { +0x00000112233007ffLL, 20, +0x11223300 }, + { ~0x00000112233007ffLL, 20, ~0x112232ff }, + { +0x0000011223300000LL, 20, +0x11223300 }, + { ~0x0000011223300000LL, 20, ~0x112232ff }, + + { +0x1234567fffffffffLL, -4, +0x01234568 }, + { ~0x1234567fffffffffLL, -4, ~0x01234567 }, + { +0x1234567800000000LL, -4, +0x01234568 }, + { ~0x1234567800000000LL, -4, ~0x01234567 }, + { +0x12345677ffffffffLL, -4, +0x01234567 }, + { ~0x12345677ffffffffLL, -4, ~0x01234566 }, + { +0x1234567000000000LL, -4, +0x01234567 }, + { ~0x1234567000000000LL, -4, ~0x01234566 }, + + /* Saturation tests */ + + { +0x4000000000000000LL, 44, +0x7fffffff }, + { ~0x4000000000000000LL, 44, ~0x7fffffff }, + { +0x0000000000080000LL, 44, +0x7fffffff }, + { ~0x0000000000080000LL, 44, ~0x7fffffff }, + { +0x000000000007ffffLL, 44, +0x7ffff000 }, + { ~0x000000000007ffffLL, 44, ~0x7fffffff }, + { +0x000000000007fffeLL, 44, +0x7fffe000 }, + { ~0x000000000007fffeLL, 44, ~0x7fffefff }, + + { +0x4000000000000000LL, 20, +0x7fffffff }, + { ~0x4000000000000000LL, 20, ~0x7fffffff }, + { +0x0000080000000000LL, 20, +0x7fffffff }, + { ~0x0000080000000000LL, 20, ~0x7fffffff }, + { +0x000007ffffffffffLL, 20, +0x7fffffff }, + { ~0x000007ffffffffffLL, 20, ~0x7fffffff }, + { +0x000007fffffff000LL, 20, +0x7fffffff }, + { ~0x000007fffffff000LL, 20, ~0x7ffffffe }, + { +0x000007ffffffe000LL, 20, +0x7ffffffe }, + { ~0x000007ffffffefffLL, 20, ~0x7ffffffe } + }; + + unsigned int i; + + for (i = 0; i < sizeof (values) / sizeof (values[0]); i++) + { + __IACCsetll (0, values[i].value); + if (__SCUTSS (values[i].cut_point) != values[i].result) + abort (); + } + exit (0); +} diff --git a/gcc/testsuite/gcc.target/frv/fr405-builtins-3.c b/gcc/testsuite/gcc.target/frv/fr405-builtins-3.c new file mode 100644 index 000000000..91fd96d7f --- /dev/null +++ b/gcc/testsuite/gcc.target/frv/fr405-builtins-3.c @@ -0,0 +1,58 @@ +/* Test the remaining integer instructions. */ +/* { dg-options "-mcpu=fr405" } */ +/* { dg-do run } */ +extern void abort (void); +extern void exit (int); + +int main () +{ + if (__SLASS (0x112233, 4) != 0x1122330) + abort (); + + if (__SLASS (0x7ffff, 12) != 0x7ffff000) + abort (); + + if (__SLASS (0x80000, 12) != 0x7fffffff) + abort (); + + if (__SLASS (-0x7ffff, 12) != -0x7ffff000) + abort (); + + if (__SLASS (-0x80000, 12) != -0x7fffffff - 1) + abort (); + + if (__SLASS (-0x80001, 12) != -0x7fffffff - 1) + abort (); + + if (__ADDSS (0x7fffffff, 1) != 0x7fffffff) + abort (); + + if (__ADDSS (0x7ffffffd, 1) != 0x7ffffffe) + abort (); + + if (__ADDSS (-0x7fffffff, -2) != -0x7fffffff - 1) + abort (); + + if (__ADDSS (-0x7ffffffd, -2) != -0x7fffffff) + abort (); + + if (__SUBSS (0x7fffffff, -1) != 0x7fffffff) + abort (); + + if (__SUBSS (0x7ffffffd, -1) != 0x7ffffffe) + abort (); + + if (__SUBSS (-0x7fffffff, 2) != -0x7fffffff - 1) + abort (); + + if (__SUBSS (-0x7ffffffd, 2) != -0x7fffffff) + abort (); + + if (__SCAN (0x12345678, 0) != 3) + abort (); + + if (__SCAN (0x12345678, 0x24680000) != 17) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.target/frv/fr450-builtins-1.c b/gcc/testsuite/gcc.target/frv/fr450-builtins-1.c new file mode 100644 index 000000000..cb7986ddb --- /dev/null +++ b/gcc/testsuite/gcc.target/frv/fr450-builtins-1.c @@ -0,0 +1,27 @@ +/* Test __MQLCLRHS. */ +/* { dg-options "-mcpu=fr450" } */ +/* { dg-do run } */ +extern void abort (void); +extern void exit (int); + +int main () +{ + struct { unsigned long long a, b, c; } entries[] = { + { 0x10002000e800d800ULL, 0x0800080008000800ULL, 0x10002000e800d800ULL }, + { 0x10002000e800d800ULL, 0xf800f800f800f800ULL, 0xf000e00018002800ULL }, + { 0x1000100010001000ULL, 0xf000f80008001000ULL, 0x0000f00010000000ULL }, + { 0xf000f000f000f000ULL, 0xf000f80008001000ULL, 0x00001000f0000000ULL }, + { 0x8000800080008000ULL, 0x80007fff80010000ULL, 0x000080007fff8000ULL }, + { 0x7fff7fff7fff7fffULL, 0x80007fff80010000ULL, 0x0000000000007fffULL }, + { 0x8001800180018001ULL, 0x80007fff80010000ULL, 0x0000000000008001ULL }, + { 0x800080000001ffffULL, 0x0001ffff80008000ULL, 0x80007fff00000000ULL } + }; + + unsigned int i; + + for (i = 0; i < sizeof (entries) / sizeof (entries[0]); i++) + if (__MQLCLRHS (entries[i].a, entries[i].b) != entries[i].c) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.target/frv/fr450-builtins-2.c b/gcc/testsuite/gcc.target/frv/fr450-builtins-2.c new file mode 100644 index 000000000..663d735cf --- /dev/null +++ b/gcc/testsuite/gcc.target/frv/fr450-builtins-2.c @@ -0,0 +1,27 @@ +/* Test __MLMTHS. */ +/* { dg-options "-mcpu=fr450" } */ +/* { dg-do run } */ +extern void abort (void); +extern void exit (int); + +int main () +{ + struct { unsigned long long a, b, c; } entries[] = { + { 0x10002000e800d800ULL, 0x0800080008000800ULL, 0x08000800f800f800ULL }, + { 0x10002000e800d800ULL, 0xf800f800f800f800ULL, 0xf800f80008000800ULL }, + { 0x1000100010001000ULL, 0xe800f80008001800ULL, 0x1000f80008001000ULL }, + { 0xf000f000f000f000ULL, 0xe800f80008001800ULL, 0xf0000800f800f000ULL }, + { 0x8000800080008000ULL, 0x80007fff80010000ULL, 0x7fff80017fff0000ULL }, + { 0x7fff7fff7fff7fffULL, 0x80007fff80010000ULL, 0x7fff7fff80010000ULL }, + { 0x8001800180018001ULL, 0x80007fff80010000ULL, 0x800180017fff0000ULL }, + { 0x800080000001ffffULL, 0x0001ffff80008000ULL, 0xffff00010001ffffULL } + }; + + unsigned int i; + + for (i = 0; i < sizeof (entries) / sizeof (entries[0]); i++) + if (__MQLMTHS (entries[i].a, entries[i].b) != entries[i].c) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.target/frv/fr450-builtins-3.c b/gcc/testsuite/gcc.target/frv/fr450-builtins-3.c new file mode 100644 index 000000000..00478a4ae --- /dev/null +++ b/gcc/testsuite/gcc.target/frv/fr450-builtins-3.c @@ -0,0 +1,25 @@ +/* Test __MQSLLHI. */ +/* { dg-options "-mcpu=fr450" } */ +/* { dg-do run } */ +extern void abort (void); +extern void exit (int); + +int main () +{ + if (__MQSLLHI (0x0001000200030004ULL, 1) != 0x0002000400060008ULL) + abort (); + + if (__MQSLLHI (0xfffffffefffcfff8ULL, 1) != 0xfffefffcfff8fff0ULL) + abort (); + + if (__MQSLLHI (0xfffffffefffcfff8ULL, 12) != 0xf000e000c0008000ULL) + abort (); + + if (__MQSLLHI (0x123456789abcdef0ULL, 12) != 0x40008000c0000000ULL) + abort (); + + if (__MQSLLHI (0x123456789abcdef0ULL, 16) != 0x123456789abcdef0ULL) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.target/frv/fr450-builtins-4.c b/gcc/testsuite/gcc.target/frv/fr450-builtins-4.c new file mode 100644 index 000000000..1eee1861a --- /dev/null +++ b/gcc/testsuite/gcc.target/frv/fr450-builtins-4.c @@ -0,0 +1,25 @@ +/* Test __MQSRAHI. */ +/* { dg-options "-mcpu=fr450" } */ +/* { dg-do run } */ +extern void abort (void); +extern void exit (int); + +int main () +{ + if (__MQSRAHI (0x0001000200030004ULL, 1) != 0x0000000100010002ULL) + abort (); + + if (__MQSRAHI (0xfffffffefffcfff8ULL, 1) != 0xfffffffffffefffcULL) + abort (); + + if (__MQSRAHI (0x8000c000e000f000ULL, 12) != 0xfff8fffcfffeffffULL) + abort (); + + if (__MQSRAHI (0x123456789abcdef0ULL, 12) != 0x00010005fff9fffdULL) + abort (); + + if (__MQSRAHI (0x123456789abcdef0ULL, 16) != 0x123456789abcdef0ULL) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.target/frv/fr450-builtins-5.c b/gcc/testsuite/gcc.target/frv/fr450-builtins-5.c new file mode 100644 index 000000000..c94e8ff80 --- /dev/null +++ b/gcc/testsuite/gcc.target/frv/fr450-builtins-5.c @@ -0,0 +1,35 @@ +/* Test that all accumulator registers are accessible. */ +/* { dg-options "-mcpu=fr450" } */ +/* { dg-do run } */ +extern void abort (void); +extern void exit (int); + +#define TEST_ACC(X) \ + (__MWTACC (X, 0x11220000 | X), __MRDACC (X) ^ (0x11220000 | X)) + +#define TEST_ACCG(X) \ + (__MWTACCG (X, X), __MRDACCG (X) ^ X) + +#define ZERO_ACC(X) \ + (__MRDACC (X) | __MRDACCG (X)) + +int +main () +{ + if (TEST_ACC (0) | TEST_ACC (1) | TEST_ACC (2) | TEST_ACC (3)) + abort (); + if (TEST_ACC (8) | TEST_ACC (9) | TEST_ACC (10) | TEST_ACC (11)) + abort (); + if (TEST_ACCG (0) | TEST_ACCG (1) | TEST_ACCG (2) | TEST_ACCG (3)) + abort (); + if (TEST_ACCG (8) | TEST_ACCG (9) | TEST_ACCG (10) | TEST_ACCG (11)) + abort (); + + __MCLRACCA (); + if (ZERO_ACC (0) | ZERO_ACC (1) | ZERO_ACC (2) | ZERO_ACC (3)) + abort (); + if (ZERO_ACC (8) | ZERO_ACC (9) | ZERO_ACC (10) | ZERO_ACC (11)) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.target/frv/fr450-builtins-6.c b/gcc/testsuite/gcc.target/frv/fr450-builtins-6.c new file mode 100644 index 000000000..0624eb1f5 --- /dev/null +++ b/gcc/testsuite/gcc.target/frv/fr450-builtins-6.c @@ -0,0 +1,23 @@ +/* Test a situation in which an M5 instruction (mrdacc) and M4 instruction + (mqmulhu) can be issued together. */ +/* { dg-options "-mcpu=fr450" } */ +/* { dg-do run } */ +extern void abort (void); +extern void exit (int); + +int +main () +{ + __MQMULHU (0, 0x0011002200330044ULL, 0x0002000300040001ULL); + __MQMULHU (8, 0x0100020003000400ULL, 0x0001000200030004ULL); + + /* 0x22 + 0x66 + 0xcc + 0x44 = 0x198 */ + /* 0x100 + 0x400 + 0x900 + 0x1000 = 0x1e00 */ + if (__MRDACC (0) + __MRDACC (1) + + __MRDACC (2) + __MRDACC (3) + + __MRDACC (8) + __MRDACC (9) + + __MRDACC (10) + __MRDACC (11) != 0x1f98) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.target/frv/fr450-builtins-7.c b/gcc/testsuite/gcc.target/frv/fr450-builtins-7.c new file mode 100644 index 000000000..dbba44a85 --- /dev/null +++ b/gcc/testsuite/gcc.target/frv/fr450-builtins-7.c @@ -0,0 +1,24 @@ +/* Test that the code from fr450-builtins-6.c packs together an + M4 and M5 instruction. */ +/* { dg-options "-O2 -mcpu=fr450" } */ +/* { dg-do compile } */ +/* { dg-final { scan-assembler "mqmulhu.p\[^\t\]*\t*mrdacc" } } */ +extern void abort (void); +extern void exit (int); + +int +main () +{ + __MQMULHU (0, 0x0011002200330044ULL, 0x0002000300040001ULL); + __MQMULHU (8, 0x0100020003000400ULL, 0x0001000200030004ULL); + + /* 0x22 + 0x66 + 0xcc + 0x44 = 0x198 */ + /* 0x100 + 0x400 + 0x900 + 0x1000 = 0x1e00 */ + if (__MRDACC (0) + __MRDACC (1) + + __MRDACC (2) + __MRDACC (3) + + __MRDACC (8) + __MRDACC (9) + + __MRDACC (10) + __MRDACC (11) != 0x1f98) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.target/frv/fr450-builtins-8.c b/gcc/testsuite/gcc.target/frv/fr450-builtins-8.c new file mode 100644 index 000000000..2c23f8cd8 --- /dev/null +++ b/gcc/testsuite/gcc.target/frv/fr450-builtins-8.c @@ -0,0 +1,22 @@ +/* Test a situation in which an M6 instruction (mdcutssi) and M4 instruction + (mqmulhu) can be issued together. */ +/* { dg-options "-mcpu=fr450" } */ +/* { dg-do run } */ +extern void abort (void); +extern void exit (int); + +int +main () +{ + __MQMULHU (0, 0x0001001101111111ULL, 0x0001000200030004ULL); + __MQMULHU (8, 0x0002002202222222ULL, 0x0004000400040004ULL); + if (__MDCUTSSI (0, 8) + + __MDCUTSSI (2, 8) + + __MDCUTSSI (8, 8) + + __MDCUTSSI (10, 8) + != (0x0000000100000022ULL + 0x0000033300004444ULL + + 0x0000000800000088ULL + 0x0000088800008888ULL)) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.target/frv/fr450-builtins-9.c b/gcc/testsuite/gcc.target/frv/fr450-builtins-9.c new file mode 100644 index 000000000..5f32ba281 --- /dev/null +++ b/gcc/testsuite/gcc.target/frv/fr450-builtins-9.c @@ -0,0 +1,23 @@ +/* Test a situation in which an M6 instruction (mdcutssi) and M4 instruction + (mqmulhu) can be issued together. */ +/* { dg-options "-O2 -mcpu=fr450" } */ +/* { dg-do compile } */ +/* { dg-final { scan-assembler "mqmulhu.p\[^\t\]*\t*mdcutssi" } } */ +extern void abort (void); +extern void exit (int); + +int +main () +{ + __MQMULHU (0, 0x0001001101111111ULL, 0x0001000200030004ULL); + __MQMULHU (8, 0x0002002202222222ULL, 0x0004000400040004ULL); + if (__MDCUTSSI (0, 8) + + __MDCUTSSI (2, 8) + + __MDCUTSSI (8, 8) + + __MDCUTSSI (10, 8) + != (0x0000000100000022ULL + 0x0000033300004444ULL + + 0x0000000800000088ULL + 0x0000088800008888ULL)) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.target/frv/fr550-builtins-1.c b/gcc/testsuite/gcc.target/frv/fr550-builtins-1.c new file mode 100644 index 000000000..d728f12a4 --- /dev/null +++ b/gcc/testsuite/gcc.target/frv/fr550-builtins-1.c @@ -0,0 +1,42 @@ +/* Test prefetch support. */ +/* { dg-do run } */ +extern void abort (void); +extern void exit (int); + +unsigned char global[64]; + +void +foo (unsigned int *x, int n) +{ + unsigned short local[16]; + + __data_prefetch0 (x); + __data_prefetch0 (&x[8]); + __data_prefetch0 (&x[n]); + __data_prefetch0 (local); + __data_prefetch0 (&local[16]); + __data_prefetch0 (&local[n]); + __data_prefetch0 (global); + __data_prefetch0 (&global[32]); + __data_prefetch0 (&global[n]); + +#if __FRV_VLIW__ > 1 + __data_prefetch (x); + __data_prefetch (&x[8]); + __data_prefetch (&x[n]); + __data_prefetch (local); + __data_prefetch (&local[16]); + __data_prefetch (&local[n]); + __data_prefetch (global); + __data_prefetch (&global[32]); + __data_prefetch (&global[n]); +#endif +} + +int main () +{ + unsigned int i[16]; + + foo (i, 2); + exit (0); +} diff --git a/gcc/testsuite/gcc.target/frv/fr550-builtins-2.c b/gcc/testsuite/gcc.target/frv/fr550-builtins-2.c new file mode 100644 index 000000000..ce39f462c --- /dev/null +++ b/gcc/testsuite/gcc.target/frv/fr550-builtins-2.c @@ -0,0 +1,9 @@ +/* Test prefetch support. */ +/* { dg-do compile } */ + +void foo (void *x) +{ + __data_prefetch0 (x); +} + +/* { dg-final { scan-assembler "\tdcpl " } } */ diff --git a/gcc/testsuite/gcc.target/frv/fr550-builtins-3.c b/gcc/testsuite/gcc.target/frv/fr550-builtins-3.c new file mode 100644 index 000000000..b5347de74 --- /dev/null +++ b/gcc/testsuite/gcc.target/frv/fr550-builtins-3.c @@ -0,0 +1,13 @@ +/* Test prefetch support. */ +/* { dg-do compile } */ + +#if __FRV_VLIW__ > 1 +void foo (void *x) +{ + __data_prefetch (x); +} +#else +asm (";\tnop.p\n;\tnldub "); +#endif + +/* { dg-final { scan-assembler "\tnop.p.*\tnldub " } } */ diff --git a/gcc/testsuite/gcc.target/frv/fr550-builtins-4.c b/gcc/testsuite/gcc.target/frv/fr550-builtins-4.c new file mode 100644 index 000000000..801dfee20 --- /dev/null +++ b/gcc/testsuite/gcc.target/frv/fr550-builtins-4.c @@ -0,0 +1,48 @@ +/* Test the __M{,D}{ADD,SUB}ACC functions. */ +/* { dg-do run } */ +extern void abort (void); +extern void exit (int); + +int +main () +{ + __MWTACC (6, 10); + __MWTACC (7, 25); + __MADDACCS (5, 6); + if (__MRDACC (5) != 35) + abort (); + __MSUBACCS (4, 6); + if (__MRDACC (4) != -15) + abort (); + __MASACCS (4, 6); + if (__MRDACC (4) != 35 || __MRDACC (5) != -15) + abort (); + + __MWTACC (0, 100); + __MWTACC (1, 150); + __MWTACC (2, 1000); + __MWTACC (3, 1500); + __MDADDACCS (2, 0); + if (__MRDACC (2) != 250 || __MRDACC (3) != 2500) + abort (); + + __MWTACC (0, 100); + __MWTACC (1, 150); + __MWTACC (2, 1000); + __MWTACC (3, 1500); + __MDSUBACCS (2, 0); + if (__MRDACC (2) != -50 || __MRDACC (3) != -500) + abort (); + + __MWTACC (0, 100); + __MWTACC (1, 150); + __MWTACC (2, 1000); + __MWTACC (3, 1500); + __MDASACCS (0, 0); + if (__MRDACC (0) != 250 || __MRDACC (1) != -50) + abort (); + if (__MRDACC (2) != 2500 || __MRDACC (3) != -500) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.target/frv/fr550-builtins-5.c b/gcc/testsuite/gcc.target/frv/fr550-builtins-5.c new file mode 100644 index 000000000..ff75ea17d --- /dev/null +++ b/gcc/testsuite/gcc.target/frv/fr550-builtins-5.c @@ -0,0 +1,25 @@ +/* Test that __MADDACC only changes the registers it's supposed to. */ +/* { dg-do run } */ +extern void abort (void); +extern void exit (int); + +int +main () +{ + __MWTACC (0, 1); + __MWTACC (1, 1); + __MWTACC (2, 1); + __MWTACC (3, 1); + __MWTACC (4, 1); + __MWTACC (5, 1); + __MWTACC (6, 1); + __MWTACC (7, 1); + __MADDACCS (0, 2); + __MADDACCS (4, 6); + if ((__MRDACC (0) - 2) + | (__MRDACC (1) - 1) + | (__MRDACC (4) - 2) + | (__MRDACC (5) - 1)) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.target/frv/frv.exp b/gcc/testsuite/gcc.target/frv/frv.exp new file mode 100644 index 000000000..82b2541cd --- /dev/null +++ b/gcc/testsuite/gcc.target/frv/frv.exp @@ -0,0 +1,53 @@ +# Copyright (C) 2004 Free Software Foundation, Inc. +# +# This file is part of GCC. +# +# GCC is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GCC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# <http://www.gnu.org/licenses/>. + +# The name of each test starts with the architecture it requires. Tests that +# work on all variants start with "all". + +if {![istarget frv-*-*]} { + return 0 +} + +load_lib gcc-dg.exp + +# Find out which architecture is used by default. +set mainarch "fr500" +foreach flag [target_info multilib_flags] { + regexp "^-mcpu=(.*)" $flag dummy mainarch + if {$flag == "-mno-pack"} { + # -mno-pack disables media intrinsics. + return 0 + } +} + +# Set $archs to "all" plus the list of architectures we can test. +set archs [list "all" $mainarch] +switch $mainarch { + fr405 { lappend archs fr400 } + fr450 { lappend archs fr405 fr400 } +} + +# Set $files to the list of files we can test. +set files "" +foreach arch $archs { + lappend files [lsort [glob -nocomplain $srcdir/$subdir/${arch}*.c]] +} + +dg-init +gcc-dg-runtest [eval concat $files] "" +dg-finish |