This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU][GlobalISel] Support register offsets for SMRDs.
ClosedPublic

Authored by kosarev on Jun 29 2022, 9:59 AM.

Diff Detail

Event Timeline

kosarev created this revision.Jun 29 2022, 9:59 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 29 2022, 9:59 AM
kosarev requested review of this revision.Jun 29 2022, 9:59 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 29 2022, 9:59 AM

Should add some MIR select tests

llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp
3862–3873

Isn't GEPInfo.Imm > 0 redundant with isUInt<32>?

3877

Should use matchZeroExtendFromS32 to handle all the extended cases. Also this isn't checking the match return

kosarev updated this revision to Diff 441319.Jun 30 2022, 2:44 AM

Updated to use matchZeroExtendFromS32().

kosarev added inline comments.Jun 30 2022, 2:53 AM
llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp
3862–3873

I believe isUInt<32>() allows zero?

3877

Changed.

Also this isn't checking the match return

Yes, intentionally. In the previous version, as long as the operand originates from a 32-bit scalar, we don't really care if zero-expansion matched. Though I couldn't provide a reproducer for the case without expansion.

Should add some selector MIR tests

llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp
3862–3873

Clearer to change to != 0 then

kosarev updated this revision to Diff 441413.Jun 30 2022, 8:36 AM

Added an MIR instruction selection test and changed the if () condition
as suggested.

foad accepted this revision.Jul 5 2022, 12:52 AM

LGTM with a tweak to inst-select-load-smrd.mir.

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

Not your fault, but this seems to be missing checks (or asserts) on the number of operands and the type of the operands of the G_MERGE_VALUES.

3854–3855

I don't understand this comment. What cases are we still missing?

llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-load-smrd.mir
232

Please put these checks before the function, not after. (But wow the existing checks in this file are really messy.)

This revision is now accepted and ready to land.Jul 5 2022, 12:52 AM
kosarev updated this revision to Diff 442268.Jul 5 2022, 5:38 AM

Moved the check lines in the test before the function.

kosarev marked an inline comment as done.Jul 5 2022, 5:38 AM
kosarev added inline comments.
llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp
3240

Indeed. Will address this with a separate patch.

3854–3855

I guess this refers to i64 values that are known to fit 32 bits, such as (x & 3) << 2, etc.

foad accepted this revision.Jul 5 2022, 5:46 AM

LGTM.

This revision was landed with ongoing or failed builds.Jul 5 2022, 5:58 AM
This revision was automatically updated to reflect the committed changes.