| Commit-Queue | +1 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
LGTM
// Check if right is a positive integer.
__ Fcvtzu(x_scratch, right);
__ Scvtf(d_temp, x_scratch);
__ Fcmp(right, d_temp);
__ B(ne, &slow);
__ Fcmp(right, 0.0);
__ B(le, &slow);I bet most of the time we do module a fixed integer, so we could even avoid this!
__ bind(&slow);Do we need AllowExternalCallThatCantCauseGC here as well?
// Check if right is a positive integer.
__ Fcvtzu(x_scratch, right);
__ Scvtf(d_temp, x_scratch);
__ Fcmp(right, d_temp);
__ B(ne, &slow);
__ Fcmp(right, 0.0);
__ B(le, &slow);
For Maglev it should be easy to check if right is a constant.
__ Fdiv(d_temp, left, right);
__ Frintz(d_temp, d_temp);
__ Fmsub(out, d_temp, right, left);I guess if we were able to prove (statically) that both are integers, we would have emitted Int32ModulusWithOverflow instead?
Label slow, done_mod;
{
UseScratchRegisterScope temps(masm);
DoubleRegister d_temp = temps.AcquireD();
Register x_scratch = temps.AcquireX();
// Check if left is a positive integer.
__ Fcvtzu(x_scratch, left);
__ Scvtf(d_temp, x_scratch);
__ Fcmp(left, d_temp);
__ B(ne, &slow);
__ Fcmp(left, 0.0);
__ B(le, &slow);
// Check if right is a positive integer.
__ Fcvtzu(x_scratch, right);
__ Scvtf(d_temp, x_scratch);
__ Fcmp(right, d_temp);
__ B(ne, &slow);
__ Fcmp(right, 0.0);
__ B(le, &slow);
// Both are positive integers.
__ Fdiv(d_temp, left, right);
__ Frintz(d_temp, d_temp);
__ Fmsub(out, d_temp, right, left);
__ B(&done_mod);
}
__ bind(&slow);
{
AllowExternalCallThatCantCauseGC scope(masm);
__ CallCFunction(ExternalReference::mod_two_doubles_operation(), 0, 2);
}
__ bind(&done_mod);Since this is common for both maglev and code-generator, should we add it to the MacroAssembler instead?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
// Check if right is a positive integer.
__ Fcvtzu(x_scratch, right);
__ Scvtf(d_temp, x_scratch);
__ Fcmp(right, d_temp);
__ B(ne, &slow);
__ Fcmp(right, 0.0);
__ B(le, &slow);I bet most of the time we do module a fixed integer, so we could even avoid this!
I'll leave that as a follow up. In lazy-collections, both left and right are not constants (we compute the Erastothenes sieve like 123 % 2, 123 % 3 etc.), so it won't help there. I'm adding a TODO.
Do we need AllowExternalCallThatCantCauseGC here as well?
Using the FrameScope as discussed
// Check if right is a positive integer.
__ Fcvtzu(x_scratch, right);
__ Scvtf(d_temp, x_scratch);
__ Fcmp(right, d_temp);
__ B(ne, &slow);
__ Fcmp(right, 0.0);
__ B(le, &slow);
For Maglev it should be easy to check if right is a constant.
Ditto
__ Fdiv(d_temp, left, right);
__ Frintz(d_temp, d_temp);
__ Fmsub(out, d_temp, right, left);I guess if we were able to prove (statically) that both are integers, we would have emitted Int32ModulusWithOverflow instead?
will look into this when I look into the follow ups...
Label slow, done_mod;Since this is common for both maglev and code-generator, should we add it to the MacroAssembler instead?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
📍 Job mac-m1_mini_2020-perf/jetstream-main.crossbench complete.
See results at: https://pinpoint-dot-chromeperf.appspot.com/job/15ef8395f10000
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
[arm64|turbofan|maglev] Implement fast path for modulo
Note the existing test case div-mod.js.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |