LegalizeFloatType:ExpandFloatRes_FADD

I’m looking at the Legalize code and in 2.5 the above function is:

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),

N, false);

assert(Call.getNode()->getOpcode() == ISD::BUILD_PAIR &&

“Call lowered wrongly!”);

Lo = Call.getOperand(0); Hi = Call.getOperand(1);

}

But in 2.4 the function was:

void DAGTypeLegalizer::ExpandFloatRes_FADD(SDNode *N, SDValue &Lo,

SDValue &Hi) {

SDValue Ops[2] = { N->getOperand(0), N->getOperand(1) };

SDValue Call = MakeLibCall(GetFPLibCall(N->getValueType(0),

RTLIB::ADD_F32,

RTLIB::ADD_F64,

RTLIB::ADD_F80,

RTLIB::ADD_PPCF128),

N->getValueType(0), Ops, 2,

false);

assert(Call.getNode()->getOpcode() == ISD::BUILD_PAIR && “Call lowered wrongly!”);

Lo = Call.getOperand(0); Hi = Call.getOperand(1);

}

It seems to me that it was switched from a binary function expansion to a unary function expansion.

Is my understanding of this correct? If not what is this section of code support to do?

Thanks,

Hi Micah,

I'm looking at the Legalize code and in 2.5 the above function is:
...
It seems to me that it was switched from a binary function expansion to
a unary function expansion.

I don't understand the question. The new code is supposed to do exactly
the same thing as the old code. Can you please be more explicit about
what you think the problem is.

Is my understanding of this correct? If not what is this section of code
support to do?

This turns an FADD (x, y) node into a call to a library function that
performs a floating point addition of x and y.

Ciao,

Duncan.

In the 2.4 code, it explicitly used 2 Operands to the
MakeLibCall function, whereas in 2.5 it only uses 1 Operand.
Other functions like pow, cos, sin, only use 1 Operand as
I would expect since they are unary functions and div/mul
uses two operands as expected.

But after looking more closely at the code, I realized my
Mistake in thinking that MakeLibCall was the same in both
Cases but instead it uses LibCallify instead.

Sorry for the mistake,

Micah

Hopefully, "pow" is using 2 operands. :slight_smile:

-bw