This uses PreprocessISelDAG to replace the constant before
instruction selection instead of matching opcodes after.
Cases that require constants should be using ISD::TargetConstant instead of ISD::Constant.
I fixed one case I found where it would break in 375849518db97096212f7f2b996b0d15f97be959. There might be others. I'll try to see if I can find a way to check the isel tables for other cases.
Are we ok with this implementation?
I don't have a great way to protect intrinsics not using TargetConstant properly in the future, but I think we're ok at the moment based on what I see in the isel table.