This is an archive of the discontinued LLVM Phabricator instance.

[X86][AVX512] Only look at lower bit in constant scalar masks
ClosedPublic

Authored by guyblank on May 3 2017, 7:18 AM.

Details

Summary

for scalar masked instructions only the lower bit of the mask is relevant. so for constant masks we should either do an unmasked operation or no operation, depending on the value of the lower bit.
This patch handles cases where the lower bit is '1'.

Diff Detail

Event Timeline

guyblank created this revision.May 3 2017, 7:18 AM
igorb added inline comments.May 3 2017, 8:07 AM
test/CodeGen/X86/avx512-intrinsics.ll
5204 ↗(On Diff #97633)

This is incorrect behavior. The upper bit of the source should be preserved.
IF k[0]
dst[31:0] := (a[31:0] * b[31:0]) + c[31:0]
ELSE
dst[31:0] := 0
FI
dst[127:32] := a[127:32]

The same for the tests below.

guyblank added inline comments.May 3 2017, 8:51 AM
test/CodeGen/X86/avx512-intrinsics.ll
5204 ↗(On Diff #97633)

ah, i've misread the description.
got confused from the zeroing of DEST[MAX_VL-1:128]

thanks!

guyblank updated this revision to Diff 98137.May 8 2017, 1:49 AM
guyblank retitled this revision from [X86][AVX512] Properly handle scalar masking for constant masks to [X86][AVX512] Only look at lower bit in constant scalar masks.
guyblank edited the summary of this revision. (Show Details)

change the patch to only address cases where the lower bit is '1'

guyblank updated this revision to Diff 98138.May 8 2017, 1:51 AM

this time with the correct patch...

igorb accepted this revision.May 9 2017, 8:16 AM

LGTM

This revision is now accepted and ready to land.May 9 2017, 8:16 AM
This revision was automatically updated to reflect the committed changes.