Instantiating ArithmeticCastOps in DRRs


could somebody give me a hint how to instantiate an SIToFPOp (or any other Op that inherits from ArithmeticCastOp) in a DRR? Right now I am trying this:

def TestPattern : Pat<
  (SomeOtherOp:$res $arg),
  (SIToFPOp $arg, TypeAttr<F32>),

leading to the following TableGen error:

error: Expected a class name, got ‘TypeAttr’
(SIToFPOp $arg, TypeAttr)))),

I’m probably using TypeAttr incorrectly and / or in the wrong place.


Looking at the definition of ArithmeticCastOp again, I suspect that instantiation is only possible by invoking one of the builders explicitly or through parsing from a textual representation. At least, I do not see how the target type can be passed, neither as an argument, nor as an attribute.

Are these simply not intended to be used in DRRs?

Addressed in D104120.