cpu: ScalarLifter in cpu_sse_aot.py omits NEG flag producers and crashes on SETcc/CMOVcc GPR instructions #743
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#743
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 00:26 UTC · original
Commit or build
fd2486f(upstream/main)Reproduction
Run with the repo Python environment (
iced-x86andpefile) against a temporary copy of the source-built fixtureout/build/dev/cpu_reloc_original.dll:Expected behavior
ScalarLifter/condition()intools/cpu_sse_aot.pyshould supportNEGas a flag producer (M.NEGis already inFLAG_PRODUCERSandLifter.condition()intools/cpu_switch_aot.py:195, 931-956), loweringneg ecx; je ...cleanly instead of raisingValueError.ScalarLifter.statement()(tools/cpu_sse_aot.py:119-120) delegates non-scalar GPR instructions tosuper().statement(...),cpu_sse_aot.lift()/ScalarLiftershould either track the flag producer forSETcc/CMOVcc(settingsets_flagswhen the consumer isSETcc/CMOVccand passingproducertosuper().statement(ins, sets_flags, producer)) or rejectSETcc/CMOVccwith an explicitValueError, rather than crashing with an unhandledAttributeError.Acceptance criteria:
tools/cpu_sse_aot.py:115-123,229-233, and258soM.NEGis accepted as an integer flag producer andSETcc/CMOVcceither resolve their preceding flag producer cleanly or fail with a clearValueError.NEG+Jcc,CMP+SETcc, andCMP+CMOVcccoverage intests/cpu/scalar_float_check.py.Observed behavior
In
tools/cpu_sse_aot.py:condition()(tools/cpu_sse_aot.py:231) restricts integer flag producers to(*ALU, M.CMP, M.TEST, M.INC, M.DEC), omittingM.NEG.ScalarLifter.statement()(tools/cpu_sse_aot.py:119-120) callssuper().statement(ins, next_ins is not None and next_ins.flow_control == FlowControl.CONDITIONAL_BRANCH)without passingproducer, andlift()(tools/cpu_sse_aot.py:258) does not resolve flag producers forSETcc/CMOVccinstructions. InsideLifter.lower()(tools/cpu_switch_aot.py:965-975),SETcc/CMOVccaccessesproducer.op0_kindonNone.Running the reproduction prints:
Environment
Windows 10 Pro 24H2 (build 26100.7623), Python 3.12.8 (
out\pe-env\Scripts\python.exe).Checklist
AI-assisted.
@R0Y00 on GitHub · 2026-11-23 01:08 UTC · original
Please reuse the verified #731 flag rules where the ScalarLifter supports the same operand. Unsupported producers or operands should give the normal lowering diagnostic. Add source-built SETcc and CMOVcc controls with both condition outcomes and verify 8-bit preservation and 32-bit zero-extension where applicable.