This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU: try and convert fmad to add + omod
AbandonedPublic

Authored by airlied on Apr 23 2017, 9:14 PM.

Details

Reviewers
arsenm
Summary

This patch tries to convert fmad with constant srcs, to an add with an output modifier, if the fmad multiply constant is one of the acceptable ones for an output modifier, also if the add src divided by the modifier is an inlinable constant.

I've seen amdgpu-pro vulkan driver do this optimisation.

Diff Detail

Repository
rL LLVM

Event Timeline

airlied created this revision.Apr 23 2017, 9:14 PM
arsenm edited edge metadata.Apr 24 2017, 12:25 AM

I don't see the motivation to do this. What advantage does this give? With denormals disabled mad/add are the same rate. The use of the modifier requires VOP3 anyway, so there's no possible code size savings. We also usually emit v_mac_f32 before this point.

airlied abandoned this revision.May 1 2018, 8:12 PM