[x86_64] Status flags undefined for mul/div/idiv
The following table summerizes how Mu integer binops are mapped to x86_64 insts, and how x86_64 insts affect status flags.
Mu IR | X86_64 Inst | #N (signed) | #Z (zero) | #C (carry) | #V (overflow) |
---|---|---|---|---|---|
ADD | add | ✓ | ✓ | ✓ | ✓ |
SUB | sub | ✓ | ✓ | ✓ | ✓ |
AND | and | ✓ | ✓ | - | - |
OR | or | ✓ | ✓ | - | - |
XOR | xor | ✓ | ✓ | - | - |
MUL | mul | ✗ | ✗ | ✓ | ✓ |
UDIV | div | ✗ | ✗ | - | - |
SDIV | idiv | ✗ | ✗ | - | - |
UREM | div | ✗ | ✗ | - | - |
SREM | idiv | ✗ | ✗ | - | - |
SHL | shl | ✓ | ✓ | - | - |
LSHR | shr | ✓ | ✓ | - | - |
ASHR | sar | ✓ | ✓ | - | - |
mul
, div
and idiv
generate undefined signed flag (#N), and zero flag(#Z). We will need to generate extra code to check, and set those flags.