how to do make a FP_ROUND need/operattion

Hi Guys,

I and trying to covert a float to a f16.
calling

DAG.getNode(ISD::FP_ROUND, DL, Op->getValueType(0), FloatNode);

will get the error message:“Invalid method to make FP_ROUND node”

what is the “right” way to make this work?

best

Kevin

The problem is that FP_ROUND has two operands, per ISDOpcodes.h:

-Ahmed

The problem is that FP_ROUND has two operands, per ISDOpcodes.h:

    /// X = FP_ROUND(Y, TRUNC) - Rounding 'Y' from a larger floating point type
    /// down to the precision of the destination VT. TRUNC is a flag, which is
    /// always an integer that is zero or one. If TRUNC is 0, this is a
    /// normal rounding, if it is 1, this FP_ROUND is known to not change the
    /// value of Y.

So, something like this should work:

    DAG.getNode(ISD::FP_ROUND, DL, Op->getValueType(0), FloatNode,
DAG.getIntPtrConstant(0, DL));

-Ahmed