<div dir="ltr"><div><div>I was just looking at the related masked load/store operations, and I think there are at least 2 bugs:<br><br>1. X86TTIImpl::isLegalMaskedLoad/Store() should be legal for FP types with AVX1 (not just AVX2).<br>2. X86TTIImpl::isLegalMaskedGather/Scatter() should be legal for 128/256 bit vectors with AVX2 (not just AVX512).<br><br></div><div>I looked at this for the first time today, so I may be missing something...<br></div><div><br></div>So for the moment, the answer to your question is 'no'; there's no generic way to produce these instructions. You should be able to use the _mm_* intrinsics in C though.<br><br></div><div><br><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jan 22, 2016 at 5:00 PM, 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> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>I used clang -O3 -c -emit-llvm on the follow code to generate a bitcode, say a.bc. I read the .ll file and didn't see any gather intrinsic. Also, I used opt -O3 -mcpu=core-avx2/-mcpu=skx, but there is still no gather intrinsic generated.</div><div><br></div><div>int foo(int A[800], int B[800], int C[800]) {</div><div>    for (int i = 0; i < 800; i++) {</div><div>        A[B[i]] = i + 5;</div><div>    }</div><div><br></div><div>    for (int i = 0; i < 800; i++) {<br></div><div>        A[B[i]]++;<br></div><div>    }<br></div><div><br></div><div>    for (int i = 0; i < 800; i++) {<br></div><div>        A[i] = B[C[i]];<br></div><div>    }<br></div><div>    return 0;</div><div>}</div><div><br></div><div>Could some give me an example that will generate gather intrinsic for AVX2? I tried to used the masked_gather intrinsic provided in the language ref. But it seemed that it only generates gather intrinsic for AVX-512 but for AVX-2. I found that there are 16 gather intrinsic versions depending on the data types provided for AVX-2. Do I have to check the data type before calling them specifically? or is there a generic way to use AVX-2 gather intrinsic? </div><div><br></div><div>Best,</div><div>Zhi </div></div>
<br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
<br></blockquote></div><br></div>