diff options
| author | Luís Marques <luismarques@lowrisc.org> | 2019-10-25 13:52:40 +0100 |
|---|---|---|
| committer | Luís Marques <luismarques@lowrisc.org> | 2019-10-25 14:02:02 +0100 |
| commit | 1baa50396d9b8766a2e3d775f2ea14c42e2fc05c (patch) | |
| tree | 01d8d14c3b6c96a4a27da144f5f96e3ccf4f831d /llvm/lib/Target | |
| parent | 43e931cb5fc1830f6b9250f35d29e1377a66eee6 (diff) | |
| download | bcm5719-llvm-1baa50396d9b8766a2e3d775f2ea14c42e2fc05c.tar.gz bcm5719-llvm-1baa50396d9b8766a2e3d775f2ea14c42e2fc05c.zip | |
[RISCV] Add support for half-precision floats
Complete fp16 support by ensuring that load extension / truncate store
operations are properly expanded.
Reviewers: asb, lenary
Reviewed By: lenary
Differential Revision: https://reviews.llvm.org/D69246
Diffstat (limited to 'llvm/lib/Target')
| -rw-r--r-- | llvm/lib/Target/RISCV/RISCVISelLowering.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp index b56d95132e0..b67d4a85c32 100644 --- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp +++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp @@ -146,7 +146,8 @@ RISCVTargetLowering::RISCVTargetLowering(const TargetMachine &TM, ISD::SETGE, ISD::SETNE}; ISD::NodeType FPOpToExtend[] = { - ISD::FSIN, ISD::FCOS, ISD::FSINCOS, ISD::FPOW, ISD::FREM}; + ISD::FSIN, ISD::FCOS, ISD::FSINCOS, ISD::FPOW, ISD::FREM, ISD::FP16_TO_FP, + ISD::FP_TO_FP16}; if (Subtarget.hasStdExtF()) { setOperationAction(ISD::FMINNUM, MVT::f32, Legal); @@ -158,6 +159,8 @@ RISCVTargetLowering::RISCVTargetLowering(const TargetMachine &TM, setOperationAction(ISD::BR_CC, MVT::f32, Expand); for (auto Op : FPOpToExtend) setOperationAction(Op, MVT::f32, Expand); + setLoadExtAction(ISD::EXTLOAD, MVT::f32, MVT::f16, Expand); + setTruncStoreAction(MVT::f32, MVT::f16, Expand); } if (Subtarget.hasStdExtF() && Subtarget.is64Bit()) @@ -175,6 +178,8 @@ RISCVTargetLowering::RISCVTargetLowering(const TargetMachine &TM, setTruncStoreAction(MVT::f64, MVT::f32, Expand); for (auto Op : FPOpToExtend) setOperationAction(Op, MVT::f64, Expand); + setLoadExtAction(ISD::EXTLOAD, MVT::f64, MVT::f16, Expand); + setTruncStoreAction(MVT::f64, MVT::f16, Expand); } setOperationAction(ISD::GlobalAddress, XLenVT, Custom); |

