RESOLVED FIXED 272901
[WASM] Avoid extraneous move for simple integer arithmetic in BBQ
https://bugs.webkit.org/show_bug.cgi?id=272901
Summary [WASM] Avoid extraneous move for simple integer arithmetic in BBQ
David Degazio
Reported 2024-04-18 09:42:29 PDT
When we emit various simple integer arithmetic instructions in BBQ with a constant operand, we currently use the MacroAssembler API pretty pessimistically, for example in i32.add: m_jit.move(ImmHelpers::regLocation(lhsLocation, rhsLocation).asGPR(), resultLocation.asGPR()); m_jit.add32(Imm32(ImmHelpers::imm(lhs, rhs).asI32()), resultLocation.asGPR()); It's well-supported in our MacroAssembler to perform a three-operand add (and other arithmetic instructions) even on platforms like x86, so we should just use that. It should save us from obviously redundant codegen like the following on ARM: mov x1, x0 add x1, x1, #1 ...and allow us to use instructions like lea on x86 to accomplish much the same.
Attachments
Radar WebKit Bug Importer
Comment 1 2024-04-18 09:42:58 PDT
David Degazio
Comment 2 2024-04-18 10:45:41 PDT
*** Bug 272902 has been marked as a duplicate of this bug. ***
David Degazio
Comment 3 2024-04-18 14:13:39 PDT
EWS
Comment 4 2024-04-19 17:09:15 PDT
Committed 277770@main (7a2375d28da4): <https://commits.webkit.org/277770@main> Reviewed commits have been landed. Closing PR #27473 and removing active labels.
Fujii Hironori
Comment 5 2024-04-21 13:47:39 PDT
Regressed: Bug 273048 – REGRESSION(277770@main): [Mac WK1, GTK, WPE, Win] ASSERTION FAILED: v <= 0 under MacroAssemblerX86Common::sub32
Note You need to log in before you can comment on or make changes to this bug.