llvm.org GIT mirror llvm / 007f984
Output sinl for a long double FSIN node, not sin. Likewise fix up a bunch of other libcalls. While there I remove NEG_F32 and NEG_F64 since they are not used anywhere. This fixes 9 Ada ACATS failures. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45833 91177308-0d34-0410-b5e6-96231b3b80d8 Duncan Sands 12 years ago
5 changed file(s) with 84 addition(s) and 58 deletion(s). Raw diff Collapse all Expand all
4848 // FLOATING POINT
4949 ADD_F32,
5050 ADD_F64,
51 ADD_F80,
5152 ADD_PPCF128,
5253 SUB_F32,
5354 SUB_F64,
55 SUB_F80,
5456 SUB_PPCF128,
5557 MUL_F32,
5658 MUL_F64,
59 MUL_F80,
5760 MUL_PPCF128,
5861 DIV_F32,
5962 DIV_F64,
63 DIV_F80,
6064 DIV_PPCF128,
6165 REM_F32,
6266 REM_F64,
67 REM_F80,
6368 REM_PPCF128,
64 NEG_F32,
65 NEG_F64,
6669 POWI_F32,
6770 POWI_F64,
6871 POWI_F80,
7376 SQRT_PPCF128,
7477 SIN_F32,
7578 SIN_F64,
79 SIN_F80,
80 SIN_PPCF128,
7681 COS_F32,
7782 COS_F64,
83 COS_F80,
84 COS_PPCF128,
7885 POW_F32,
7986 POW_F64,
8087 POW_F80,
734734 }
735735
736736 return DAG.getNode(ISD::BUILD_VECTOR, VT, &Scalars[0], Scalars.size());
737 }
738
739 /// GetFPLibCall - Return the right libcall for the given floating point type.
740 static RTLIB::Libcall GetFPLibCall(MVT::ValueType VT,
741 RTLIB::Libcall Call_F32,
742 RTLIB::Libcall Call_F64,
743 RTLIB::Libcall Call_F80,
744 RTLIB::Libcall Call_PPCF128) {
745 return
746 VT == MVT::f32 ? Call_F32 :
747 VT == MVT::f64 ? Call_F64 :
748 VT == MVT::f80 ? Call_F80 :
749 VT == MVT::ppcf128 ? Call_PPCF128 :
750 RTLIB::UNKNOWN_LIBCALL;
737751 }
738752
739753 /// LegalizeOp - We know that the specified value has a legal type, and
27732787 }
27742788 break;
27752789 case ISD::FPOW:
2776 LC = VT == MVT::f32 ? RTLIB::POW_F32 :
2777 VT == MVT::f64 ? RTLIB::POW_F64 :
2778 VT == MVT::f80 ? RTLIB::POW_F80 :
2779 VT == MVT::ppcf128 ? RTLIB::POW_PPCF128 :
2780 RTLIB::UNKNOWN_LIBCALL;
2790 LC = GetFPLibCall(VT, RTLIB::POW_F32, RTLIB::POW_F64, RTLIB::POW_F80,
2791 RTLIB::POW_PPCF128);
27812792 break;
27822793 default: break;
27832794 }
29953006 Result = LegalizeOp(UnrollVectorOp(Op));
29963007 } else {
29973008 // Floating point mod -> fmod libcall.
2998 RTLIB::Libcall LC = VT == MVT::f32
2999 ? RTLIB::REM_F32 : RTLIB::REM_F64;
3009 RTLIB::Libcall LC = GetFPLibCall(VT, RTLIB::REM_F32, RTLIB::REM_F64,
3010 RTLIB::REM_F80, RTLIB::REM_PPCF128);
30003011 SDOperand Dummy;
30013012 Result = ExpandLibCall(TLI.getLibcallName(LC), Node,
30023013 false/*sign irrelevant*/, Dummy);
32733284 RTLIB::Libcall LC = RTLIB::UNKNOWN_LIBCALL;
32743285 switch(Node->getOpcode()) {
32753286 case ISD::FSQRT:
3276 LC = VT == MVT::f32 ? RTLIB::SQRT_F32 :
3277 VT == MVT::f64 ? RTLIB::SQRT_F64 :
3278 VT == MVT::f80 ? RTLIB::SQRT_F80 :
3279 VT == MVT::ppcf128 ? RTLIB::SQRT_PPCF128 :
3280 RTLIB::UNKNOWN_LIBCALL;
3287 LC = GetFPLibCall(VT, RTLIB::SQRT_F32, RTLIB::SQRT_F64,
3288 RTLIB::SQRT_F80, RTLIB::SQRT_PPCF128);
32813289 break;
32823290 case ISD::FSIN:
3283 LC = VT == MVT::f32 ? RTLIB::SIN_F32 : RTLIB::SIN_F64;
3291 LC = GetFPLibCall(VT, RTLIB::SIN_F32, RTLIB::SIN_F64,
3292 RTLIB::SIN_F80, RTLIB::SIN_PPCF128);
32843293 break;
32853294 case ISD::FCOS:
3286 LC = VT == MVT::f32 ? RTLIB::COS_F32 : RTLIB::COS_F64;
3295 LC = GetFPLibCall(VT, RTLIB::COS_F32, RTLIB::COS_F64,
3296 RTLIB::COS_F80, RTLIB::COS_PPCF128);
32873297 break;
32883298 default: assert(0 && "Unreachable!");
32893299 }
33063316 }
33073317
33083318 // We always lower FPOWI into a libcall. No target support for it yet.
3309 RTLIB::Libcall LC =
3310 VT == MVT::f32 ? RTLIB::POWI_F32 :
3311 VT == MVT::f64 ? RTLIB::POWI_F64 :
3312 VT == MVT::f80 ? RTLIB::POWI_F80 :
3313 VT == MVT::ppcf128 ? RTLIB::POWI_PPCF128 :
3314 RTLIB::UNKNOWN_LIBCALL;
3319 RTLIB::Libcall LC = GetFPLibCall(VT, RTLIB::POWI_F32, RTLIB::POWI_F64,
3320 RTLIB::POWI_F80, RTLIB::POWI_PPCF128);
33153321 SDOperand Dummy;
33163322 Result = ExpandLibCall(TLI.getLibcallName(LC), Node,
33173323 false/*sign irrelevant*/, Dummy);
60666072 break;
60676073
60686074 case ISD::FADD:
6069 Lo = ExpandLibCall(TLI.getLibcallName(VT == MVT::f32 ? RTLIB::ADD_F32 :
6070 VT == MVT::f64 ? RTLIB::ADD_F64 :
6071 VT == MVT::ppcf128 ?
6072 RTLIB::ADD_PPCF128 :
6073 RTLIB::UNKNOWN_LIBCALL),
6075 Lo = ExpandLibCall(TLI.getLibcallName(GetFPLibCall(VT, RTLIB::ADD_F32,
6076 RTLIB::ADD_F64,
6077 RTLIB::ADD_F80,
6078 RTLIB::ADD_PPCF128)),
60746079 Node, false, Hi);
60756080 break;
60766081 case ISD::FSUB:
6077 Lo = ExpandLibCall(TLI.getLibcallName(VT == MVT::f32 ? RTLIB::SUB_F32 :
6078 VT == MVT::f64 ? RTLIB::SUB_F64 :
6079 VT == MVT::ppcf128 ?
6080 RTLIB::SUB_PPCF128 :
6081 RTLIB::UNKNOWN_LIBCALL),
6082 Lo = ExpandLibCall(TLI.getLibcallName(GetFPLibCall(VT, RTLIB::SUB_F32,
6083 RTLIB::SUB_F64,
6084 RTLIB::SUB_F80,
6085 RTLIB::SUB_PPCF128)),
60826086 Node, false, Hi);
60836087 break;
60846088 case ISD::FMUL:
6085 Lo = ExpandLibCall(TLI.getLibcallName(VT == MVT::f32 ? RTLIB::MUL_F32 :
6086 VT == MVT::f64 ? RTLIB::MUL_F64 :
6087 VT == MVT::ppcf128 ?
6088 RTLIB::MUL_PPCF128 :
6089 RTLIB::UNKNOWN_LIBCALL),
6089 Lo = ExpandLibCall(TLI.getLibcallName(GetFPLibCall(VT, RTLIB::MUL_F32,
6090 RTLIB::MUL_F64,
6091 RTLIB::MUL_F80,
6092 RTLIB::MUL_PPCF128)),
60906093 Node, false, Hi);
60916094 break;
60926095 case ISD::FDIV:
6093 Lo = ExpandLibCall(TLI.getLibcallName(VT == MVT::f32 ? RTLIB::DIV_F32 :
6094 VT == MVT::f64 ? RTLIB::DIV_F64 :
6095 VT == MVT::ppcf128 ?
6096 RTLIB::DIV_PPCF128 :
6097 RTLIB::UNKNOWN_LIBCALL),
6096 Lo = ExpandLibCall(TLI.getLibcallName(GetFPLibCall(VT, RTLIB::DIV_F32,
6097 RTLIB::DIV_F64,
6098 RTLIB::DIV_F80,
6099 RTLIB::DIV_PPCF128)),
60986100 Node, false, Hi);
60996101 break;
61006102 case ISD::FP_EXTEND:
61156117 Lo = ExpandLibCall(TLI.getLibcallName(RTLIB::FPROUND_F64_F32),Node,true,Hi);
61166118 break;
61176119 case ISD::FPOWI:
6118 Lo = ExpandLibCall(TLI.getLibcallName((VT == MVT::f32) ? RTLIB::POWI_F32 :
6119 (VT == MVT::f64) ? RTLIB::POWI_F64 :
6120 (VT == MVT::f80) ? RTLIB::POWI_F80 :
6121 (VT == MVT::ppcf128) ?
6122 RTLIB::POWI_PPCF128 :
6123 RTLIB::UNKNOWN_LIBCALL),
6120 Lo = ExpandLibCall(TLI.getLibcallName(GetFPLibCall(VT, RTLIB::POWI_F32,
6121 RTLIB::POWI_F64,
6122 RTLIB::POWI_F80,
6123 RTLIB::POWI_PPCF128)),
61246124 Node, false, Hi);
61256125 break;
61266126 case ISD::FSQRT:
61296129 RTLIB::Libcall LC = RTLIB::UNKNOWN_LIBCALL;
61306130 switch(Node->getOpcode()) {
61316131 case ISD::FSQRT:
6132 LC = (VT == MVT::f32) ? RTLIB::SQRT_F32 :
6133 (VT == MVT::f64) ? RTLIB::SQRT_F64 :
6134 (VT == MVT::f80) ? RTLIB::SQRT_F80 :
6135 (VT == MVT::ppcf128) ? RTLIB::SQRT_PPCF128 :
6136 RTLIB::UNKNOWN_LIBCALL;
6132 LC = GetFPLibCall(VT, RTLIB::SQRT_F32, RTLIB::SQRT_F64,
6133 RTLIB::SQRT_F80, RTLIB::SQRT_PPCF128);
61376134 break;
61386135 case ISD::FSIN:
6139 LC = (VT == MVT::f32) ? RTLIB::SIN_F32 : RTLIB::SIN_F64;
6136 LC = GetFPLibCall(VT, RTLIB::SIN_F32, RTLIB::SIN_F64,
6137 RTLIB::SIN_F80, RTLIB::SIN_PPCF128);
61406138 break;
61416139 case ISD::FCOS:
6142 LC = (VT == MVT::f32) ? RTLIB::COS_F32 : RTLIB::COS_F64;
6140 LC = GetFPLibCall(VT, RTLIB::COS_F32, RTLIB::COS_F64,
6141 RTLIB::COS_F80, RTLIB::COS_PPCF128);
61436142 break;
61446143 default: assert(0 && "Unreachable!");
61456144 }
4747 Names[RTLIB::NEG_I64] = "__negdi2";
4848 Names[RTLIB::ADD_F32] = "__addsf3";
4949 Names[RTLIB::ADD_F64] = "__adddf3";
50 Names[RTLIB::ADD_F80] = "__addxf3";
5051 Names[RTLIB::ADD_PPCF128] = "__gcc_qadd";
5152 Names[RTLIB::SUB_F32] = "__subsf3";
5253 Names[RTLIB::SUB_F64] = "__subdf3";
54 Names[RTLIB::SUB_F80] = "__subxf3";
5355 Names[RTLIB::SUB_PPCF128] = "__gcc_qsub";
5456 Names[RTLIB::MUL_F32] = "__mulsf3";
5557 Names[RTLIB::MUL_F64] = "__muldf3";
58 Names[RTLIB::MUL_F80] = "__mulxf3";
5659 Names[RTLIB::MUL_PPCF128] = "__gcc_qmul";
5760 Names[RTLIB::DIV_F32] = "__divsf3";
5861 Names[RTLIB::DIV_F64] = "__divdf3";
62 Names[RTLIB::DIV_F80] = "__divxf3";
5963 Names[RTLIB::DIV_PPCF128] = "__gcc_qdiv";
6064 Names[RTLIB::REM_F32] = "fmodf";
6165 Names[RTLIB::REM_F64] = "fmod";
66 Names[RTLIB::REM_F80] = "fmodl";
6267 Names[RTLIB::REM_PPCF128] = "fmodl";
63 Names[RTLIB::NEG_F32] = "__negsf2";
64 Names[RTLIB::NEG_F64] = "__negdf2";
6568 Names[RTLIB::POWI_F32] = "__powisf2";
6669 Names[RTLIB::POWI_F64] = "__powidf2";
6770 Names[RTLIB::POWI_F80] = "__powixf2";
7275 Names[RTLIB::SQRT_PPCF128] = "sqrtl";
7376 Names[RTLIB::SIN_F32] = "sinf";
7477 Names[RTLIB::SIN_F64] = "sin";
78 Names[RTLIB::SIN_F80] = "sinl";
79 Names[RTLIB::SIN_PPCF128] = "sinl";
7580 Names[RTLIB::COS_F32] = "cosf";
7681 Names[RTLIB::COS_F64] = "cos";
82 Names[RTLIB::COS_F80] = "cosl";
83 Names[RTLIB::COS_PPCF128] = "cosl";
7784 Names[RTLIB::POW_F32] = "powf";
7885 Names[RTLIB::POW_F64] = "pow";
7986 Names[RTLIB::POW_F80] = "powl";
340340
341341 // Darwin long double math library functions have $LDBL128 appended.
342342 if (TM.getSubtarget().isDarwin()) {
343 setLibcallName(RTLIB::SQRT_PPCF128, "sqrtl$LDBL128");
343 setLibcallName(RTLIB::COS_PPCF128, "cosl$LDBL128");
344344 setLibcallName(RTLIB::POW_PPCF128, "powl$LDBL128");
345345 setLibcallName(RTLIB::REM_PPCF128, "fmodl$LDBL128");
346 setLibcallName(RTLIB::SIN_PPCF128, "sinl$LDBL128");
347 setLibcallName(RTLIB::SQRT_PPCF128, "sqrtl$LDBL128");
346348 }
347349
348350 computeRegisterProperties();
0 ; RUN: llvm-as < %s | llc -o - | grep sinl
1
2 target triple = "i686-pc-linux-gnu"
3
4 define x86_fp80 @f(x86_fp80 %x) nounwind {
5 entry:
6 %tmp2 = tail call x86_fp80 @sinl( x86_fp80 %x ) nounwind readonly ; [#uses=1]
7 ret x86_fp80 %tmp2
8 }
9
10 declare x86_fp80 @sinl(x86_fp80) nounwind readonly