Given the following minimal example:
repro:
xor ecx, ecx
mov r8, 1122334466666BADh
shrd r8d, r8d, 33
mov rax, r8
ret
At MMAT_GENERATED, the SHRD instruction is lowered into:
mov r8d.4, et0.4 ; u=r8d.4 d=et0.4
mov r8d.4, rt0^4.4 ; u=r8d.4 d=rt0^4.4
mov #0x21.1, t2.1 ; u= d=t2.1
shr rt0.8, t2.1, rt0.8 ; u=rt0.8,t2.1 d=rt0.8
mov et0.4, r8d.4 ; u=et0.4 d=r8d.4
xdu r8d.4, r8.8 ; u=r8d.4 d=r8^4.4
Notice that the shift uses the original count of 0x21 (33).
At MMAT_LVARS:
mov #0x333335D6.8, result.8 ; u= d=rax.8
Resulting in:
return 0x333335D6;
For a 32-bit SHRD, the count is masked to five bits, so a count of 33 is equivalent to a count of one.
Since both operands are r8d, the operation is equivalent to a 32-bit rotate-right by one bit. The expected result is therefore:
return 0xB33335D6;
The corresponding test using an immediate count of one is decompiled correctly, so this appears specific to handling counts that require masking.