cpu: lower AVX horizontal floating-point add and subtract instructions #926
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!926
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/926/head"
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?
@Ammmae0x on GitHub · 2026-11-23 17:23 UTC · original
Ammmae0x:cpu/avx-horiz-fp→main· +782 −0 · 6 files · 2 commits · merged 2026-11-23 17:50 UTCChange
Lower the four VEX-encoded AVX horizontal floating-point add/subtract instructions (
vhaddps,vhaddpd,vhsubps,vhsubpd) intools/ffx_version_query.pyusing a shared helper (lower_avx_horiz_fp+avx_horiz_fp_ops):XMM0–XMM2(zeroing destination bytes[16:32]per VEX semantics) and 256-bitYMM0–YMM2(independent 128-bit lanes), with both register and unalignedm128/m256memorysrc2operands._mm_hadd_ps,_mm_hadd_pd,_mm_hsub_ps,_mm_hsub_pd) per 128-bit lane to preserve hardware NaN payloads, signed zeros, rounding modes, DAZ, and FTZ semantics.xmm3+/ymm3+), segment prefixes, EIP-relative addressing, and mismatched operand shapes withValueError.tests/cpu/avx_horiz_fp.{asm,def,py}, registerscpu_avx_horiz_fp,cpu_avx_horiz_fp_lifted, andcpu_aot_avx_horiz_fp(SKIP_RETURN_CODE 77) inCMakeLists.txt, and documents the fixture indocs/experiments.md.Verification
cmake --build --preset dev --target cpu_avx_horiz_fp cpu_avx_horiz_fp_liftedandcmake --build --preset release --target cpu_avx_horiz_fp cpu_avx_horiz_fp_lifted: 0 errors, 0 warnings in both Debug (dev) and/O2(release).ctest --preset dev --no-tests=error -R "^cpu_aot_(avx_horiz_fp|avx2_regs|avx_int_regs|avx_move_regs|float_packed|sse41_42_misc)$" -V:6/6passed (cpu_aot_avx_horiz_fp:632 VEX AVX horizontal FP cases across 22 exports and 7 MXCSR modes matched native DLL and IEEE-754 reference; 2 mutated controls mismatched, plus 16 rejection controls).ctest --preset release --no-tests=error -R "^cpu_aot_(avx_horiz_fp|avx2_regs|avx_int_regs|avx_move_regs|float_packed|sse41_42_misc)$" -V:6/6passed (cpu_aot_avx_horiz_fp:632cases +2mutated controls)..\out\pe-env\Scripts\python.exe -B tests/form_coverage_check.py:form coverage checks passed/Self-test passed..\out\pe-env\Scripts\python.exe -B tests/docs_links_check.py:Checked 13 Markdown files and 178 links. Self-test passed..\out\pe-env\Scripts\python.exe -B tests/bidi_controls_check.py:Checked 725 tracked source, script and build/CI files: no bidirectional controls.tools/form_coverage.pyagainstctest --preset dev -R "^cpu_"JUnit output:vhaddps,vhaddpd,vhsubps,vhsubpdare covered (+4 net new covered x64 Zen 2AVXforms,799 of 948total).Evidence and follow-up
tests/cpu/avx_horiz_fp.{asm,def,py}are original source-built MASM and Python fixtures contributed under the MIT License.Fractionreference across aliasing (dst == src1,dst == src2,src1 == src2,dst == src1 == src2), unalignedm128/m256loads, upper-16-byte zeroing, QNaN/SNaN payloads, signed zeros, infinities, subnormals, and 7 MXCSR rounding/DAZ/FTZ modes, alongside 16 rejection controls and 2 mutated negative controls.Checklist
AI-assisted.
@R0Y00 on GitHub · 2026-11-23 17:33 UTC · original
I independently built and tested
4673aeewith MSVC 19.51 x64 Release. cpu_aot_avx_horiz_fp passed all 632 cases across 22 exports and seven MXCSR modes, with both mutants detected. I will check the full GitHub run and current mergeability before merging.@R0Y00 on GitHub · 2026-11-23 17:36 UTC · original
I integrated the branch with current main at
56ef0bfand retained the adjacent integer and shuffle fixtures. Windows x64 Release passed all four focused AVX tests. The horizontal case still matched 632 cases and caught both mutations; the existing guard-page and VZEROALL ABI controls also passed. Waiting for CI on the combined head.