Instruction selection of intrinsics


I am a bit stuck with this because the intrinsics on the LLVM I/R can only have one value, but for a memory intrinsic, I need it to have two values actually.

How should I add the second value and maintain the control chain?

The intrinsic looks like (MVT::i16, MVT::other), and if I lower the node to (MVT::i16, MVT::i16, MVT::other), I get the problem that the user of the chain is not updated to the right value index. Should I put the chain in the same slot, like (MVT::i16, MVT::other, MVT::i16), to avoid this, or must the chain be last value / first operand always, and if so, why?

Or, should I perhaps use a custom lowering and add the operand manually?