Lower an intrinsic with constant integer parameter to a particular physical register in assembly

Hi All, I am working on lowering an LLVM intrinsic with a constant integer parameter that represents a physical register in assembly. I have tried to custom lowering this intrinsic during ISelDAGToDAG but am unable to set the physical register here due to various assertions and I do not think this is the right place to do this as it is pre-register allocation. I am also trying to find an approach that doesn’t involve modifying the instruction definitions in the backend.

Example lowering:

llvm.intrinsics.inst(1) → inst r1
where inst is the assembly instruction and 1 represents r1 physical register, 2-> r2 and so on.

I wanted to know if there is a similar intrinsic that I can look at to implement this or any suggestions on how I can approach this problem. Thank you.

@sagark Yes, AMX intrinsics used the same way. You can find the implementation here: ⚙ D83111 [X86-64] Support Intel AMX Intrinsic

Thanks alot! This is exactly what I am looking for.