This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU/GlobalISel: Legalize G_FPOW
ClosedPublic

Authored by arsenm on Feb 20 2020, 4:02 PM.

Details

Summary

There are few differences from the DAG handling. First, the DAG
handling uses a primitive selection pattern instead of custom
legalizing it. Because of this, this makes use of source modifiers
while the DAG does not.

Also instead of promoting f16, try to use the f16 log/exp. There's no
f16 fmul_legacy, so widen just for the multiply, although I'm not sure
that's the best solution.

Diff Detail

Event Timeline

arsenm created this revision.Feb 20 2020, 4:02 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 20 2020, 4:02 PM
foad accepted this revision.Feb 21 2020, 1:27 AM

LGTM.

As discussed off-list, perhaps we could use a normal fp16 mul instead of converting to fp32 for a legacy mul, at least for graphics.

As an extension it would be nice to catch cases like pow(3,y) and constant-fold the log(3). SelectionDAG doesn't do this.

This revision is now accepted and ready to land.Feb 21 2020, 1:27 AM