cpu: lower ENDBR64 and ENDBR32 as no-ops in the shared lowering #2848
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2856"
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 R0D4X on 2026-11-26T14:30:27Z.
Fixes #1476
Root Cause / Motivation
The first slice of #1476 (
a1455727,a72a0929,7368c1b6) lowered the documentedRESERVEDNOPencodings (0F 19,0F 1D,0F 1E,0F 1F) and deliberately leftENDBR64(F3 0F 1E FA) andENDBR32(F3 0F 1E FB) refused for a separate follow-up. CET-instrumented functions (-fcf-protection) begin withendbr64, so they were still rejected bytools/ffx_version_query.py.Summary
tools/ffx_version_query.py): Add_ENDBR_CODES = frozenset((C.ENDBR64, C.ENDBR32))and lower both exacticed_x86.Codevalues to;. Per Intel SDM Vol. 2A,ENDBR64andENDBR32affect no registers, flags, or memory, and onx64_zen2(no CET-IBT) they execute as architectural NOPs. Neighbouring encodings (RDSSPD/RDSSPQF3 0F 1E /1,CLDEMOTE,0F 0D,0F 18,0F 1A-0F 1C, MPX) remain refused.tests/cpu/hint_nop_check.py): Movef30f1efa(endbr64) andf30f1efb(endbr32) toACCEPTED(verifying lifted-body equality with0f1f00NOP) and addf3480f1ec8(rdsspq rax) toREFUSED(13 accepted, 9 refused).tests/cpu/hint_nop_fixture.py): Addhn_endbr64andhn_endbr32comparing native execution against the lifted C++ body (preserving RAX andLAHFarithmetic flags) in bothdevandrelease(/O2) builds alongside the existingPAGE_NOACCESSand register-clobber controls.Before / After
F3 0F 1E FA(endbr64) andF3 0F 1E FB(endbr32) raisedunsupported query operation.;with identical lifted bodies to0f1f00and match native register/flag execution in Debug and Release (/O2), while all 9 neighbouring encodings stay refused.Verification
22d567e8(based on4992a46e)10.0.26300.9974), MSVC19.44.35230, Windows SDK10.0.26100.0Commands and measured results (0 failures, 0 skips):
out\pe-env\Scripts\python.exe -B tests/cpu/hint_nop_check.py: PASS (13 accepted forms lowered to a no-op, 9 neighbours still refused)git diff --check,docs_links_check.py,bidi_controls_check.py: PASSctest --preset dev --no-tests=error -j 1 -R '^(cpu_hint_nop|cpu_hint_nop_fixture|cpu_aot_integer_flags)$' -V: 3/3 passed (hn_endbr64andhn_endbr32:native=0x123456789ab1600 lifted=0x123456789ab1600 faulted=0 lifted_faulted=0 ok)ctest --preset release --no-tests=error -j 1 -R '^(cpu_hint_nop|cpu_hint_nop_fixture|cpu_aot_integer_flags)$' -V: 3/3 passed (0.55 sec)drop_endbr64,drop_endbr32): 2/2 caught (rc=1) and reverted cleanly.Evidence Scope
devandrelease(/O2), and neighbour regressioncpu_aot_integer_flags.x64_zen2;ENDBR64/ENDBR32are modelled strictly as architectural no-ops).AI-assisted; source-built fixtures only.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T14:46:58Z.
Review: COMMENTED
Review and Win2025 WARP receipt for head
22d567e8(10 commits behind main, no conflicts).Review (code + fixture tests only):
tools/ffx_version_query.py:_ENDBR_CODESselects the exact iced codes ENDBR64/ENDBR32, so RDSSPD/RDSSPQ (F3 0F 1E /1), CLDEMOTE,0F 0D/18/1A-1Cand MPX stay refused. Lowering to;matches the SDM (no register, flag or memory effect).hint_nop_check.pymoves both encodings to ACCEPTED (body equal to0f1f00) and addsrdsspq raxto REFUSED;hint_nop_fixture.pyaddshn_endbr64/hn_endbr32(native vs lifted).i.code in _ENDBR_CODESfrom the lowering ->hint_nop_check.pyrc=1; shrinking_ENDBR_CODESto ENDBR64 only -> rc=1. Both reverted.hint_nop_check.pyPASS (13 accepted, 9 refused),docs_links_check.pyok,bidi_controls_check.pyok,git diff --check origin/main...HEADclean.Win2025 (Build 26100, MSVC 14.44 + D3D12 WARP), command:
x2w_pipe.py win2025 2856 --wait 7200 --keep-release --regex '^(cpu_hint_nop|cpu_hint_nop_fixture|cpu_aot_integer_flags)$' --py-checks tests/cpu/hint_nop_check.pydev): 100% tests passed out of 3 (cpu_hint_nop,cpu_hint_nop_fixture,cpu_aot_integer_flags).PYCHECK name=tests/cpu/hint_nop_check.py rc=0.AI-assisted; commands listed were executed locally.