Page MenuHomePhabricator

LegalizeDAG: Implement expansion of f16 = FP_TO_FP16 f64

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

Diff Detail


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.


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

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.

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


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