diff options
author | carll <carll@138bc75d-0d04-0410-961f-82ee72b054a4> | 2018-07-05 15:04:27 +0000 |
---|---|---|
committer | carll <carll@138bc75d-0d04-0410-961f-82ee72b054a4> | 2018-07-05 15:04:27 +0000 |
commit | fa8d5450e50e62135a9993dfe63e9cb7a568372b (patch) | |
tree | 62a90ccff193458993de6555ae806b0667b567a6 | |
parent | a0b1b7f2bcea46d17658ed531337f86bd51f9c81 (diff) |
gcc/ChangeLog:
2018-07-03 Carl Love <cel@us.ibm.com>
Backport from trunk
2018-07-03 Carl Love <cel@us.ibm.com>
* config/rs6000/rs6000-c.c: Map ALTIVEC_BUILTIN_VEC_UNPACKH for
float argument to VSX_BUILTIN_DOUBLEH_V4SF.
Map ALTIVEC_BUILTIN_VEC_UNPACKL for float argument to
VSX_BUILTIN_DOUBLEL_V4SF.
gcc/testsuite/ChangeLog:
2018-07-03 Carl Love <cel@us.ibm.com>
Backport from trunk
2018-07-03 Carl Love <cel@us.ibm.com>
* gcc.target/altivec-1-runnable.c: New test file.
* gcc.target/altivec-2-runnable.c: New test file.
* gcc.target/vsx-7.c (main2): Test file changes not backported from
mainline since test file does not exist in GCC 8.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@262440 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000-c.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/powerpc/altivec-1-runnable.c | 257 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/powerpc/altivec-2-runnable.c | 94 |
5 files changed, 373 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3838ef0bb631..05892b482951 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2018-07-03 Carl Love <cel@us.ibm.com> + + Backport from trunk + 2018-07-03 Carl Love <cel@us.ibm.com> + + * config/rs6000/rs6000-c.c: Map ALTIVEC_BUILTIN_VEC_UNPACKH for + float argument to VSX_BUILTIN_DOUBLEH_V4SF. + Map ALTIVEC_BUILTIN_VEC_UNPACKL for float argument to + VSX_BUILTIN_DOUBLEL_V4SF. + 2018-07-04 Luis Machado <luis.machado@linaro.org> * config/aarch64/aarch64.c (qdf24xx_addrcost_table): New static diff --git a/gcc/config/rs6000/rs6000-c.c b/gcc/config/rs6000/rs6000-c.c index 3542af35abb7..7cbbf7af1543 100644 --- a/gcc/config/rs6000/rs6000-c.c +++ b/gcc/config/rs6000/rs6000-c.c @@ -894,7 +894,7 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = { RS6000_BTI_bool_V2DI, RS6000_BTI_bool_V4SI, 0, 0 }, { ALTIVEC_BUILTIN_VEC_UNPACKH, ALTIVEC_BUILTIN_VUPKHPX, RS6000_BTI_unsigned_V4SI, RS6000_BTI_pixel_V8HI, 0, 0 }, - { ALTIVEC_BUILTIN_VEC_UNPACKH, ALTIVEC_BUILTIN_VUPKHPX, + { ALTIVEC_BUILTIN_VEC_UNPACKH, VSX_BUILTIN_DOUBLEH_V4SF, RS6000_BTI_V2DF, RS6000_BTI_V4SF, 0, 0 }, { ALTIVEC_BUILTIN_VEC_VUPKHSH, ALTIVEC_BUILTIN_VUPKHSH, RS6000_BTI_V4SI, RS6000_BTI_V8HI, 0, 0 }, @@ -926,7 +926,7 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = { RS6000_BTI_V2DI, RS6000_BTI_V4SI, 0, 0 }, { ALTIVEC_BUILTIN_VEC_UNPACKL, P8V_BUILTIN_VUPKLSW, RS6000_BTI_bool_V2DI, RS6000_BTI_bool_V4SI, 0, 0 }, - { ALTIVEC_BUILTIN_VEC_UNPACKL, ALTIVEC_BUILTIN_VUPKLPX, + { ALTIVEC_BUILTIN_VEC_UNPACKL, VSX_BUILTIN_DOUBLEL_V4SF, RS6000_BTI_V2DF, RS6000_BTI_V4SF, 0, 0 }, { ALTIVEC_BUILTIN_VEC_VUPKLPX, ALTIVEC_BUILTIN_VUPKLPX, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V8HI, 0, 0 }, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 87b05d955ba8..3f36dc0ee858 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,13 @@ +2018-07-03 Carl Love <cel@us.ibm.com> + + Backport from trunk + 2018-07-03 Carl Love <cel@us.ibm.com> + + * gcc.target/altivec-1-runnable.c: New test file. + * gcc.target/altivec-2-runnable.c: New test file. + * gcc.target/vsx-7.c (main2): Test file changes not backported from + mainline since test file does not exist in GCC 8. + 2018-07-02 Paul Thomas <pault@gcc.gnu.org> PR fortran/82969 diff --git a/gcc/testsuite/gcc.target/powerpc/altivec-1-runnable.c b/gcc/testsuite/gcc.target/powerpc/altivec-1-runnable.c new file mode 100644 index 000000000000..bb913d2d5717 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/altivec-1-runnable.c @@ -0,0 +1,257 @@ +/* { dg-do compile { target powerpc*-*-* } } */ +/* { dg-require-effective-target powerpc_altivec_ok } */ +/* { dg-options "-maltivec" } */ + +#include <altivec.h> + +#ifdef DEBUG +#include <stdio.h> +#endif + +/* Endian considerations: The "high" half of a vector with n elements is the + first n/2 elements of the vector. For little endian, these elements are in + the rightmost half of the vector. For big endian, these elements are in the + leftmost half of the vector. */ + + +void abort (void); + +int main () +{ + int i; + vector bool short vec_bs_arg; + vector bool short vec_bs_result, vec_bs_expected; + vector bool int vec_bi_arg; + vector bool int vec_bi_result, vec_bi_expected; + vector bool char vec_bc_arg; + vector bool char vec_bc_result, vec_bc_expected; + vector signed short vec_ss_arg; + vector signed short vec_ss_result, vec_ss_expected; + vector signed int vec_si_arg; + vector signed int vec_si_result, vec_si_expected; + vector signed char vec_sc_arg; + vector signed char vec_sc_result, vec_sc_expected; + vector float vec_float_arg; + vector double vec_double_result, vec_double_expected; + vector pixel vec_pixel_arg; + vector unsigned int vec_ui_result, vec_ui_expected; + + union conv { + double d; + unsigned long long l; + } conv_exp, conv_val; + + vec_bs_arg = (vector bool short){ 0, 101, 202, 303, + 404, 505, 606, 707 }; + vec_bi_expected = (vector bool int){ 0, 101, 202, 303 }; + + vec_bi_result = vec_unpackh (vec_bs_arg); + + for (i = 0; i < 4; i++) { + if (vec_bi_expected[i] != vec_bi_result[i]) +#if DEBUG + printf("ERROR: vec_unpackh(), vec_bi_expected[%d] = %d does not match vec_bi_result[%d] = %d\n", + i, vec_bi_expected[i], i, vec_bi_result[i]); +#else + abort(); +#endif + } + + vec_bi_expected = (vector bool int){ 404, 505, 606, 707 }; + vec_bi_result = vec_unpackl (vec_bs_arg); + + for (i = 0; i < 4; i++) { + if (vec_bi_expected[i] != vec_bi_result[i]) +#if DEBUG + printf("ERROR: vec_unpackl(), vec_bi_expected[%d] = %d does not match vec_bi_result[%d] = %d\n", + i, vec_bi_expected[i], i, vec_bi_result[i]); +#else + abort(); +#endif + } + + + vec_ss_arg = (vector signed short){ 0, 101, 202, 303, + 404, 505, 606, 707 }; + vec_si_expected = (vector signed int){ 0, 101, 202, 303 }; + + vec_si_result = vec_unpackh (vec_ss_arg); + + for (i = 0; i < 4; i++) { + if (vec_si_expected[i] != vec_si_result[i]) +#if DEBUG + printf("ERROR: vec_unpackh(), vec_si_expected[%d] = %d does not match vec_si_result[%d] = %d\n", + i, vec_si_expected[i], i, vec_si_result[i]); +#else + abort(); +#endif + } + + vec_si_expected = (vector signed int){ 404, 505, 606, 707 }; + + vec_si_result = vec_unpackl (vec_ss_arg); + + for (i = 0; i < 4; i++) { + if (vec_si_expected[i] != vec_si_result[i]) +#if DEBUG + printf("ERROR: vec_unpackl(), vec_si_expected[%d] = %d does not match vec_si_result[%d] = %d\n", + i, vec_si_expected[i], i, vec_si_result[i]); +#else + abort(); +#endif + } + + + vec_pixel_arg = (vector pixel){ 0x0, 0x65, 0xca, 0x12f, + 0x194, 0x1f9, 0x25e, 0x2c3 }; + vec_ui_expected = (vector unsigned int){ 0x0, 0x305, 0x60a, 0x90f }; + + vec_ui_result = vec_unpackh (vec_pixel_arg); + + for (i = 0; i < 4; i++) { + if (vec_ui_expected[i] != vec_ui_result[i]) +#if DEBUG + printf("ERROR: vec_unpackh(), vec_ui_expected[%d] = 0x%x does not match vec_ui_result[%d] = 0x%x\n", + i, vec_ui_expected[i], i, vec_ui_result[i]); +#else + abort(); +#endif + } + + vec_ui_expected = (vector unsigned int){ 0xc14, 0xf19, 0x121e, 0x1603 }; + + vec_ui_result = vec_unpackl (vec_pixel_arg); + + for (i = 0; i < 4; i++) { + if (vec_ui_expected[i] != vec_ui_result[i]) +#if DEBUG + printf("ERROR: vec_unpackl(), vec_ui_expected[%d] = 0x%x does not match vec_ui_result[%d] = 0x%x\n", + i, vec_ui_expected[i], i, vec_ui_result[i]); +#else + abort(); +#endif + } + + + vec_bc_arg = (vector bool char){ 0, 1, 0, 1, 0, 1, 0, 1, + 0, 0, 1, 1, 0, 0, 1, 1 }; + + vec_bs_expected = (vector bool short){ 0, 1, 0, 1, 0, 1, 0, 1 }; + + vec_bs_result = vec_unpackh (vec_bc_arg); + + for (i = 0; i < 8; i++) { + if (vec_bs_expected[i] != vec_bs_result[i]) +#if DEBUG + printf("ERROR: vec_unpackh(), vec_bs_expected[%d] = %d does not match vec_bs_result[%d] = %d\n", + i, vec_bs_expected[i], i, vec_bs_result[i]); +#else + abort(); +#endif + } + + vec_bs_expected = (vector bool short){ 0, 0, 1, 1, 0, 0, 1, 1 }; + + vec_bs_result = vec_unpackl (vec_bc_arg); + + for (i = 0; i < 8; i++) { + if (vec_bs_expected[i] != vec_bs_result[i]) +#if DEBUG + printf("ERROR: vec_unpackh(), vec_bs_expected[%d] = %d does not match vec_bs_result[%d] = %d\n", + i, vec_bs_expected[i], i, vec_bs_result[i]); +#else + abort(); +#endif + } + + vec_bs_expected = (vector bool short){ 0, 0, 1, 1, 0, 0, 1, 1 }; + + vec_bs_result = vec_unpackl (vec_bc_arg); + + for (i = 0; i < 8; i++) { + if (vec_bs_expected[i] != vec_bs_result[i]) +#if DEBUG + printf("ERROR: vec_unpackl(), vec_bs_expected[%d] = %d does not match vec_bs_result[%d] = %d\n", + i, vec_bs_expected[i], i, vec_bs_result[i]); +#else + abort(); +#endif + } + + + vec_sc_arg = (vector signed char){ 0, 1, 2, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15 }; + + vec_ss_expected = (vector signed short){ 0, 1, 2, 3, 4, 5, 6, 7 }; + + vec_ss_result = vec_unpackh (vec_sc_arg); + + for (i = 0; i < 8; i++) { + if (vec_ss_expected[i] != vec_ss_result[i]) +#if DEBUG + printf("ERROR: vec_unpackh(), vec_ss_expected[%d] = %d does not match vec_ss_result[%d] = %d\n", + i, vec_ss_expected[i], i, vec_ss_result[i]); +#else + abort(); +#endif + } + + vec_ss_expected = (vector signed short){ 8, 9, 10, 11, 12, 13, 14, 15 }; + + vec_ss_result = vec_unpackl (vec_sc_arg); + + for (i = 0; i < 8; i++) { + if (vec_ss_expected[i] != vec_ss_result[i]) +#if DEBUG + printf("ERROR: vec_unpackl(), vec_ss_expected[%d] = %d does not match vec_ss_result[%d] = %d\n", + i, vec_ss_expected[i], i, vec_ss_result[i]); +#else + abort(); +#endif + } + + + vec_float_arg = (vector float){ 0.0, 1.5, 2.5, 3.5 }; + + vec_double_expected = (vector double){ 0.0, 1.5 }; + + vec_double_result = vec_unpackh (vec_float_arg); + + for (i = 0; i < 2; i++) { + if (vec_double_expected[i] != vec_double_result[i]) + { +#if DEBUG + printf("ERROR: vec_unpackh(), vec_double_expected[%d] = %f does not match vec_double_result[%d] = %f\n", + i, vec_double_expected[i], i, vec_double_result[i]); + conv_val.d = vec_double_result[i]; + conv_exp.d = vec_double_expected[i]; + printf(" vec_unpackh(), vec_double_expected[%d] = 0x%llx does not match vec_double_result[%d] = 0x%llx\n", + i, conv_exp.l, i,conv_val.l); +#else + abort(); +#endif + } + } + + vec_double_expected = (vector double){ 2.5, 3.5 }; + + vec_double_result = vec_unpackl (vec_float_arg); + + for (i = 0; i < 2; i++) { + if (vec_double_expected[i] != vec_double_result[i]) + { +#if DEBUG + printf("ERROR: vec_unpackl() vec_double_expected[%d] = %f does not match vec_double_result[%d] = %f\n", + i, vec_double_expected[i], i, vec_double_result[i]); + conv_val.d = vec_double_result[i]; + conv_exp.d = vec_double_expected[i]; + printf(" vec_unpackh(), vec_double_expected[%d] = 0x%llx does not match vec_double_result[%d] = 0x%llx\n", + i, conv_exp.l, i,conv_val.l); +#else + abort(); +#endif + } + } + + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/altivec-2-runnable.c b/gcc/testsuite/gcc.target/powerpc/altivec-2-runnable.c new file mode 100644 index 000000000000..9d8aad402e66 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/altivec-2-runnable.c @@ -0,0 +1,94 @@ +/* { dg-do compile { target powerpc*-*-* } } */ +/* { dg-require-effective-target powerpc_p8vector_ok } */ +/* { dg-options "-mpower8-vector -mvsx" } */ + +#include <altivec.h> + +#ifdef DEBUG +#include <stdio.h> +#endif + +void abort (void); + +/* Endian considerations: The "high" half of a vector with n elements is the + first n/2 elements of the vector. For little endian, these elements are in + the rightmost half of the vector. For big endian, these elements are in the + leftmost half of the vector. */ + +int main () +{ + int i; + vector bool int vec_bi_arg; + vector bool long long vec_bll_result, vec_bll_expected; + + vector signed int vec_si_arg; + vector signed long long int vec_slli_result, vec_slli_expected; + + /* use of ‘long long’ in AltiVec types requires -mvsx */ + /* __builtin_altivec_vupkhsw and __builtin_altivec_vupklsw + requires the -mpower8-vector option */ + + vec_bi_arg = (vector bool int){ 0, 1, 1, 0 }; + + vec_bll_expected = (vector bool long long){ 0, 1 }; + + vec_bll_result = vec_unpackh (vec_bi_arg); + + for (i = 0; i < 2; i++) { + if (vec_bll_expected[i] != vec_bll_result[i]) +#if DEBUG + printf("ERROR: vec_unpackh, vec_bll_expected[%d] = %d does not match vec_bll_result[%d] = %d\n", + i, vec_bll_expected[i], i, vec_bll_result[i]); +#else + abort(); +#endif + } + + vec_bll_expected = (vector bool long long){ 1, 0 }; + + vec_bll_result = vec_unpackl (vec_bi_arg); + + for (i = 0; i < 2; i++) { + if (vec_bll_expected[i] != vec_bll_result[i]) +#if DEBUG + printf("ERROR: vec_unpackl, vec_bll_expected[%d] = %d does not match vec_bll_result[%d] = %d\n", + i, vec_bll_expected[i], i, vec_bll_result[i]); +#else + abort(); +#endif + } + + + vec_si_arg = (vector signed int){ 0, 101, 202, 303 }; + + vec_slli_expected = (vector signed long long int){ 0, 101 }; + + vec_slli_result = vec_unpackh (vec_si_arg); + + for (i = 0; i < 2; i++) { + if (vec_slli_expected[i] != vec_slli_result[i]) +#if DEBUG + printf("ERROR: vec_unpackh, vec_slli_expected[%d] = %d does not match vec_slli_result[%d] = %d\n", + i, vec_slli_expected[i], i, vec_slli_result[i]); +#else + abort(); +#endif + } + + vec_slli_result = vec_unpackl (vec_si_arg); + vec_slli_expected = (vector signed long long int){ 202, 303 }; + + for (i = 0; i < 2; i++) { + if (vec_slli_expected[i] != vec_slli_result[i]) +#if DEBUG + printf("ERROR: vec_unpackl, vec_slli_expected[%d] = %d does not match vec_slli_result[%d] = %d\n", + i, vec_slli_expected[i], i, vec_slli_result[i]); +#else + abort(); +#endif + } + + + + return 0; +} |