From: Carl Love Date: Wed, 27 Jun 2018 21:50:01 +0000 (+0000) Subject: Add test case that was supposed to be added in commit 255556 on 2017-12-11. X-Git-Tag: upstream/12.2.0~30694 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=356d53635faecee4b8abfc6b21208432c72eebff;p=platform%2Fupstream%2Fgcc.git Add test case that was supposed to be added in commit 255556 on 2017-12-11. gcc/testsuite/ChangeLog: 2018-06-27 Carl Love Add test case that was supposed to be added in commit 255556 on 2017-12-11. * gcc.target/vsx-vector-abss.c: New file to test vec_abss. From-SVN: r262196 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f20147a..e9e2e2a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2018-06-27 Carl Love + +Add test case that was supposed to be added in commit 255556 on 2017-12-11. + + * gcc.target/vsx-vector-abss.c: New file to test vec_abss. + 2018-06-27 Tamar Christina PR target/85769 diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-vector-abss.c b/gcc/testsuite/gcc.target/powerpc/vsx-vector-abss.c new file mode 100644 index 0000000..d8927b3 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vsx-vector-abss.c @@ -0,0 +1,96 @@ +/* { dg-do run { target { powerpc*-*-* && lp64 } } } */ +/* { dg-skip-if "" { powerpc*-*-darwin* } } */ +/* { dg-require-effective-target vsx_hw } */ +/* { dg-options "-mvsx -O2" } */ + + +#include +#include + +#ifdef DEBUG +#include +#endif + +void abort (void); + +static vector signed char +vabss_char (vector signed char arg) +{ + return vec_abss (arg); +} + +static vector signed short +vabss_short (vector signed short arg) +{ + return vec_abss (arg); +} + +static vector signed int +vabss_int (vector signed int arg) +{ + return vec_abss (arg); +} + +int +main (int argc, char *argv[]) +{ + int i; + vector signed char val_char; + vector signed char expected_char; + vector signed char result_char; + vector signed short val_short; + vector signed short expected_short; + vector signed short result_short; + vector signed int val_int; + vector signed int expected_int; + vector signed int result_int; + + /* CHAR */ + val_char = (vector signed char) {-7, 6, -5, 4, -3, 1, 0, -0, 1, -2, 3, -5, 6, -7}; + expected_char = (vector signed char) {7, 6, 5, 4, 3, 1, 0, 0, 1, 2, 3, 5, 6, 7}; + + result_char = vabss_char (val_char); + + for (i = 0; i< 16; i++) + if (result_char[i] != expected_char[i]) +#ifdef DEBUG + printf("ERROR: vec_abss() result_char[%d] = %d, not expected_char[%d] = %d\n", + i, result_char[i], i, expected_char[i]); +#else + abort (); +#endif + + /* SHORT */ + val_short = (vector signed short) {-0, 1, -2, 3, 4, -5, 6, -7}; + expected_short = (vector signed short) {0, 1, 2, 3, 4, 5, 6, 7}; + + result_short = vabss_short (val_short); + + for (i = 0; i< 8; i++) + if (result_short[i] != expected_short[i]) +#ifdef DEBUG + printf("ERROR: vec_abss() result_short[%d] = %d, not expected_short[%d] = %d\n", + i, result_short[i], i, expected_short[i]); +#else + abort (); +#endif + + /* INT */ + val_int = (vector signed int) {-7, 6, -5, 4}; + expected_int = (vector signed int) {7, 6, 5, 4}; + + result_int = vabss_int (val_int); + + for (i = 0; i< 4; i++) + if (result_int[i] != expected_int[i]) +#ifdef DEBUG + printf("ERROR: vec_abss() result_int[%d] = %d, not expected_int[%d] = %d\n", + i, result_int[i], i, expected_int[i]); +#else + abort (); +#endif + + return 0; +} + +