return (vector double)__builtin_vsx_lxvl(__a, (__b << 56));
}
-static __inline__ vector double __ATTRS_o_ai vec_xl_len_r(unsigned char *__a,
- size_t __b) {
+static __inline__ vector unsigned char __ATTRS_o_ai
+vec_xl_len_r(unsigned char *__a, size_t __b) {
vector unsigned char __res =
(vector unsigned char)__builtin_vsx_lxvll(__a, (__b << 56));
#ifdef __LITTLE_ENDIAN__
#ifdef __VSX__
#define vec_cts(__a, __b) \
_Generic((__a), vector float \
- : __builtin_altivec_vctsxs((__a), (__b)), vector double \
+ : __builtin_altivec_vctsxs((vector float)(__a), (__b)), \
+ vector double \
: __extension__({ \
vector double __ret = \
- (__a) * \
+ (vector double)(__a) * \
(vector double)(vector unsigned long long)((0x3ffULL + (__b)) \
<< 52); \
__builtin_convertvector(__ret, vector signed long long); \
#ifdef __VSX__
#define vec_ctu(__a, __b) \
_Generic((__a), vector float \
- : __builtin_altivec_vctuxs((__a), (__b)), vector double \
+ : __builtin_altivec_vctuxs((vector float)(__a), (__b)), \
+ vector double \
: __extension__({ \
vector double __ret = \
- (__a) * \
+ (vector double)(__a) * \
(vector double)(vector unsigned long long)((0x3ffULL + __b) \
<< 52); \
__builtin_convertvector(__ret, vector unsigned long long); \
#ifdef __VSX__
static __inline__ vector double __ATTRS_o_ai vec_or(vector bool long long __a,
vector double __b) {
- return (vector unsigned long long)__a | (vector unsigned long long)__b;
+ return (vector double)((vector unsigned long long)__a |
+ (vector unsigned long long)__b);
}
static __inline__ vector double __ATTRS_o_ai vec_or(vector double __a,
vector bool long long __b) {
- return (vector unsigned long long)__a | (vector unsigned long long)__b;
+ return (vector double)((vector unsigned long long)__a |
+ (vector unsigned long long)__b);
}
static __inline__ vector double __ATTRS_o_ai vec_or(vector double __a,
vector double __b) {
- vector unsigned long long __res =
- (vector unsigned long long)__a | (vector unsigned long long)__b;
- return (vector double)__res;
+ return (vector double)((vector unsigned long long)__a |
+ (vector unsigned long long)__b);
}
static __inline__ vector signed long long __ATTRS_o_ai
static __inline__ int __ATTRS_o_ai vec_all_ne(vector float __a,
vector float __b) {
#ifdef __VSX__
- return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __b);
+ return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, (vector double)__a, (vector double)__b);
#else
return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __b);
#endif
#endif
#ifdef __POWER9_VECTOR__
-#define vec_test_data_class(__a, __b) \
- _Generic((__a), \
- vector float: \
- (vector bool int)__builtin_vsx_xvtstdcsp((__a), (__b)), \
- vector double: \
- (vector bool long long)__builtin_vsx_xvtstdcdp((__a), (__b)) \
- )
+#define vec_test_data_class(__a, __b) \
+ _Generic( \
+ (__a), vector float \
+ : (vector bool int)__builtin_vsx_xvtstdcsp((vector float)(__a), (__b)), \
+ vector double \
+ : (vector bool long long)__builtin_vsx_xvtstdcdp((vector double)(__a), \
+ (__b)))
#endif /* #ifdef __POWER9_VECTOR__ */
// RUN: %clang_cc1 -target-feature +altivec -target-feature +power9-vector \
// RUN: -triple powerpc64-unknown-unknown -fsyntax-only \
+// RUN: -flax-vector-conversions=integer \
// RUN: -Wall -Werror -verify %s
// RUN: %clang_cc1 -target-feature +altivec -target-feature +power9-vector \
// RUN: -triple powerpc64le-unknown-unknown -fsyntax-only \
+// RUN: -flax-vector-conversions=integer \
+// RUN: -Wall -Werror -verify %s
+
+// FIXME: Fix <altivec.h> so this test also passes under
+// -flax-vector-conversions=none (this last test exists to produce an error if
+// we change the default to that without fixing <altivec.h>).
+// RUN: %clang_cc1 -target-feature +altivec -target-feature +power9-vector \
+// RUN: -triple powerpc64-unknown-unknown -fsyntax-only \
// RUN: -Wall -Werror -verify %s
#include <altivec.h>
// REQUIRES: powerpc-registered-target
// RUN: %clang_cc1 -target-feature +altivec -target-feature +power9-vector \
// RUN: -triple powerpc64-unknown-unknown -emit-llvm %s \
+// RUN: -flax-vector-conversions=integer \
// RUN: -o - | FileCheck %s -check-prefix=CHECK-BE
// RUN: %clang_cc1 -target-feature +altivec -target-feature +power9-vector \
// RUN: -triple powerpc64le-unknown-unknown -emit-llvm %s \
+// RUN: -flax-vector-conversions=integer \
// RUN: -o - | FileCheck %s
+// FIXME: This last test is intended to fail if the default is changed to
+// -flax-vector-conversions=none and <altivec.h> isn't fixed first.
+// RUN: %clang_cc1 -target-feature +altivec -target-feature +power9-vector \
+// RUN: -triple powerpc64-unknown-unknown -emit-llvm %s \
+// RUN: -o - | FileCheck %s -check-prefix=CHECK-BE
+
#include <altivec.h>
vector signed char vsca, vscb;
// CHECK: insertelement <2 x double>
return vec_unpackl(vfa);
}
-vector double test81(void) {
+vector float test81(void) {
// CHECK: extractelement <2 x double>
// CHECK: fptrunc double
// CHECK: insertelement <4 x float>