summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2019-09-13 05:19:12 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2019-09-13 05:19:12 +0000
commitaeb279dd88d72589c4e46662613b9ee0f1a3f8ef (patch)
treeb8f852d3442a1c4f541a35498ec2ea9023d44143 /clang
parent4aaa77e48dd1bd8337d5a4fe9795f13c54f3a9cb (diff)
downloadbcm5719-llvm-aeb279dd88d72589c4e46662613b9ee0f1a3f8ef.tar.gz
bcm5719-llvm-aeb279dd88d72589c4e46662613b9ee0f1a3f8ef.zip
Remove reliance on lax vector conversions from altivec.h and its test.
llvm-svn: 371814
Diffstat (limited to 'clang')
-rw-r--r--clang/include/clang/Basic/BuiltinsPPC.def4
-rw-r--r--clang/lib/Headers/altivec.h40
-rw-r--r--clang/test/CodeGen/builtins-ppc-altivec.c26
3 files changed, 38 insertions, 32 deletions
diff --git a/clang/include/clang/Basic/BuiltinsPPC.def b/clang/include/clang/Basic/BuiltinsPPC.def
index 41427cc69c5..314e1cc0590 100644
--- a/clang/include/clang/Basic/BuiltinsPPC.def
+++ b/clang/include/clang/Basic/BuiltinsPPC.def
@@ -50,8 +50,8 @@ BUILTIN(__builtin_altivec_vavguw, "V4UiV4UiV4Ui", "")
BUILTIN(__builtin_altivec_vrfip, "V4fV4f", "")
-BUILTIN(__builtin_altivec_vcfsx, "V4fV4iIi", "")
-BUILTIN(__builtin_altivec_vcfux, "V4fV4iIi", "")
+BUILTIN(__builtin_altivec_vcfsx, "V4fV4SiIi", "")
+BUILTIN(__builtin_altivec_vcfux, "V4fV4UiIi", "")
BUILTIN(__builtin_altivec_vctsxs, "V4SiV4fIi", "")
BUILTIN(__builtin_altivec_vctuxs, "V4UiV4fIi", "")
diff --git a/clang/lib/Headers/altivec.h b/clang/lib/Headers/altivec.h
index a7f480e45d8..bc26f1089d0 100644
--- a/clang/lib/Headers/altivec.h
+++ b/clang/lib/Headers/altivec.h
@@ -2876,9 +2876,10 @@ static __inline__ vector double __ATTRS_o_ai vec_cpsgn(vector double __a,
#ifdef __VSX__
#define vec_ctf(__a, __b) \
_Generic((__a), vector int \
- : (vector float)__builtin_altivec_vcfsx((__a), (__b)), \
+ : (vector float)__builtin_altivec_vcfsx((vector int)(__a), (__b)), \
vector unsigned int \
- : (vector float)__builtin_altivec_vcfux((vector int)(__a), (__b)), \
+ : (vector float)__builtin_altivec_vcfux((vector unsigned int)(__a), \
+ (__b)), \
vector unsigned long long \
: (__builtin_convertvector((vector unsigned long long)(__a), \
vector double) * \
@@ -2892,9 +2893,10 @@ static __inline__ vector double __ATTRS_o_ai vec_cpsgn(vector double __a,
#else
#define vec_ctf(__a, __b) \
_Generic((__a), vector int \
- : (vector float)__builtin_altivec_vcfsx((__a), (__b)), \
+ : (vector float)__builtin_altivec_vcfsx((vector int)(__a), (__b)), \
vector unsigned int \
- : (vector float)__builtin_altivec_vcfux((vector int)(__a), (__b)))
+ : (vector float)__builtin_altivec_vcfux((vector unsigned int)(__a), \
+ (__b)))
#endif
/* vec_vcfsx */
@@ -16423,27 +16425,27 @@ vec_xl(signed long long __offset, unsigned __int128 *__ptr) {
#ifdef __LITTLE_ENDIAN__
static __inline__ vector signed char __ATTRS_o_ai
vec_xl_be(signed long long __offset, signed char *__ptr) {
- vector signed char __vec = __builtin_vsx_lxvd2x_be(__offset, __ptr);
+ vector signed char __vec = (vector signed char)__builtin_vsx_lxvd2x_be(__offset, __ptr);
return __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14,
13, 12, 11, 10, 9, 8);
}
static __inline__ vector unsigned char __ATTRS_o_ai
vec_xl_be(signed long long __offset, unsigned char *__ptr) {
- vector unsigned char __vec = __builtin_vsx_lxvd2x_be(__offset, __ptr);
+ vector unsigned char __vec = (vector unsigned char)__builtin_vsx_lxvd2x_be(__offset, __ptr);
return __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14,
13, 12, 11, 10, 9, 8);
}
static __inline__ vector signed short __ATTRS_o_ai
vec_xl_be(signed long long __offset, signed short *__ptr) {
- vector signed short __vec = __builtin_vsx_lxvd2x_be(__offset, __ptr);
+ vector signed short __vec = (vector signed short)__builtin_vsx_lxvd2x_be(__offset, __ptr);
return __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4);
}
static __inline__ vector unsigned short __ATTRS_o_ai
vec_xl_be(signed long long __offset, unsigned short *__ptr) {
- vector unsigned short __vec = __builtin_vsx_lxvd2x_be(__offset, __ptr);
+ vector unsigned short __vec = (vector unsigned short)__builtin_vsx_lxvd2x_be(__offset, __ptr);
return __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4);
}
@@ -16581,7 +16583,8 @@ static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed char __vec,
vector signed char __tmp =
__builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14,
13, 12, 11, 10, 9, 8);
- __builtin_vsx_stxvd2x_be(__tmp, __offset, __ptr);
+ typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double;
+ __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr);
}
static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned char __vec,
@@ -16590,7 +16593,8 @@ static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned char __vec,
vector unsigned char __tmp =
__builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14,
13, 12, 11, 10, 9, 8);
- __builtin_vsx_stxvd2x_be(__tmp, __offset, __ptr);
+ typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double;
+ __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr);
}
static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed short __vec,
@@ -16598,7 +16602,8 @@ static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed short __vec,
signed short *__ptr) {
vector signed short __tmp =
__builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4);
- __builtin_vsx_stxvd2x_be(__tmp, __offset, __ptr);
+ typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double;
+ __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr);
}
static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned short __vec,
@@ -16606,7 +16611,8 @@ static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned short __vec,
unsigned short *__ptr) {
vector unsigned short __tmp =
__builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4);
- __builtin_vsx_stxvd2x_be(__tmp, __offset, __ptr);
+ typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double;
+ __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr);
}
static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed int __vec,
@@ -16618,32 +16624,32 @@ static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed int __vec,
static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned int __vec,
signed long long __offset,
unsigned int *__ptr) {
- __builtin_vsx_stxvw4x_be(__vec, __offset, __ptr);
+ __builtin_vsx_stxvw4x_be((vector int)__vec, __offset, __ptr);
}
static __inline__ void __ATTRS_o_ai vec_xst_be(vector float __vec,
signed long long __offset,
float *__ptr) {
- __builtin_vsx_stxvw4x_be(__vec, __offset, __ptr);
+ __builtin_vsx_stxvw4x_be((vector int)__vec, __offset, __ptr);
}
#ifdef __VSX__
static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed long long __vec,
signed long long __offset,
signed long long *__ptr) {
- __builtin_vsx_stxvd2x_be(__vec, __offset, __ptr);
+ __builtin_vsx_stxvd2x_be((vector double)__vec, __offset, __ptr);
}
static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned long long __vec,
signed long long __offset,
unsigned long long *__ptr) {
- __builtin_vsx_stxvd2x_be(__vec, __offset, __ptr);
+ __builtin_vsx_stxvd2x_be((vector double)__vec, __offset, __ptr);
}
static __inline__ void __ATTRS_o_ai vec_xst_be(vector double __vec,
signed long long __offset,
double *__ptr) {
- __builtin_vsx_stxvd2x_be(__vec, __offset, __ptr);
+ __builtin_vsx_stxvd2x_be((vector double)__vec, __offset, __ptr);
}
#endif
diff --git a/clang/test/CodeGen/builtins-ppc-altivec.c b/clang/test/CodeGen/builtins-ppc-altivec.c
index e7ba7167cf9..d53011b37d4 100644
--- a/clang/test/CodeGen/builtins-ppc-altivec.c
+++ b/clang/test/CodeGen/builtins-ppc-altivec.c
@@ -1,10 +1,10 @@
// REQUIRES: powerpc-registered-target
// RUN: %clang_cc1 -target-feature +altivec -triple powerpc-unknown-unknown -emit-llvm %s \
-// RUN: -o - | FileCheck %s
+// RUN: -flax-vector-conversions=none -o - | FileCheck %s
// RUN: %clang_cc1 -target-feature +altivec -triple powerpc64-unknown-unknown -emit-llvm %s \
-// RUN: -o - | FileCheck %s
+// RUN: -flax-vector-conversions=none -o - | FileCheck %s
// RUN: %clang_cc1 -target-feature +altivec -triple powerpc64le-unknown-unknown -emit-llvm %s \
-// RUN: -o - | FileCheck %s -check-prefix=CHECK-LE
+// RUN: -flax-vector-conversions=none -o - | FileCheck %s -check-prefix=CHECK-LE
// RUN: not %clang_cc1 -triple powerpc64le-unknown-unknown -emit-llvm %s \
// RUN: -ferror-limit 0 -DNO_ALTIVEC -o - 2>&1 \
// RUN: | FileCheck %s -check-prefix=CHECK-NOALTIVEC
@@ -2419,7 +2419,7 @@ void test6() {
// CHECK-LE: or <16 x i8>
// CHECK-LE: xor <16 x i8>
- res_vuc = vec_nor(vbc, vbc);
+ res_vbc = vec_nor(vbc, vbc);
// CHECK: or <16 x i8>
// CHECK: xor <16 x i8>
// CHECK-LE: or <16 x i8>
@@ -2437,7 +2437,7 @@ void test6() {
// CHECK-LE: or <8 x i16>
// CHECK-LE: xor <8 x i16>
- res_vus = vec_nor(vbs, vbs);
+ res_vbs = vec_nor(vbs, vbs);
// CHECK: or <8 x i16>
// CHECK: xor <8 x i16>
// CHECK-LE: or <8 x i16>
@@ -2455,7 +2455,7 @@ void test6() {
// CHECK-LE: or <4 x i32>
// CHECK-LE: xor <4 x i32>
- res_vui = vec_nor(vbi, vbi);
+ res_vbi = vec_nor(vbi, vbi);
// CHECK: or <4 x i32>
// CHECK: xor <4 x i32>
// CHECK-LE: or <4 x i32>
@@ -2479,7 +2479,7 @@ void test6() {
// CHECK-LE: or <16 x i8>
// CHECK-LE: xor <16 x i8>
- res_vuc = vec_vnor(vbc, vbc);
+ res_vbc = vec_vnor(vbc, vbc);
// CHECK: or <16 x i8>
// CHECK: xor <16 x i8>
// CHECK-LE: or <16 x i8>
@@ -2497,7 +2497,7 @@ void test6() {
// CHECK-LE: or <8 x i16>
// CHECK-LE: xor <8 x i16>
- res_vus = vec_vnor(vbs, vbs);
+ res_vbs = vec_vnor(vbs, vbs);
// CHECK: or <8 x i16>
// CHECK: xor <8 x i16>
// CHECK-LE: or <8 x i16>
@@ -2515,7 +2515,7 @@ void test6() {
// CHECK-LE: or <4 x i32>
// CHECK-LE: xor <4 x i32>
- res_vui = vec_vnor(vbi, vbi);
+ res_vbi = vec_vnor(vbi, vbi);
// CHECK: or <4 x i32>
// CHECK: xor <4 x i32>
// CHECK-LE: or <4 x i32>
@@ -5385,11 +5385,11 @@ void test6() {
// CHECK: sub <8 x i16>
// CHECK-LE: sub <8 x i16>
- res_vs = vec_vsubuhm(vbs, vus);
+ res_vs = vec_vsubuhm(vbs, vs);
// CHECK: sub <8 x i16>
// CHECK-LE: sub <8 x i16>
- res_vs = vec_vsubuhm(vus, vbs);
+ res_vs = vec_vsubuhm(vs, vbs);
// CHECK: sub <8 x i16>
// CHECK-LE: sub <8 x i16>
@@ -9251,11 +9251,11 @@ void test8() {
// CHECK: shufflevector <8 x i16> %{{[0-9]+}}, <8 x i16> %{{[0-9]+}}, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
// CHECK-LE: shufflevector <8 x i16> %{{[0-9]+}}, <8 x i16> %{{[0-9]+}}, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
- res_vbs = vec_reve(vs);
+ res_vs = vec_reve(vs);
// CHECK: shufflevector <8 x i16> %{{[0-9]+}}, <8 x i16> %{{[0-9]+}}, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
// CHECK-LE: shufflevector <8 x i16> %{{[0-9]+}}, <8 x i16> %{{[0-9]+}}, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
- res_vbs = vec_reve(vus);
+ res_vus = vec_reve(vus);
// CHECK: shufflevector <8 x i16> %{{[0-9]+}}, <8 x i16> %{{[0-9]+}}, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
// CHECK-LE: shufflevector <8 x i16> %{{[0-9]+}}, <8 x i16> %{{[0-9]+}}, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
OpenPOWER on IntegriCloud