[PATCH] D48552: [Power9] Add __float128 library call for frem
Stefan Pintilie via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 25 10:35:54 PDT 2018
stefanp created this revision.
stefanp added reviewers: nemanjai, kbarton, hfinkel, sfertile, syzaara, lei.
We do not have a hardware instruction for `frem` but we can call `fmodf128` from libm.
https://reviews.llvm.org/D48552
Files:
lib/Target/PowerPC/PPCISelLowering.cpp
test/CodeGen/PowerPC/f128-arith.ll
Index: test/CodeGen/PowerPC/f128-arith.ll
===================================================================
--- test/CodeGen/PowerPC/f128-arith.ll
+++ test/CodeGen/PowerPC/f128-arith.ll
@@ -175,3 +175,17 @@
; CHECK: xscvdpqp
; CHECK: blr
}
+
+ at a = common global fp128 0xL00000000000000000000000000000000, align 16
+ at b = common global fp128 0xL00000000000000000000000000000000, align 16
+
+define fp128 @qp_frem() #0 {
+entry:
+ %0 = load fp128, fp128* @a, align 16
+ %1 = load fp128, fp128* @b, align 16
+ %rem = frem fp128 %0, %1
+ ret fp128 %rem
+; CHECK-LABEL: qp_frem
+; CHECK: bl fmodf128
+; CHECK: blr
+}
Index: lib/Target/PowerPC/PPCISelLowering.cpp
===================================================================
--- lib/Target/PowerPC/PPCISelLowering.cpp
+++ lib/Target/PowerPC/PPCISelLowering.cpp
@@ -823,6 +823,7 @@
setOperationAction(ISD::FCOS , MVT::f128, Expand);
setOperationAction(ISD::FPOW, MVT::f128, Expand);
setOperationAction(ISD::FPOWI, MVT::f128, Expand);
+ setOperationAction(ISD::FREM, MVT::f128, Expand);
}
}
@@ -1059,6 +1060,7 @@
setLibcallName(RTLIB::FMIN_F128, "fminf128");
setLibcallName(RTLIB::FMAX_F128, "fmaxf128");
setLibcallName(RTLIB::POWI_F128, "__powikf2");
+ setLibcallName(RTLIB::REM_F128, "fmodf128");
}
// Darwin long double math library functions have $LDBL128 appended.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48552.152725.patch
Type: text/x-patch
Size: 1401 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180625/0e29d723/attachment.bin>
More information about the llvm-commits
mailing list