Open xwafish opened 5 years ago
function: unsigned mod(unsigned a, unsigned b)
unsigned a = 0xffff ffff; unsigned b = 0xffff ffff; if we call mod(a, b). when just enter function mod, the register 'a0' and 'a1' should be 0xffff ffff ffff ffff ffff? but the jited code generated by RawMachineAssembler is 0xffff ffff?
sign extend the arguments will fix this issue.
do we need to fix this?
this case test 'Uint32Mod' which is compiled to divu and mfhi. see src/compiler/mips64/instruction-selector-mips64.cpp src/compiler/mips64/code-generator-mips64.cpp
this case failed when 0xffff ffff % 0xffff ffff
https://s3-eu-west-1.amazonaws.com/downloads-mips/documents/MD00087-2B-MIPS64BIS-AFP-05.04.pdf about div: Restrictions: If either GPR rt or GPR rs does not contain sign-extended 32-bit values (bits 63..31 equal), then the result of the operation is UNPREDICTABLE. If the divisor in GPR rt is zero, the arithmetic result value is UNPREDICTABLE.
here should use ddivu instead?