Closed Bug 2051485 Opened 4 months ago Closed 4 months ago

Improve address calculations in riscv64

Categories

(Core :: JavaScript Engine: JIT, enhancement, P1)

enhancement

Tracking

()

RESOLVED FIXED
154 Branch
Tracking Status
firefox154 --- fixed

People

(Reporter: anba, Assigned: anba)

References

(Blocks 1 open bug)

Details

Attachments

(8 external files)

No description provided.

To reduce the common code sequence when calling the existing
computeScaledAddress method.

Also directly add the offset if it doesn't fit into i12 load/store immediate.

Next parts will add more optimisations to this method.

If the index is known to be zero, no shift/add instructions are needed.

Part 5 will pass zero index to this method.

Reduce code duplication to split a value into two i12 immediates.

Part 4 will also call this new function.

RISCV64 allows the following optimisation for address offset computations:

  1. If the offset fits into i12, directly pass to the load/store instruction.
  2. If the offset fits into two i12, add one half using addi and pass the
    other half to the load/store instruction.
  3. If the offset can be split into high i20 and low i12, and adding the
    low i12 can be performed through 64-bit add, use load high i20 through
    lui and pass low i12 to the load/store instruction.
  4. Otherwise load the offset as Imm32 through ma_li.

Also add zero store optimisation to LWasmStoreI64.

Severity: -- → N/A
Priority: -- → P1
Pushed by andre.bargull@gmail.com: https://github.com/mozilla-firefox/firefox/commit/c8ebdd123baf https://hg.mozilla.org/integration/autoland/rev/5cb83b2761ba Part 1: Add MacroAssemblerRiscv64::computeScaledAddress with Address result. r=spidermonkey-reviewers,jandem https://github.com/mozilla-firefox/firefox/commit/4e971c3c2c3f https://hg.mozilla.org/integration/autoland/rev/5efe9e258899 Part 2: Handle zero index in computeScaledAddress. r=spidermonkey-reviewers,jandem https://github.com/mozilla-firefox/firefox/commit/8d9b4146a5be https://hg.mozilla.org/integration/autoland/rev/3453e6f1b549 Part 3: Add ToTwoInt12. r=spidermonkey-reviewers,jandem https://github.com/mozilla-firefox/firefox/commit/8ddde740e8a3 https://hg.mozilla.org/integration/autoland/rev/a6d59f23f4ea Part 4: Shorter address computations. r=spidermonkey-reviewers,jandem https://github.com/mozilla-firefox/firefox/commit/b7f3d183a7cc https://hg.mozilla.org/integration/autoland/rev/e6626976072d Part 5: Better code generation for loads from/stores to constant heap offsets for riscv64. r=spidermonkey-reviewers,jandem https://github.com/mozilla-firefox/firefox/commit/fbe9a18cd249 https://hg.mozilla.org/integration/autoland/rev/fdc7797d7f3d Part 6: Don't clobber index register in Wasm{Load,Store}I64. r=spidermonkey-reviewers,jandem https://github.com/mozilla-firefox/firefox/commit/7cbbef5f2504 https://hg.mozilla.org/integration/autoland/rev/878b55833905 Part 7: Optimise zero wasm-stores for riscv64. r=spidermonkey-reviewers,jandem https://github.com/mozilla-firefox/firefox/commit/759b8b253d41 https://hg.mozilla.org/integration/autoland/rev/fbb5ff2bd27b Part 8: Sync arm64 with riscv64. r=spidermonkey-reviewers,jandem
Regressions: 2054456
QA Whiteboard: [qa-triage-done-c155/b154]
See Also: → 2061116
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: