mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-27 00:00:52 +01:00
[PR #1202] x64_recomp: SSE/SSE2 scalar floating-point and XMM move/bitwise emitters (X64-RECOMP-SSE-SCALAR) #1234
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#1234
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/1202
Author: @IlyassRS3
Created: 11/24/2026
Status: 🔄 Open
Base:
main← Head:feat/x64-recomp-sse-scalar📝 Commits (1)
e61deb5x64_recomp: SSE/SSE2 scalar floating-point and XMM move/bitwise emitters (X64-RECOMP-SSE-SCALAR)📊 Changes
3 files changed (+1141 additions, -32 deletions)
View changed files
📝
docs/mobile.md(+9 -0)➕
tests/test_x64_recomp_sse.py(+723 -0)📝
tools/x64_recomp.py(+409 -32)📄 Description
Claimed in the coordination issue as: X64-RECOMP-SSE-SCALAR (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7143077050)
What and why
Advances Next Step #2 of
docs/mobile.mdby adding legacy0FSSE/SSE2 scalar floating-point, conversion, comparison, and 128-bit XMM move/bitwise decoding and arm64 emission totools/x64_recomp.py(independent of#1174and conflict-free with all openx64_recompPRs).0FSSE/SSE2 decoder (_OF_SSE): decodesxmm0–xmm15(("x", reg, size)), width specsx(16B) andy(4/8B viaREX.W, ignoring0x66), mandatoryF2/F3precedence over66, and keeps unprefixed MMX encodings as unhandled"simd".Asm): addsfldr/fstr(S/D/Q),fadd/fsub/fmul/fdiv/fsqrt,fcmp/fcsel,fmov_r/fmov_to_fp/fmov_to_gpr,fcvt_s2d/fcvt_d2s,scvtf/fcvtzs/fcvtns,vins0,vand16b/vbic16b/vorr16b/veor16b, plus EL1CPACR_EL1.FPENenable inbuild_test_kernelfor bare-metal QEMU runs.XMAP:xmm0–xmm15->v0–v15, scratchv28–v30):add/sub/mul/div/sqrt/min/max(ss/sd),cvt*, and registermovss/movsdwrite lane 0 viainsso upper XMM bits are preserved; memorymovss/movsdandmovd/movqzero-extend to 128 bits.minss/minsd/maxss/maxsdimplement exact x86 NaN and±0.0second-operand rules viafcmp+fcsel(mi/gt) while preserving liveNZCV.ucomis*/comis*(FCMP_KIND) map all 16 x86 conditions across ordered and unordered (PF/ZF/CF,OF=SF=AF=0) results on both the arm64NZCVfast path and materializedCTX_EFLAGS(includingsetcc,cmov,pushf,lahf,adc/sbb/cmc, and interveninginc/dec).cvttss2si/cvttsd2si/cvtss2si/cvtsd2si, 32/64-bit) return x86 integer indefinite (INT32_MIN/INT64_MIN) forNaNand overflow (including2147483647.5forcvtsd2sivscvttsd2si) while preserving liveNZCV.movaps/movups/movapd/movupd/movdqa/movdqu) and bitwise ops (xorps/xorpd/pxor,andps/andpd/pand,andnps/andnpd/pandnas(~dst) & src,orps/orpd/por)._ctx_jcc_regemittedtst_i(w, EF_CF | EF_ZF)(0x41is not a valid arm64 bitmask immediate) on cross-blockja/jbe/seta/setbe; replaced withmovz+tst_r._classifytaggedlahf/sahfaskind="conv"instead of"alu", making their_emit_aluhandler unreachable.tests/test_x64_recomp_sse.py): 16 tests covering decoding, LLVM 21–verified arm64 FP/SIMD encodings, translation/liveness, and 8 end-to-end execution tests (SSEExecTests, which run automatically with the Mach-O runner once#1174lands or under QEMU).Tested
main:python3 -I tests/test_x64_recomp_sse.py -v(8 cross-platform passed, 8 exec cleanly skipped without QEMU),tests/test_x64_recomp.py,tests/test_recomp_census.py,tests/test_ci_registration.py,tests/test_text_write_line_endings.py,tests/test_tool_startup.py, all 11tests/test_docs_*.py,tests/test_i18n_index.py,compileall,make_game.py --help,check_no_game_data.py: all passed.#1174in a scratch checkout):tests/test_x64_recomp_sse.py16/16 passed (all 8SSEExecTestsexecuted natively) andtests/test_x64_recomp.py46/46 passed.git apply --check) against openx64_recompPRs#847,#950,#1120,#1121, and#1174.GPUs tested: n/a (CPU x86-64 -> arm64 recompiler; tested natively on Apple M5 arm64, macOS 27.2.1)
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.