cpu: add legacy SSE4.1 FP AOT lifter and test suite #2683
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2691"
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?
Imported from R0Y00/Xbox2Windows. Originally posted by Ammmae0x on 2026-11-26T02:09:25Z.
Change
Add a bounded AOT lifter (
tools/cpu_sse41_fp_aot.py) and source-built MASM/differential verification suite (tests/cpu/sse41_fp_aot.{asm,def,_check.py}, CTestcpu_aot_sse41_fp) covering all 8 legacy SSE4.1 floating-point instructions in register and flat[rcx|rdx|r8]memory forms:ROUNDPS,ROUNDPD,ROUNDSS,ROUNDSD: modelsimm8[1:0]whenimm8[2]==0or host MXCSR RC whenimm8[2]==1, handling-0.0,+/-Inf, qNaN/sNaN quieting, MXCSR DAZ, and scalar destination upper-lane preservation.DPPS,DPPD: source masksimm8[7:4]/imm8[5:4], pairwise SSE2 reduction under host MXCSR (RC, DAZ, FTZ), and destination masksimm8[3:0]/imm8[1:0](disabled outputs set to+0.0).INSERTPS: selectscount_s = imm8[7:6]from register or lane 0 fromm32, inserts atcount_d = imm8[5:4], and applieszmask = imm8[3:0]last.EXTRACTPS: extracts laneimm8[1:0]to volatile scratchr32/r64(zero-extending[63:32]) or flatm32[r8].MOVAPS/D/UPS/D/DQA/DQU/SS/SD, scratch 32/64-bitMOV, terminalRET) with strict refusal of VEX/EVEX encodings, nonvolatileXMM6..15and nonvolatile GPRs, argument GPR writes, undefined reads, non-flat/displaced/indexed/RIP-relative memory operands, non-[r8]stores, prefixes, and missing/trailingret.Verification
Verified on commit
f294a2c0(based onupstream/mainf02ebd66) on Windows x64 (MSVC, bothdevDebug andrelease/O2):ctest --preset dev -N-> 2178 total tests,cpu_aot_sse41_fpregistered withSKIP_RETURN_CODE 77andFORM_COVERAGE_RECORD.cmake --build --preset dev --clean-first --target cpu_sse41_fp_aot_original cpu_sse41_fp_aot_original_lifted cpu_sse41_fp_aot_altered cpu_sse41_fp_aot_altered_lifted-> exit 0, 0 errors, 0 warnings.ctest --preset dev --no-tests=error -R '^cpu_aot_sse41_fp$' -E 'cpu_native_archive_' -V-> 1/1 passed: 33 forms accepted, 33 refusal controls, 5 CLI negative checks, 2263 differential cases across 57 exports and 7 MXCSR modes (RN/RD/RU/RZ, DAZ, FTZ, DAZ+FTZ), 8ALTER_SSE41_FPaltered controls diverged,FORM_COVERAGE_RECORDemitted 18 forms (dppd, dpps, extractps, insertps, mov, movapd, movaps, movdqa, movdqu, movsd, movss, movupd, movups, ret, roundpd, roundps, roundsd, roundss).cmake --build --preset release --clean-first --target cpu_sse41_fp_aot_original cpu_sse41_fp_aot_original_lifted cpu_sse41_fp_aot_altered cpu_sse41_fp_aot_altered_lifted-> exit 0, 0 errors, 0 warnings.ctest --preset release --no-tests=error -R '^cpu_aot_sse41_fp$' -E 'cpu_native_archive_' -V-> 1/1 passed (same 2263 cases + 8 altered controls + 18 forms under/O2).out\pe-env\Scripts\python.exe -B tests\form_coverage_check.py,tests\docs_links_check.py,tests\bidi_controls_check.py-> all exit 0.tests/cpu/sse41_fp_aot_check.py): disabling legacy-only encoding check, disabling non-[r8]store guard, and disabling argument GPR write guard.CPUID.01H:ECX[19](SSE4.1) and exits77when unavailable; 0 capability skips on this host.Evidence and follow-up
tests/cpu/sse41_fp_aot.asmand module definitiontests/cpu/sse41_fp_aot.defare original repository files under MIT License (no external dumps or binaries).; coverage: record cpu_aot_sse41_fpfor automated x64 form coverage tracking.Checklist
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T03:18:00Z.
Review: COMMENTED
Review of head
82fc6044(comment only).Checked:
tools/cpu_sse41_fp_aot.py) and source-built MASM/CTest differential suitecpu_aot_sse41_fp(ROUNDPS/PD/SS/SD, DPPS/DPPD, INSERTPS, EXTRACTPS). Same dedicated-suite pattern as the othercpu_*_aotlifters. The earlier lowering PRs in the shared lifter are separate; the nearest open PR (#2390, VEX rounding) covers different encodings.foreach/endforeachbalanced,SKIP_RETURN_CODE 77andFORM_COVERAGE_RECORDset.Commands run:
git diff --check origin/main...HEAD: cleanpython3 tests/docs_links_check.py: passpython3 tests/bidi_controls_check.py: passx2w_pipe.py win2025 2691 --regex cpu_aot_sse41_fp: dev 1/1 and release 1/1 passed (receipt in the next comment)Not run: the Python suite on Linux (it needs MASM and the Windows build).
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T03:18:01Z.
Win2025 WARP receipt for head
82fc6044after updating with main.Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
82fc6044fc4e331854ce53f5882460f2da2640bb:--preset dev):cmake --build --preset dev --target cpu_sse41_fp_aot_altered cpu_sse41_fp_aot_altered_lifted cpu_sse41_fp_aot_original cpu_sse41_fp_aot_original_lifted -- -j 2):10.12s(configure3.99s)ctest --preset dev -R 'cpu_aot_sse41_fp' --parallel 2 --no-tests=error --output-on-failure): 1/1 passed (1.63s:cpu_aot_sse41_fp1.37s)/O2(--preset release):cmake --build --preset release --target cpu_sse41_fp_aot_altered cpu_sse41_fp_aot_altered_lifted cpu_sse41_fp_aot_original cpu_sse41_fp_aot_original_lifted -- -j 2):2.95s(configure4.95s)ctest --preset release -R 'cpu_aot_sse41_fp' --parallel 2 --no-tests=error --output-on-failure): 1/1 passed (1.49s:cpu_aot_sse41_fp1.24s)sccache: 0/4 hits; wall41.7sAI-assisted; commands listed were executed locally.