Improve riscv64 codegen for LWasm(CompareAnd)Select
Categories
(Core :: JavaScript: WebAssembly, enhancement, P1)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox154 | --- | fixed |
People
(Reporter: anba, Assigned: anba)
References
(Blocks 1 open bug)
Details
Attachments
(5 external files)
Don't use defineReuseInput to avoid some unnecessary register moves added by the register allocator. (Register allocation in riscv64 will then match what we do for arm64.)
| Assignee | ||
Comment 1•4 months ago
|
||
Make it work by creating branchy code instead.
This change is needed for parts 2-3.
| Assignee | ||
Comment 2•4 months ago
|
||
This can avoid unnecessary register moves added by the register allocator.
For example:
(module
(func (export "f")
(param $p1 i32) (param $p2 i32) (param $p3 i32) (param $p4 i32) (result i32)
(select (local.get $p3) (local.get $p4)
(i32.eq (local.get $p1) (local.get $p2)))))
Was compiled to:
sext.w t1, a2
sext.w t0, t1
xor t4, a0, a1
snez t4, t4
czero.nez t0, t0, t4
czero.eqz t4, a3, t4
add t0, t0, t4
sext.w a0, t0
But is now compiled to:
xor t4, a0, a1
seqz t4, t4
czero.eqz a0, a2, t4
czero.nez t4, a3, t4
add a0, a0, t4
This also allows to handle more input types for LWasmCompareAndSelect.
| Assignee | ||
Comment 3•4 months ago
|
||
For example:
(module
(func (export "f")
(param $p1 i32) (param $p2 i32) (param $p3 i32) (result i32)
(select (local.get $p2) (local.get $p1) (local.get $p3))))
Was compiled to:
sext.w t1, a1
sext.w t0, t1
czero.eqz t0, t0, a2
czero.nez t4, a0, a2
add t0, t0, t4
sext.w a0, t0
And is now compiled to:
czero.nez a0, a0, a2
czero.eqz t4, a1, a2
add a0, a0, t4
| Assignee | ||
Comment 4•4 months ago
|
||
cmpPtrMovePtr can be implemented through ma_cmp_mv.
| Assignee | ||
Comment 5•4 months ago
|
||
These two methods are no longer called after the changes from parts 3-4.
Updated•4 months ago
|
Comment 7•4 months ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/c7d9ce4be772
https://hg.mozilla.org/mozilla-central/rev/763e957c3693
https://hg.mozilla.org/mozilla-central/rev/2daf17ea90f2
https://hg.mozilla.org/mozilla-central/rev/0bd58ac6a734
https://hg.mozilla.org/mozilla-central/rev/c138d27657a9
Updated•4 months ago
|
Description
•