About trigonometric Instructions

HI developers,

I want to add trigonometric instructions in my instrinfo.td files how can i directly map these instructions in .td files. Please help me Guys.For Sin, Cos, Tan and Cot Instructions.

If I used llvm.sin.* as SDNode Then it is error as llvm variable is not defined SO please Help me.

Some of these SDnodes are already defined in ISDOpcodes.h (FSIN, FCOS and also FSINCOS), so just map from them.

For the others you can add an intrinsic (this is how we’ve done it) and map from those (or you could add the ISD yourself).


If you have a call to ‘sin(float)’, you should see ISD::FSIN in the DAG (-view-isel-dags) if this is legal for your target (ie you’re not expanding or customizing in XXXISelLowering).

For the others, if you create the intrinsic you should see the same thing in your DAG (ie not a call, a node like ‘llvm.tan’, or whatever you call it).