cpu: lower SSE2 packed double arithmetic in the SSE FP leaf translator #1352
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1359"
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 tedin7 on 2026-11-24T09:13:14Z.
Change
tools/cpu_sse_fp_aot.pynow lowers the seven legacy SSE2 packed double arithmetic formsADDPD,SUBPD,MULPD,DIVPD,MINPD,MAXPDandSQRTPD(register source and 16-byte alignedm128source) in bounded leaf functions. Before this change the translator refused them withunsupported instruction.emmintrin.hinstruction on a run-time operand: rounding mode, DAZ and FTZ are the host's, nothing is folded at translation time, and the C library square root is never used (it can differ from the hardware on denormal operands under DAZ).MINPDandMAXPDuse the host instruction unchanged.SQRTPDonly reads its source and returns a NaN lane quiet with its payload.ldmxcsris still not lifted and exception flags are not observed (stated in the translator docstring anddocs/experiments.md).F2/F3prefixed spellings of the same opcodes), the other packed double forms (cmppd,andpd,cvtps2pd, ...), nonvolatile or undefined registers, non-argument or indexed memory bases.tests/cpu/sse_fp_check.pyusedaddpd,sqrtpdandminpdas unsupported controls; they now usehaddpd,cvtps2pdandandpd.Follows the packed single arithmetic change in
docs/experiments.md("Legacy SSE FP compares and partial/non-temporal moves"). No open PR touchescpu_sse_fp_aot.pyor thesse_fpfixture.Verification
Linux x86-64 (QEMU virtual processor): fixture assembled with
llvm-ml-19, linked withlld-link-19, original machine code run through a Windows-ABI caller, translation built withclang++-19at -O0, -O2 and -O3 (-Wall -Wextra, only the existing unused-function notes for helpers a given fixture does not use) and compiled with MinGWg++at -O0/-O2/-O3.python3 -m py_compileof the four Python files,tests/docs_links_check.py,tests/bidi_controls_check.pyandtests/form_coverage_check.pypass. All three optimization levels passedtests/cpu/sse_fp_pd_check.py(bound through the same caller) and the unchangedcheck_alt_encodings_and_rejectionsoftests/cpu/sse_fp_check.py:origin/mainfails on the new fixture withunsupported instruction at RVA 0x1006: addpd xmm0,xmm1(andsqrtpd xmm0,[rdx]for the memory form).lifted op_addpd case 1), subtract with swapped operands (op_subpd case 0), multiply as divide (op_mulpd case 0), divide as multiply (op_divpd case 0), minimum as maximum (op_minpd case 1), swappedminpdandmaxpdoperands (case 0),sqrtpdnot quieting a NaN (op_sqrtpd case 7), NaN rule not quieting (op_addpd case 196), NaN rule choosing the second operand (op_addpd case 189),sqrtpdas a doubling (op_sqrtpd case 1).ctestrun ofcpu_aot_sse_fp_pdon Windows. Commands for that run:ctest --preset dev --no-tests=error -R '^cpu_aot_sse_fp_pd$' -V(and--preset release).Evidence and follow-up
tests/cpu/sse_fp_pd.asm, 29 exports); the referencetests/cpu/sse_fp_pd_ref.pyis exact rational arithmetic with no host floating point and none of the translator. The native MXCSR driver is the existingsse_fp_harnessimage.movapsstores the packed single fixture already used. Every call checks 32-byte guards around all three buffers and that output bytes the function does not write keep their fill value; misaligned displacements are rejected before any code exists.cmppdand the other packed double forms,rcpps,rsqrtps. Whether the processor returns original bits or a flushed zero for MIN/MAX under DAZ, and whether FTZ judges tininess before or after rounding, are left unconstrained in the reference rather than assumed.Checklist
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T09:17:55Z.
Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207) at commit
a53a750d2752c04137160d9106dc272dc108d7aa:--preset dev):cpu_sse_fp_pd_*,cpu_sse_fp_*):3.92s(configure1.66s)ctest --preset dev -R '^(cpu_aot_sse_fp_pd|cpu_aot_sse_fp)$' --parallel 4 --no-tests=error --output-on-failure): 2/2 passed (cpu_aot_sse_fp9.24s,cpu_aot_sse_fp_pd20.09s)/O2(--preset release):cpu_sse_fp_pd_*,cpu_sse_fp_*):1.30s(configure1.79s)ctest --preset release -R '^(cpu_aot_sse_fp_pd|cpu_aot_sse_fp)$' --parallel 4 --no-tests=error --output-on-failure): 2/2 passed (cpu_aot_sse_fp8.43s,cpu_aot_sse_fp_pd18.94s)Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T09:18:07Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
a53a750ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.