rajeshgangam requested wasmtime-compiler-s390x-reviewers for a review on PR #13797.
rajeshgangam opened PR #13797 from rajeshgangam:clobber-save-restore to bytecodealliance:main:
Summary
- When the Zca extension is enabled, split the SP adjustment in function prologues/epilogues so callee-saved stores use small SP-relative offsets that fit in
c.sdsp's 504-byte encoding range- All callee-save stores/loads compress from 4-byte
sd/ldto 2-bytec.sdsp/c.ldsp, saving ~28 bytes per function with 8 callee-saves- Without Zca, the original combined SP decrement is preserved — zero behavior change on existing tests
- Adds
isa_flagsparameter to theABIMachineSpec::gen_clobber_saveandgen_clobber_restoretrait methods so implementations can make ISA-specific decisionsBefore (main,
has_cenabled, 1KB frame + 8 callee-saves):addi sp, sp, -0x440 ; 4B combined (clobber+frame) sd s1, 0x438(sp) ; 4B offset > 504, can't compress sd s2, 0x430(sp) ; 4B ...After (with Zca):
c.addi16sp sp, -0x40 ; 2B clobber only c.sdsp s1, 0x38(sp) ; 2B offset ≤ 504, compressed c.sdsp s2, 0x30(sp) ; 2B ... addi sp, sp, -0x400 ; 4B remaining frameFixes #7190.
Test plan
- [ ] All 235 riscv64 compile filetests pass
- [ ] All 116 aarch64, 181 x64, 101 s390x, 49 pulley filetests pass (no regressions from trait change)
- [ ] New
c-clobber-save-restore.cliftest with 3 cases: 100KB frame, 512B boundary, max callee-saves- [ ] Existing 9 riscv64 test files have zero diff against main (non-Zca path unchanged)
:robot: Generated with Claude Code
rajeshgangam requested alexcrichton for a review on PR #13797.
rajeshgangam requested wasmtime-compiler-reviewers for a review on PR #13797.
rajeshgangam edited PR #13797:
Summary
- When the Zca extension is enabled, split the SP adjustment in function prologues/epilogues so callee-saved stores use small SP-relative offsets that fit in
c.sdsp's 504-byte encoding range- All callee-save stores/loads compress from 4-byte
sd/ldto 2-bytec.sdsp/c.ldsp, saving ~28 bytes per function with 8 callee-saves- Without Zca, the original combined SP decrement is preserved — zero behavior change on existing tests
- Adds
isa_flagsparameter to theABIMachineSpec::gen_clobber_saveandgen_clobber_restoretrait methods so implementations can make ISA-specific decisionsBefore (main,
has_cenabled, 1KB frame + 8 callee-saves):addi sp, sp, -0x440 ; 4B combined (clobber+frame) sd s1, 0x438(sp) ; 4B offset > 504, can't compress sd s2, 0x430(sp) ; 4B ...After (with Zca):
c.addi16sp sp, -0x40 ; 2B clobber only c.sdsp s1, 0x38(sp) ; 2B offset ≤ 504, compressed c.sdsp s2, 0x30(sp) ; 2B ... addi sp, sp, -0x400 ; 4B remaining frameFixes #7190.
Test plan
- [ ] All 235 riscv64 compile filetests pass
- [ ] All 116 aarch64, 181 x64, 101 s390x, 49 pulley filetests pass (no regressions from trait change)
- [ ] New
c-clobber-save-restore.cliftest with 3 cases: 100KB frame, 512B boundary, max callee-saves- [ ] Existing 9 riscv64 test files have zero diff against main (non-Zca path unchanged)
rajeshgangam edited PR #13797:
Summary
- When the Zca extension is enabled, split the SP adjustment in function prologues/epilogues so callee-saved stores use small SP-relative offsets that fit in
c.sdsp's 504-byte encoding range- All callee-save stores/loads compress from 4-byte
sd/ldto 2-bytec.sdsp/c.ldsp, saving ~28 bytes per function with 8 callee-saves- Without Zca, the original combined SP decrement is preserved — zero behavior change on existing tests
- Adds
isa_flagsparameter to theABIMachineSpec::gen_clobber_saveandgen_clobber_restoretrait methods so implementations can make ISA-specific decisionsBefore (main,
has_cenabled, 1KB frame + 8 callee-saves):addi sp, sp, -0x440 ; 4B combined (clobber+frame) sd s1, 0x438(sp) ; 4B offset > 504, can't compress sd s2, 0x430(sp) ; 4B ...After (with Zca):
c.addi16sp sp, -0x40 ; 2B clobber only c.sdsp s1, 0x38(sp) ; 2B offset ≤ 504, compressed c.sdsp s2, 0x30(sp) ; 2B ... addi sp, sp, -0x400 ; 4B remaining frameFixes #7190.
Test plan
- [ ] All 235 riscv64 compile filetests pass
- [ ] All 116 aarch64, 181 x64, 101 s390x, 49 pulley filetests pass (no regressions from trait change)
- [ ] New
c-clobber-save-restore.cliftest with 3 cases: 100KB frame, 512B boundary, max callee-saves- [ ] Existing 9 riscv64 test files have zero diff against main (non-Zca path unchanged)
rajeshgangam updated PR #13797.
github-actions[bot] added the label cranelift on PR #13797.
github-actions[bot] added the label cranelift:area:machinst on PR #13797.
github-actions[bot] added the label cranelift:area:aarch64 on PR #13797.
github-actions[bot] added the label cranelift:area:x64 on PR #13797.
fitzgen commented on PR #13797:
Hi, can you confirm that you are following our AI policy and have fully reviewed and understood the code here, and are willing to take responsibility for the code in the way that only a human can? Thanks.
Last updated: Jul 29 2026 at 05:03 UTC