Repository navigation
x64_recomp: SSE/SSE2 scalar floating-point and XMM move/bitwise emitters (X64-RECOMP-SSE-SCALAR) - #1202
x64_recomp: SSE/SSE2 scalar floating-point and XMM move/bitwise emitters (X64-RECOMP-SSE-SCALAR)#1202IlyassRS3 wants to merge 1 commit into
Conversation
…ers (X64-RECOMP-SSE-SCALAR)
|
Independent run with QEMU. Apple M5 Pro, macOS 27.2.1 (26B131), Python 3.14.2, QEMU 11.1.3 from Homebrew. I merged I found nothing wrong. 3,012 of 3,013 generated checks match Python's float arithmetic, and the one that does not is
Not tested: the packed and bitwise 128-bit forms, memory operands, non-default MXCSR rounding modes and the exception flags, the signalling difference between |
Claimed in the coordination issue as: X64-RECOMP-SSE-SCALAR (#14 (comment))
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.