This is an archive of the discontinued LLVM Phabricator instance.

GlobalISel/AMDGPU: Legalize G_FMAD
ClosedPublic

Authored by arsenm on Sep 6 2019, 8:02 AM.

Details

Summary

Unlike SelectionDAG, treat this as a normally legalizable operation.
In SelectionDAG this is supposed to only ever formed if it's legal, but
I've found that to be restricting. For AMDGPU this is contextually legal
depending on whether denormal flushing is allowed in the use function.

Technically we currently treat the denormal mode as a subtarget
feature, so custom lowering could be avoided. However I consider this
to be a defect, and this should be contextually dependent on the
controllable rounding mode of the parent function.

Diff Detail

Event Timeline

arsenm created this revision.Sep 6 2019, 8:02 AM
arsenm updated this revision to Diff 219112.Sep 6 2019, 8:04 AM

Add comment

lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp
1298

Won't ignoring this case here result in it failing the checks at the beginning of the instruction select where it probably will assert that this instruction is not legal (as it's custom).

arsenm marked an inline comment as done.Sep 11 2019, 12:56 PM
arsenm added inline comments.
lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp
1298

That check asserts isLegalOrCustom

aditya_nandakumar added inline comments.
lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp
1298

Aah - I was looking at a different branch but I see that it's indeed LegalOrCustom in upstream.

This revision is now accepted and ready to land.Sep 11 2019, 1:11 PM
arsenm closed this revision.Sep 12 2019, 5:43 PM

r371800