<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">2017-05-06 7:41 GMT+08:00 zhi chen <span dir="ltr"><<a href="mailto:zchenhn@gmail.com" target="_blank">zchenhn@gmail.com</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">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></blockquote></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">​</div><div class="gmail_default"><span style="font-family:arial,helvetica,sans-serif">I think you can use <span style="font-size:14px">`getelementptr`</span><span style="font-size:14px"> to calculate </span>​</span><font color="#000000"><span style="white-space:pre-wrap">the address needed by the </span></font><span style="font-family:arial,helvetica,sans-serif;font-size:14px">gather intrinsic, though I don't know</span></div><div class="gmail_default"><span style="font-family:arial,helvetica,sans-serif;font-size:14px">if there is better way to achieve your goal.</span></div><div><br></div>-- <br><div class="gmail_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/~chenwj</a></div></div></div>
</div></div>