This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Better codegen for i64 bitreverse
ClosedPublic

Authored by foad on Feb 26 2021, 5:44 AM.

Diff Detail

Event Timeline

foad created this revision.Feb 26 2021, 5:44 AM
foad requested review of this revision.Feb 26 2021, 5:44 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 26 2021, 5:44 AM
arsenm added inline comments.Feb 26 2021, 5:46 AM
llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
5746

I don't see how you can just replace this with the two reversed halves. That would give you abcd -> badc instead of dcba

Also should handle globalisel

foad added a comment.Feb 26 2021, 5:52 AM

Also should handle globalisel

GlobalISel already looks good in test/CodeGen/AMDGPU/GlobalISel/legalize-bitreverse.mir.

foad added inline comments.Feb 26 2021, 5:53 AM
llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
5746

That's why I set Swap = true, to also swap the two halves.

Also should handle globalisel

GlobalISel already looks good in test/CodeGen/AMDGPU/GlobalISel/legalize-bitreverse.mir.

That won't end up using the scalar i64 then

foad updated this revision to Diff 326684.Feb 26 2021, 7:07 AM

Now with globalisel.

GlobalISel could use the end to end IR test

foad updated this revision to Diff 326689.Feb 26 2021, 7:34 AM

End-to-end test for globalisel.

arsenm accepted this revision.Feb 26 2021, 7:50 AM
This revision is now accepted and ready to land.Feb 26 2021, 7:50 AM
This revision was landed with ongoing or failed builds.Feb 26 2021, 7:52 AM
This revision was automatically updated to reflect the committed changes.