Skip to content

ir/aarch64: emit cbz/cbnz instead of cmp + b.ne#22673

Closed
henderkes wants to merge 1 commit into
php:masterfrom
henderkes:xperf/jit-arm64-cbz-cbnz-guards
Closed

ir/aarch64: emit cbz/cbnz instead of cmp + b.ne#22673
henderkes wants to merge 1 commit into
php:masterfrom
henderkes:xperf/jit-arm64-cbz-cbnz-guards

Conversation

@henderkes

Copy link
Copy Markdown
Contributor

ir_emit_if_int used to emit

cmp   w1, #0
b.ne  >refcount_path

and now emits

cbnz  w1, >refcount_path

for

function f($x) {
    $s = "s" . $x;   // $s is a refcounted string
    unset($s);       // FREE: DELREF + maybe destroy, only if refcounted
}

LLM disclosure: this was fully found and done by Fable, all I did was verify correctness. ~ +1% in jit on phpbench for both Clang and GCC. No non-jit impact for obvious reasons.

@henderkes
henderkes force-pushed the xperf/jit-arm64-cbz-cbnz-guards branch from 933ecc3 to 6399e7d Compare July 10, 2026 13:17
@Girgias

Girgias commented Jul 10, 2026

Copy link
Copy Markdown
Member

Shouldn't this be opened against https://github.com/dstogov/ir ?

@henderkes

Copy link
Copy Markdown
Contributor Author

The file doesn't mention anything like that, but it certainly seems like the files are copied over. I'll copy it over there, thank you!

@henderkes henderkes closed this Jul 10, 2026
@henderkes
henderkes deleted the xperf/jit-arm64-cbz-cbnz-guards branch July 10, 2026 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants