This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Add expansions for floating-point intrinsics
ClosedPublic

Authored by luismarques on Nov 2 2018, 8:01 AM.

Details

Summary

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.

Diff Detail

Repository
rL LLVM

Event Timeline

luismarques created this revision.Nov 2 2018, 8:01 AM
asb accepted this revision.Nov 2 2018, 8:15 AM

Thanks Luis, this looks good to me. Just a minor nitpick re OP -> Op.

Expanding FMA to a libcall is better than a compiler assertion, so it makes sense to add this as a minimal incremental improvement and then follow-up with a patch adding patterns for FMAs.

lib/Target/RISCV/RISCVISelLowering.cpp
116 ↗(On Diff #172357)

Nitpick: should be FPOpToExtend

127 ↗(On Diff #172357)

OP -> Op

141 ↗(On Diff #172357)

OP -> Op

This revision is now accepted and ready to land.Nov 2 2018, 8:15 AM

Fixes some capitalization issues, as suggested by Alex Bradbury.

This revision was automatically updated to reflect the committed changes.