how the fptrunc ... to .... is supported

Dear experts.

I am curious how the “ = fptrunc to ” is supported by the backends? I searched all llvm directory with “fptrunc” key words, no lucky.

Is it supported by the front end itself?

if I have to support/overide it, which ISD node I should map to?
why there is no such a node like “fptrunc” is defined so I can write patterns for it?


I think that the SelectionDAG node that corresponds to fptrunc is called FP_ROUND.

FP_ROUND 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.