[llvm-dev] load instruction to gather intrinsics

zhi chen via llvm-dev llvm-dev at lists.llvm.org
Fri May 5 17:42:23 PDT 2017


But I think I still need to get A+i and A+i+1 from %1 = load <2 x i64>*
%Ai, align 8 even if I want to use getelementptr, is that correct?

On Fri, May 5, 2017 at 4:56 PM, 陳韋任 <chenwj.cs97g at g2.nctu.edu.tw> wrote:

>
>
> 2017-05-06 7:41 GMT+08:00 zhi chen <zchenhn at gmail.com>:
>
>> The frontend would generate the load in the IR. I am using IRBuilder to
>> generate gather. I know it is mainly for discontinuous memory locations.
>> It's a long story why I want to use this. I want to gather some memory
>> locations. Suppose there are an array A, I manually duplicated it somewhere
>> with an offset x. Now, we have two arrays A and A', where A'[i] - A[i] =
>> offset. I want to gather the two values at A+i and A+i whenever there was a
>> load instruction to get a value from A+i.
>>
>> It is easy to do this if the code was not vectorized, but it become
>> tricky when they are vectorized. If there is a load %1 = load <2 x i64>*
>> %Ai, align 8, which loads two consecutive values at Ai, I need to gather
>> the values from A'i as well. So I think I need to use gather to get values
>> from A+i, A+i+1, A'+i, A'+i+1.
>>
>> I think you can use `getelementptr` to calculate ​the address needed by
> the gather intrinsic, though I don't know
> if there is better way to achieve your goal.
>
> --
> Wei-Ren Chen (陳韋任)
> Homepage: https://people.cs.nctu.edu.tw/~chenwj
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170505/bea42d3c/attachment.html>


More information about the llvm-dev mailing list