[PATCH] D26546: [PPC] Add vec_insert4b/vec_extract4b to altivec.h

Kit Barton via cfe-commits cfe-commits at lists.llvm.org
Sat Nov 12 23:22:09 PST 2016


kbarton added inline comments.


================
Comment at: lib/Headers/altivec.h:12014
+#define vec_insert4b(__a, __b, __c) \
+  ((vector unsigned char)__builtin_vsx_xxinsertw((__a), (__b), (__c) & 0xF))
+#endif
----------------
nemanjai wrote:
> As far as I can tell by looking at this patch and the corresponding back end patch, the `__a` argument will have a word inserted into it and it will be returned.
> 
> Is that the semantics that the ABI specifies (I can't seem to make sense of the description).
> 
> ```
> vector unsigned int a = { 0xAAAAAAAA, 0xBBBBBB, 0xCCCCCC, 0xDDDDDD };
> vector unsigned char b = (vector unsigned char) 0xFF;
> vector unsigned char c = vec_insert4b(a, b, 4);
> // Do we expect vector c to be:
> // { 0xAA, 0xAA, 0xAA, 0xAA, 0xFF, 0xFF, 0xFF, 0xFF, 0xCC, 0xCC, 0xCC, 0xCC, 0xDD, 0xDD, 0xDD, 0xDD }
> ```
I think the current version of the ABI document has an error in it. The description of the vec_insert4b is identical to the vec_extract4b, so I expect it was copy/pasted in error. I think we need to open up an (internal) bug against the ABI and wait for clarification to complete this. 


Repository:
  rL LLVM

https://reviews.llvm.org/D26546





More information about the cfe-commits mailing list