[PATCH] D33053: [PowerPC] Implement vec_xxpermdi builtin.

Tony Jiang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 16 13:20:54 PDT 2017


jtony marked 6 inline comments as done.
jtony added inline comments.


================
Comment at: lib/CodeGen/CGBuiltin.cpp:8433
+    if (getTarget().isLittleEndian()) {
+      switch (Index) {
+      case 0:
----------------
nemanjai wrote:
> The switch is overkill. You should just implement this in an obvious way (i.e. the same way as described in the ISA).
> For big endian:
> `ElemIdx0 = (Index & 2;) >> 1`
> `ElemIdx1 = 2 + (Index & 1)`
> 
> For little endian:
> `ElemIdx0 = (~Index & 1) + 2;`
> `ElemIdx1 = ~Index & 2 >> 1;`
> 
> (of course, please verify the expressions).
Good call, fixed as suggested.


https://reviews.llvm.org/D33053





More information about the llvm-commits mailing list