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

Nemanja Ivanovic via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 11 16:22:54 PST 2016


nemanjai 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
----------------
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 }
```


Repository:
  rL LLVM

https://reviews.llvm.org/D26546





More information about the cfe-commits mailing list