[llvm-dev] What's the most efficient way to load a vector of pointers?

Levo DeLellis via llvm-dev llvm-dev at lists.llvm.org
Tue Apr 7 18:45:37 PDT 2020


Hello everyone. I'll tell you my goal then my question. In pseudo code I'd
like to do the following

values = lookup_table[offsets]

offsets is `<8 x i8>` which I get by doing `and <8 x i8> %a, %b`
lookup_table is simply a 16 byte constant array of i8 aligned to 16.
values would be `<8 x i8>` which I'll use with another vector operation

I was thinking I might need an array of pointers but I looked at
getelementptr for a solution. It appears it can use it
https://llvm.org/docs/LangRef.html#vector-of-pointers
Specifically the following line

%A = getelementptr i8, i8* %ptr, <4 x i64> %offsets

However it doesn't show how I should load %A but mentions gather (I don't
need a mask or pass through values). I looked at 'load' and it doesn't
appear to support a vector. Is there anything else I can use that may be
more efficient? If llvm.masked.gather is the way to go do I want the mask
all 1's or 0's? I heard of masked-off bit being different things to
different people but my first impression is I want all 0's
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200407/3f409cbd/attachment.html>


More information about the llvm-dev mailing list