[PATCH] D122090: [PPCISelLowering] Avoid emitting calls to __multi3, __muloti4

Aaron Puchert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 19 19:51:02 PDT 2022


aaronpuchert updated this revision to Diff 416755.
aaronpuchert marked an inline comment as done.
aaronpuchert added a comment.

Block `MULO_I128` also on 64-bit, because libgcc doesn't have `__muloti4` there.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122090

Files:
  llvm/lib/Target/PowerPC/PPCISelLowering.cpp
  llvm/test/CodeGen/PowerPC/overflow-intrinsic-optimizations.ll


Index: llvm/test/CodeGen/PowerPC/overflow-intrinsic-optimizations.ll
===================================================================
--- llvm/test/CodeGen/PowerPC/overflow-intrinsic-optimizations.ll
+++ llvm/test/CodeGen/PowerPC/overflow-intrinsic-optimizations.ll
@@ -1,8 +1,11 @@
 ; RUN: llc %s -mtriple=powerpc -o - | FileCheck %s
+; RUN: llc %s -mtriple=powerpc64 -o - | FileCheck %s
+; RUN: llc %s -mtriple=powerpc64le -o - | FileCheck %s
 
 define i1 @no__mulodi4(i32 %a, i64 %b, i32* %c) {
 ; CHECK-LABEL: no__mulodi4
 ; CHECK-NOT: bl __mulodi4
+; CHECK-NOT: bl __multi3
 entry:
   %0 = sext i32 %a to i64
   %1 = call { i64, i1 } @llvm.smul.with.overflow.i64(i64 %0, i64 %b)
@@ -16,4 +19,14 @@
   ret i1 %7
 }
 
+define i1 @no__muloti4(i128 %a, i128 %b) {
+; CHECK-LABEL: no__muloti4
+; CHECK-NOT: bl __muloti4
+entry:
+  %0 = call { i128, i1 } @llvm.smul.with.overflow.i128(i128 %a, i128 %b)
+  %1 = extractvalue { i128, i1 } %0, 1
+  ret i1 %1
+}
+
 declare { i64, i1 } @llvm.smul.with.overflow.i64(i64, i64)
+declare { i128, i1 } @llvm.smul.with.overflow.i128(i128, i128)
Index: llvm/lib/Target/PowerPC/PPCISelLowering.cpp
===================================================================
--- llvm/lib/Target/PowerPC/PPCISelLowering.cpp
+++ llvm/lib/Target/PowerPC/PPCISelLowering.cpp
@@ -1335,11 +1335,13 @@
     setBooleanVectorContents(ZeroOrNegativeOneBooleanContent);
   }
 
+  setLibcallName(RTLIB::MULO_I128, nullptr);
   if (!isPPC64) {
     // These libcalls are not available in 32-bit.
     setLibcallName(RTLIB::SHL_I128, nullptr);
     setLibcallName(RTLIB::SRL_I128, nullptr);
     setLibcallName(RTLIB::SRA_I128, nullptr);
+    setLibcallName(RTLIB::MUL_I128, nullptr);
     setLibcallName(RTLIB::MULO_I64, nullptr);
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122090.416755.patch
Type: text/x-patch
Size: 1756 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220320/1d794322/attachment.bin>


More information about the llvm-commits mailing list