> On Jan 20, 2016, at 12:59 PM, Tim Northover via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > Hi Zhi, > > On 18 January 2016 at 11:28, zhi chen via llvm-dev > <llvm-dev at lists.llvm.org> wrote: >> Any idea about this error? Or could anyone give me an example how to use the >> gather intrinsic if there is something wrong with the way I am using it? > > Modulo obvious typos, the snippets look like they ought to work (on > trunk at least). Do you have an actual .ll or .bc and llc invocation > that fails?Only typo that caught my eye is ‘llvm.masked.gather.v8f64’ which should have v2 instead of v8 to match the <2 x double> Could that be the problem? Cheers, Pete> > Cheers. > > Tim. > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Hi Pete, Sorry, that is a typo... Best, Zhi On Wed, Jan 20, 2016 at 1:02 PM, Pete Cooper <peter_cooper at apple.com> wrote:> > > On Jan 20, 2016, at 12:59 PM, Tim Northover via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > > > > Hi Zhi, > > > > On 18 January 2016 at 11:28, zhi chen via llvm-dev > > <llvm-dev at lists.llvm.org> wrote: > >> Any idea about this error? Or could anyone give me an example how to > use the > >> gather intrinsic if there is something wrong with the way I am using it? > > > > Modulo obvious typos, the snippets look like they ought to work (on > > trunk at least). Do you have an actual .ll or .bc and llc invocation > > that fails? > Only typo that caught my eye is ‘llvm.masked.gather.v8f64’ which should > have v2 instead of v8 to match the <2 x double> > > Could that be the problem? > > Cheers, > Pete > > > > Cheers. > > > > Tim. > > _______________________________________________ > > LLVM Developers mailing list > > llvm-dev at lists.llvm.org > > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160120/8dbe2fcb/attachment.html>
Tim Northover via llvm-dev
2016-Jan-20 21:21 UTC
[llvm-dev] error of using GATHER intrinsic
> Only typo that caught my eye is ‘llvm.masked.gather.v8f64’ which should have v2 instead of v8 to match the <2 x double>There's an extra comma after an "i1" too. But they both just result in LLVM rejecting the code immediately.> But it still fails if I use -mcpu=core-avx2.My simple tests get correctly expanded to scalar loads. I've still not seen a selection failure.> It seems that avx2 supports gather/scatter, but I am not sure why it doesn't work.AVX2 supports some gather instructions, but they're more limited than the AVX-512 variants ones @llvm.masked.gather was added for. It looks like you can get the AVX2 ones using x86-specific intrinsics (look for @llvm.x86.avx2.gather.d.pd etc in tests/CodeGen/X86). It might make sense to use the AVX2 ones for @llvm.masked.gather as well, but there would be more register shuffling so it might not. Either way, no-one seems to have done so yet. Cheers. Tim.
Hi Tim, Thanks for your response. The attached is the .bc file after my pass. I could generate the assembly with -mcpu=skx but not with -mcpu=core-avx2. Could you please take a look? BTW, I am using LLVM-3.7. Best, Zhi On Wed, Jan 20, 2016 at 1:21 PM, Tim Northover <t.p.northover at gmail.com> wrote:> > Only typo that caught my eye is ‘llvm.masked.gather.v8f64’ which should > have v2 instead of v8 to match the <2 x double> > > There's an extra comma after an "i1" too. But they both just result in > LLVM rejecting the code immediately. > > > But it still fails if I use -mcpu=core-avx2. > > My simple tests get correctly expanded to scalar loads. I've still not > seen a selection failure. > > > It seems that avx2 supports gather/scatter, but I am not sure why it > doesn't work. > > AVX2 supports some gather instructions, but they're more limited than > the AVX-512 variants ones @llvm.masked.gather was added for. It looks > like you can get the AVX2 ones using x86-specific intrinsics (look for > @llvm.x86.avx2.gather.d.pd etc in tests/CodeGen/X86). > > It might make sense to use the AVX2 ones for @llvm.masked.gather as > well, but there would be more register shuffling so it might not. > Either way, no-one seems to have done so yet. > > Cheers. > > Tim. >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160120/ee3621c9/attachment.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: test_opt.bc Type: application/octet-stream Size: 3100 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160120/ee3621c9/attachment.obj>