[llvm] r336406 - [Power9] Add __float128 library call for frem

Stefan Pintilie via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 5 19:47:02 PDT 2018


Author: stefanp
Date: Thu Jul  5 19:47:02 2018
New Revision: 336406

URL: http://llvm.org/viewvc/llvm-project?rev=336406&view=rev
Log:
[Power9] Add __float128 library call for frem

Power 9 does not have a hardware instruction for frem but we can call fmodf128.

Differential Revision: https://reviews.llvm.org/D48552

Modified:
    llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp
    llvm/trunk/test/CodeGen/PowerPC/f128-arith.ll

Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=336406&r1=336405&r2=336406&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Thu Jul  5 19:47:02 2018
@@ -820,6 +820,7 @@ PPCTargetLowering::PPCTargetLowering(con
         setOperationAction(ISD::FCOS , MVT::f128, Expand);
         setOperationAction(ISD::FPOW, MVT::f128, Expand);
         setOperationAction(ISD::FPOWI, MVT::f128, Expand);
+        setOperationAction(ISD::FREM, MVT::f128, Expand);
       }
 
     }
@@ -1070,6 +1071,7 @@ PPCTargetLowering::PPCTargetLowering(con
     setLibcallName(RTLIB::FMIN_F128, "fminf128");
     setLibcallName(RTLIB::FMAX_F128, "fmaxf128");
     setLibcallName(RTLIB::POWI_F128, "__powikf2");
+    setLibcallName(RTLIB::REM_F128, "fmodf128");
   }
 
   // With 32 condition bits, we don't need to sink (and duplicate) compares

Modified: llvm/trunk/test/CodeGen/PowerPC/f128-arith.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/f128-arith.ll?rev=336406&r1=336405&r2=336406&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/PowerPC/f128-arith.ll (original)
+++ llvm/trunk/test/CodeGen/PowerPC/f128-arith.ll Thu Jul  5 19:47:02 2018
@@ -293,3 +293,17 @@ entry:
   ret void
 }
 declare fp128 @llvm.powi.f128(fp128 %Val, i32 %power)
+
+ 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
+}




More information about the llvm-commits mailing list