cpu: lower AVX VEX FP compare instructions #973
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!973
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/973/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 19:22 UTC · original
Ammmae0x:cpu/avx-cmp-fp→main· +1236 −0 · 6 files · 1 commits · closed without mergingChange
Add VEX AVX floating-point compare lowering (
tools/ffx_version_query.py) and differential fixture coverage (tests/cpu/avx_cmp_fp.{asm,def,py},CMakeLists.txt,docs/experiments.md) for four uncovered x64 Zen 2AVXmnemonics:vcmpps(VEX.128 and VEX.256, register and unalignedm128/m256operands)vcmppd(VEX.128 and VEX.256, register and unalignedm128/m256operands)vcmpss(VEX.128, register and unalignedm32operands)vcmpsd(VEX.128, register and unalignedm64operands)The lowering (
avx_cmp_pred,avx_cmp_f32,avx_cmp_f64inINTEGER_HEADERpluslower_avx_cmp_fp) implements all 32 AVX predicate immediates (imm8 & 0x1f) using portable SSE2_mm_comi*/_mm_ucomi*intrinsics and bit-level NaN checks (compatible with non-/arch:AVXMSVC builds), preserving ordered/unordered NaN semantics, quiet vs. signaling MXCSR#I, DAZ handling, upper-lane preservation (4..15onvcmpss,8..15onvcmpsd), and upper-128-bit zeroing on XMM destinations. EVEX encodings, legacy SSE encodings, untracked vector registers (xmm3/ymm3), segment prefixes, EIP-relative operands, mixed XMM/YMM widths, mismatched memory operand sizes, and non-imm8predicates are rejected.Verification
Tested on commit
75dd03f(branchcpu/avx-cmp-fp, x64 Windows host with AVX):ctest --preset dev -N: 503 total tests (cpu_aot_avx_cmp_fpregistered as Test #216 withSKIP_RETURN_CODE 77; no test drops or regressions).cmake --preset dev+cmake --build --preset dev --clean-first --target cpu_avx_cmp_fp_lifted cpu_avx_horiz_fp_lifted cpu_avx_scalar_fp_lifted cpu_version_query_lifted: succeeded with 0 errors, 0 warnings.cmake --preset release+cmake --build --preset release --target cpu_avx_cmp_fp_lifted cpu_avx_horiz_fp_lifted cpu_avx_scalar_fp_lifted cpu_version_query_lifted: succeeded with 0 errors, 0 warnings.ctest --preset dev --no-tests=error -R "^(cpu_aot_avx_cmp_fp|cpu_aot_avx_horiz_fp|cpu_aot_avx_scalar_fp|cpu_aot_version_query)$" -V: 4/4 passed (cpu_aot_avx_cmp_fp: 1760 VEX AVX FP compare cases across 217 exports and 2 MXCSR modes + guard-page bounds + 18 byte-decoded & 11 synthetic rejections + 4 mutated controls;cpu_aot_avx_horiz_fp: 632 cases + 2 mutated controls;cpu_aot_avx_scalar_fp: 39 cases;cpu_aot_version_query: passed).ctest --preset release --no-tests=error -R "^(cpu_aot_avx_cmp_fp|cpu_aot_avx_horiz_fp|cpu_aot_avx_scalar_fp|cpu_aot_version_query)$" -V: 4/4 passed with matching counts..\out\pe-env\Scripts\python.exe -B tests/form_coverage_check.py,tests/docs_links_check.py,tests/bidi_controls_check.py: all passed (13 Markdown files / 195 links; 796 tracked files).tools/form_coverage.pyoncpu_aot_avx_cmp_fpJUnit XML:vcmpps,vcmppd,vcmpss,vcmpsdall counted as covered inAVX.Evidence and follow-up
tests/cpu/avx_cmp_fp.asm) and Python differential check (tests/cpu/avx_cmp_fp.py) with an independent IEEE-754 comparison reference model, unaligned memory offsets, VirtualAlloc guard-page bounds checks, 18 byte-decoded + 11 synthetic rejection controls, and 4 mutated C++ negative controls.AVXforms indocs/coverage/x64_zen2.tsv(vaddsubps/pd,vptest,vtestps/pd,vldmxcsr,vstmxcsr,vmovq,vmaskmovdqu) are out of scope for this PR.Checklist
AI-assisted.
@R0Y00 on GitHub · 2026-11-23 19:36 UTC · original
Both Windows jobs stop while generating the lifted fixture:
mutated control vcmpps_flipped_ord_unord_control changed nothing. The standalone head builds locally. In GitHub's merge candidate, main's existingelif op in avx_comparehandles all four mnemonics before the added branch, so the generated body uses the existing compare intrinsic and the mutation never matches. Please keep the stronger all-predicate, guard-page and MXCSR comparisons as a fixture on current main. Make the controls change the actual emitted instruction path, keep their failure assertions, and report any native-versus-main mismatch separately before replacing that lowering.@Ammmae0x on GitHub · 2026-11-23 19:43 UTC · original
Closing as superseded by merged #393, which already covers
vcmpps,vcmppd,vcmpss, andvcmpsd. AI-assisted.Pull request closed