Improve ma_cmp_set with Imm32
Categories
(Core :: JavaScript Engine: JIT, enhancement, P1)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox153 | --- | fixed |
People
(Reporter: anba, Assigned: anba)
References
(Blocks 1 open bug)
Details
Attachments
(3 external files)
ma_cmp_set calls to ma_cmp to use shared code for more conditions, but this approach requires performing an additional xori to negate the result.
For example:
function f(x) {
return x >= 100000;
}
Is compiled to:
lui t4, 0x18
addiw t4, t4, 1696
slt t1, t0, t4
xori t1, t1, 0x1
But can instead be compiled to:
lui t4, 0x18
addiw t4, t4, 1695
slt t1, t4, t0
In addition to that, ma_cmp_set with an ImmWord operand should also support negative Imm32 values. For example:
function f(i64) {
return i64[0] <= -10;
}
Is currently compiled to:
li t4, -10
slt t0, t4, t1
xori t0, t0, 0x1
Instead of the expected:
slti t0, t1, -9
| Assignee | ||
Comment 1•5 months ago
|
||
| Assignee | ||
Comment 2•5 months ago
|
||
And improve it to require no more than three instructions.
For example:
function f(x) {
return x >= 100000;
}
Was compiled to:
lui t4, 0x18
addiw t4, t4, 1696
slt t1, t0, t4
xori t1, t1, 0x1
And is now compiled to:
lui t4, 0x18
addiw t4, t4, 1695
slt t1, t4, t0
| Assignee | ||
Comment 3•5 months ago
|
||
This restriction was copied mips64/loong64, but I don't see any obvious issues
why riscv64 needs to have the same restriction.
Updated•5 months ago
|
Comment 5•5 months ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/3e98db21cbcc
https://hg.mozilla.org/mozilla-central/rev/af1d3d7e0c74
https://hg.mozilla.org/mozilla-central/rev/b4c2a7b52618
Updated•5 months ago
|
Description
•