[llvm-branch-commits] [cfe-branch] r214823 - Merging r214801:
Author: wschmidt Date: Mon Aug 4 18:48:10 2014 New Revision: 214823 URL: http://llvm.org/viewvc/llvm-project?rev=214823view=rev Log: Merging r214801: r214801 | wschmidt | 2014-08-04 18:21:26 -0500 (Mon, 04 Aug 2014) | 19 lines [PPC64LE] Fix wrong IR for vec_sld and vec_vsldoi My original LE implementation of the vsldoi instruction, with its altivec.h interfaces vec_sld and vec_vsldoi, produces incorrect shufflevector operations in the LLVM IR. Correct code is generated because the back end handles the incorrect shufflevector in a consistent manner. This patch and a companion patch for LLVM correct this problem by removing the fixup from altivec.h and the corresponding fixup from the PowerPC back end. Several test cases are also modified to reflect the now-correct LLVM IR. The vec_sums and vec_vsumsws interfaces in altivec.h are also fixed, because they used vec_perm calls intended to be recognized as vsldoi instructions. These vec_perm calls are now replaced with code that more clearly shows the intent of the transformation. Modified: cfe/branches/release_35/lib/Headers/altivec.h cfe/branches/release_35/test/CodeGen/builtins-ppc-altivec.c Modified: cfe/branches/release_35/lib/Headers/altivec.h URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_35/lib/Headers/altivec.h?rev=214823r1=214822r2=214823view=diff == --- cfe/branches/release_35/lib/Headers/altivec.h (original) +++ cfe/branches/release_35/lib/Headers/altivec.h Mon Aug 4 18:48:10 2014 @@ -5224,113 +5224,65 @@ vec_vslw(vector unsigned int __a, vector static vector signed char __ATTRS_o_ai vec_sld(vector signed char __a, vector signed char __b, unsigned char __c) { -#ifdef __LITTLE_ENDIAN__ - return vec_perm(__a, __b, (vector unsigned char) -(__c, __c-1, __c-2, __c-3, __c-4, __c-5, __c-6, __c-7, - __c-8, __c-9, __c-10, __c-11, __c-12, __c-13, __c-14, __c-15)); -#else return vec_perm(__a, __b, (vector unsigned char) (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7, __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15)); -#endif } static vector unsigned char __ATTRS_o_ai vec_sld(vector unsigned char __a, vector unsigned char __b, unsigned char __c) { -#ifdef __LITTLE_ENDIAN__ - return vec_perm(__a, __b, (vector unsigned char) -(__c, __c-1, __c-2, __c-3, __c-4, __c-5, __c-6, __c-7, - __c-8, __c-9, __c-10, __c-11, __c-12, __c-13, __c-14, __c-15)); -#else return vec_perm(__a, __b, (vector unsigned char) (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7, __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15)); -#endif } static vector short __ATTRS_o_ai vec_sld(vector short __a, vector short __b, unsigned char __c) { -#ifdef __LITTLE_ENDIAN__ - return vec_perm(__a, __b, (vector unsigned char) -(__c, __c-1, __c-2, __c-3, __c-4, __c-5, __c-6, __c-7, - __c-8, __c-9, __c-10, __c-11, __c-12, __c-13, __c-14, __c-15)); -#else return vec_perm(__a, __b, (vector unsigned char) (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7, __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15)); -#endif } static vector unsigned short __ATTRS_o_ai vec_sld(vector unsigned short __a, vector unsigned short __b, unsigned char __c) { -#ifdef __LITTLE_ENDIAN__ - return vec_perm(__a, __b, (vector unsigned char) -(__c, __c-1, __c-2, __c-3, __c-4, __c-5, __c-6, __c-7, - __c-8, __c-9, __c-10, __c-11, __c-12, __c-13, __c-14, __c-15)); -#else return vec_perm(__a, __b, (vector unsigned char) (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7, __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15)); -#endif } static vector pixel __ATTRS_o_ai vec_sld(vector pixel __a, vector pixel __b, unsigned char __c) { -#ifdef __LITTLE_ENDIAN__ - return vec_perm(__a, __b, (vector unsigned char) -(__c, __c-1, __c-2, __c-3, __c-4, __c-5, __c-6, __c-7, - __c-8, __c-9, __c-10, __c-11, __c-12, __c-13, __c-14, __c-15)); -#else return vec_perm(__a, __b, (vector unsigned char) (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7, __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15)); -#endif } static vector int __ATTRS_o_ai vec_sld(vector int __a, vector int __b, unsigned char __c) { -#ifdef __LITTLE_ENDIAN__ - return vec_perm(__a, __b, (vector unsigned char) -(__c, __c-1, __c-2, __c-3, __c-4, __c-5, __c-6, __c-7, - __c-8, __c-9, __c-10, __c-11, __c-12, __c-13, __c-14, __c-15)); -#else return vec_perm(__a, __b, (vector unsigned char) (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7, __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15)); -#endif } static vector unsigned int
Re: [llvm-branch-commits] [cfe-branch] r214823 - Merging r214801:
Okay. Thanks for this. I didn’t realize that these were old emails. Sorry for freaking out. -bw On Aug 26, 2014, at 4:36 PM, Bill Schmidt wschm...@linux.vnet.ibm.com wrote: Hi Bill, I forgot to CC you when I just responded on-list, but it might sit in a moderator queue like all these others did, so here is what I wrote: Hi Bill, These were committed back on August 4th. I followed your instructions to use the merge tool, but I didn't have write-authority to the branch-commits list so all the notifications sat in a queue waiting for verification from a moderator. I have to assume that this finally happened... So anyway, nothing untoward here. These changes were from several weeks ago. Thanks, Bill On Tue, 2014-08-26 at 15:31 -0700, Bill Wendling wrote: Um…What the hell is this? It’s far too late to be applying things to the branch, especially without my approval -bw On Aug 4, 2014, at 4:48 PM, Bill Schmidt wschm...@linux.vnet.ibm.com wrote: Author: wschmidt Date: Mon Aug 4 18:48:10 2014 New Revision: 214823 URL: http://llvm.org/viewvc/llvm-project?rev=214823view=rev Log: Merging r214801: r214801 | wschmidt | 2014-08-04 18:21:26 -0500 (Mon, 04 Aug 2014) | 19 lines [PPC64LE] Fix wrong IR for vec_sld and vec_vsldoi My original LE implementation of the vsldoi instruction, with its altivec.h interfaces vec_sld and vec_vsldoi, produces incorrect shufflevector operations in the LLVM IR. Correct code is generated because the back end handles the incorrect shufflevector in a consistent manner. This patch and a companion patch for LLVM correct this problem by removing the fixup from altivec.h and the corresponding fixup from the PowerPC back end. Several test cases are also modified to reflect the now-correct LLVM IR. The vec_sums and vec_vsumsws interfaces in altivec.h are also fixed, because they used vec_perm calls intended to be recognized as vsldoi instructions. These vec_perm calls are now replaced with code that more clearly shows the intent of the transformation. Modified: cfe/branches/release_35/lib/Headers/altivec.h cfe/branches/release_35/test/CodeGen/builtins-ppc-altivec.c Modified: cfe/branches/release_35/lib/Headers/altivec.h URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_35/lib/Headers/altivec.h?rev=214823r1=214822r2=214823view=diff == --- cfe/branches/release_35/lib/Headers/altivec.h (original) +++ cfe/branches/release_35/lib/Headers/altivec.h Mon Aug 4 18:48:10 2014 @@ -5224,113 +5224,65 @@ vec_vslw(vector unsigned int __a, vector static vector signed char __ATTRS_o_ai vec_sld(vector signed char __a, vector signed char __b, unsigned char __c) { -#ifdef __LITTLE_ENDIAN__ - return vec_perm(__a, __b, (vector unsigned char) -(__c, __c-1, __c-2, __c-3, __c-4, __c-5, __c-6, __c-7, - __c-8, __c-9, __c-10, __c-11, __c-12, __c-13, __c-14, __c-15)); -#else return vec_perm(__a, __b, (vector unsigned char) (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7, __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15)); -#endif } static vector unsigned char __ATTRS_o_ai vec_sld(vector unsigned char __a, vector unsigned char __b, unsigned char __c) { -#ifdef __LITTLE_ENDIAN__ - return vec_perm(__a, __b, (vector unsigned char) -(__c, __c-1, __c-2, __c-3, __c-4, __c-5, __c-6, __c-7, - __c-8, __c-9, __c-10, __c-11, __c-12, __c-13, __c-14, __c-15)); -#else return vec_perm(__a, __b, (vector unsigned char) (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7, __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15)); -#endif } static vector short __ATTRS_o_ai vec_sld(vector short __a, vector short __b, unsigned char __c) { -#ifdef __LITTLE_ENDIAN__ - return vec_perm(__a, __b, (vector unsigned char) -(__c, __c-1, __c-2, __c-3, __c-4, __c-5, __c-6, __c-7, - __c-8, __c-9, __c-10, __c-11, __c-12, __c-13, __c-14, __c-15)); -#else return vec_perm(__a, __b, (vector unsigned char) (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7, __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15)); -#endif } static vector unsigned short __ATTRS_o_ai vec_sld(vector unsigned short __a, vector unsigned short __b, unsigned char __c) { -#ifdef __LITTLE_ENDIAN__ - return vec_perm(__a, __b, (vector unsigned char) -(__c, __c-1, __c-2, __c-3, __c-4, __c-5, __c-6, __c-7, - __c-8, __c-9, __c-10, __c-11, __c-12, __c-13, __c-14, __c-15)); -#else return vec_perm(__a, __b, (vector unsigned char) (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7, __c+8, __c+9, __c+10, __c+11,