diff options
author | Akira Hatanaka <ahatanaka@mips.com> | 2013-03-01 21:11:44 +0000 |
---|---|---|
committer | Akira Hatanaka <ahatanaka@mips.com> | 2013-03-01 21:11:44 +0000 |
commit | c3c3810f514af7e08f84ef76b0c304ec264ee021 (patch) | |
tree | 3f067ed62d872a8e0f01b3fe9918de03c80f823e | |
parent | df861b3ac4521814903ec39787f5f24c1a79b6a3 (diff) |
Set properties for f128 type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176378 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp | 79 | ||||
-rw-r--r-- | lib/CodeGen/TargetLoweringBase.cpp | 9 | ||||
-rw-r--r-- | test/CodeGen/Mips/mips64-f128.ll | 646 |
3 files changed, 717 insertions, 17 deletions
diff --git a/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp b/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp index 1ee21921b4..6a05cf8975 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp +++ b/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp @@ -29,11 +29,13 @@ static RTLIB::Libcall GetFPLibCall(EVT VT, RTLIB::Libcall Call_F32, RTLIB::Libcall Call_F64, RTLIB::Libcall Call_F80, + RTLIB::Libcall Call_F128, RTLIB::Libcall Call_PPCF128) { return VT == MVT::f32 ? Call_F32 : VT == MVT::f64 ? Call_F64 : VT == MVT::f80 ? Call_F80 : + VT == MVT::f128 ? Call_F128 : VT == MVT::ppcf128 ? Call_PPCF128 : RTLIB::UNKNOWN_LIBCALL; } @@ -156,6 +158,7 @@ SDValue DAGTypeLegalizer::SoftenFloatRes_FADD(SDNode *N) { RTLIB::ADD_F32, RTLIB::ADD_F64, RTLIB::ADD_F80, + RTLIB::ADD_F128, RTLIB::ADD_PPCF128), NVT, Ops, 2, false, N->getDebugLoc()); } @@ -167,6 +170,7 @@ SDValue DAGTypeLegalizer::SoftenFloatRes_FCEIL(SDNode *N) { RTLIB::CEIL_F32, RTLIB::CEIL_F64, RTLIB::CEIL_F80, + RTLIB::CEIL_F128, RTLIB::CEIL_PPCF128), NVT, &Op, 1, false, N->getDebugLoc()); } @@ -220,6 +224,7 @@ SDValue DAGTypeLegalizer::SoftenFloatRes_FCOS(SDNode *N) { RTLIB::COS_F32, RTLIB::COS_F64, RTLIB::COS_F80, + RTLIB::COS_F128, RTLIB::COS_PPCF128), NVT, &Op, 1, false, N->getDebugLoc()); } @@ -232,6 +237,7 @@ SDValue DAGTypeLegalizer::SoftenFloatRes_FDIV(SDNode *N) { RTLIB::DIV_F32, RTLIB::DIV_F64, RTLIB::DIV_F80, + RTLIB::DIV_F128, RTLIB::DIV_PPCF128), NVT, Ops, 2, false, N->getDebugLoc()); } @@ -243,6 +249,7 @@ SDValue DAGTypeLegalizer::SoftenFloatRes_FEXP(SDNode *N) { RTLIB::EXP_F32, RTLIB::EXP_F64, RTLIB::EXP_F80, + RTLIB::EXP_F128, RTLIB::EXP_PPCF128), NVT, &Op, 1, false, N->getDebugLoc()); } @@ -254,6 +261,7 @@ SDValue DAGTypeLegalizer::SoftenFloatRes_FEXP2(SDNode *N) { RTLIB::EXP2_F32, RTLIB::EXP2_F64, RTLIB::EXP2_F80, + RTLIB::EXP2_F128, RTLIB::EXP2_PPCF128), NVT, &Op, 1, false, N->getDebugLoc()); } @@ -265,6 +273,7 @@ SDValue DAGTypeLegalizer::SoftenFloatRes_FFLOOR(SDNode *N) { RTLIB::FLOOR_F32, RTLIB::FLOOR_F64, RTLIB::FLOOR_F80, + RTLIB::FLOOR_F128, RTLIB::FLOOR_PPCF128), NVT, &Op, 1, false, N->getDebugLoc()); } @@ -276,6 +285,7 @@ SDValue DAGTypeLegalizer::SoftenFloatRes_FLOG(SDNode *N) { RTLIB::LOG_F32, RTLIB::LOG_F64, RTLIB::LOG_F80, + RTLIB::LOG_F128, RTLIB::LOG_PPCF128), NVT, &Op, 1, false, N->getDebugLoc()); } @@ -287,6 +297,7 @@ SDValue DAGTypeLegalizer::SoftenFloatRes_FLOG2(SDNode *N) { RTLIB::LOG2_F32, RTLIB::LOG2_F64, RTLIB::LOG2_F80, + RTLIB::LOG2_F128, RTLIB::LOG2_PPCF128), NVT, &Op, 1, false, N->getDebugLoc()); } @@ -298,6 +309,7 @@ SDValue DAGTypeLegalizer::SoftenFloatRes_FLOG10(SDNode *N) { RTLIB::LOG10_F32, RTLIB::LOG10_F64, RTLIB::LOG10_F80, + RTLIB::LOG10_F128, RTLIB::LOG10_PPCF128), NVT, &Op, 1, false, N->getDebugLoc()); } @@ -311,6 +323,7 @@ SDValue DAGTypeLegalizer::SoftenFloatRes_FMA(SDNode *N) { RTLIB::FMA_F32, RTLIB::FMA_F64, RTLIB::FMA_F80, + RTLIB::FMA_F128, RTLIB::FMA_PPCF128), NVT, Ops, 3, false, N->getDebugLoc()); } @@ -323,6 +336,7 @@ SDValue DAGTypeLegalizer::SoftenFloatRes_FMUL(SDNode *N) { RTLIB::MUL_F32, RTLIB::MUL_F64, RTLIB::MUL_F80, + RTLIB::MUL_F128, RTLIB::MUL_PPCF128), NVT, Ops, 2, false, N->getDebugLoc()); } @@ -334,6 +348,7 @@ SDValue DAGTypeLegalizer::SoftenFloatRes_FNEARBYINT(SDNode *N) { RTLIB::NEARBYINT_F32, RTLIB::NEARBYINT_F64, RTLIB::NEARBYINT_F80, + RTLIB::NEARBYINT_F128, RTLIB::NEARBYINT_PPCF128), NVT, &Op, 1, false, N->getDebugLoc()); } @@ -347,6 +362,7 @@ SDValue DAGTypeLegalizer::SoftenFloatRes_FNEG(SDNode *N) { RTLIB::SUB_F32, RTLIB::SUB_F64, RTLIB::SUB_F80, + RTLIB::SUB_F128, RTLIB::SUB_PPCF128), NVT, Ops, 2, false, N->getDebugLoc()); } @@ -384,6 +400,7 @@ SDValue DAGTypeLegalizer::SoftenFloatRes_FPOW(SDNode *N) { RTLIB::POW_F32, RTLIB::POW_F64, RTLIB::POW_F80, + RTLIB::POW_F128, RTLIB::POW_PPCF128), NVT, Ops, 2, false, N->getDebugLoc()); } @@ -397,6 +414,7 @@ SDValue DAGTypeLegalizer::SoftenFloatRes_FPOWI(SDNode *N) { RTLIB::POWI_F32, RTLIB::POWI_F64, RTLIB::POWI_F80, + RTLIB::POWI_F128, RTLIB::POWI_PPCF128), NVT, Ops, 2, false, N->getDebugLoc()); } @@ -409,6 +427,7 @@ SDValue DAGTypeLegalizer::SoftenFloatRes_FREM(SDNode *N) { RTLIB::REM_F32, RTLIB::REM_F64, RTLIB::REM_F80, + RTLIB::REM_F128, RTLIB::REM_PPCF128), NVT, Ops, 2, false, N->getDebugLoc()); } @@ -420,6 +439,7 @@ SDValue DAGTypeLegalizer::SoftenFloatRes_FRINT(SDNode *N) { RTLIB::RINT_F32, RTLIB::RINT_F64, RTLIB::RINT_F80, + RTLIB::RINT_F128, RTLIB::RINT_PPCF128), NVT, &Op, 1, false, N->getDebugLoc()); } @@ -431,6 +451,7 @@ SDValue DAGTypeLegalizer::SoftenFloatRes_FSIN(SDNode *N) { RTLIB::SIN_F32, RTLIB::SIN_F64, RTLIB::SIN_F80, + RTLIB::SIN_F128, RTLIB::SIN_PPCF128), NVT, &Op, 1, false, N->getDebugLoc()); } @@ -442,6 +463,7 @@ SDValue DAGTypeLegalizer::SoftenFloatRes_FSQRT(SDNode *N) { RTLIB::SQRT_F32, RTLIB::SQRT_F64, RTLIB::SQRT_F80, + RTLIB::SQRT_F128, RTLIB::SQRT_PPCF128), NVT, &Op, 1, false, N->getDebugLoc()); } @@ -454,6 +476,7 @@ SDValue DAGTypeLegalizer::SoftenFloatRes_FSUB(SDNode *N) { RTLIB::SUB_F32, RTLIB::SUB_F64, RTLIB::SUB_F80, + RTLIB::SUB_F128, RTLIB::SUB_PPCF128), NVT, Ops, 2, false, N->getDebugLoc()); } @@ -465,6 +488,7 @@ SDValue DAGTypeLegalizer::SoftenFloatRes_FTRUNC(SDNode *N) { RTLIB::TRUNC_F32, RTLIB::TRUNC_F64, RTLIB::TRUNC_F80, + RTLIB::TRUNC_F128, RTLIB::TRUNC_PPCF128), NVT, &Op, 1, false, N->getDebugLoc()); } @@ -839,7 +863,8 @@ void DAGTypeLegalizer::ExpandFloatRes_FADD(SDNode *N, SDValue &Lo, SDValue &Hi) { SDValue Call = LibCallify(GetFPLibCall(N->getValueType(0), RTLIB::ADD_F32, RTLIB::ADD_F64, - RTLIB::ADD_F80, RTLIB::ADD_PPCF128), + RTLIB::ADD_F80, RTLIB::ADD_F128, + RTLIB::ADD_PPCF128), N, false); GetPairElements(Call, Lo, Hi); } @@ -848,7 +873,8 @@ void DAGTypeLegalizer::ExpandFloatRes_FCEIL(SDNode *N, SDValue &Lo, SDValue &Hi) { SDValue Call = LibCallify(GetFPLibCall(N->getValueType(0), RTLIB::CEIL_F32, RTLIB::CEIL_F64, - RTLIB::CEIL_F80, RTLIB::CEIL_PPCF128), + RTLIB::CEIL_F80, RTLIB::CEIL_F128, + RTLIB::CEIL_PPCF128), N, false); GetPairElements(Call, Lo, Hi); } @@ -859,6 +885,7 @@ void DAGTypeLegalizer::ExpandFloatRes_FCOPYSIGN(SDNode *N, RTLIB::COPYSIGN_F32, RTLIB::COPYSIGN_F64, RTLIB::COPYSIGN_F80, + RTLIB::COPYSIGN_F128, RTLIB::COPYSIGN_PPCF128), N, false); GetPairElements(Call, Lo, Hi); @@ -868,7 +895,8 @@ void DAGTypeLegalizer::ExpandFloatRes_FCOS(SDNode *N, SDValue &Lo, SDValue &Hi) { SDValue Call = LibCallify(GetFPLibCall(N->getValueType(0), RTLIB::COS_F32, RTLIB::COS_F64, - RTLIB::COS_F80, RTLIB::COS_PPCF128), + RTLIB::COS_F80, RTLIB::COS_F128, + RTLIB::COS_PPCF128), N, false); GetPairElements(Call, Lo, Hi); } @@ -880,6 +908,7 @@ void DAGTypeLegalizer::ExpandFloatRes_FDIV(SDNode *N, SDValue &Lo, RTLIB::DIV_F32, RTLIB::DIV_F64, RTLIB::DIV_F80, + RTLIB::DIV_F128, RTLIB::DIV_PPCF128), N->getValueType(0), Ops, 2, false, N->getDebugLoc()); @@ -890,7 +919,8 @@ void DAGTypeLegalizer::ExpandFloatRes_FEXP(SDNode *N, SDValue &Lo, SDValue &Hi) { SDValue Call = LibCallify(GetFPLibCall(N->getValueType(0), RTLIB::EXP_F32, RTLIB::EXP_F64, - RTLIB::EXP_F80, RTLIB::EXP_PPCF128), + RTLIB::EXP_F80, RTLIB::EXP_F128, + RTLIB::EXP_PPCF128), N, false); GetPairElements(Call, Lo, Hi); } @@ -899,7 +929,8 @@ void DAGTypeLegalizer::ExpandFloatRes_FEXP2(SDNode *N, SDValue &Lo, SDValue &Hi) { SDValue Call = LibCallify(GetFPLibCall(N->getValueType(0), RTLIB::EXP2_F32, RTLIB::EXP2_F64, - RTLIB::EXP2_F80, RTLIB::EXP2_PPCF128), + RTLIB::EXP2_F80, RTLIB::EXP2_F128, + RTLIB::EXP2_PPCF128), N, false); GetPairElements(Call, Lo, Hi); } @@ -907,8 +938,9 @@ void DAGTypeLegalizer::ExpandFloatRes_FEXP2(SDNode *N, void DAGTypeLegalizer::ExpandFloatRes_FFLOOR(SDNode *N, SDValue &Lo, SDValue &Hi) { SDValue Call = LibCallify(GetFPLibCall(N->getValueType(0), - RTLIB::FLOOR_F32,RTLIB::FLOOR_F64, - RTLIB::FLOOR_F80,RTLIB::FLOOR_PPCF128), + RTLIB::FLOOR_F32, RTLIB::FLOOR_F64, + RTLIB::FLOOR_F80, RTLIB::FLOOR_F128, + RTLIB::FLOOR_PPCF128), N, false); GetPairElements(Call, Lo, Hi); } @@ -917,7 +949,8 @@ void DAGTypeLegalizer::ExpandFloatRes_FLOG(SDNode *N, SDValue &Lo, SDValue &Hi) { SDValue Call = LibCallify(GetFPLibCall(N->getValueType(0), RTLIB::LOG_F32, RTLIB::LOG_F64, - RTLIB::LOG_F80, RTLIB::LOG_PPCF128), + RTLIB::LOG_F80, RTLIB::LOG_F128, + RTLIB::LOG_PPCF128), N, false); GetPairElements(Call, Lo, Hi); } @@ -926,7 +959,8 @@ void DAGTypeLegalizer::ExpandFloatRes_FLOG2(SDNode *N, SDValue &Lo, SDValue &Hi) { SDValue Call = LibCallify(GetFPLibCall(N->getValueType(0), RTLIB::LOG2_F32, RTLIB::LOG2_F64, - RTLIB::LOG2_F80, RTLIB::LOG2_PPCF128), + RTLIB::LOG2_F80, RTLIB::LOG2_F128, + RTLIB::LOG2_PPCF128), N, false); GetPairElements(Call, Lo, Hi); } @@ -934,8 +968,9 @@ void DAGTypeLegalizer::ExpandFloatRes_FLOG2(SDNode *N, void DAGTypeLegalizer::ExpandFloatRes_FLOG10(SDNode *N, SDValue &Lo, SDValue &Hi) { SDValue Call = LibCallify(GetFPLibCall(N->getValueType(0), - RTLIB::LOG10_F32,RTLIB::LOG10_F64, - RTLIB::LOG10_F80,RTLIB::LOG10_PPCF128), + RTLIB::LOG10_F32, RTLIB::LOG10_F64, + RTLIB::LOG10_F80, RTLIB::LOG10_F128, + RTLIB::LOG10_PPCF128), N, false); GetPairElements(Call, Lo, Hi); } @@ -947,6 +982,7 @@ void DAGTypeLegalizer::ExpandFloatRes_FMA(SDNode *N, SDValue &Lo, RTLIB::FMA_F32, RTLIB::FMA_F64, RTLIB::FMA_F80, + RTLIB::FMA_F128, RTLIB::FMA_PPCF128), N->getValueType(0), Ops, 3, false, N->getDebugLoc()); @@ -960,6 +996,7 @@ void DAGTypeLegalizer::ExpandFloatRes_FMUL(SDNode *N, SDValue &Lo, RTLIB::MUL_F32, RTLIB::MUL_F64, RTLIB::MUL_F80, + RTLIB::MUL_F128, RTLIB::MUL_PPCF128), N->getValueType(0), Ops, 2, false, N->getDebugLoc()); @@ -972,6 +1009,7 @@ void DAGTypeLegalizer::ExpandFloatRes_FNEARBYINT(SDNode *N, RTLIB::NEARBYINT_F32, RTLIB::NEARBYINT_F64, RTLIB::NEARBYINT_F80, + RTLIB::NEARBYINT_F128, RTLIB::NEARBYINT_PPCF128), N, false); GetPairElements(Call, Lo, Hi); @@ -997,7 +1035,8 @@ void DAGTypeLegalizer::ExpandFloatRes_FPOW(SDNode *N, SDValue &Lo, SDValue &Hi) { SDValue Call = LibCallify(GetFPLibCall(N->getValueType(0), RTLIB::POW_F32, RTLIB::POW_F64, - RTLIB::POW_F80, RTLIB::POW_PPCF128), + RTLIB::POW_F80, RTLIB::POW_F128, + RTLIB::POW_PPCF128), N, false); GetPairElements(Call, Lo, Hi); } @@ -1006,7 +1045,8 @@ void DAGTypeLegalizer::ExpandFloatRes_FPOWI(SDNode *N, SDValue &Lo, SDValue &Hi) { SDValue Call = LibCallify(GetFPLibCall(N->getValueType(0), RTLIB::POWI_F32, RTLIB::POWI_F64, - RTLIB::POWI_F80, RTLIB::POWI_PPCF128), + RTLIB::POWI_F80, RTLIB::POWI_F128, + RTLIB::POWI_PPCF128), N, false); GetPairElements(Call, Lo, Hi); } @@ -1015,7 +1055,8 @@ void DAGTypeLegalizer::ExpandFloatRes_FRINT(SDNode *N, SDValue &Lo, SDValue &Hi) { SDValue Call = LibCallify(GetFPLibCall(N->getValueType(0), RTLIB::RINT_F32, RTLIB::RINT_F64, - RTLIB::RINT_F80, RTLIB::RINT_PPCF128), + RTLIB::RINT_F80, RTLIB::RINT_F128, + RTLIB::RINT_PPCF128), N, false); GetPairElements(Call, Lo, Hi); } @@ -1024,7 +1065,8 @@ void DAGTypeLegalizer::ExpandFloatRes_FSIN(SDNode *N, SDValue &Lo, SDValue &Hi) { SDValue Call = LibCallify(GetFPLibCall(N->getValueType(0), RTLIB::SIN_F32, RTLIB::SIN_F64, - RTLIB::SIN_F80, RTLIB::SIN_PPCF128), + RTLIB::SIN_F80, RTLIB::SIN_F128, + RTLIB::SIN_PPCF128), N, false); GetPairElements(Call, Lo, Hi); } @@ -1033,7 +1075,8 @@ void DAGTypeLegalizer::ExpandFloatRes_FSQRT(SDNode *N, SDValue &Lo, SDValue &Hi) { SDValue Call = LibCallify(GetFPLibCall(N->getValueType(0), RTLIB::SQRT_F32, RTLIB::SQRT_F64, - RTLIB::SQRT_F80, RTLIB::SQRT_PPCF128), + RTLIB::SQRT_F80, RTLIB::SQRT_F128, + RTLIB::SQRT_PPCF128), N, false); GetPairElements(Call, Lo, Hi); } @@ -1045,6 +1088,7 @@ void DAGTypeLegalizer::ExpandFloatRes_FSUB(SDNode *N, SDValue &Lo, RTLIB::SUB_F32, RTLIB::SUB_F64, RTLIB::SUB_F80, + RTLIB::SUB_F128, RTLIB::SUB_PPCF128), N->getValueType(0), Ops, 2, false, N->getDebugLoc()); @@ -1055,7 +1099,8 @@ void DAGTypeLegalizer::ExpandFloatRes_FTRUNC(SDNode *N, SDValue &Lo, SDValue &Hi) { SDValue Call = LibCallify(GetFPLibCall(N->getValueType(0), RTLIB::TRUNC_F32, RTLIB::TRUNC_F64, - RTLIB::TRUNC_F80, RTLIB::TRUNC_PPCF128), + RTLIB::TRUNC_F80, RTLIB::TRUNC_F128, + RTLIB::TRUNC_PPCF128), N, false); GetPairElements(Call, Lo, Hi); } diff --git a/lib/CodeGen/TargetLoweringBase.cpp b/lib/CodeGen/TargetLoweringBase.cpp index f0f3d34fa3..3c346766ad 100644 --- a/lib/CodeGen/TargetLoweringBase.cpp +++ b/lib/CodeGen/TargetLoweringBase.cpp @@ -912,6 +912,15 @@ void TargetLoweringBase::computeRegisterProperties() { ValueTypeActions.setTypeAction(MVT::ppcf128, TypeExpandFloat); } + // Decide how to handle f128. If the target does not have native f128 support, + // expand it to i128 and we will be generating soft float library calls. + if (!isTypeLegal(MVT::f128)) { + NumRegistersForVT[MVT::f128] = NumRegistersForVT[MVT::i128]; + RegisterTypeForVT[MVT::f128] = RegisterTypeForVT[MVT::i128]; + TransformToType[MVT::f128] = MVT::i128; + ValueTypeActions.setTypeAction(MVT::f128, TypeSoftenFloat); + } + // Decide how to handle f64. If the target does not have native f64 support, // expand it to i64 and we will be generating soft float library calls. if (!isTypeLegal(MVT::f64)) { diff --git a/test/CodeGen/Mips/mips64-f128.ll b/test/CodeGen/Mips/mips64-f128.ll new file mode 100644 index 0000000000..9aa8b8e1df --- /dev/null +++ b/test/CodeGen/Mips/mips64-f128.ll @@ -0,0 +1,646 @@ +; RUN: llc -march=mips64el -mcpu=mips64 -soft-float -O1 \ +; RUN: -disable-mips-delay-filler < %s | FileCheck %s + +@gld0 = external global fp128 +@gld1 = external global fp128 +@gld2 = external global fp128 +@gf1 = external global float +@gd1 = external global double + +; CHECK: addLD: +; CHECK: ld $25, %call16(__addtf3) + +define fp128 @addLD() { +entry: + %0 = load fp128* @gld0, align 16 + %1 = load fp128* @gld1, align 16 + %add = fadd fp128 %0, %1 + ret fp128 %add +} + +; CHECK: subLD: +; CHECK: ld $25, %call16(__subtf3) + +define fp128 @subLD() { +entry: + %0 = load fp128* @gld0, align 16 + %1 = load fp128* @gld1, align 16 + %sub = fsub fp128 %0, %1 + ret fp128 %sub +} + +; CHECK: mulLD: +; CHECK: ld $25, %call16(__multf3) + +define fp128 @mulLD() { +entry: + %0 = load fp128* @gld0, align 16 + %1 = load fp128* @gld1, align 16 + %mul = fmul fp128 %0, %1 + ret fp128 %mul +} + +; CHECK: divLD: +; CHECK: ld $25, %call16(__divtf3) + +define fp128 @divLD() { +entry: + %0 = load fp128* @gld0, align 16 + %1 = load fp128* @gld1, align 16 + %div = fdiv fp128 %0, %1 + ret fp128 %div +} + +; CHECK: conv_LD_char: +; CHECK: ld $25, %call16(__floatsitf) + +define fp128 @conv_LD_char(i8 signext %a) { +entry: + %conv = sitofp i8 %a to fp128 + ret fp128 %conv +} + +; CHECK: conv_LD_short: +; CHECK: ld $25, %call16(__floatsitf) + +define fp128 @conv_LD_short(i16 signext %a) { +entry: + %conv = sitofp i16 %a to fp128 + ret fp128 %conv +} + +; CHECK: conv_LD_int: +; CHECK: ld $25, %call16(__floatsitf) + +define fp128 @conv_LD_int(i32 %a) { +entry: + %conv = sitofp i32 %a to fp128 + ret fp128 %conv +} + +; CHECK: conv_LD_LL: +; CHECK: ld $25, %call16(__floatditf) + +define fp128 @conv_LD_LL(i64 %a) { +entry: + %conv = sitofp i64 %a to fp128 + ret fp128 %conv +} + +; CHECK: conv_LD_UChar: +; CHECK: ld $25, %call16(__floatunsitf) + +define fp128 @conv_LD_UChar(i8 zeroext %a) { +entry: + %conv = uitofp i8 %a to fp128 + ret fp128 %conv +} + +; CHECK: conv_LD_UShort: +; CHECK: ld $25, %call16(__floatunsitf) + +define fp128 @conv_LD_UShort(i16 zeroext %a) { +entry: + %conv = uitofp i16 %a to fp128 + ret fp128 %conv +} + +; CHECK: conv_LD_UInt: +; CHECK: ld $25, %call16(__floatunsitf) + +define fp128 @conv_LD_UInt(i32 %a) { +entry: + %conv = uitofp i32 %a to fp128 + ret fp128 %conv +} + +; CHECK: conv_LD_ULL: +; CHECK: ld $25, %call16(__floatunditf) + +define fp128 @conv_LD_ULL(i64 %a) { +entry: + %conv = uitofp i64 %a to fp128 + ret fp128 %conv +} + +; CHECK: conv_char_LD: +; CHECK: ld $25, %call16(__fixtfsi) + +define signext i8 @conv_char_LD(fp128 %a) { +entry: + %conv = fptosi fp128 %a to i8 + ret i8 %conv +} + +; CHECK: conv_short_LD: +; CHECK: ld $25, %call16(__fixtfsi) + +define signext i16 @conv_short_LD(fp128 %a) { +entry: + %conv = fptosi fp128 %a to i16 + ret i16 %conv +} + +; CHECK: conv_int_LD: +; CHECK: ld $25, %call16(__fixtfsi) + +define i32 @conv_int_LD(fp128 %a) { +entry: + %conv = fptosi fp128 %a to i32 + ret i32 %conv +} + +; CHECK: conv_LL_LD: +; CHECK: ld $25, %call16(__fixtfdi) + +define i64 @conv_LL_LD(fp128 %a) { +entry: + %conv = fptosi fp128 %a to i64 + ret i64 %conv +} + +; CHECK: conv_UChar_LD: +; CHECK: ld $25, %call16(__fixtfsi) + +define zeroext i8 @conv_UChar_LD(fp128 %a) { +entry: + %conv = fptoui fp128 %a to i8 + ret i8 %conv +} + +; CHECK: conv_UShort_LD: +; CHECK: ld $25, %call16(__fixtfsi) + +define zeroext i16 @conv_UShort_LD(fp128 %a) { +entry: + %conv = fptoui fp128 %a to i16 + ret i16 %conv +} + +; CHECK: conv_UInt_LD: +; CHECK: ld $25, %call16(__fixunstfsi) + +define i32 @conv_UInt_LD(fp128 %a) { +entry: + %conv = fptoui fp128 %a to i32 + ret i32 %conv +} + +; CHECK: conv_ULL_LD: +; CHECK: ld $25, %call16(__fixunstfdi) + +define i64 @conv_ULL_LD(fp128 %a) { +entry: + %conv = fptoui fp128 %a to i64 + ret i64 %conv +} + +; CHECK: conv_LD_float: +; CHECK: ld $25, %call16(__extendsftf2) + +define fp128 @conv_LD_float(float %a) { +entry: + %conv = fpext float %a to fp128 + ret fp128 %conv +} + +; CHECK: conv_LD_double: +; CHECK: ld $25, %call16(__extenddftf2) + +define fp128 @conv_LD_double(double %a) { +entry: + %conv = fpext double %a to fp128 + ret fp128 %conv +} + +; CHECK: conv_float_LD: +; CHECK: ld $25, %call16(__trunctfsf2) + +define float @conv_float_LD(fp128 %a) { +entry: + %conv = fptrunc fp128 %a to float + ret float %conv +} + +; CHECK: conv_double_LD: +; CHECK: ld $25, %call16(__trunctfdf2) + +define double @conv_double_LD(fp128 %a) { +entry: + %conv = fptrunc fp128 %a to double + ret double %conv +} + +; CHECK: libcall1_fabsl: +; CHECK: ld $[[R0:[0-9]+]], 8($[[R4:[0-9]+]]) +; CHECK: daddiu $[[R1:[0-9]+]], $zero, 1 +; CHECK: dsll $[[R2:[0-9]+]], $[[R1]], 63 +; CHECK: daddiu $[[R3:[0-9]+]], $[[R2]], -1 +; CHECK: and $3, $[[R0]], $[[R3]] +; CHECK: ld $2, 0($[[R4]]) + +define fp128 @libcall1_fabsl() { +entry: + %0 = load fp128* @gld0, align 16 + %call = tail call fp128 @fabsl(fp128 %0) nounwind readnone + ret fp128 %call +} + +declare fp128 @fabsl(fp128) #1 + +; CHECK: libcall1_ceill: +; CHECK: ld $25, %call16(ceill) + +define fp128 @libcall1_ceill() { +entry: + %0 = load fp128* @gld0, align 16 + %call = tail call fp128 @ceill(fp128 %0) nounwind readnone + ret fp128 %call +} + +declare fp128 @ceill(fp128) #1 + +; CHECK: libcall1_sinl: +; CHECK: ld $25, %call16(sinl) + +define fp128 @libcall1_sinl() { +entry: + %0 = load fp128* @gld0, align 16 + %call = tail call fp128 @sinl(fp128 %0) nounwind + ret fp128 %call +} + +declare fp128 @sinl(fp128) #2 + +; CHECK: libcall1_cosl: +; CHECK: ld $25, %call16(cosl) + +define fp128 @libcall1_cosl() { +entry: + %0 = load fp128* @gld0, align 16 + %call = tail call fp128 @cosl(fp128 %0) nounwind + ret fp128 %call +} + +declare fp128 @cosl(fp128) #2 + +; CHECK: libcall1_expl: +; CHECK: ld $25, %call16(expl) + +define fp128 @libcall1_expl() { +entry: + %0 = load fp128* @gld0, align 16 + %call = tail call fp128 @expl(fp128 %0) nounwind + ret fp128 %call +} + +declare fp128 @expl(fp128) #2 + +; CHECK: libcall1_exp2l: +; CHECK: ld $25, %call16(exp2l) + +define fp128 @libcall1_exp2l() { +entry: + %0 = load fp128* @gld0, align 16 + %call = tail call fp128 @exp2l(fp128 %0) nounwind + ret fp128 %call +} + +declare fp128 @exp2l(fp128) #2 + +; CHECK: libcall1_logl: +; CHECK: ld $25, %call16(logl) + +define fp128 @libcall1_logl() { +entry: + %0 = load fp128* @gld0, align 16 + %call = tail call fp128 @logl(fp128 %0) nounwind + ret fp128 %call +} + +declare fp128 @logl(fp128) #2 + +; CHECK: libcall1_log2l: +; CHECK: ld $25, %call16(log2l) + +define fp128 @libcall1_log2l() { +entry: + %0 = load fp128* @gld0, align 16 + %call = tail call fp128 @log2l(fp128 %0) nounwind + ret fp128 %call +} + +declare fp128 @log2l(fp128) #2 + +; CHECK: libcall1_log10l: +; CHECK: ld $25, %call16(log10l) + +define fp128 @libcall1_log10l() { +entry: + %0 = load fp128* @gld0, align 16 + %call = tail call fp128 @log10l(fp128 %0) nounwind + ret fp128 %call +} + +declare fp128 @log10l(fp128) #2 + +; CHECK: libcall1_nearbyintl: +; CHECK: ld $25, %call16(nearbyintl) + +define fp128 @libcall1_nearbyintl() { +entry: + %0 = load fp128* @gld0, align 16 + %call = tail call fp128 @nearbyintl(fp128 %0) nounwind readnone + ret fp128 %call +} + +declare fp128 @nearbyintl(fp128) #1 + +; CHECK: libcall1_floorl: +; CHECK: ld $25, %call16(floorl) + +define fp128 @libcall1_floorl() { +entry: + %0 = load fp128* @gld0, align 16 + %call = tail call fp128 @floorl(fp128 %0) nounwind readnone + ret fp128 %call +} + +declare fp128 @floorl(fp128) #1 + +; CHECK: libcall1_sqrtl: +; CHECK: ld $25, %call16(sqrtl) + +define fp128 @libcall1_sqrtl() { +entry: + %0 = load fp128* @gld0, align 16 + %call = tail call fp128 @sqrtl(fp128 %0) nounwind + ret fp128 %call +} + +declare fp128 @sqrtl(fp128) #2 + +; CHECK: libcall1_rintl: +; CHECK: ld $25, %call16(rintl) + +define fp128 @libcall1_rintl() { +entry: + %0 = load fp128* @gld0, align 16 + %call = tail call fp128 @rintl(fp128 %0) nounwind readnone + ret fp128 %call +} + +declare fp128 @rintl(fp128) #1 + +; CHECK: libcall_powil: +; CHECK: ld $25, %call16(__powitf2) + +define fp128 @libcall_powil(fp128 %a, i32 %b) { +entry: + %0 = tail call fp128 @llvm.powi.f128(fp128 %a, i32 %b) + ret fp128 %0 +} + +declare fp128 @llvm.powi.f128(fp128, i32) #3 + +; CHECK: libcall2_copysignl: +; CHECK: daddiu $[[R2:[0-9]+]], $zero, 1 +; CHECK: dsll $[[R3:[0-9]+]], $[[R2]], 63 +; CHECK: ld $[[R0:[0-9]+]], %got_disp(gld1) +; CHECK: ld $[[R1:[0-9]+]], 8($[[R0]]) +; CHECK: and $[[R4:[0-9]+]], $[[R1]], $[[R3]] +; CHECK: ld $[[R5:[0-9]+]], %got_disp(gld0) +; CHECK: ld $[[R6:[0-9]+]], 8($[[R5]]) +; CHECK: daddiu $[[R7:[0-9]+]], $[[R3]], -1 +; CHECK: and $[[R8:[0-9]+]], $[[R6]], $[[R7]] +; CHECK: or $3, $[[R8]], $[[R4]] +; CHECK: ld $2, 0($[[R5]]) + +define fp128 @libcall2_copysignl() { +entry: + %0 = load fp128* @gld0, align 16 + %1 = load fp128* @gld1, align 16 + %call = tail call fp128 @copysignl(fp128 %0, fp128 %1) nounwind readnone + ret fp128 %call +} + +declare fp128 @copysignl(fp128, fp128) #1 + +; CHECK: libcall2_powl: +; CHECK: ld $25, %call16(powl) + +define fp128 @libcall2_powl() { +entry: + %0 = load fp128* @gld0, align 16 + %1 = load fp128* @gld1, align 16 + %call = tail call fp128 @powl(fp128 %0, fp128 %1) nounwind + ret fp128 %call +} + +declare fp128 @powl(fp128, fp128) #2 + +; CHECK: libcall2_fmodl: +; CHECK: ld $25, %call16(fmodl) + +define fp128 @libcall2_fmodl() { +entry: + %0 = load fp128* @gld0, align 16 + %1 = load fp128* @gld1, align 16 + %call = tail call fp128 @fmodl(fp128 %0, fp128 %1) nounwind + ret fp128 %call +} + +declare fp128 @fmodl(fp128, fp128) #2 + +; CHECK: libcall3_fmal: +; CHECK: ld $25, %call16(fmal) + +define fp128 @libcall3_fmal() { +entry: + %0 = load fp128* @gld0, align 16 + %1 = load fp128* @gld2, align 16 + %2 = load fp128* @gld1, align 16 + %3 = tail call fp128 @llvm.fma.f128(fp128 %0, fp128 %2, fp128 %1) + ret fp128 %3 +} + +declare fp128 @llvm.fma.f128(fp128, fp128, fp128) #4 + +; CHECK: cmp_lt: +; CHECK: ld $25, %call16(__lttf2) + +define i32 @cmp_lt(fp128 %a, fp128 %b) { +entry: + %cmp = fcmp olt fp128 %a, %b + %conv = zext i1 %cmp to i32 + ret i32 %conv +} + +; CHECK: cmp_le: +; CHECK: ld $25, %call16(__letf2) + +define i32 @cmp_le(fp128 %a, fp128 %b) { +entry: + %cmp = fcmp ole fp128 %a, %b + %conv = zext i1 %cmp to i32 + ret i32 %conv +} + +; CHECK: cmp_gt: +; CHECK: ld $25, %call16(__gttf2) + +define i32 @cmp_gt(fp128 %a, fp128 %b) { +entry: + %cmp = fcmp ogt fp128 %a, %b + %conv = zext i1 %cmp to i32 + ret i32 %conv +} + +; CHECK: cmp_ge: +; CHECK: ld $25, %call16(__getf2) + +define i32 @cmp_ge(fp128 %a, fp128 %b) { +entry: + %cmp = fcmp oge fp128 %a, %b + %conv = zext i1 %cmp to i32 + ret i32 %conv +} + +; CHECK: cmp_eq: +; CHECK: ld $25, %call16(__eqtf2) + +define i32 @cmp_eq(fp128 %a, fp128 %b) { +entry: + %cmp = fcmp oeq fp128 %a, %b + %conv = zext i1 %cmp to i32 + ret i32 %conv +} + +; CHECK: cmp_ne: +; CHECK: ld $25, %call16(__netf2) + +define i32 @cmp_ne(fp128 %a, fp128 %b) { +entry: + %cmp = fcmp une fp128 %a, %b + %conv = zext i1 %cmp to i32 + ret i32 %conv +} + +; CHECK: load_LD_LD: +; CHECK: ld $[[R0:[0-9]+]], %got_disp(gld1) +; CHECK: ld $2, 0($[[R0]]) +; CHECK: ld $3, 8($[[R0]]) + +define fp128 @load_LD_LD() { +entry: + %0 = load fp128* @gld1, align 16 + ret fp128 %0 +} + +; CHECK: load_LD_float: +; CHECK: ld $[[R0:[0-9]+]], %got_disp(gf1) +; CHECK: lw $4, 0($[[R0]]) +; CHECK: ld $25, %call16(__extendsftf2) +; CHECK: jalr $25 + +define fp128 @load_LD_float() { +entry: + %0 = load float* @gf1, align 4 + %conv = fpext float %0 to fp128 + ret fp128 %conv +} + +; CHECK: load_LD_double: +; CHECK: ld $[[R0:[0-9]+]], %got_disp(gd1) +; CHECK: ld $4, 0($[[R0]]) +; CHECK: ld $25, %call16(__extenddftf2) +; CHECK: jalr $25 + +define fp128 @load_LD_double() { +entry: + %0 = load double* @gd1, align 8 + %conv = fpext double %0 to fp128 + ret fp128 %conv +} + +; CHECK: store_LD_LD: +; CHECK: ld $[[R0:[0-9]+]], %got_disp(gld1) +; CHECK: ld $[[R1:[0-9]+]], 0($[[R0]]) +; CHECK: ld $[[R2:[0-9]+]], 8($[[R0]]) +; CHECK: ld $[[R3:[0-9]+]], %got_disp(gld0) +; CHECK: sd $[[R2]], 8($[[R3]]) +; CHECK: sd $[[R1]], 0($[[R3]]) + +define void @store_LD_LD() { +entry: + %0 = load fp128* @gld1, align 16 + store fp128 %0, fp128* @gld0, align 16 + ret void +} + +; CHECK: store_LD_float: +; CHECK: ld $[[R0:[0-9]+]], %got_disp(gld1) +; CHECK: ld $4, 0($[[R0]]) +; CHECK: ld $5, 8($[[R0]]) +; CHECK: ld $25, %call16(__trunctfsf2) +; CHECK: jalr $25 +; CHECK: ld $[[R1:[0-9]+]], %got_disp(gf1) +; CHECK: sw $2, 0($[[R1]]) + +define void @store_LD_float() { +entry: + %0 = load fp128* @gld1, align 16 + %conv = fptrunc fp128 %0 to float + store float %conv, float* @gf1, align 4 + ret void +} + +; CHECK: store_LD_double: +; CHECK: ld $[[R0:[0-9]+]], %got_disp(gld1) +; CHECK: ld $4, 0($[[R0]]) +; CHECK: ld $5, 8($[[R0]]) +; CHECK: ld $25, %call16(__trunctfdf2) +; CHECK: jalr $25 +; CHECK: ld $[[R1:[0-9]+]], %got_disp(gd1) +; CHECK: sd $2, 0($[[R1]]) + +define void @store_LD_double() { +entry: + %0 = load fp128* @gld1, align 16 + %conv = fptrunc fp128 %0 to double + store double %conv, double* @gd1, align 8 + ret void +} + +; CHECK: select_LD: +; CHECK: movn $8, $6, $4 +; CHECK: movn $9, $7, $4 +; CHECK: or $2, $8, $zero +; CHECK: or $3, $9, $zero + +define fp128 @select_LD(i32 %a, i64, fp128 %b, fp128 %c) { +entry: + %tobool = icmp ne i32 %a, 0 + %cond = select i1 %tobool, fp128 %b, fp128 %c + ret fp128 %cond +} + +; CHECK: selectCC_LD: +; CHECK: or $[[R0:[0-9]+]], $11, $zero +; CHECK: or $[[R1:[0-9]+]], $10, $zero +; CHECK: or $[[R2:[0-9]+]], $9, $zero +; CHECK: or $[[R3:[0-9]+]], $8, $zero +; CHECK: ld $25, %call16(__gttf2)($gp) +; CHECK: jalr $25 +; CHECK: slt $1, $zero, $2 +; CHECK: movn $[[R1]], $[[R3]], $1 +; CHECK: movn $[[R0]], $[[R2]], $1 +; CHECK: or $2, $[[R1]], $zero +; CHECK: or $3, $[[R0]], $zero + +define fp128 @selectCC_LD(fp128 %a, fp128 %b, fp128 %c, fp128 %d) { +entry: + %cmp = fcmp ogt fp128 %a, %b + %cond = select i1 %cmp, fp128 %c, fp128 %d + ret fp128 %cond +} |