[LLVMdev] how to do make a FP_ROUND need/operattion

Ahmed Bougacha ahmed.bougacha at gmail.com
Mon May 11 18:49:52 PDT 2015


On Mon, May 11, 2015 at 6:46 PM, Ahmed Bougacha
<ahmed.bougacha at gmail.com> wrote:
> 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

> -Ahmed
>
>
> On Mon, May 11, 2015 at 5:26 PM, Zhang, Kewu <Kewu.Zhang at amd.com> wrote:
>> 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
>>
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>



More information about the llvm-dev mailing list