llvm.org GIT mirror llvm / 813090c
Properly handle sdiv / udiv / srem / urem libcalls git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70764 91177308-0d34-0410-b5e6-96231b3b80d8 Anton Korobeynikov 11 years ago
3 changed file(s) with 19 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
4444 MUL_I32,
4545 MUL_I64,
4646 MUL_I128,
47 SDIV_I16,
4748 SDIV_I32,
4849 SDIV_I64,
4950 SDIV_I128,
51 UDIV_I16,
5052 UDIV_I32,
5153 UDIV_I64,
5254 UDIV_I128,
55 SREM_I16,
5356 SREM_I32,
5457 SREM_I64,
5558 SREM_I128,
59 UREM_I16,
5660 UREM_I32,
5761 UREM_I64,
5862 UREM_I128,
33073307 switch (Node->getOpcode()) {
33083308 case ISD::UDIV:
33093309 case ISD::SDIV:
3310 if (VT == MVT::i32) {
3311 LC = Node->getOpcode() == ISD::UDIV
3312 ? RTLIB::UDIV_I32 : RTLIB::SDIV_I32;
3313 isSigned = Node->getOpcode() == ISD::SDIV;
3314 }
3315 break;
3310 isSigned = Node->getOpcode() == ISD::SDIV;
3311 if (VT == MVT::i16)
3312 LC = (isSigned ? RTLIB::SDIV_I16 : RTLIB::UDIV_I16);
3313 else if (VT == MVT::i32)
3314 LC = (isSigned ? RTLIB::SDIV_I32 : RTLIB::UDIV_I32);
3315 else if (VT == MVT::i64)
3316 LC = (isSigned ? RTLIB::SDIV_I64 : RTLIB::UDIV_I64);
3317 else if (VT == MVT::i128)
3318 LC = (isSigned ? RTLIB::SDIV_I128 : RTLIB::UDIV_I128);
3319 break;
33163320 case ISD::MUL:
33173321 if (VT == MVT::i16)
33183322 LC = RTLIB::MUL_I16;
3319 if (VT == MVT::i32)
3323 else if (VT == MVT::i32)
33203324 LC = RTLIB::MUL_I32;
33213325 else if (VT == MVT::i64)
33223326 LC = RTLIB::MUL_I64;
6666 Names[RTLIB::MUL_I32] = "__mulsi3";
6767 Names[RTLIB::MUL_I64] = "__muldi3";
6868 Names[RTLIB::MUL_I128] = "__multi3";
69 Names[RTLIB::SDIV_I16] = "__divhi3";
6970 Names[RTLIB::SDIV_I32] = "__divsi3";
7071 Names[RTLIB::SDIV_I64] = "__divdi3";
7172 Names[RTLIB::SDIV_I128] = "__divti3";
73 Names[RTLIB::UDIV_I32] = "__udivhi3";
7274 Names[RTLIB::UDIV_I32] = "__udivsi3";
7375 Names[RTLIB::UDIV_I64] = "__udivdi3";
7476 Names[RTLIB::UDIV_I128] = "__udivti3";
77 Names[RTLIB::SREM_I16] = "__modhi3";
7578 Names[RTLIB::SREM_I32] = "__modsi3";
7679 Names[RTLIB::SREM_I64] = "__moddi3";
7780 Names[RTLIB::SREM_I128] = "__modti3";
81 Names[RTLIB::UREM_I16] = "__umodsi3";
7882 Names[RTLIB::UREM_I32] = "__umodsi3";
7983 Names[RTLIB::UREM_I64] = "__umoddi3";
8084 Names[RTLIB::UREM_I128] = "__umodti3";