cpu: lower FSIN, FCOS, FSINCOS, FPTAN, and FPATAN instructions in x87_lower #1656
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1663"
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-24T16:41:24Z.
Change
Lower
FSIN,FCOS,FSINCOS,FPTAN, andFPATANin the opt-in x87 leaf-function profile (tools/x87_lower.py,tools/x87_soft.h), and add the source-owned differential fixturecpu_aot_x87_trig(tests/cpu/x87_trig.asm,tests/cpu/x87_trig.def,tests/cpu/x87_trig.py,CMakeLists.txt,docs/experiments.md).FSIN,FCOS,FSINCOS, andFPTANcompute 64-bit extended-precision results in pure integer arithmetic (256-bit Payne-Hanek range reduction modulopi/2and 128-bit Taylor series) when|ST(0)| < 2^63, setting status-wordC2 = 0and leavingC0/C1/C3undefined.|ST(0)| >= 2^63,FSINandFCOSsetC2 = 1and leaveST(0)unchanged; forFSINCOSandFPTAN, finite|ST(0)| >= 2^63is outside the fixed static-depth profile because hardware setsC2 = 1without pushing while static-depth lowering advances the stack depth by 1, so the emitted code gatesM.FSINCOSandM.FPTANwithif (c2) x87_trap();(__ud2()on MSVC,__builtin_trap()on GCC/Clang) before pushing the extra slot, ending the translated function with an illegal-instruction trap (STATUS_ILLEGAL_INSTRUCTION/0xC000001D) instead of continuing with a divergent stack (ptan_c2_resetalso pins thatFPTANclears a priorC2 = 1fromFTST).FPATANcomputesatan2(ST(1), ST(0))intoST(1)and popsST(0), leavingC0-C3undefined.TRIG_C2status tracking intools/x87_lower.pymakes onlyC2known afterFSIN/FCOS/FSINCOS/FPTANsoFNSTSW AX+SAHF(JP) orTEST AH, 04his accepted while readers of unknownC0/C1/C3(orC2afterFPATAN) are rejected.check_rejections()in the seven earliertests/cpu/x87_*.pysuites (x87_add.py,x87_compare.py,x87_iarith.py,x87_moves.py,x87_sqrt.py,x87_status.py,x87_sub.py) to use still-unsupportedf2xm1/fyl2xin place of the newly supported trig instructions.Verification
Built
cpu_x87_harness,cpu_x87_trig,cpu_x87_trig_lifted, and all 8 mutated control DLLs in bothdev(Debug) andrelease(/O2) with MSVC via& .\tools\dev.ps1:ctest --preset dev --no-tests=error -R "^cpu_aot_x87_trig$" -V-> 1/1 passed (99184 cases over 18 exports matched native and translated DLLs;liftedout-of-rangesincos_m80/ptan_m80/ptan_c2_resetchecks assertSTATUS_ILLEGAL_INSTRUCTION(0xC000001D) with untouched output buffers; 8 mutated controls all mismatched:noc2,c262with SEH accounting,sincosswap,ptanno1,patanswap,sinnegzero,snan,pc53; 15 rejected sequences).ctest --preset release --no-tests=error -R "^cpu_aot_x87_trig$" --output-on-failure-> 1/1 passed..\out\pe-env\Scripts\python.exe -B tests/form_coverage_check.py->form coverage checks passed.\out\pe-env\Scripts\python.exe -B tests/docs_links_check.py->Checked 16 Markdown files and 348 links..\out\pe-env\Scripts\python.exe -B tests/bidi_controls_check.py->Checked 1270 tracked source, script and build/CI files: no bidirectional controls.Evidence and follow-up
tests/cpu/x87_trig.asmgenerated bytests/cpu/x87_trig.py asmwith; coverage: source cpu_aot_x87_trigon line 1; independent 150-digitDecimalreference model intests/cpu/x87_trig.py.docs/experiments.mdunderx87 in the shared lowering.Checklist
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T16:57:46Z.
Review: COMMENTED
Review of head
2853202d241fae7437b64d2914c380c1c117515e(comment only, no approval or change request).Verified
All of this ran on Linux x86-64. The x87 instructions were executed natively on the host CPU. The translated semantics were compiled with g++ using a small shim for the MSVC intrinsics (
_umul128,_udiv128,_addcarry_u64,_subborrow_u64,_BitScanReverse64) around the unmodifiedtools/x87_soft.h.check_rejections()oftests/cpu/x87_{add,compare,iarith,moves,sqrt,status,sub,trig}.pyplusx87_{div,mul,fprem,bcd}.pyall pass on the PR head (neededpefileandiced-x86). The seven older tests are only touched in their rejection tables:fsin,fsincos,fptan,fpatan,fcosused to be the "unsupported" example, and are nowf2xm1orfyl2x. That is coherent and not noise.emit,check) cannot run here, so I rebuilt that path without a PE. I lowered five exports (sin_m80,cos_m80,sincos_m80,ptan_m80,patan_m80) with the reallower(..., x87=True)from hand-encoded bytes, compiled them, and ran all 32,876 of the PR's own cases for those five names. Every case passed the PR's ownreference()andlifted_matches(). The same cases through the host's native instructions all pass the PR's ownnative_matches(). The full case list is 98,633 cases over 17 exports, as the doc says.fsin/fcos/fsincos/fptan/fpatan(about 80,000 random trials with random depth 0 to 7 and control words 0x007f, 0x027f, 0x037f, 0x047f, 0x087f, 0x0a7f, 0x0c7f). I comparedfxsavestate, the C2 bit and depth. NaN (quiet and signaling), +-Inf, unnormals, pseudo-infinity, pseudo-NaN, +-0, denormals and pseudo-denormals, and allfpatansign and quadrant combinations matched bit for bit. The sole exceptions are the out-of-range and tiny-directed-rounding cases below.Decimalreference (same reference as the test): 0 ULP error on about 30,000 evaluations (in-range finite, random exponents -60..62, arguments near k*pi/2 for k up to 2^60,fpatanratios near the reduction thresholds). C2 matched native on every in-range case.Mutation checks
Each mutation was applied in the review worktree, the five-export lowered build was re-run, then reverted with
git restore. A clean build passes.fptanpushes 0.0 instead of 1.0fsincossin/cos slots swapped inx87_lower.pyu.e >= 63->64in the sin/cos coresin_m802,cos_m802)fpatanstack effect does not popfsin(-0)returns +0fptannever sets C2 (lowering)fpatanoperands swapped in loweringfsincosout-of-range second valueindefinite->xfptanout-of-range pushed valueindefinite->1.0fpatan(+-0, x<0)loses pik&3->(k+1)&3fptanwithout push in_effectM6, M8 and M9 survive because of the test gap in finding 2.
Findings
P2:
fsincos/fptanwith|ST(0)| >= 2^63push a value, but hardware does not.tools/x87_soft.h:775and:828,tools/x87_lower.py:320.The SDM says that for out-of-range operands C2 is set and the stack is left unchanged. The translator pushes unconditionally (depth + 1) and writes
indefiniteinto the new top. Repro:fld [prior=1.5]; fld [x=2^64]; fsincos; fstp; fstp; fstp(same forfptan).indefinite).indefinite, ST1 = 2^64, ST2 = 1.5.With
fptan; fstp st(0)the translated code keepsxas the "tan" while the hardware dropsx. The doc paragraph says ST(0) is left unchanged for all four instructions, which is not what the lowered code produces forfsincos/fptan. TheTOPreported byfnstswalso differs in that path. The static-depth design cannot represent a conditional push, so either rejectfsincos/fptanunless the out-of-range case is provably excluded (or a C2 branch rebalances the depth), or state in the doc that the out-of-range case is outside the profile.P2: that out-of-range case is not exercised for
fsincos/fptan(tests/cpu/x87_trig.py:43-52,:451).sincos_m80,sincos_sum,ptan_m80,ptan_to_m64usem80_in, which filters out|x| >= 2^63;sincos_depth7andptan_depth7usem64x7_in. Onlyfsin/fcosget out-of-range inputs, and onlysin_c2_readersreads C2 (thesahf/test ah,4form). Survivors M6, M8 and M9 show this. The single-op out-of-range case happens to agree with hardware insincos_m80only because a pop on an empty stack storesindefinite. Thereference()model also encodes the push (trig_opreturns[v, INDEFINITE]), so fixing the first finding would need the reference updated too.P2 (doc and tolerance): "finite in-range m80 results match within 4 ULPs natively" (
docs/experiments.md, thecpu_aot_x87_trigparagraph) is not true in general, andnative_matchesis weaker than it reads.|x| > 8, it only requires the native result to be zero or finite (largebranch).|x| <= 8it excludes results below 2^-50 (andfptanabove 2^50).fsin/fcos/fsincos/fptanfor8 < |x| < 2^63are off by more than 4 ULP in 85% to 96% of random samples (worst about 10^19 ULP, near multiples of pi/2, from the hardware's 66-bit pi).|x| <= 8and|result| >= 2^-50, hardware exceeds 4 ULP in 3 of ~1040fcos, 8 of ~2000fsincos, and 40 of ~1050fptansamples (12 ULP forfcos, a larger deviation forfptannear the poles).The translated model is the more accurate side (0 ULP vs the exact reference), so the translation is not bit-compatible with hardware near multiples of pi/2. The tolerance as written is acceptable for the fixed case set, but the claim should say it holds for the listed cases and is hardware-dependent. The check also passes on this host, but a different CPU's microcode could shift borderline cases.
nit:
|x| < 2^-64with a directed rounding control (checked entry only).tools/x87_soft.h:781,:829.x87_round_u128(..., force_inexact=false)returnsxitself, sofsin(1.5*2^-70)under RC = toward zero returnsx, while native returnsx - 1 ulp(bfff...ff:3fb9); a denormal0x...01gives native0and model0x...01. Within the 1 ULP tolerance, and only reachable throughfldcwin the checked entry, so I would only document it.No issue found with: tag/TOP handling at fixed depth for the in-range cases,
fpatanpop andST(1)write,fpatanargument order, signed zeros, SNaN/QNaN quieting,fsin(inf)giving the indefinite QNaN, the 2^63 boundary (2^63 - 1ulpis in range,2^63is out), or the added reject cases (underflow and depth-8 push, readers of C0/C1/C3).Not verified
.asm,.def, CMake registration (cpu_aot_x87_trig, the nine DLL variants, preset behavior) and the PE-basedemit/checkentry points were not executed;x87_trig.asmwas only compared toSEQUENCESby reading.noc2,c262,sincosswap,ptanno1,patanswap,sinnegzero,snan,pc53) were not run; my own mutations cover the same behaviors, and the mismatch counts in the doc (318, 22, 627, ...) were not reproduced.sincos_depth7,ptan_depth7,patan_depth8,*_to_m64and*_to_m32exports were not run through the lowered path (the semantic checks above cover the same helpers).AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T20:23:54Z.
Review: COMMENTED
Re-review of head
5a784b5039fe8955b61f570cdef326db56943cba. My previous review was at2853202d; the PR added one commit (5a784b50: docs,tools/x87_lower.pycomment,tests/cpu/x87_trig.{py,asm,def}). Comment only, not an approval.Verdict: 0 P1 / 1 P2 still open (documented, not fixed) / 1 P3. The test-gap and the tolerance-claim findings are addressed. The out-of-range
fsincos/fptanbehaviour is now written down but the translated code still diverges from hardware.Linux limits. Linux x86-64, Python 3 with pefile/iced-x86 in a venv. The x87 instructions ran natively on the host CPU; the translated code was compiled with g++ plus a small shim for the MSVC intrinsics. I could not build the PE or run the MASM/MSVC path,
ctest, or the eight built-in control variants. I rebuilt the lowering forsin_m80,cos_m80,sincos_m80,ptan_m80andptan_c2_resetfrom gas-assembled bytes (the PR's ownasm_linestext,lower(..., x87=True)), not from the PR's PE flow. The mutation counts and case totals in the doc (99184 cases, 18 exports, 318/24/627/1150/84768/8/132/27168) are the author's and were not reproduced.Previous findings
fsincos/fptanpush a value; hardware does not): documented, NOT fixed.tools/x87_lower.pyanddocs/experiments.mdnow say finite|ST(0)| >= 2^63for those two is outside the static-depth profile.tools/x87_soft.his unchanged. I re-ran it on this head with the lowered code against the native instruction (x = 2^63, -2^63, 2^64, 1e30):sincos_m80andptan_m80: C2 = 1 on both sides, but native leaves x on the stack and the third pop reads empty, so the slots are[indefinite at +0, x at +16]. The lowered code writes[x at +0, indefinite at +16]. Same forptan_c2_reset.sin_m80andcos_m80: identical to hardware (C2 = 1, x unchanged).The doc is accurate about this. But "outside the profile" is not enforced anywhere: the translator accepts any
fptan/fsincosand silently produces a stack that differs from hardware whenever the runtime input is out of range. If that is acceptable for the title's code paths, say so in the PR description as a known limitation. A cheap hardening that keeps the static depth: have the lowered code stop (fault or trap) when|x| >= 2^63for those two instructions instead of continuing with a different stack.sincos_m80andptan_m80on the lifted DLL at 2^63, -2^63 and 2^64 and compares withreference(). Mutations of the kind I listed before (fptan never sets C2;fsincosout-of-range second valuexinstead of indefinite;fptanout-of-range pushed value1.0instead of indefinite) change exactly the bytes this new check compares, so they should now fail it; I did not re-run those three through the PR's owncheck, which needs the PE. Note the check pins the known-divergent behaviour: the native side deliberately still filters those inputs out.|x| <= 8, magnitudes>= 2^-50,<= 2^50forfptan), saysnative_matchesonly checks finiteness for|x| > 8and tiny or near-pole results, and calls borderline cases hardware-dependent. On my host the lifted-vs-native comparison for|x| <= 8had 2 inputs of 54 over 4 ULP (4.7231 and -4.7235, next to 3pi/2; 7 and 8 ULP), which matches the hardware-pi remark; C2 matched on all in-range inputs.|x| < 2^-64under directed rounding): documented in the same paragraph.New in this commit
ptan_c2_reset(fldz; fldz; fdivp; ftst; pop; fld x; fptan) lowers (loweracceptsfldz,fdivp,ftst). Native vs lifted over my 54 in-range inputs: C2 equal on all (fptanclears the C2 set byftst). The reference getsfldz,fdivpandftsthandlers.check_rejections()forx87_{trig,add,compare,iarith,moves,sqrt,status,sub,div,mul,fprem,bcd}at this SHA: all print ok.Other checks:
git diff --check origin/main...HEAD,tests/docs_links_check.py(16 files, 348 links at this base),tests/bidi_controls_check.py(1270 files): clean.tests/form_coverage_check.py: passed.git merge-tree --write-tree origin/main HEAD: clean, but the branch is 363 commits behindmain, so please rebase before relying on CI (P3).AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by Ammmae0x on 2026-11-24T20:10:14Z.
Updated PR #1663 (commit
5a784b50) to address the P2 findings and nits:fsincos/fptanprofile boundary: Explicitly documented intools/x87_lower.pyanddocs/experiments.mdthat finite|ST(0)| >= 2^63forfsincosandfptanis outside the fixed static-depth profile (hardware leaves the stack unchanged without pushing whenC2 = 1, whereas static-depth lowering unconditionally advances the stack depth by 1 and pushesx87_indefinite).ptan_c2_reset+ lifted out-of-range checks): Addedptan_c2_resetintests/cpu/x87_trig.py(regeneratingtests/cpu/x87_trig.asmandtests/cpu/x87_trig.def) softstsetsC2 = 1before an in-rangefptanresetsC2 = 0, and addedlifted-DLL checks forsincos_m80andptan_m80at|x| >= 2^63(C2 = 1andx87_indefinitein the pushed slot).docs/experiments.mdto the listed fixture cases (|x| <= 8, magnitudes>= 2^-50, and<= 2^50forfptan), notingnative_matcheschecks|x| > 8and tiny/near-pole outputs only for finiteness and is host-dependent, and documented the|x| < 2^-64directed-rounding nit.Verified
cpu_aot_x87_trigin bothdev(99184 cases over 18 exports, 8 mutated controls, 15 rejected sequences) andrelease, plusform_coverage_check.py,docs_links_check.py, andbidi_controls_check.py. AI-assisted.Imported from R0Y00/Xbox2Windows. Originally posted by Ammmae0x on 2026-11-24T20:42:06Z.
Updated PR #1663 (merged
upstream/mainand pushed commit28f1c4c5) to resolve the remaining P2 finding and P3 rebase note:FSINCOS/FPTAN: Addedx87_trap()intools/x87_soft.h(__ud2()on MSVC,__builtin_trap()on GCC/Clang) and gatedM.FSINCOSandM.FPTANintools/x87_lower.pywithif (c2) x87_trap();before pushing the extra slot so runtime|ST(0)| >= 2^63traps cleanly instead of continuing with a divergent stack.tests/cpu/x87_trig.pyto assertSTATUS_ILLEGAL_INSTRUCTION(0xC000001D) with untouched output buffers forsincos_m80,ptan_m80, andptan_c2_resetat|x| >= 2^63(plus SEH mismatch accounting forc262), and updateddocs/experiments.md.Verified
cpu_aot_x87_trigin bothdev(99184 cases over 18 exports, out-of-range trap checks, 8 mutated controls, 15 rejected sequences) andrelease, plustests/form_coverage_check.py,tests/docs_links_check.py(18 files, 376 links), andtests/bidi_controls_check.py(1338 files). AI-assisted.Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T21:24:51Z.
Review: COMMENTED
Re-review of head
28f1c4c5e88f328814cb1e0e8256bb1c71ac7e84(my previous review was at5a784b50; the PR added the commit "trap on out-of-range FSINCOS/FPTAN in x87_lower" and mergedmain). Comment only, not an approval.Verdict: 0 P1 / 0 P2. The open P2 from the last round (out-of-range
fsincos/fptancontinued with a stack that differs from hardware) is fixed.What changed and what I checked
tools/x87_lower.py:782-785: the loweredfsincosandfptannow runif (c2) x87_trap();right after the helper call, before anything is stored.tools/x87_soft.h:755-762addsx87_trap()(__ud2()on MSVC,__builtin_trap()otherwise).c2is only set in one place for these two helpers: finite|ST(0)| >= 2^63(x87_soft.h:785and:837). Infinity, NaN, unsupported encodings and zero keepc2 = false, so the trap cannot fire on inputs the profile accepts.FSIN/FCOSare unchanged (they match hardware: C2 = 1, ST(0) unchanged).tests/cpu/x87_trig.py:661-683: the out-of-range check now callssincos_m80,ptan_m80andptan_c2_reseton the lifted DLL at 2^63, -2^63, 2^64 and 2^100 and requires an SEH0xC000001Dand an untouched output buffer. The control loop (:695-708) counts a trap as a mismatch for the mutated DLLs.x87_lower.pyheader comment now say the translated code traps for those inputs.Commands run locally at
28f1c4c5git diff --check origin/main...HEAD: exit 0tests/docs_links_check.py: 18 Markdown files, 376 links OKtests/bidi_controls_check.py: 1338 files OKtests/form_coverage_check.py: passedcheck_rejections()fromtests/cpu/x87_trig.py: "rejected 15 sequences outside the profile" OKgit merge-tree --write-tree origin/main HEAD: clean. The branch is 85 commits behindmain.x2w_pipe.py win2025 1663 --targets cpu_x87_harness,cpu_x87_trig,cpu_x87_trig_{lifted,noc2,c262,sincosswap,ptanno1,patanswap,sinnegzero,snan,pc53} --regex '^cpu_aot_x87_trig$': Windows Server 2025 Debug (dev) 1/1 passed (27.0 s) and Release/O21/1 passed (23.1 s). This runs the real PE path, so the SEH check inx87_trig.pywas exercised.Mutations (Linux, local, reverted)
I could not build the PR's PE on Linux, so I took the exact statements
lower()emits forfsincosandfptan(printed from the PR's own lowering), compiled them withtools/x87_soft.husing g++ and a small shim for the MSVC intrinsics, and ran each input in a forked child (6 out-of-range inputs and 3 in-range inputs per instruction).bad=0.if (c2) x87_trap();from both statements: out-of-range runs exit 0,bad=12. Killed.x87_soft.hfromu.e >= 63tou.e >= 62: in-range 2^62 forfsincosis trapped,bad=1. Killed.Remaining notes (not blocking)
cpu_x87_trig_snan.cpp(541),cpu_x87_trig_pc53.cpp(541)) compile with MSVC warning C4805 (|betweenuint64_tandbool). It does not change a result; I did not check whether it predates this PR.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T12:13:25Z.
Review: COMMENTED
Review of head
25ea2e28e62556f9406c95fb9cd9f421b6aa8920(comment only, no approval).Result: no P1, no P2. Two nits and one CI note below.
What I checked
git diff --stat origin/main...HEAD: 14 files, +1528/-14. Title and wording are neutral, no local-probe or title references.python3 tests/docs_links_check.py->Checked 18 Markdown files and 448 links.python3 tests/bidi_controls_check.py->Checked 1613 tracked ... files: no bidirectional controls.git diff --check origin/main...HEAD-> clean.python3 -B tests/startup_run_sh_check.py->startup run.sh: 0 failed. The red Linux job (Run Python checks) failed onstartup_run_sh_check.py("mutant 'watcher without --render' was not detected"). That file is not in this diff and passes locally on this head, so it looks unrelated or flaky. A re-run should settle it.tests/cpu/x87_trig.pyneeds the Windows harness and DLLs, so the newcpu_aot_x87_trigtest cannot run on Linux. It is covered by the pending Windows CI job, and I did not queue the Windows VM.Independent differential run (Linux, outside the repo)
I compiled
tools/x87_soft.hwith a small shim for the MSVC intrinsics. I comparedx87_sin,x87_cos,x87_sincos,x87_ptanandx87_patanagainst the host's real x87 instructions. Inputs were 200000 random operands per group: moderate, tiny, up to 2^64 and near 2^63. About 994k compared results.const int qc = (q + 1) & 3;to(q + 3) & 3;in a copy ofx87_soft.h. FCOS mismatches rose from 106489 to 158637 in my harness, so the cos quadrant logic is observable. I did not mutate the PR's own Windows test, because it needs the Windows harness. The PR already ships eight mutated control DLLs (noc2,c262,sincosswap,ptanno1,patanswap,sinnegzero,snan,pc53) that the check requires to mismatch. Windows CI will show whether they are all killed.Findings
tools/x87_lower.py(FSIN/FCOS statement):x87_swis overwritten with only C2. This is correct, because C0, C1 and C3 are undefined for these ops, but a one-line comment in the generated code would help readers of the lowered output.tools/x87_soft.h(x87_trap): the finite |ST(0)| >= 2^63 case for FSINCOS/FPTAN traps by design. Please keep the Windows CI evidence of the trap path (sincos_depth7/ptan_depth7and the out-of-range check attests/cpu/x87_trig.py:661) in the PR body.Needs before Ready
Build and test on Windows) must go green. It was still pending when I reviewed.startup_run_sh_checkfailure.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T12:32:18Z.
Review: COMMENTED
Review of head
5d8cf6fe04e1a1685c26597de801da93d177b157(FSIN, FCOS, FSINCOS, FPTAN, FPATAN lowering).Verdict: no P1, no P2. Two nits below.
Checks run locally (Linux)
gh pr checks 1663: Linux Python checks, Windows build and test, and gfx1013 fixtures all pass; the /O2 job was skipped.python3 tests/docs_links_check.py: self-test passed, 18 Markdown files and 451 links checked.python3 tests/bidi_controls_check.py: 1618 files, no bidirectional controls.git diff --check origin/main...HEAD: clean.python3 -I -m py_compile tests/cpu/x87_trig.py tools/x87_lower.py: OK.python3 tests/cpu/x87_trig.py asm /tmp/t.asm /tmp/t.def: output is byte-identical to the committedx87_trig.asmandx87_trig.def.checkandcheck_rejectionscould not run here. They need the Windows harness andiced_x86, and the Windows CI job coverscpu_aot_x87_trig.Independent numeric check of
tools/x87_soft.hlong double.x87_sincos,x87_ptanandx87_patan(16 atan2 pairs) agreed to within 1e-19 relative error.x87_sincosandx87_ptanset C2 for 1e19 (above 2^63), as the code comments say.Mutation
sub = !swapped || !sxtosub = !swappedinx87_patan, in a copy of the header.sincosswap,patanswap,c262, and others) need Windows to run, so I did not run them.Code review
_effectlook right. FSINCOS and FPTAN push one, FPATAN pops one, FSIN and FCOS keep the depth.TRIG_C2and_after. The rejection list incheck_rejectionscovers the readers of the undefined bits.docs/experiments.md.Nits
isDraft=false), and mergeable wasUNKNOWNwhen I checked.docs/experiments.mdis a single very long paragraph. It is hard to review, but it matches the file's existing style.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by Ammmae0x on 2026-11-25T12:26:02Z.
Merged
upstream/main(4514fa09, including#2323which stabilizestests/startup_run_sh_check.py) intocpu/x87-trigat commit5d8cf6feto clear the unrelated Linux Python CI failure; re-rantests/form_coverage_check.py,tests/docs_links_check.py(448 links), andtests/bidi_controls_check.py(exit 0). Note:cpu_aot_x87_trig(and all 23x87CTests) passed on bothdev(Debug) andrelease(/O2) on Windows x64 after merging the x87 environment updates, including thesincos_depth7/ptan_depth7trap path.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T18:22:03Z.
Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
59865488b893a62ebf57ed36dce852352a0df0fe:--preset dev):cmake --build --preset dev --target cpu_x87_harness cpu_x87_trig cpu_x87_trig_lifted cpu_x87_trig_noc2 cpu_x87_trig_c262 cpu_x87_trig_sincosswap cpu_x87_trig_ptanno1 cpu_x87_trig_patanswap cpu_x87_trig_sinnegzero cpu_x87_trig_snan cpu_x87_trig_pc53 -- -j 2):4.87s(configure1.75s)ctest --preset dev -R '^cpu_aot_x87_trig$' --parallel 6 --no-tests=error --output-on-failure): 1/1 passed (24.65s:cpu_aot_x87_trig24.53s)/O2(--preset release):cmake --build --preset release --target cpu_x87_harness cpu_x87_trig cpu_x87_trig_lifted cpu_x87_trig_noc2 cpu_x87_trig_c262 cpu_x87_trig_sincosswap cpu_x87_trig_ptanno1 cpu_x87_trig_patanswap cpu_x87_trig_sinnegzero cpu_x87_trig_snan cpu_x87_trig_pc53 -- -j 2):24.66s(configure1.75s)ctest --preset release -R '^cpu_aot_x87_trig$' --parallel 6 --no-tests=error --output-on-failure): 1/1 passed (20.92s:cpu_aot_x87_trig20.82s)sccache: 18/18 hits; wall60.3sAI-assisted; commands listed were executed locally.