This patch adds legalization support to operate on FP16 as a load/store type
and do operations on it as floats.
Generic pass/fail tests have been added to
test/CodeGen/Generic/fp16-promote.ll.
Paths
| Differential D8755
Add support to promote f16 to f32 ClosedPublic Authored by pirama on Mar 31 2015, 4:35 PM.
Details Summary This patch adds legalization support to operate on FP16 as a load/store type Generic pass/fail tests have been added to
Diff Detail Event Timelinepirama updated this object. Comment Actions This patch is rough on the edges and needs to handle:
Comment Actions I forgot to subscribe llvm-commits. So, I'm re-sending the Summary and the raw diff to the mailing list. Summary: Generic pass/fail tests have been added to This patch is rough on the edges and needs to handle: the right approach to expose this as a command-line option. Right now, the option is added to TargetOptions.h, but that might not be right. D8755.diff31 KBDownload Comment Actions Awesome, I wanted to do this next, thanks for working on this =) I'll look into this closer, but a couple of very high level not-really-questions first:
In the meantime, you might be interested in http://reviews.llvm.org/D8648 for tests, as I tried to cover as many IR/generic ISD opcodes as possible. The patch itself just focuses on ops promotion on AArch64 (where half is legal). -Ahmed
Comment Actions Thanks for the code review ab. I'll make your suggestions, as well as remove the command line option. Looks like the Mips backend isn't setting the right operation action for FP_TO_FP16. I'll fix that in a different patch.
Comment Actions
Comment Actions In ARM-32 ABI, f16 args and return values gets promoted to f32. To keep calling convention out of the picture, the ARM codegen tests take half* args to load arguments and store results. Comment Actions Looking better, thanks!
pirama edited edge metadata. Comment Actions
This revision is now accepted and ready to land.Apr 17 2015, 10:18 AM
pirama edited edge metadata. Comment ActionsThanks for the review and LGTM, ab.
Closed by commit rL235215: Add support to promote f16 to f32 (authored by pirama). · Explain WhyApr 17 2015, 11:39 AM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 23951 include/llvm/Target/TargetLowering.h
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
lib/CodeGen/SelectionDAG/LegalizeTypes.h
lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
lib/CodeGen/TargetLoweringBase.cpp
test/CodeGen/ARM/fp16-promote.ll
|
I don't think you need this, just always pick some opcode, and let the operation legalizer decide it doesn't like a type combination.