cpu: lower VEX.128/256 AVX horizontal and addsub FP ops in cpu_avx_horiz_fp_aot #2621
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2629"
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-25T23:37:21Z.
Change
Add a dedicated AVX horizontal and alternating add/sub floating-point AOT translator (
tools/cpu_avx_horiz_fp_aot.py), MASM fixture (tests/cpu/avx_horiz_fp_aot.asm,tests/cpu/avx_horiz_fp_aot.def), and differential/refusal/coverage check (tests/cpu/avx_horiz_fp_aot_check.py), registered inCMakeLists.txtascpu_aot_avx_horiz_fp_dedicated(SKIP_RETURN_CODE 77+FORM_COVERAGE_RECORD).[rcx|rdx|r8]memory-source forms:VHADDPS,VHADDPD,VHSUBPS,VHSUBPD,VADDSUBPS, andVADDSUBPD, plusVMOVAPS/VMOVAPD/VMOVUPS/VMOVUPDglue,VZEROUPPER, andRET.[255:128]zeroing, aliaseddst/src1/src2read-before-write semantics, unaligned memory loads/stores, and MXCSR rounding/FTZ/DAZ +-0.0/denormal/Inf/NaN behavior.XMM6..15/YMM6..15/ZMM*), undefined vector reads, displaced/indexed/RIP-relative/non-argument memory operands, non-[r8]stores, instruction prefixes, and missing/trailingret; use sibling-temp atomic.cppwrites.CPUID.01H:ECX[27:28](OSXSAVE+AVX) +XGETBV(0)[2:1](exit77when unsupported).Verification
Commit:
93078265(rebased onupstream/mainb97bb64d) on Windows x64 (MSVCcl+ Ninja via.\tools\dev.ps1):cmake --preset dev+cmake --build --preset dev --target cpu_avx_horiz_fp_aot_original cpu_avx_horiz_fp_aot_original_lifted cpu_avx_horiz_fp_aot_altered cpu_avx_horiz_fp_aot_altered_lifted-> 0 errors, 0 warningsctest --preset dev -N-> listscpu_aot_avx_horiz_fp_dedicated(no dropped tests)ctest --preset dev --output-on-failure -R "^cpu_aot_avx_horiz_fp_dedicated$" -E "cpu_native_archive_" -V-> 1/1 Passed (48 accepted forms, 19 refusal controls, 910 differential cases across 31 exports and 7 MXCSR modes matched native DLL and IEEE-754 reference, 4 altered controls diverged;FORM_COVERAGE_RECORDrecorded 12 mnemonics:ret, vaddsubpd, vaddsubps, vhaddpd, vhaddps, vhsubpd, vhsubps, vmovapd, vmovaps, vmovupd, vmovups, vzeroupper)cmake --preset release+cmake --build --preset release --target cpu_avx_horiz_fp_aot_original cpu_avx_horiz_fp_aot_original_lifted cpu_avx_horiz_fp_aot_altered cpu_avx_horiz_fp_aot_altered_lifted-> 0 errors, 0 warnings (/O2)ctest --preset release --output-on-failure -R "^cpu_aot_avx_horiz_fp_dedicated$" -E "cpu_native_archive_" -V-> 1/1 Passed (910 cases, 4 altered controls diverged,FORM_COVERAGE_RECORD12 mnemonics)out\pe-env\Scripts\python.exe -B tests\form_coverage_check.py-> exit 0out\pe-env\Scripts\python.exe -B tests\docs_links_check.py-> exit 0 (19 Markdown files, 507 links)out\pe-env\Scripts\python.exe -B tests\bidi_controls_check.py-> exit 0 (1866 tracked files)tools/cpu_avx_horiz_fp_aot.py(nonvolatile vector guard, undefined vector guard,[r8]-only store guard, zero-displacement memory guard, VEX.128 width flag): 5/5 killed.Evidence and follow-up
tests/cpu/avx_horiz_fp_aot.asmandtests/cpu/avx_horiz_fp_aot.defare source-built MASM fixtures authored for this repository (MIT License), assembled intooriginalandaltered(ALTER_AVX_HORIZ_FP) DLLs to provide both positive differential checks and diverging negative controls.Checklist
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T23:41:49Z.
Review: COMMENTED
Review of head
93078265against current main (6 commits behind, no overlap in files).What I checked:
tools/cpu_avx_horiz_fp_aot.py: the six ops (VHADD/VHSUB/VADDSUB, PS and PD) are lowered per 128-bit lane with the matching SSE3 intrinsics, so the in-lane pairing of the 256-bit forms is right; VEX.128 forms zero bits [255:128]. Refusal list (EVEX, legacy SSE, XMM/YMM6..15, displaced/indexed memory, non-[r8] stores, prefixes, missing/trailing ret) matches the docstring.cpu_avx_int_aot/cpu_avx_fp_move_aot. The latter explicitly refuses VADDSUB, so there is no overlap.cpu_aot_avx_horiz_fp_dedicatedis a native-vs-lifted differential over 7 MXCSR modes, with refusal controls and 4 altered-DLL controls that must diverge, so it guards the behavior. It needs the MASM fixture, so it only runs on Windows; it exits 77 when AVX/OSXSAVE is missing.cpu_aot_*pattern (SKIP_RETURN_CODE 77, FORM_COVERAGE_RECORD).Commands run (Linux):
git diff --check origin/main...HEAD-> cleanpython3 tests/docs_links_check.py-> ok (19 files, 507 links)python3 tests/bidi_controls_check.py-> okNo blocking findings.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T23:42:57Z.
Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
93078265b51066f03735d9b86c5fe5b64fcebd9e:--preset dev):cmake --build --preset dev --target cpu_avx_horiz_fp_aot_altered cpu_avx_horiz_fp_aot_altered_lifted cpu_avx_horiz_fp_aot_original cpu_avx_horiz_fp_aot_original_lifted -- -j 2):0.84s(configure0.00s)ctest --preset dev -R '^cpu_aot_avx_horiz_fp_dedicated$' --parallel 6 --no-tests=error --output-on-failure): 1/1 passed (0.65s:cpu_aot_avx_horiz_fp_dedicated0.51s)/O2(--preset release):cmake --build --preset release --target cpu_avx_horiz_fp_aot_altered cpu_avx_horiz_fp_aot_altered_lifted cpu_avx_horiz_fp_aot_original cpu_avx_horiz_fp_aot_original_lifted -- -j 2):0.86s(configure0.00s)ctest --preset release -R '^cpu_aot_avx_horiz_fp_dedicated$' --parallel 6 --no-tests=error --output-on-failure): 1/1 passed (0.58s:cpu_aot_avx_horiz_fp_dedicated0.45s)sccache: 4/17 hits; wall8.5sAI-assisted; commands listed were executed locally.