cpu: lift legacy SSE and VEX.128 AES-NI and PCLMULQDQ leaf functions to C++ #2669
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2677"
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-26T01:46:22Z.
Change
Add a pure portable x64-to-C++ leaf lifter (
tools/cpu_aes_pclmul_aot.py) and source-built MASM/CTest differential suite (tests/cpu/aes_pclmul_aot.{asm,def,_check.py}, CTestcpu_aot_aes_pclmul) covering legacy SSE and VEX.128 register and flat[rcx|rdx|r8]m128 forms ofAESENC/VAESENC,AESENCLAST/VAESENCLAST,AESDEC/VAESDEC,AESDECLAST/VAESDECLAST,AESIMC/VAESIMC,AESKEYGENASSIST/VAESKEYGENASSIST, andPCLMULQDQ/VPCLMULQDQ.AESKEYGENASSISTRCON/SubWord/RotWord on words 1 and 3, and GF(2) carryless multiplication (imm8[0]andimm8[4], ignoring other bits) in pure portable C++ with zero AES/PCLMUL intrinsics and zero<wmmintrin.h>.VZEROUPPER, aliased source-before-destination reads, andatomic_signal_fence+ volatile loads so/O2preserves faulting memory reads (verified byop_aes_pclmul_discarded_read).[r8]stores, prefixes, branches, and missing/trailing instructions afterret.cpu_aot_aes_pclmulwithSKIP_RETURN_CODE 77(CPUID.01H:ECX[1,25,27,28] + XGETBV[2:1]) andFORM_COVERAGE_RECORD(; coverage: record cpu_aot_aes_pclmul).Verification
db59320d(based onupstream/main72879797)cmake --preset dev+cmake --build --preset dev --target cpu_aes_pclmul_aot_original cpu_aes_pclmul_aot_original_lifted cpu_aes_pclmul_aot_altered cpu_aes_pclmul_aot_altered_lifted-> 0 errors, 0 warningsctest --preset dev -N->Total Tests: 2166(cpu_aot_aes_pclmulregistered)ctest --preset dev --output-on-failure -R "^cpu_aot_aes_pclmul$" -E "cpu_native_archive_"->1/1 Passed(1.60s);out\build\dev\form_coverage\cpu_aot_aes_pclmul.txtrecorded 27 formscmake --preset release+cmake --build --preset release --target cpu_aes_pclmul_aot_original cpu_aes_pclmul_aot_original_lifted cpu_aes_pclmul_aot_altered cpu_aes_pclmul_aot_altered_lifted-> 0 errors, 0 warningsctest --preset release --output-on-failure -R "^cpu_aot_aes_pclmul$" -E "cpu_native_archive_"->1/1 Passed(1.86s);out\build\release\form_coverage\cpu_aot_aes_pclmul.txtrecorded 27 formsout\pe-env\Scripts\python.exe -B tests\form_coverage_check.py->form coverage checks passed(exit 0)out\pe-env\Scripts\python.exe -B tests\docs_links_check.py->Self-test passed. Checked 19 Markdown files and 510 links.(exit 0)out\pe-env\Scripts\python.exe -B tests\bidi_controls_check.py->Self-test passed. Checked 1894 tracked source, script and build/CI files: no bidirectional controls.(exit 0)0x1B,PCLMULQDQimm8[4]selector, VEX.128zext256upper-lane zeroing).ALTER_AES_PCLMULdiverging exports, 6 SDM mutant models, FIPS-197 Appendix B encrypt+decrypt round-trip, 26 IR + 4 raw + 9 PE-patched + CLI rejections, and discarded NULL-read fault preservation under/O2.Evidence and follow-up
All assembly fixtures in
tests/cpu/aes_pclmul_aot.asmare source-built MASM x64 routines authored under the repository MIT license, verified against an independent first-principles Python GF(2^8)/GF(2) model and FIPS-197 Appendix B vectors. Portable lifted, mutant, rejection, and/O2 /W4 /WXcompilation checks run unconditionally before the CPUID/XGETBV native differential gate (exit 77 if unsupported).Checklist
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T03:14:11Z.
Review: COMMENTED
Review of head
27dd8acb(after merging current main).Looks sound:
tools/cpu_aes_pclmul_aot.pyfollows the same pattern as the mergedcpu_sha256_aot(#2397). It is separate from the earlier lowering in #380, which covers one fixture; this adds a general leaf lifter plus a source-built MASM fixture, so it is not a duplicate slice.cpu_aot_aes_pclmulwithSKIP_RETURN_CODE 77andFORM_COVERAGE_RECORD, and has anALTER_AES_PCLMULaltered build, built-in mutants that must be caught, FIPS-197 vectors, YMM[255:128] checks, a/O2discarded-read check and rejection cases. No game or startup claim is made.Commands run locally (Linux):
python3 -B tests/docs_links_check.py,python3 -B tests/bidi_controls_check.py-> okgit diff --check origin/main...HEAD-> cleanpython3 -m py_compileon the lifter and the check -> okAI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T03:18:28Z.
Win2025 WARP receipt for head
27dd8acbafter updating with main.Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
27dd8acbf172670140956b815a951156f1be5abd:--preset dev):cmake --build --preset dev --target cpu_aes_pclmul_aot_altered cpu_aes_pclmul_aot_altered_lifted cpu_aes_pclmul_aot_original cpu_aes_pclmul_aot_original_lifted -- -j 2):7.11s(configure3.98s)ctest --preset dev -R '^cpu_aot_aes_pclmul$' --parallel 2 --no-tests=error --output-on-failure): 1/1 passed (3.49s:cpu_aot_aes_pclmul3.23s)/O2(--preset release):cmake --build --preset release --target cpu_aes_pclmul_aot_altered cpu_aes_pclmul_aot_altered_lifted cpu_aes_pclmul_aot_original cpu_aes_pclmul_aot_original_lifted -- -j 2):3.51s(configure4.66s)ctest --preset release -R '^cpu_aot_aes_pclmul$' --parallel 2 --no-tests=error --output-on-failure): 1/1 passed (2.86s:cpu_aot_aes_pclmul2.62s)sccache: 5/13 hits; wall30.1sAI-assisted; commands listed were executed locally.