llvm.org GIT mirror llvm / cd7a155
Fix PR15632: No support for ppcf128 floating-point remainder on PowerPC. For this we need to use a libcall. Previously LLVM didn't implement libcall support for frem, so I've added it in the usual straightforward manner. A test case from the bug report is included. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178639 91177308-0d34-0410-b5e6-96231b3b80d8 Bill Schmidt 7 years ago
4 changed file(s) with 28 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
823823 case ISD::LOAD: ExpandFloatRes_LOAD(N, Lo, Hi); break;
824824 case ISD::SINT_TO_FP:
825825 case ISD::UINT_TO_FP: ExpandFloatRes_XINT_TO_FP(N, Lo, Hi); break;
826 case ISD::FREM: ExpandFloatRes_FREM(N, Lo, Hi); break;
826827 }
827828
828829 // If Lo/Hi is null, the sub-method took care of registering results etc.
10461047 RTLIB::POWI_F32, RTLIB::POWI_F64,
10471048 RTLIB::POWI_F80, RTLIB::POWI_F128,
10481049 RTLIB::POWI_PPCF128),
1050 N, false);
1051 GetPairElements(Call, Lo, Hi);
1052 }
1053
1054 void DAGTypeLegalizer::ExpandFloatRes_FREM(SDNode *N,
1055 SDValue &Lo, SDValue &Hi) {
1056 SDValue Call = LibCallify(GetFPLibCall(N->getValueType(0),
1057 RTLIB::REM_F32, RTLIB::REM_F64,
1058 RTLIB::REM_F80, RTLIB::REM_F128,
1059 RTLIB::REM_PPCF128),
10491060 N, false);
10501061 GetPairElements(Call, Lo, Hi);
10511062 }
464464 void ExpandFloatRes_FP_EXTEND (SDNode *N, SDValue &Lo, SDValue &Hi);
465465 void ExpandFloatRes_FPOW (SDNode *N, SDValue &Lo, SDValue &Hi);
466466 void ExpandFloatRes_FPOWI (SDNode *N, SDValue &Lo, SDValue &Hi);
467 void ExpandFloatRes_FREM (SDNode *N, SDValue &Lo, SDValue &Hi);
467468 void ExpandFloatRes_FRINT (SDNode *N, SDValue &Lo, SDValue &Hi);
468469 void ExpandFloatRes_FSIN (SDNode *N, SDValue &Lo, SDValue &Hi);
469470 void ExpandFloatRes_FSQRT (SDNode *N, SDValue &Lo, SDValue &Hi);
115115 setOperationAction(ISD::FTRUNC, MVT::ppcf128, Expand);
116116 setOperationAction(ISD::FRINT, MVT::ppcf128, Expand);
117117 setOperationAction(ISD::FNEARBYINT, MVT::ppcf128, Expand);
118 setOperationAction(ISD::FREM, MVT::ppcf128, Expand);
118119
119120 // PowerPC has no SREM/UREM instructions
120121 setOperationAction(ISD::SREM, MVT::i32, Expand);
0 ; RUN: llc -mcpu=pwr7 -O0 < %s | FileCheck %s
1
2 target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v128:128:128-n32:64"
3 target triple = "powerpc64-unknown-linux-gnu"
4
5 declare void @other(ppc_fp128 %tmp70)
6
7 define void @bug() {
8 entry:
9 %tmp70 = frem ppc_fp128 0xM00000000000000000000000000000000, undef
10 call void @other(ppc_fp128 %tmp70)
11 unreachable
12 }
13
14 ; CHECK: bl fmodl