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. 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 } + +@a = common global fp128 0xL00000000000000000000000000000000, align 16 +@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 +}