diff options
author | Will Schmidt <will_schmidt@vnet.ibm.com> | 2020-03-10 14:38:13 -0500 |
---|---|---|
committer | Will Schmidt <will_schmidt@vnet.ibm.com> | 2020-03-10 14:38:13 -0500 |
commit | e00cb200f39d8144de226e76c5d0257b613dbbf6 (patch) | |
tree | 2a49be01a6334ac308e7273f290073eb03ffe59f | |
parent | cf0c3a457319df1e8dc9321227162a7c57169a39 (diff) | |
download | gcc-e00cb200f39d8144de226e76c5d0257b613dbbf6.zip gcc-e00cb200f39d8144de226e76c5d0257b613dbbf6.tar.gz gcc-e00cb200f39d8144de226e76c5d0257b613dbbf6.tar.bz2 |
PR90763: PowerPC vec_xl_len should take const argument.
PR target/90763
* config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin): Add
clause to handle P9V_BUILTIN_VEC_LXVL with const arguments.
* gcc.target/powerpc/pr90763.c: New.
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000-c.c | 13 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/powerpc/pr90763.c | 88 |
4 files changed, 112 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c78d01a..c525661 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2020-03-10 Will Schmidt <will_schmidt@vnet.ibm.com> + + PR target/90763 + * config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin): Add + clause to handle P9V_BUILTIN_VEC_LXVL with const arguments. + 2020-03-10 Roman Zhuykov <zhroma@ispras.ru> * loop-iv.c (find_simple_exit): Make it static. diff --git a/gcc/config/rs6000/rs6000-c.c b/gcc/config/rs6000/rs6000-c.c index 37c74cf..8c1fbbf 100644 --- a/gcc/config/rs6000/rs6000-c.c +++ b/gcc/config/rs6000/rs6000-c.c @@ -1638,6 +1638,19 @@ altivec_resolve_overloaded_builtin (location_t loc, tree fndecl, arg = fold_convert (type, arg); } + /* For P9V_BUILTIN_VEC_LXVL, convert any const * to its non constant + equivalent to simplify the overload matching below. */ + if (fcode == P9V_BUILTIN_VEC_LXVL) + { + if (POINTER_TYPE_P (type) + && TYPE_READONLY (TREE_TYPE (type))) + { + type = build_pointer_type (build_qualified_type ( + TREE_TYPE (type),0)); + arg = fold_convert (type, arg); + } + } + args[n] = arg; types[n] = type; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1935ebc..da525a3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2020-03-10 Will Schmidt <will_schmidt@vnet.ibm.com> + + PR target/90763 + * gcc.target/powerpc/pr90763.c: New. + 2020-03-10 Uroš Bizjak <ubizjak@gmail.com> * g++.dg/pr80481.C (dg-final): Scan for SSE reg-reg moves only. diff --git a/gcc/testsuite/gcc.target/powerpc/pr90763.c b/gcc/testsuite/gcc.target/powerpc/pr90763.c new file mode 100644 index 0000000..55f1d46 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr90763.c @@ -0,0 +1,88 @@ +/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */ +/* { dg-require-effective-target powerpc_p9vector_ok } */ +/* { dg-options "-mcpu=power9 -O2" } */ + +/* PR90763: PowerPC vec_xl_len should take const. +*/ + +#include <altivec.h> + +vector unsigned char vec_load_uc(unsigned char *p, int num) { + return vec_xl_len(p, num); +} +vector unsigned char vec_load_const_uc(const unsigned char *p, int num) { + return vec_xl_len(p, num); +} +vector signed char vec_load_sc(signed char *p, int num) { + return vec_xl_len(p, num); +} +vector signed char vec_load_const_sc(const signed char *p, int num) { + return vec_xl_len(p, num); +} + +vector signed short vec_load_ss(signed short *p, int num) { + return vec_xl_len(p, num); +} +vector signed short vec_load_const_ss(const signed short *p, int num) { + return vec_xl_len(p, num); +} +vector unsigned short vec_load_us(unsigned short *p, int num) { + return vec_xl_len(p, num); +} +vector unsigned short vec_load_const_us(const unsigned short *p, int num) { + return vec_xl_len(p, num); +} + +vector signed int vec_load_si(signed int *p, int num) { + return vec_xl_len(p, num); +} +vector signed int vec_load_const_si(const signed int *p, int num) { + return vec_xl_len(p, num); +} +vector unsigned int vec_load_ui(unsigned int *p, int num) { + return vec_xl_len(p, num); +} +vector unsigned int vec_load_const_ui(const unsigned int *p, int num) { + return vec_xl_len(p, num); +} + +vector signed long long vec_load_sll(signed long long *p, int num) { + return vec_xl_len(p, num); +} +vector signed long long vec_load_const_sll(const signed long long *p, int num) { + return vec_xl_len(p, num); +} +vector unsigned long long vec_load_ull(unsigned long long *p, int num) { + return vec_xl_len(p, num); +} +vector unsigned long long vec_load_const_ull(const unsigned long long *p, int num) { + return vec_xl_len(p, num); +} + +vector signed __int128 vec_load_si128(signed __int128 *p, int num) { + return vec_xl_len(p, num); +} +vector signed __int128 vec_load_const_si128(const signed __int128 *p, int num) { + return vec_xl_len(p, num); +} +vector unsigned __int128 vec_load_ui128(unsigned __int128 *p, int num) { + return vec_xl_len(p, num); +} +vector unsigned __int128 vec_load_const_ui128(const unsigned __int128 *p, int num) { + return vec_xl_len(p, num); +} + +vector float vec_load_f(float *p, int num) { + return vec_xl_len(p, num); +} +vector float vec_load_const_f(const float *p, int num) { + return vec_xl_len(p, num); +} + +vector double vec_load_d(double *p, int num) { + return vec_xl_len(p, num); +} +vector double vec_load_const_d(const double *p, int num) { + return vec_xl_len(p, num); +} + |