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

Open
opened 2026-11-26 21:20:21 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/2188
Author: @robot00f
Created: 11/26/2026
Status: 🔄 Open

Base: main ← Head: docs/cpu-avx1-baseline-counts


📝 Commits (1)

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

📊 Changes

1 file changed (+46 additions, -4 deletions)

View changed files

📝 docs/cpu_features.md (+46 -4)

📄 Description

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://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7181466437
AI-assisted: yes (Antigravity, Gemini 4 Carbon)


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/2188 **Author:** [@robot00f](https://github.com/robot00f) **Created:** 11/26/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `docs/cpu-avx1-baseline-counts` --- ### 📝 Commits (1) - [`c59ae5e`](https://github.com/ubiquitarianism/leonida/commit/c59ae5ed639ea835df386a7c772ca52cd0657a79) docs(cpu_features): record baseline instruction counts and AVX1/SSE4.2 host delta ### 📊 Changes **1 file changed** (+46 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `docs/cpu_features.md` (+46 -4) </details> ### 📄 Description ## 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://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7181466437 AI-assisted: yes (Antigravity, Gemini 4 Carbon) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#2191
No description provided.