********** EXPANDING POST-RA PSEUDO INSTRS ********** real copy: renamable $r3 = COPY killed renamable $cr0 replaced by: $r3 = MFOCRF $cr0
As shown above, how we copying the CRRC to GRC is using a single MFOCRF to copy the contents of CR field n (CR bits 4×n+32:4×n+35) into bits 4×n+32:4×n+35 of register GRC. That's not correct because we expect the value of destination register equals to source so we have to put the the contents of CR field in the lowest 4 bits.
This patch adds a RLWINM after MFOCRF to achieve that.
In fact, the problem came up when adding builtins for xvtdivdp, xvtdivsp, xvtsqrtdp, xvtsqrtsp, as posted in D88278.
We need to move the outputs (in CR register) to GRC. However outputs of these instructions may not in a fixed CR# register, so we can't directly add a rotation instruction in the .td patterns, but need to wait until the CR register is determined. Then we confirmed this should be a bug in POST-RA PSEUDO PASS.