Skip to content

arm: detect Linux userspace ISA extensions - #197

Merged
nihui merged 2 commits into
masterfrom
arm-linux-userspace-isa
Oct 9, 2026
Merged

nihui merged 2 commits into
masterfrom
arm-linux-userspace-isa

Conversation

@nihui

@nihui nihui commented Sep 15, 2026 •

Copy link
Copy Markdown
Owner

Expand ARM/AArch64 userspace ISA detection using the current Linux ARM HWCAP definitions and Linux's own arm64 hwcap SIGILL selftests as the primary opcode reference.

This keeps ruapu's execute-and-trap design: all new probes are direct RUAPU_INSTCODE() sequences, with no CPUID/auxv dependency and no new helper-style ruapu_some_xxx() functions.

AArch64 additions include:

  • scalar/system ISA: fp, fphp, lrcpc, ilrcpc, lrcpc3, lse128, lsfe, flagm, flagm2, rng, fpmr, gcs, poe, cssc, cmpbr, hbc, fprcvt
  • AdvSIMD/FP: faminmax, lut, FP8 (f8cvt, f8fma, f8dp2, f8dp4, f8mm4, f8mm8), and FP16 matrix/dot (f16mm, f16f32dot, f16f32mm)
  • memory operations: mops
  • SVE: base probe switched to RDVL, plus sve2p2, sve2p3, svef16mm, sveeltperm, sveaes2, svebfscale, sveb16b16, sveb16mm, svelut6, and safer sve2p1
  • SME: base probe switched to RDSVL, plus legacy optional features (smei16i64, smef64f64, smei8i32, smef16f32, smeb16f32, smef32f32, smefa64), SME2/2.1/2.2/2.3, smei16i32, smebi32i32, smeb16b16, smef16f16, smeaes, smesbitperm, FP8/LUT/streaming subfeatures, smesfexpa, smesmop4, and smestmop

ARM32 additions include:

  • vfp, fphp
  • asimdbf16, i8mm
  • ARMv8 crypto HWCAP2 probes: aes, pmull, sha1, sha2, crc32
  • Intel/Marvell iwmmxt, using the Linux iWMMXt userspace/lazy-context path

swp is intentionally not exposed: Linux can software-emulate SWP/SWPB after an undefined-instruction trap, so execute-and-trap would conflate kernel emulation with hardware ISA support.

Several Linux HWCAPs are intentionally deferred when execute-and-trap cannot identify them reliably or a safe direct probe would require special memory/state handling. Examples include LS64 (requires suitable device/non-cacheable memory), SVE/SME EBF16 behavior flags, FP8 format-only flags, legacy ARM Jazelle/ThumbEE/Crunch, and hint/behavior-only capabilities that are not reliably distinguishable by SIGILL.

README.md, main.c, instruction definitions, and g_ruapu_isa_map are kept in sync.

@nihui
nihui force-pushed the arm-linux-userspace-isa branch from db5c23c to 6167434 Compare September 15, 2026 15:46
@nihui
nihui force-pushed the arm-linux-userspace-isa branch from f26dfc4 to 7090efc Compare September 15, 2026 15:58
@nihui
nihui requested a balanced review from Copilot September 15, 2026 16:13

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The renamed smei64i64 public feature key needs a compatibility alias.

Get a fresh assessment by requesting another Copilot review.

Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment thread ruapu.h
Use RAX1 for SVE SHA3 and MOVAZ with SM and ZA enabled for SME2.1.
Require CP0 WOR after the iWMMXt load to reject NWFPE emulation.
Keep smei64i64 as an alias of smei16i64 and reuse adjacent probe results.
@nihui
nihui merged commit 26bf1c3 into master Oct 9, 2026
13 checks passed
@nihui
nihui deleted the arm-linux-userspace-isa branch October 9, 2026 02:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants