docs(cpu_features): record baseline instruction counts and AVX1/SSE4.2 host delta #2188

Open
github-bot wants to merge 1 commit from github-bot/gh-2188 into main AGit
Owner

@⁠robot00f on GitHub · 2026-11-26 03:41 UTC · original
robot00f:docs/cpu-avx1-baseline-counts → main · +46 −4 · 1 files · 1 commits · open

Summary

Record the baseline instruction counts measured by tools/cpu_feature_scan.py (at 0b11d86b) on the 1.0.2.1 executable in docs/cpu_features.md and document the AVX1 + SSE4.2 host delta (Intel Sandy Bridge and Ivy Bridge).

  • Fill in the previously unrecorded baseline feature counts in the Instruction sets used table (AVX, FMA, AVX2, BMI1, BMI2, AES, F16C, ADX, PCLMULQDQ, POPCNT, MOVBE, LZCNT, CX16, PREFETCHW, and 0 for RDRAND, RDSEED, FSGSBASE, CLFLUSHOPT).
  • Note two scan-bucket details relevant to pre-Haswell hosts:
    • AVX (2,871,070 in .pdata) includes 32,101 register-source vbroadcastss (31,970) and vbroadcastsd (131) sites (ModRM.mod == 3), which require AVX2 (#UD on AVX1) unlike the memory-source forms.
    • AVX2 (81,500 in .pdata) contains 0 vgather* or vpgather* sites anywhere in .text.
  • Add an AVX1 + SSE4.2 hosts (pre-Haswell) subsection distinguishing:
    1. Instructions that raise #UD (STATUS_ILLEGAL_INSTRUCTION) cleanly on an AVX1 + SSE4.2 host (AVX2, FMA3, F16C, VEX-encoded BMI1/BMI2, MOVBE).
    2. Legacy LZCNT (F3 0F BD) and TZCNT (F3 0F BC), which execute without faulting as BSR and BSF when CPUID.80000001H:ECX.LZCNT[bit 5] == 0 / CPUID.07H:EBX.BMI1[bit 3] == 0 (988 of 11,827 .pdata tzcnt sites immediately feed a CF-reading conditional move or branch, and 149 of 294 .pdata lzcnt sites use 4-byte non-REX encodings).

Validation

  • python -I -m unittest tests/test_docs_links.py tests/test_docs_table_rows.py tests/test_docs_table_ids.py tests/test_docs_repo_paths.py tests/test_docs_list_items.py tests/test_docs_repeated_lines.py tests/test_text_write_line_endings.py (all 7 suites OK)
  • python -I scripts/check_no_game_data.py docs/cpu_features.md (clean)

Claim: #1608
AI-assisted: yes (Antigravity, Gemini 4 Carbon)

**@⁠robot00f** on GitHub · 2026-11-26 03:41 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2188) `robot00f:docs/cpu-avx1-baseline-counts` → `main` · +46 −4 · 1 files · 1 commits · open ## Summary Record the baseline instruction counts measured by `tools/cpu_feature_scan.py` (at `0b11d86b`) on the `1.0.2.1` executable in `docs/cpu_features.md` and document the `AVX1 + SSE4.2` host delta (Intel Sandy Bridge and Ivy Bridge). - Fill in the previously unrecorded `baseline` feature counts in the `Instruction sets used` table (`AVX`, `FMA`, `AVX2`, `BMI1`, `BMI2`, `AES`, `F16C`, `ADX`, `PCLMULQDQ`, `POPCNT`, `MOVBE`, `LZCNT`, `CX16`, `PREFETCHW`, and `0` for `RDRAND`, `RDSEED`, `FSGSBASE`, `CLFLUSHOPT`). - Note two scan-bucket details relevant to pre-Haswell hosts: - `AVX` (`2,871,070` in `.pdata`) includes `32,101` register-source `vbroadcastss` (`31,970`) and `vbroadcastsd` (`131`) sites (`ModRM.mod == 3`), which require `AVX2` (`#UD` on `AVX1`) unlike the memory-source forms. - `AVX2` (`81,500` in `.pdata`) contains **`0`** `vgather*` or `vpgather*` sites anywhere in `.text`. - Add an `AVX1 + SSE4.2 hosts (pre-Haswell)` subsection distinguishing: 1. Instructions that raise `#UD` (`STATUS_ILLEGAL_INSTRUCTION`) cleanly on an `AVX1 + SSE4.2` host (`AVX2`, `FMA3`, `F16C`, VEX-encoded `BMI1`/`BMI2`, `MOVBE`). 2. Legacy `LZCNT` (`F3 0F BD`) and `TZCNT` (`F3 0F BC`), which execute **without faulting** as `BSR` and `BSF` when `CPUID.80000001H:ECX.LZCNT[bit 5] == 0` / `CPUID.07H:EBX.BMI1[bit 3] == 0` (`988` of `11,827` `.pdata` `tzcnt` sites immediately feed a `CF`-reading conditional move or branch, and `149` of `294` `.pdata` `lzcnt` sites use 4-byte non-REX encodings). ## Validation - `python -I -m unittest tests/test_docs_links.py tests/test_docs_table_rows.py tests/test_docs_table_ids.py tests/test_docs_repo_paths.py tests/test_docs_list_items.py tests/test_docs_repeated_lines.py tests/test_text_write_line_endings.py` (all 7 suites OK) - `python -I scripts/check_no_game_data.py docs/cpu_features.md` (clean) Claim: https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608 AI-assisted: yes (Antigravity, Gemini 4 Carbon)
Record the baseline instruction counts measured by tools/cpu_feature_scan.py
(at 0b11d86b) on the 1.0.2.1 executable (AVX, FMA, AVX2, BMI1, BMI2, F16C,
AES, ADX, PCLMULQDQ, POPCNT, MOVBE, LZCNT, CX16, PREFETCHW, and the absent
RDRAND/RDSEED/FSGSBASE/CLFLUSHOPT sets), including the 32,101 register-source
vbroadcastss/vbroadcastsd sites counted under AVX that require AVX2 and the zero
vgather*/vpgather* count.

Add a subsection on AVX1 + SSE4.2 hosts (Intel Sandy Bridge and Ivy Bridge)
separating the Haswell/ABM delta that faults with #UD from legacy LZCNT/TZCNT
(F3 0F BD / F3 0F BC), which execute silently as BSR/BSF without #UD while 988
.pdata tzcnt sites immediately feed a CF consumer and 149 .pdata lzcnt sites
are 4-byte encodings.

Claim: https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7181466437
AI-assisted: yes (Antigravity, Gemini 4 Carbon)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:21:46 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2188/head:github-bot/gh-2188'
git switch 'github-bot/gh-2188'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2188'
git switch 'github-bot/gh-2188'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2188'
git switch 'github-bot/gh-2188'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2188'
git switch 'main'
git merge --squash 'github-bot/gh-2188'
git switch 'main'
git merge --ff-only 'github-bot/gh-2188'
git switch 'main'
git merge 'github-bot/gh-2188'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.