cpu: lower VEX vaddsubps and vaddsubpd #1008
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1015"
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 zohaiblazuli on 2026-11-23T21:17:50Z.
Change
Lower the VEX.128 and VEX.256 alternating floating-point add/subtract forms
vaddsubpsandvaddsubpdin the shared lowering (tools/ffx_version_query.py). Both wereobserved_without_passrows in theAVXgroup ofdocs/coverage/x64_zen2.tsv.The forms go through the existing per-lane SSE3 path used for
vhaddps/vhsubps(#926), with_mm_addsub_psand_mm_addsub_pd. That path already accepts register and unalignedm128/m256sources, zeroes bits 255:128 for 128-bit destinations, and rejects EVEX, untracked registers, segment prefixes and EIP-relative operands. So the lowering change is two table entries plus a docstring and diagnostic wording update.Refs #387. Its original scope listed these two forms. They were dropped when it was narrowed to
vminps/vmaxps, with the note that the other floating-point forms could be assessed with their own native evidence. This PR provides that evidence forvaddsubps/vaddsubpdonly. No shared interface changes.tests/cpu/sse34_fp.pyhad a rejection control expecting register-formvaddsubps xmm0, xmm1, xmm2to be refused. That form is now accepted, so the control usesvaddsubps xmm0, xmm1, xmm3instead (untracked source), which remains refused. The control still exercises the VEX addsub encoding.Verification
Commit
5246da9onmainat2067f54. Windows 11 build 26300.10075, MSVC 19.50.35728 x64, Intel Core i5-14600K (AVX).cpu_aot_avx_addsub_fp: 400 cases across 14 exports and 7 MXCSR modes matched the native DLL and the IEEE-754 reference; 3 mutated controls mismatched.cpu_aot_avx_horiz_fp: 632 cases, unchanged, passed.cpu_aot_sse34_fp: 950 cases, passed with the retargeted control.The same three tests passed 3/3 with the
releasepreset (/O2).docs_linkspassed, andpython -B tests/form_coverage_check.pyreported "form coverage checks passed". Runningtools/form_coverage.py --gaps x64_zen2on a full non-hardware run ofmainlistedvaddsubpsandvaddsubpdasobserved_without_pass. With this change, the fixture is classifiedpassand neither form appears in the gaps.Evidence and follow-up
New fixture
tests/cpu/avx_addsub_fp.asmis original MASM source (MIT), with 14 exports:dst = src1,dst = src2,src1 = src2and all-aliased register forms;Inputs use distinct values per element and lane, so swapped elements, swapped add/sub positions, or a dropped upper lane all change the output. They cover:
inf - inf(invalid only in subtract positions);The test reuses the IEEE-754 reference model, guarded buffers and AVX/MXCSR probes from
tests/cpu/avx_horiz_fp.pyrather than copying them. It exits 77 on hosts without AVX. The mutated controls are:ps;pd;Reproduction steps are in
docs/experiments.md, next to the horizontal FP entry. The legacyaddsubps/addsubpdpath insse34_fpis unchanged.Checklist