This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU/GlobalISel: Select G_SHUFFLE_VECTOR
ClosedPublic

Authored by arsenm on Feb 17 2020, 2:42 PM.

Details

Summary

G_SHUFFLE_VECTOR is legal since it theoretically may help match op_sel
for VOP3P instructions. Expand it in some other way in case it doesn't
fold into the use instructions.

Diff Detail

Event Timeline

arsenm created this revision.Feb 17 2020, 2:42 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 17 2020, 2:43 PM
arsenm updated this revision to Diff 245041.Feb 17 2020, 2:49 PM

Add comment and remove redundant check

foad added a comment.Feb 21 2020, 2:10 AM

LGTM but please consider the suggestions inline.

llvm/lib/Target/AMDGPU/AMDGPUGlobalISelUtils.cpp
53–54

I realise it's a matter of taste but how about (Mask[0] & 2) == (Mask[1] & 2)?

llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp
2184

Mask[0] == 1 might be clearer here, since we've already handled the all-undef case and we don't want to be handling it again here.

2194

Mask[1] == 0 might be clearer. All other cases have been handled.

Don't you also want to separate out the Mask[0] == -1 && Mask[1] == 0 case which can just be a left shift?

2212

Mask[0] == 1 && Mask[1] == 1 might be clearer. All other case have been handled.

2230

Mask[0] == 1 && Mask[1] == 0 might be clearer. All other cases have been handled.

arsenm updated this revision to Diff 245883.Feb 21 2020, 8:57 AM

Address comments

foad accepted this revision.Feb 21 2020, 9:13 AM

Thanks, LGTM.

This revision is now accepted and ready to land.Feb 21 2020, 9:13 AM