amyk created this revision. amyk added reviewers: PowerPC, nemanjai, stefanp. amyk added projects: LLVM, PowerPC, clang. amyk requested review of this revision.
This patch updates the vec_extract builtins to take a signed int as the second parameter, as defined by the Power Vector Intrinsics Programming Reference. This patch is NFC and all existing tests pass. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D110935 Files: clang/lib/Headers/altivec.h Index: clang/lib/Headers/altivec.h =================================================================== --- clang/lib/Headers/altivec.h +++ clang/lib/Headers/altivec.h @@ -13444,74 +13444,74 @@ /* vec_extract */ static __inline__ signed char __ATTRS_o_ai vec_extract(vector signed char __a, - unsigned int __b) { + signed int __b) { return __a[__b & 0xf]; } static __inline__ unsigned char __ATTRS_o_ai -vec_extract(vector unsigned char __a, unsigned int __b) { +vec_extract(vector unsigned char __a, signed int __b) { return __a[__b & 0xf]; } static __inline__ unsigned char __ATTRS_o_ai vec_extract(vector bool char __a, - unsigned int __b) { + signed int __b) { return __a[__b & 0xf]; } static __inline__ signed short __ATTRS_o_ai vec_extract(vector signed short __a, - unsigned int __b) { + signed int __b) { return __a[__b & 0x7]; } static __inline__ unsigned short __ATTRS_o_ai -vec_extract(vector unsigned short __a, unsigned int __b) { +vec_extract(vector unsigned short __a, signed int __b) { return __a[__b & 0x7]; } static __inline__ unsigned short __ATTRS_o_ai vec_extract(vector bool short __a, - unsigned int __b) { + signed int __b) { return __a[__b & 0x7]; } static __inline__ signed int __ATTRS_o_ai vec_extract(vector signed int __a, - unsigned int __b) { + signed int __b) { return __a[__b & 0x3]; } static __inline__ unsigned int __ATTRS_o_ai vec_extract(vector unsigned int __a, - unsigned int __b) { + signed int __b) { return __a[__b & 0x3]; } static __inline__ unsigned int __ATTRS_o_ai vec_extract(vector bool int __a, - unsigned int __b) { + signed int __b) { return __a[__b & 0x3]; } #ifdef __VSX__ static __inline__ signed long long __ATTRS_o_ai -vec_extract(vector signed long long __a, unsigned int __b) { +vec_extract(vector signed long long __a, signed int __b) { return __a[__b & 0x1]; } static __inline__ unsigned long long __ATTRS_o_ai -vec_extract(vector unsigned long long __a, unsigned int __b) { +vec_extract(vector unsigned long long __a, signed int __b) { return __a[__b & 0x1]; } static __inline__ unsigned long long __ATTRS_o_ai -vec_extract(vector bool long long __a, unsigned int __b) { +vec_extract(vector bool long long __a, signed int __b) { return __a[__b & 0x1]; } static __inline__ double __ATTRS_o_ai vec_extract(vector double __a, - unsigned int __b) { + signed int __b) { return __a[__b & 0x1]; } #endif static __inline__ float __ATTRS_o_ai vec_extract(vector float __a, - unsigned int __b) { + signed int __b) { return __a[__b & 0x3]; }
Index: clang/lib/Headers/altivec.h =================================================================== --- clang/lib/Headers/altivec.h +++ clang/lib/Headers/altivec.h @@ -13444,74 +13444,74 @@ /* vec_extract */ static __inline__ signed char __ATTRS_o_ai vec_extract(vector signed char __a, - unsigned int __b) { + signed int __b) { return __a[__b & 0xf]; } static __inline__ unsigned char __ATTRS_o_ai -vec_extract(vector unsigned char __a, unsigned int __b) { +vec_extract(vector unsigned char __a, signed int __b) { return __a[__b & 0xf]; } static __inline__ unsigned char __ATTRS_o_ai vec_extract(vector bool char __a, - unsigned int __b) { + signed int __b) { return __a[__b & 0xf]; } static __inline__ signed short __ATTRS_o_ai vec_extract(vector signed short __a, - unsigned int __b) { + signed int __b) { return __a[__b & 0x7]; } static __inline__ unsigned short __ATTRS_o_ai -vec_extract(vector unsigned short __a, unsigned int __b) { +vec_extract(vector unsigned short __a, signed int __b) { return __a[__b & 0x7]; } static __inline__ unsigned short __ATTRS_o_ai vec_extract(vector bool short __a, - unsigned int __b) { + signed int __b) { return __a[__b & 0x7]; } static __inline__ signed int __ATTRS_o_ai vec_extract(vector signed int __a, - unsigned int __b) { + signed int __b) { return __a[__b & 0x3]; } static __inline__ unsigned int __ATTRS_o_ai vec_extract(vector unsigned int __a, - unsigned int __b) { + signed int __b) { return __a[__b & 0x3]; } static __inline__ unsigned int __ATTRS_o_ai vec_extract(vector bool int __a, - unsigned int __b) { + signed int __b) { return __a[__b & 0x3]; } #ifdef __VSX__ static __inline__ signed long long __ATTRS_o_ai -vec_extract(vector signed long long __a, unsigned int __b) { +vec_extract(vector signed long long __a, signed int __b) { return __a[__b & 0x1]; } static __inline__ unsigned long long __ATTRS_o_ai -vec_extract(vector unsigned long long __a, unsigned int __b) { +vec_extract(vector unsigned long long __a, signed int __b) { return __a[__b & 0x1]; } static __inline__ unsigned long long __ATTRS_o_ai -vec_extract(vector bool long long __a, unsigned int __b) { +vec_extract(vector bool long long __a, signed int __b) { return __a[__b & 0x1]; } static __inline__ double __ATTRS_o_ai vec_extract(vector double __a, - unsigned int __b) { + signed int __b) { return __a[__b & 0x1]; } #endif static __inline__ float __ATTRS_o_ai vec_extract(vector float __a, - unsigned int __b) { + signed int __b) { return __a[__b & 0x3]; }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits