This is an archive of the discontinued LLVM Phabricator instance.

AVX512: fix mask handling for gather/scatter/prefetch
ClosedPublic

Authored by igorb on Jan 31 2016, 7:22 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

igorb updated this revision to Diff 46491.Jan 31 2016, 7:22 AM
igorb retitled this revision from to AVX512: fix mask handling for gather/scatter/prefetch.
igorb updated this object.
igorb added a reviewer: delena.
igorb set the repository for this revision to rL LLVM.
igorb added a subscriber: llvm-commits.
delena added inline comments.Jan 31 2016, 10:21 AM
lib/Target/X86/X86ISelLowering.cpp
16486 ↗(On Diff #46491)

Why do you need all-ones and all-zeroes. If the mask is all-zero you don't need any scatter. What happens if the mask is a constant - a mix ones and zeroes?

igorb added inline comments.Jan 31 2016, 11:16 PM
lib/Target/X86/X86ISelLowering.cpp
16486 ↗(On Diff #46491)

in general convert const to mask using gpr - for example

movw $220, %ax
kmovw %eax, %k1

in all zero use kxorw

kxorw %k0, %k0, %k1

in all-ones

kxnorw %k0, %k0, %k1

i agree that in case all-zero mask, instruction has no affect and can be removed at all, but this case not handled for any intrinsic.

delena accepted this revision.Feb 1 2016, 1:20 AM
delena edited edge metadata.

LGTM

This revision is now accepted and ready to land.Feb 1 2016, 1:20 AM
This revision was automatically updated to reflect the committed changes.