Fix aliasing with scratch register on 32-bit bbq i64 div - #1707
Fix aliasing with scratch register on 32-bit bbq i64 div#1707justinmichaud wants to merge 1 commit into
Conversation
|
|
||
| // The i32 operand of the outer add is evaluated first, so it holds a register while the | ||
| // dividend is loaded. That pushes the dividend into a register pair overlapping the pair | ||
| // the C call passes it in, which is what makes the argument shuffle need a temporary. |
There was a problem hiding this comment.
Not entirely obvious what the issue with the argument shuffle needing a temporary is. Presumably it's because we place the value to be tested in the scratch registers in the needsZeroCheck case in emitModOrDiv (so we're assuming that the shuffle won't need the temporary), but this comment read pretty mysterious to me in this file :-)
| } | ||
|
|
||
| // A zero dividend with a non-zero constant divisor emits no zero check, so losing the | ||
| // divisor makes the runtime helper divide zero by zero and take SIGFPE. |
There was a problem hiding this comment.
Similarly, I puzzled over "losing the divisor" here. IIUC this comment assumes the bug that's fixed by this commit. Perhaps "exercise the elided zero-check on the divisor"?
|
Now that I get it, looks obviously correct to me. It's a shame we're not threading the "you can't use a temporary here" assumption to |
Fix aliasing with scratch register on 32-bit bbq i64 div
3d39ac2