[llvm] [NVPTX] Add support for f16 fabs (PR #116107)
Justin Fargnoli via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 13 13:52:58 PST 2024
================
@@ -864,10 +864,15 @@ NVPTXTargetLowering::NVPTXTargetLowering(const NVPTXTargetMachine &TM,
AddPromotedToType(Op, MVT::bf16, MVT::f32);
}
for (const auto &Op : {ISD::FABS}) {
- setOperationAction(Op, MVT::f16, Promote);
setOperationAction(Op, MVT::f32, Legal);
setOperationAction(Op, MVT::f64, Legal);
- setOperationAction(Op, MVT::v2f16, Expand);
+ if (STI.getPTXVersion() >= 65) {
+ setFP16OperationAction(Op, MVT::f16, Legal, Promote);
+ setFP16OperationAction(Op, MVT::v2f16, Legal, Expand);
+ } else {
+ setOperationAction(Op, MVT::f16, Promote);
+ setOperationAction(Op, MVT::v2f16, Expand);
+ }
setBF16OperationAction(Op, MVT::v2bf16, Legal, Expand);
setBF16OperationAction(Op, MVT::bf16, Legal, Promote);
----------------
justinfargnoli wrote:
We should add `ISD::FABS` to this set of `case`s: https://github.com/llvm/llvm-project/blob/be95e16d38724a78b6845868a06eb03db87e0a53/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp#L486-L493
https://github.com/llvm/llvm-project/pull/116107
More information about the llvm-commits
mailing list