mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-27 13:30:05 +00:00
Turn calls to copysignl into an FCOPYSIGN node. Handle FCOPYSIGN nodes
with ppc_f128 type by having the type legalizer turn these back into a call to copysignl. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98514 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a8efe28a44
commit
d2c817eff1
@ -150,6 +150,10 @@ namespace RTLIB {
|
||||
FLOOR_F64,
|
||||
FLOOR_F80,
|
||||
FLOOR_PPCF128,
|
||||
COPYSIGN_F32,
|
||||
COPYSIGN_F64,
|
||||
COPYSIGN_F80,
|
||||
COPYSIGN_PPCF128,
|
||||
|
||||
// CONVERSION
|
||||
FPEXT_F32_F64,
|
||||
|
@ -817,6 +817,7 @@ void DAGTypeLegalizer::ExpandFloatResult(SDNode *N, unsigned ResNo) {
|
||||
case ISD::FABS: ExpandFloatRes_FABS(N, Lo, Hi); break;
|
||||
case ISD::FADD: ExpandFloatRes_FADD(N, Lo, Hi); break;
|
||||
case ISD::FCEIL: ExpandFloatRes_FCEIL(N, Lo, Hi); break;
|
||||
case ISD::FCOPYSIGN: ExpandFloatRes_FCOPYSIGN(N, Lo, Hi); break;
|
||||
case ISD::FCOS: ExpandFloatRes_FCOS(N, Lo, Hi); break;
|
||||
case ISD::FDIV: ExpandFloatRes_FDIV(N, Lo, Hi); break;
|
||||
case ISD::FEXP: ExpandFloatRes_FEXP(N, Lo, Hi); break;
|
||||
@ -890,6 +891,17 @@ void DAGTypeLegalizer::ExpandFloatRes_FCEIL(SDNode *N,
|
||||
GetPairElements(Call, Lo, Hi);
|
||||
}
|
||||
|
||||
void DAGTypeLegalizer::ExpandFloatRes_FCOPYSIGN(SDNode *N,
|
||||
SDValue &Lo, SDValue &Hi) {
|
||||
SDValue Call = LibCallify(GetFPLibCall(N->getValueType(0),
|
||||
RTLIB::COPYSIGN_F32,
|
||||
RTLIB::COPYSIGN_F64,
|
||||
RTLIB::COPYSIGN_F80,
|
||||
RTLIB::COPYSIGN_PPCF128),
|
||||
N, false);
|
||||
GetPairElements(Call, Lo, Hi);
|
||||
}
|
||||
|
||||
void DAGTypeLegalizer::ExpandFloatRes_FCOS(SDNode *N,
|
||||
SDValue &Lo, SDValue &Hi) {
|
||||
SDValue Call = LibCallify(GetFPLibCall(N->getValueType(0),
|
||||
|
@ -458,6 +458,7 @@ private:
|
||||
void ExpandFloatRes_FABS (SDNode *N, SDValue &Lo, SDValue &Hi);
|
||||
void ExpandFloatRes_FADD (SDNode *N, SDValue &Lo, SDValue &Hi);
|
||||
void ExpandFloatRes_FCEIL (SDNode *N, SDValue &Lo, SDValue &Hi);
|
||||
void ExpandFloatRes_FCOPYSIGN (SDNode *N, SDValue &Lo, SDValue &Hi);
|
||||
void ExpandFloatRes_FCOS (SDNode *N, SDValue &Lo, SDValue &Hi);
|
||||
void ExpandFloatRes_FDIV (SDNode *N, SDValue &Lo, SDValue &Hi);
|
||||
void ExpandFloatRes_FEXP (SDNode *N, SDValue &Lo, SDValue &Hi);
|
||||
|
@ -4639,7 +4639,7 @@ void SelectionDAGBuilder::visitCall(CallInst &I) {
|
||||
// can't be a library call.
|
||||
if (!F->hasLocalLinkage() && F->hasName()) {
|
||||
StringRef Name = F->getName();
|
||||
if (Name == "copysign" || Name == "copysignf") {
|
||||
if (Name == "copysign" || Name == "copysignf" || Name == "copysignl") {
|
||||
if (I.getNumOperands() == 3 && // Basic sanity checks.
|
||||
I.getOperand(1)->getType()->isFloatingPointTy() &&
|
||||
I.getType() == I.getOperand(1)->getType() &&
|
||||
|
@ -174,6 +174,10 @@ static void InitLibcallNames(const char **Names) {
|
||||
Names[RTLIB::FLOOR_F64] = "floor";
|
||||
Names[RTLIB::FLOOR_F80] = "floorl";
|
||||
Names[RTLIB::FLOOR_PPCF128] = "floorl";
|
||||
Names[RTLIB::COPYSIGN_F32] = "copysignf";
|
||||
Names[RTLIB::COPYSIGN_F64] = "copysign";
|
||||
Names[RTLIB::COPYSIGN_F80] = "copysignl";
|
||||
Names[RTLIB::COPYSIGN_PPCF128] = "copysignl";
|
||||
Names[RTLIB::FPEXT_F32_F64] = "__extendsfdf2";
|
||||
Names[RTLIB::FPEXT_F16_F32] = "__gnu_h2f_ieee";
|
||||
Names[RTLIB::FPROUND_F32_F16] = "__gnu_f2h_ieee";
|
||||
|
@ -35,3 +35,10 @@ declare ppc_fp128 @"\01_sinl$LDBL128"(ppc_fp128) nounwind readonly
|
||||
declare ppc_fp128 @"\01_cosl$LDBL128"(ppc_fp128) nounwind readonly
|
||||
|
||||
declare ppc_fp128 @llvm.pow.ppcf128(ppc_fp128, ppc_fp128) nounwind readonly
|
||||
|
||||
declare ppc_fp128 @copysignl(ppc_fp128, ppc_fp128)
|
||||
|
||||
define ppc_fp128 @cs(ppc_fp128 %from, ppc_fp128 %to) {
|
||||
%tmp = call ppc_fp128 @copysignl(ppc_fp128 %from, ppc_fp128 %to)
|
||||
ret ppc_fp128 %tmp
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user