diff options
author | Alex Bradbury <asb@lowrisc.org> | 2018-11-02 19:50:38 +0000 |
---|---|---|
committer | Alex Bradbury <asb@lowrisc.org> | 2018-11-02 19:50:38 +0000 |
commit | 52c27785cedc66464d356a961bdc7e3671c5775f (patch) | |
tree | 7a95ad79af9e1d9bd245dc7b22121a28fe8bd138 /llvm/lib/Target/RISCV/RISCVISelLowering.cpp | |
parent | 37829b56a1ef3e98868aebb39a32aca87ab8805e (diff) | |
download | bcm5719-llvm-52c27785cedc66464d356a961bdc7e3671c5775f.tar.gz bcm5719-llvm-52c27785cedc66464d356a961bdc7e3671c5775f.zip |
[RISCV] Add some missing expansions for floating-point intrinsics
A number of intrinsics, such as llvm.sin.f32, would result in a failure to
select. This patch adds expansions for the relevant selection DAG nodes, as
well as exhaustive testing for all f32 and f64 intrinsics.
The codegen for FMA remains a TODO item, pending support for the various
RISC-V FMA instruction variants.
The llvm.minimum.f32.* and llvm.maximum.* tests are commented-out, pending
upstream support for target-independent expansion, as discussed in
http://lists.llvm.org/pipermail/llvm-dev/2018-November/127408.html.
Differential Revision: https://reviews.llvm.org/D54034
Patch by Luís Marques.
llvm-svn: 346034
Diffstat (limited to 'llvm/lib/Target/RISCV/RISCVISelLowering.cpp')
-rw-r--r-- | llvm/lib/Target/RISCV/RISCVISelLowering.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp index 5c347ca4684..85758c0cdf8 100644 --- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp +++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp @@ -111,6 +111,11 @@ RISCVTargetLowering::RISCVTargetLowering(const TargetMachine &TM, ISD::SETUGT, ISD::SETUGE, ISD::SETULT, ISD::SETULE, ISD::SETUNE, ISD::SETGT, ISD::SETGE, ISD::SETNE}; + // TODO: add proper support for the various FMA variants + // (FMADD.S, FMSUB.S, FNMSUB.S, FNMADD.S). + ISD::NodeType FPOpToExtend[] = { + ISD::FSIN, ISD::FCOS, ISD::FSINCOS, ISD::FPOW, ISD::FMA}; + if (Subtarget.hasStdExtF()) { setOperationAction(ISD::FMINNUM, MVT::f32, Legal); setOperationAction(ISD::FMAXNUM, MVT::f32, Legal); @@ -119,6 +124,8 @@ RISCVTargetLowering::RISCVTargetLowering(const TargetMachine &TM, setOperationAction(ISD::SELECT_CC, MVT::f32, Expand); setOperationAction(ISD::SELECT, MVT::f32, Custom); setOperationAction(ISD::BR_CC, MVT::f32, Expand); + for (auto Op : FPOpToExtend) + setOperationAction(Op, MVT::f32, Expand); } if (Subtarget.hasStdExtD()) { @@ -131,6 +138,8 @@ RISCVTargetLowering::RISCVTargetLowering(const TargetMachine &TM, setOperationAction(ISD::BR_CC, MVT::f64, Expand); setLoadExtAction(ISD::EXTLOAD, MVT::f64, MVT::f32, Expand); setTruncStoreAction(MVT::f64, MVT::f32, Expand); + for (auto Op : FPOpToExtend) + setOperationAction(Op, MVT::f64, Expand); } setOperationAction(ISD::GlobalAddress, XLenVT, Custom); |