[PATCH] D156344: Disable call to fma for soft-float
Kishan Parmar via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 26 10:40:19 PDT 2023
long5hot updated this revision to Diff 544432.
long5hot added a comment.
Herald added subscribers: cfe-commits, MaskRay.
Herald added a project: clang.
After clang release/16.x there is a regression that -mabi=elfv1
or -mabi=elfv2 are being unused and throws warning. But clang-trunk
throws error for -mabi=elfv2 or elfv1. Intent of this patch to accept
elfv1 or elfv2 for -mabi.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D156344/new/
https://reviews.llvm.org/D156344
Files:
clang/lib/Driver/ToolChains/Clang.cpp
llvm/lib/Target/PowerPC/PPCISelLowering.cpp
llvm/test/CodeGen/PowerPC/ppcsoftops.ll
Index: llvm/test/CodeGen/PowerPC/ppcsoftops.ll
===================================================================
--- llvm/test/CodeGen/PowerPC/ppcsoftops.ll
+++ llvm/test/CodeGen/PowerPC/ppcsoftops.ll
@@ -51,4 +51,25 @@
; CHECK-LABEL: __divdf3
}
+; Function Attrs: noinline nounwind optnone uwtable
+define dso_local zeroext i32 @func(double noundef %0, double noundef %1) #0 {
+ %3 = alloca double, align 8
+ %4 = alloca double, align 8
+ store double %0, ptr %3, align 8
+ store double %1, ptr %4, align 8
+ %5 = load double, ptr %3, align 8
+ %6 = load double, ptr %4, align 8
+ %7 = fneg double %6
+ %8 = call double @llvm.fmuladd.f64(double %7, double 0x41F0000000000000, double %5)
+ %9 = fptoui double %8 to i32
+ ret i32 %9
+
+ ; CHECK-LABEL: __muldf3
+ ; CHECK-LABEL: __adddf3
+}
+
+; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
+declare double @llvm.fmuladd.f64(double, double, double) #1
+
attributes #0 = {"use-soft-float"="true" }
+attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
Index: llvm/lib/Target/PowerPC/PPCISelLowering.cpp
===================================================================
--- llvm/lib/Target/PowerPC/PPCISelLowering.cpp
+++ llvm/lib/Target/PowerPC/PPCISelLowering.cpp
@@ -17225,7 +17225,7 @@
bool PPCTargetLowering::isFMAFasterThanFMulAndFAdd(const Function &F,
Type *Ty) const {
- if (Subtarget.hasSPE())
+ if (Subtarget.hasSPE() || Subtarget.useSoftFloat())
return false;
switch (Ty->getScalarType()->getTypeID()) {
case Type::FloatTyID:
Index: clang/lib/Driver/ToolChains/Clang.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -2068,6 +2068,12 @@
} else if (V == "vec-extabi") {
VecExtabi = true;
A->claim();
+ } else if (V == "elfv1") {
+ ABIName = "elfv1";
+ A->claim();
+ } else if (V == "elfv2") {
+ ABIName = "elfv2";
+ A->claim();
} else if (V != "altivec")
// The ppc64 linux abis are all "altivec" abis by default. Accept and ignore
// the option if given as we don't have backend support for any targets
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156344.544432.patch
Type: text/x-patch
Size: 2320 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230726/ac3f6cb5/attachment.bin>
More information about the cfe-commits
mailing list