Skip to content

Commit fc4020d

Browse files
committed
[X86] Mark fp128 FMA as LibCall instead of Expand. Add STRICT_FMA as well.
The Expand code would fall back to LibCall, but this makes it more explicit.
1 parent 6bbca34 commit fc4020d

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,8 @@ X86TargetLowering::X86TargetLowering(const X86TargetMachine &TM,
674674
setOperationAction(ISD::STRICT_FDIV, MVT::f128, LibCall);
675675
setOperationAction(ISD::FMUL, MVT::f128, LibCall);
676676
setOperationAction(ISD::STRICT_FMUL, MVT::f128, LibCall);
677-
setOperationAction(ISD::FMA, MVT::f128, Expand);
677+
setOperationAction(ISD::FMA, MVT::f128, LibCall);
678+
setOperationAction(ISD::STRICT_FMA, MVT::f128, LibCall);
678679

679680
setOperationAction(ISD::FABS, MVT::f128, Custom);
680681
setOperationAction(ISD::FNEG, MVT::f128, Custom);

llvm/test/CodeGen/X86/fp128-libcalls-strict.ll

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,22 @@ entry:
5454
ret fp128 %div
5555
}
5656

57+
define fp128 @fma(fp128 %x, fp128 %y, fp128 %z) nounwind strictfp {
58+
; CHECK-LABEL: fma:
59+
; CHECK: # %bb.0: # %entry
60+
; CHECK-NEXT: pushq %rax
61+
; CHECK-NEXT: callq fmal
62+
; CHECK-NEXT: popq %rax
63+
; CHECK-NEXT: retq
64+
entry:
65+
%fma = call fp128 @llvm.experimental.constrained.fma.f128(fp128 %x, fp128 %y, fp128 %z, metadata !"round.dynamic", metadata !"fpexcept.strict") #0
66+
ret fp128 %fma
67+
}
68+
5769
attributes #0 = { strictfp }
5870

5971
declare fp128 @llvm.experimental.constrained.fadd.f128(fp128, fp128, metadata, metadata)
6072
declare fp128 @llvm.experimental.constrained.fsub.f128(fp128, fp128, metadata, metadata)
6173
declare fp128 @llvm.experimental.constrained.fmul.f128(fp128, fp128, metadata, metadata)
6274
declare fp128 @llvm.experimental.constrained.fdiv.f128(fp128, fp128, metadata, metadata)
75+
declare fp128 @llvm.experimental.constrained.fma.f128(fp128, fp128, fp128, metadata, metadata)

0 commit comments

Comments
 (0)