Optimize compare with immediate zero on zero/nonzero
Categories
(Core :: JavaScript Engine: JIT, enhancement, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox85 | --- | fixed |
People
(Reporter: lth, Assigned: lth)
Details
Attachments
(3 files)
ARM64 has CBZ / CBNZ for compares with zero for equality / nonequality. We should emit these when it's convenient to do so.
Assignee | ||
Comment 1•4 years ago
|
||
Arm64 has special instructions for compare-with-zero for equality/nonequality,
so use them when we can. This makes code more compact, and may be a very small
speed win.
Assignee | ||
Comment 2•4 years ago
|
||
The branchTest primitives can use CBZ/CBNZ just as easily as the branch primitives can.
Depends on D97454
Assignee | ||
Comment 3•4 years ago
|
||
ARM64 is able to do a test-for-zero-and-branch in one instruction, and
branchTest32 will emit good code for that. The code generation for
testIAndBranch should therefore use branchTest32, not separate test
and branch operations.
Depends on D97477
Pushed by lhansen@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/7d79ac9d7608 Use CBZ/CBNZ on ARM64 when we can. r=nbp https://hg.mozilla.org/integration/autoland/rev/07a158ac17b3 Use CBZ/CBNZ on ARM64 also for branchTest. r=nbp https://hg.mozilla.org/integration/autoland/rev/28db3a41c2fe Fuse test and branch for testIAndBranch on ARM64. r=nbp
Comment 5•4 years ago
|
||
Backed out for causing arm64 bustages.
Backout link: https://hg.mozilla.org/integration/autoland/rev/cc6b9d58862f9a03b2223b3c696e8fcaba5ba94b
Failure log: https://treeherder.mozilla.org/logviewer?job_id=322296805&repo=autoland&lineNumber=11026
TEST-PASS | js/src/jit-test/tests/sunspider/check-string-fasta.js | Success (code 0, args "") [7.0 s]
[task 2020-11-19T13:15:05.697Z] WARNING: VIXL simulator support for load-/store-/clear-exclusive instructions is limited. Refer to the README for details.
[task 2020-11-19T13:15:05.697Z] /builds/worker/checkouts/gecko/js/src/jit-test/tests/wasm/atomic.js line 185 > WebAssembly.Module:63:1 RuntimeError: unaligned memory access
[task 2020-11-19T13:15:05.697Z] Stack:
[task 2020-11-19T13:15:05.697Z] @/builds/worker/checkouts/gecko/js/src/jit-test/tests/wasm/atomic.js:350:18
[task 2020-11-19T13:15:05.697Z] Exit code: 3
[task 2020-11-19T13:15:05.697Z] FAIL - wasm/atomic.js
[task 2020-11-19T13:15:05.697Z] TEST-UNEXPECTED-FAIL | js/src/jit-test/tests/wasm/atomic.js | WARNING: VIXL simulator support for load-/store-/clear-exclusive instructions is limited. Refer to the README for details. (code 3, args "--wasm-compiler=baseline") [0.6 s]
[task 2020-11-19T13:15:05.698Z] INFO exit-status : 3
[task 2020-11-19T13:15:05.698Z] INFO timed-out : False
[task 2020-11-19T13:15:05.698Z] INFO stderr 2> WARNING: VIXL simulator support for load-/store-/clear-exclusive instructions is limited. Refer to the README for details.
[task 2020-11-19T13:15:05.698Z] INFO stderr 2> /builds/worker/checkouts/gecko/js/src/jit-test/tests/wasm/atomic.js line 185 > WebAssembly.Module:63:1 RuntimeError: unaligned memory access
[task 2020-11-19T13:15:05.698Z] INFO stderr 2> Stack:
[task 2020-11-19T13:15:05.698Z] INFO stderr 2> @/builds/worker/checkouts/gecko/js/src/jit-test/tests/wasm/atomic.js:350:18
[task 2020-11-19T13:15:05.833Z] TEST-PASS | js/src/jit-test/tests/sunspider/check-access-fannkuch.js | Success (code 0, args "") [11.3 s]
Assignee | ||
Comment 6•4 years ago
|
||
There were problems in both of the later patches: branchTest32(..., imm32) should not be optimized, because that imm is never zero and when it is zero it means something else than what the new code made it mean; and the two optimizations that made calls to branchTest32(..., Imm32(0)) should not call that but should instead call branch32(..., Imm32(0)), which then implements the correct optimization.
Pushed by lhansen@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a932382525cf Use CBZ/CBNZ on ARM64 when we can. r=nbp https://hg.mozilla.org/integration/autoland/rev/220d93fdaa19 Use CBZ/CBNZ on ARM64 also for branchTest. r=nbp https://hg.mozilla.org/integration/autoland/rev/c20b492e2ebe Fuse test and branch for testIAndBranch on ARM64. r=nbp
Comment 8•4 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/a932382525cf
https://hg.mozilla.org/mozilla-central/rev/220d93fdaa19
https://hg.mozilla.org/mozilla-central/rev/c20b492e2ebe
Description
•