This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU/GlobalISel: Handle sbfe/ubfe intrinsic
ClosedPublic

Authored by arsenm on Feb 10 2020, 6:30 PM.

Details

Summary

Try to handle arbitrary scalar BFEs by packing the operands. The DAG
gives up on non-constant arguments. We're still missing any constant
folding, so we end up with pretty ugly code most of the time. Also
handle the 64-bit scalar case, which the DAG doesn't try to do.

Diff Detail

Event Timeline

arsenm created this revision.Feb 10 2020, 6:30 PM
foad added a comment.Feb 11 2020, 1:31 AM

Looks OK to me, but it should probably be reviewed by someone more familiar with RegisterBankInfo.

llvm/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp
1484

Is the behaviour of the intrinsic well-defined when the "offset" argument is huge enough for this to make a difference?

arsenm marked an inline comment as done.Feb 11 2020, 7:13 AM
arsenm added inline comments.
llvm/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp
1484

I'm assuming the intrinsic is supposed to match the behavior of the V_BFE_* instructions, which ignore the high bits

foad added inline comments.Feb 11 2020, 7:54 AM
llvm/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp
1484

Fair enough. ANDing with 31 or 63 would fit better into a single-word instruction encoding, wouldn't it?

arsenm updated this revision to Diff 244034.Feb 11 2020, 5:00 PM

Use minimum mask constant

This revision is now accepted and ready to land.Feb 17 2020, 6:53 AM
arsenm closed this revision.Feb 17 2020, 6:53 AM