cpu: support NEG flags and SETcc/CMOVcc in cpu_sse_aot #747
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/753"
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-23T00:53:48Z.
Change
Fixes #743
Update
ScalarLifterandlift()intools/cpu_sse_aot.pyso the scalar-float leaf lifter handlesNEGflag producers andSETcc/CMOVccGPR instructions via the sharedcpu_switch_aothelpers:CMOVCC,FLAG_PRODUCERS,SETCC, andflag_producerfromcpu_switch_aot.FLAG_PRODUCERS(includingNEG) incondition()instead of hardcoding(*ALU, CMP, TEST, INC, DEC).flag_producer(function, edges, ins)forSETcc/CMOVccinstructions inlift(), mark their flag producers insets_flags, and passsets_flagsandproducerthroughScalarLifter.statement()toLifter.statement().neg_jcc,setcc_mix, andcmovcc_mixfixtures (tests/cpu/scalar_float.asm,tests/cpu/scalar_float.def,CMakeLists.txt) plus positive and negative controls intests/cpu/scalar_float_check.py.Verification
Tested at commit
d766349(onupstream/maincfb2600) with MSVC19.50.35727(ml6414.50.35727.0), Windows SDK10.0.26100.0, CMake4.2.3-msvc3, Ninja1.12.1, and Python3.12.8(out/pe-env):ctest --preset dev -N:324tests (devandrelease, unchanged).cpu_float_original,cpu_float_original_lifted,cpu_float_swapped,cpu_float_swapped_lifted): built in bothdevandreleasewith0errors and0warnings.ctest --preset dev --no-tests=error -R "^cpu_" -V:132passed,0skipped,2failed (#197 cpu_native_archive_reader,#198 cpu_native_archive_blast, unrelated missingziglang);#121 cpu_aot_scalar_floatpassed (1.14 s).ctest --preset release --no-tests=error -R "^cpu_" -V:132passed,0skipped,2failed (sameziglangtests);#121 cpu_aot_scalar_floatpassed (0.95 s)..\out\pe-env\Scripts\python.exe -B tests/form_coverage_check.py: exit0..\out\pe-env\Scripts\python.exe -B tests/docs_links_check.py: exit0(11Markdown files,135links)..\out\pe-env\Scripts\python.exe -B tests/bidi_controls_check.py: exit0(616tracked files).Evidence and follow-up
All new fixtures (
neg_jcc,setcc_mix,cmovcc_mix) are source-built intests/cpu/scalar_float.asmand cross-checked differentially betweenoriginalandswappedbuilds against fixed reference answers. Negative controls intests/cpu/scalar_float_check.pyverify rejection ofSETcc/CMOVccafterUCOMISS,SETcc/CMOVccacross joins/branches, second jumps afterNEG,SETccpartial writes to an undefined GPR (r9), and 16-bitCMOVcc.Checklist
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T01:22:55Z.
I synchronized #752 from main in
2018706after confirming the earlier Windows runs failed in the shared predicate-rounding test. The new Windows jobs will now test the SSE leaf change without that unrelated NameError.Imported from R0Y00/Xbox2Windows. Originally posted by FZNull on 2026-11-23T01:23:03Z.
Reviewed the diff while verifying something else. The code change looks right — I reproduced the three crashes from #743 on
356a7be(NEG+JE→ValueError unsupported flag producer,CMP+SETE/CMP+CMOVE→AttributeError 'NoneType' object has no attribute 'op0_kind') and they are gone with this branch. One thing blocks the checklist:docs/experiments.mdis not updated, but the PR checklist marks it done. This PR makes a documented "not covered" statement false. In the x87/SSE section ofdocs/experiments.mdonmain:Not covered: RIP-relative constants, packed operations, SQRT, MIN and MAX, the rounding conversions, SETcc and CMOVcc after a compare, stack frames and calls.— this PR coversSETcc/CMOVccafter a compare, andNEGas a flag producer.The source fixture exports six functions—tests/cpu/scalar_float.defgains exports here.The project convention (CONTRIBUTING.md, "Submit and review a patch": update the README row or
docs/experiments.mdwhen a public capability changes) makes this part of the change rather than a follow-up.Optional follow-up, not a request to change this PR:
condition()intools/cpu_sse_aot.pystill resolves aJccproducer through its own, more restrictive path thanSETcc/CMOVccnow use. From a scratch copy of this branch,cpu_switch_aot.flag_produceracceptscmp ecx, edx; mov r9d, eax; je, whilecpu_sse_aot.translate_perejects the same shape withunsupported flag producer. It is a clean rejection, not a miscompile, so it could be its own item in the coordination issue.