<div dir="ltr">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. <div><br></div><div>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 <span style="color:rgb(0,0,0);white-space:pre-wrap">%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. </span>  </div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, May 5, 2017 at 4:10 PM, 陳韋任 <span dir="ltr"><<a href="mailto:chenwj.cs97g@g2.nctu.edu.tw" target="_blank">chenwj.cs97g@g2.nctu.edu.tw</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_extra"><br><div class="gmail_quote"><span class="">2017-05-06 5:42 GMT+08:00 zhi chen via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi All,<div><br></div><div>Can I change a vector load to gather intrinsic? If so, how can I do it? For example, I want to change the following IR code</div><div><br></div><div><div><pre style="color:rgb(0,0,0);word-wrap:break-word;white-space:pre-wrap">%1 = load <2 x i64>* %arrayidx1, align 8</pre></div><div>to</div><div><pre style="color:rgb(0,0,0);word-wrap:break-word;white-space:pre-wrap">%1 = call <2 x i64> @llvm.masked.gather.v2i64(<2 x i64*> %arrayidx1, i32 8, <2 x i1> <i1 true, i1 true>, <2 x i64> undef)</pre></div></div></div></blockquote><div><br></div></span><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">​How those IR would be generated? By frontend or your IRBuilder?​ And why you want to use gather intrinsic? From the LangRef [1], seems it is mainly for discontinuous memory locations. </div><span class=""><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div></div><div>Basically, I am not sure how to get two consecutive addresses started from arrayidx1. Thanks for your time and help in advance.</div></div></blockquote><div><br></div></span><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">​Maybe `getelementptr` is what you need to calculate <span style="font-family:arial,sans-serif">consecutive addresses.</span></div>







</div><br><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">​[1] <a href="http://llvm.org/docs/LangRef.html#llvm-masked-gather-intrinsics" target="_blank">http://llvm.org/docs/LangRef.<wbr>html#llvm-masked-gather-<wbr>intrinsics</a>​</div><div><br></div><div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">​HTH,</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">chenwj​</div><span class="HOEnZb"><font color="#888888"><br></font></span></div><span class="HOEnZb"><font color="#888888">-- <br><div class="m_-292722731298840335gmail_signature"><div dir="ltr"><div>Wei-Ren Chen (陳韋任)<br>Homepage: <a href="https://people.cs.nctu.edu.tw/~chenwj" target="_blank">https://people.cs.nctu.edu.tw/<wbr>~chenwj</a></div></div></div>
</font></span></div></div>
</blockquote></div><br></div>