This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Use fma for lowering frem
ClosedPublic

Authored by foad on Jul 24 2020, 5:01 AM.

Details

Summary

This gives shorter f64 code and perhaps better accuracy.

Diff Detail

Event Timeline

foad created this revision.Jul 24 2020, 5:01 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 24 2020, 5:01 AM
arsenm accepted this revision.Jul 24 2020, 5:54 AM

If it doesn’t actually help accuracy, maybe it should check for fast FMA

llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
2091–2092

Could rename floor to trunc

This revision is now accepted and ready to land.Jul 24 2020, 5:54 AM
foad updated this revision to Diff 280429.Jul 24 2020, 6:08 AM

Rename misleading Floor -> Trunc.

arsenm accepted this revision.Jul 24 2020, 11:06 AM
foad updated this revision to Diff 280531.Jul 24 2020, 11:46 AM

Rebase.

foad added a comment.Jul 24 2020, 11:49 AM

If it doesn’t actually help accuracy, maybe it should check for fast FMA

I don't have any evidence that it improves accuracy but I'm not sure what the conditions should be for using FMA (I looked at SITargetLowering::isFMAFasterThanFMulAndFAdd but it is complicated) so I left it as a TODO.

This revision was automatically updated to reflect the committed changes.