[PATCH] D156344: Disable call to fma for soft-float

Kishan Parmar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 26 10:46:18 PDT 2023


long5hot updated this revision to Diff 544437.

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D156344/new/

https://reviews.llvm.org/D156344

Files:
  llvm/lib/Target/PowerPC/PPCISelLowering.cpp
  llvm/test/CodeGen/PowerPC/ppcsoftops.ll
  llvm/utils/gn/secondary/llvm/tools/sancov/BUILD.gn


Index: llvm/utils/gn/secondary/llvm/tools/sancov/BUILD.gn
===================================================================
--- llvm/utils/gn/secondary/llvm/tools/sancov/BUILD.gn
+++ llvm/utils/gn/secondary/llvm/tools/sancov/BUILD.gn
@@ -1,11 +1,20 @@
+import("//llvm/utils/TableGen/tablegen.gni")
+
+tablegen("Opts") {
+  visibility = [ ":sancov" ]
+  args = [ "-gen-opt-parser-defs" ]
+}
+
 executable("sancov") {
   deps = [
+    ":Opts",
     "//llvm/lib/DebugInfo/DWARF",
     "//llvm/lib/DebugInfo/PDB",
     "//llvm/lib/DebugInfo/Symbolize",
     "//llvm/lib/MC",
     "//llvm/lib/MC/MCDisassembler",
     "//llvm/lib/Object",
+    "//llvm/lib/Option",
     "//llvm/lib/Support",
     "//llvm/lib/Target:AllTargetsDescs",
     "//llvm/lib/Target:AllTargetsDisassemblers",
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:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156344.544437.patch
Type: text/x-patch
Size: 2451 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230726/1c846157/attachment.bin>


More information about the llvm-commits mailing list