This is an archive of the discontinued LLVM Phabricator instance.

LegalizeDAG: Implement expansion of f16 = FP_TO_FP16 f64
ClosedPublic

Authored by tstellarAMD on Oct 26 2016, 10:22 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

tstellarAMD retitled this revision from to LegalizeDAG: Implement expansion of f16 = FP_TO_FP16 f64.
tstellarAMD updated this object.
tstellarAMD added reviewers: bogner, arsenm.
tstellarAMD added a subscriber: llvm-commits.
arsenm accepted this revision.Oct 27 2016, 5:08 PM
arsenm edited edge metadata.

LGTM

This revision is now accepted and ready to land.Oct 27 2016, 5:08 PM
tstellarAMD edited edge metadata.

Move the expansion into the AMDGPU backend.

I wanted to implement this as a target independent expansion, however when
targets say they want to expand FP_TO_FP16 what they actually want is
the unsafe math expansion when possible and expansion to a libcall in all
other cases.

The only way to make this work as a target independent would be to add logic
to target's TargetLowering construction to mark theses nodes as Expand when
LegalizeDAG can use the unsafe expansion and mark them as LibCall when it
cannot. I think this would be possible, but I think it would be too fragile
and complex as it would require targets to keep their expansion logic up
to date with the code in LegalizeDAG.

LGTM with the test fixed

test/CodeGen/AMDGPU/trunc-store-f64-to-f16.ll
1 ↗(On Diff #76435)

Can you remove the -mcpu and add -verify-machineinstrs, also the FileCheck part is missing

This revision was automatically updated to reflect the committed changes.
jvesely added inline comments.
llvm/trunk/test/CodeGen/AMDGPU/fptrunc.ll
4

GCN-UNSAFE is never checked. did you mean GCN-FAST (or use GCN-UNSAFE in the tests)?

17

Is there a reason to use i16 instead of half? can the half test be moved to this file?