diff options
author | Ben Cheng <bccheng@google.com> | 2014-03-25 22:37:19 -0700 |
---|---|---|
committer | Ben Cheng <bccheng@google.com> | 2014-03-25 22:37:19 -0700 |
commit | 1bc5aee63eb72b341f506ad058502cd0361f0d10 (patch) | |
tree | c607e8252f3405424ff15bc2d00aa38dadbb2518 /gcc-4.9/gcc/testsuite/gcc.target/tic6x/builtins | |
parent | 283a0bf58fcf333c58a2a92c3ebbc41fb9eb1fdb (diff) | |
download | toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.gz toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.bz2 toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.zip |
Initial checkin of GCC 4.9.0 from trunk (r208799).
Change-Id: I48a3c08bb98542aa215912a75f03c0890e497dba
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gcc.target/tic6x/builtins')
7 files changed, 260 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/tic6x/builtins/arith24.c b/gcc-4.9/gcc/testsuite/gcc.target/tic6x/builtins/arith24.c new file mode 100644 index 000000000..5e5228446 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/tic6x/builtins/arith24.c @@ -0,0 +1,83 @@ +/* { dg-require-effective-target ti_c64xp } */ + +#include <c6x_intrinsics.h> + +extern void abort (void); + +typedef short __v2hi __attribute ((vector_size(4))); + +int a = 0x5000d000; +int b = 0xc0002000; +int c = 0x40009000; +int d = 0x80000001; +int e = 0x50002001; +int f = 0xc0008000; + +int a4 = 0x50d03080; +int b4 = 0xc020f080; +int c4 = 0xc0202080; +int d4 = 0x50003080; +int e4 = 0xc0202180; + +int main () +{ + int v; + long long vll; + + v = _add2 (a, b); + if (v != 0x1000f000) + abort (); + v = _sub2 (a, b); + if (v != 0x9000b000) + abort (); + v = _sub2 (b, a); + if (v != 0x70005000) + abort (); + + v = _add4 (a4, b4); + if (v != 0x10f02000) + abort (); + v = _sub4 (a4, b4); + if (v != 0x90b04000) + abort (); + v = _saddu4 (a4, c4); + if (v != 0xfff050ff) + abort (); + + v = _sadd2 (a, b); + if (v != 0x1000f000) + abort (); + v = _sadd2 (a, c); + if (v != 0x7fff8000) + abort (); + + v = _ssub2 (a, b); + if (v != 0x7fffb000) + abort (); + v = _ssub2 (b, a); + if (v != 0x80005000) + abort (); + + vll = _smpy2ll (a, b); + if (vll != 0xd8000000f4000000ll) + abort (); + vll = _smpy2ll (d, d); + if (vll != 0x7fffffff00000002ll) + abort (); + + v = _avg2 (b, e); + if (v != 0x08002001) + abort (); + v = _avgu4 (d4, e4); + if (v != 0x88102980) + abort (); + + v = _abs2 (a); + if (v != 0x50003000) + abort (); + v = _abs2 (f); + if (v != 0x40007fff) + abort (); + + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/tic6x/builtins/c6x-builtins.exp b/gcc-4.9/gcc/testsuite/gcc.target/tic6x/builtins/c6x-builtins.exp new file mode 100644 index 000000000..e3e99acd6 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/tic6x/builtins/c6x-builtins.exp @@ -0,0 +1,29 @@ +# Copyright (C) 2009-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 `c-torture.exp' driver, looping over +# optimization options. + +load_lib gcc-dg.exp + +if { ![istarget tic6x-*-*] } then { + return +} + +dg-init +gcc-dg-runtest [lsort [glob $srcdir/$subdir/*.c]] "" +dg-finish + diff --git a/gcc-4.9/gcc/testsuite/gcc.target/tic6x/builtins/extclr.c b/gcc-4.9/gcc/testsuite/gcc.target/tic6x/builtins/extclr.c new file mode 100644 index 000000000..e8e2139dd --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/tic6x/builtins/extclr.c @@ -0,0 +1,36 @@ +#include <c6x_intrinsics.h> + +extern void abort (void); + +#define N 4 + +int vals[N] = { 0, 0xffffffff, 0x89abcdef, 0xdeadbeef }; + +int main () +{ + int i; + for (i = 0; i < N; i++) + { + int shf1, shf2; + int v = vals[i]; + unsigned int uv = v; + + for (shf1 = 0; shf1 < 32; shf1++) + for (shf2 = 0; shf2 < 32; shf2++) + { + int r = (shf1 << 5) | shf2; + if (shf2 > shf1) + { + unsigned int mask = (1u << (shf2 - shf1) << 1) - 1; + mask <<= shf1; + if (_clrr (v, r) != (v & ~mask)) + abort (); + } + if (_extr (v, r) != v << shf1 >> shf2) + abort (); + if (_extru (v, r) != uv << shf1 >> shf2) + abort (); + } + } + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/tic6x/builtins/sarith1.c b/gcc-4.9/gcc/testsuite/gcc.target/tic6x/builtins/sarith1.c new file mode 100644 index 000000000..4ea357003 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/tic6x/builtins/sarith1.c @@ -0,0 +1,47 @@ +#include <c6x_intrinsics.h> + +extern void abort (void); + +int a1 = 0x50000000; +int b1 = 0xc0000000; +int c1 = 0x40000000; +int a2 = 0xd0000000; +int b2 = 0x20000000; +int c2 = 0x90000000; +int d = 0x80000000; + +int main () +{ + if (_sadd (a1, b1) != 0x10000000) + abort (); + if (_sadd (a2, b2) != 0xf0000000) + abort (); + if (_sadd (a1, c1) != 0x7fffffff) + abort (); + if (_sadd (a2, c2) != 0x80000000) + abort (); + + if (_ssub (a1, b1) != 0x7fffffff) + abort (); + if (_ssub (a2, b2) != 0xb0000000) + abort (); + if (_ssub (b1, a1) != 0x80000000) + abort (); + if (_ssub (b2, a2) != 0x50000000) + abort (); + + if (_abs (a1) != 0x50000000) + abort (); + if (_abs (b1) != 0x40000000) + abort (); + if (_abs (d) != 0x7fffffff) + abort (); + + if (_sshl (a1, 1) != 0x7fffffff + || _sshl (b2, 1) != 0x40000000 + || _sshl (a2, 1) != 0xa0000000 + || _sshl (a2, 4) != 0x80000000) + abort (); + + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/tic6x/builtins/smpy.c b/gcc-4.9/gcc/testsuite/gcc.target/tic6x/builtins/smpy.c new file mode 100644 index 000000000..15a993045 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/tic6x/builtins/smpy.c @@ -0,0 +1,20 @@ +#include <c6x_intrinsics.h> + +extern void abort (void); + +int a1 = 0x5000; +int b1 = 0xc000; +int a2 = 0xd000; +int b2 = 0x2000; +int c = 0x8000; +int main () +{ + if (_smpy (a1, b1) != 0xd8000000) + abort (); + if (_smpy (a2, b2) != 0xf4000000) + abort (); + if (_smpy (c, c) != 0x7fffffff) + abort (); + + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/tic6x/builtins/smpyh.c b/gcc-4.9/gcc/testsuite/gcc.target/tic6x/builtins/smpyh.c new file mode 100644 index 000000000..c8864da62 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/tic6x/builtins/smpyh.c @@ -0,0 +1,19 @@ +#include <c6x_intrinsics.h> +extern void abort (void); + +int a1 = 0x50000000; +int b1 = 0xc0000000; +int a2 = 0xd0000000; +int b2 = 0x20000000; +int c = 0x80000000; +int main () +{ + if (_smpyh (a1, b1) != 0xd8000000) + abort (); + if (_smpyh (a2, b2) != 0xf4000000) + abort (); + if (_smpyh (c, c) != 0x7fffffff) + abort (); + + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/tic6x/builtins/smpylh.c b/gcc-4.9/gcc/testsuite/gcc.target/tic6x/builtins/smpylh.c new file mode 100644 index 000000000..92a50433e --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/tic6x/builtins/smpylh.c @@ -0,0 +1,26 @@ +#include <c6x_intrinsics.h> + +extern void abort (void); + +int a1 = 0x5000; +int b1 = 0xc0000000; +int a2 = 0xd000; +int b2 = 0x20000000; +int c = 0x8000; +int main () +{ + if (_smpylh (a1, b1) != 0xd8000000) + abort (); + if (_smpylh (a2, b2) != 0xf4000000) + abort (); + if (_smpylh (c, 0x80000000) != 0x7fffffff) + abort (); + if (_smpyhl (b1, a1) != 0xd8000000) + abort (); + if (_smpyhl (b2, a2) != 0xf4000000) + abort (); + if (_smpyhl (0x80000000, c) != 0x7fffffff) + abort (); + + return 0; +} |