This is an archive of the discontinued LLVM Phabricator instance.

GlobalISel: Handle lowering non-power-of-2 extloads
ClosedPublic

Authored by arsenm on Jun 30 2021, 6:04 PM.

Diff Detail

Event Timeline

arsenm created this revision.Jun 30 2021, 6:04 PM
arsenm requested review of this revision.Jun 30 2021, 6:04 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 30 2021, 6:04 PM
Herald added a subscriber: wdng. · View Herald Transcript
foad added inline comments.Jul 1 2021, 2:35 AM
llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-load-global.mir
15738

Why does this extend to s64 for the shifting and ORing?

arsenm updated this revision to Diff 355888.Jul 1 2021, 8:12 AM

Use correct power of 2, not just ceil. Handling the case where the widened type is the same or not is more annoying than it should be

foad added inline comments.Jul 1 2021, 8:59 AM
llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-load-global.mir
15995–16020

Why is this so much more convoluted than the GFX9-HSA case? The loads look the same, it's just all the shifting and ORing afterwards that looks crazy here.

arsenm added inline comments.Jul 1 2021, 11:20 AM
llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-load-global.mir
15995–16020

This is an artifact from the terrible way we currently handle unaligned accesses. We treat it as a narrowScalar action, which doesn't really make sense. I'm trying to move towards making widenScalar/narrowScalar only touch the register size, and leave the memory access alone. Unaligned access decomposition is a kind of lowering, and only tangentially related to the register types needed after legalization.

The HSA case enables unaligned access and the mesa case doesn't, so we start out by reporting we need to narrow the s32 result to s24. When that load is legalized, it ends up producing this mess. Once lowering handles alignment decomposition they should look the same

paquette accepted this revision.Jul 1 2021, 5:56 PM

I think this seems reasonable.

This revision is now accepted and ready to land.Jul 1 2021, 5:56 PM
foad accepted this revision.Jul 2 2021, 4:15 AM