SIMD(7)

πŸ“¦
version 15.1 Β· 3 versions
, in freebsd 15.1

πŸ¦‹ simd β€” SIMD enhancements ✨

okay so this is simd(7), and it's genuinely one of those pages where you find out your libc has been secretly lifting weights this whole time πŸ’ͺ✨


🌸 NAME 🌸

simd β€” SIMD enhancements, bestie. that's the whole vibe.


πŸ’– DESCRIPTION πŸ’–

on some architectures, the FreeBSD libc hands you enhanced implementations of functions you use every single day, replacing the architecture-independent versions you'd get otherwise. no cap. 🫢

depending on the architecture and the function, one of two things happens:

  • the enhanced implementation is always used, periodt, or
  • the libc detects at runtime which SIMD instruction set extensions the machine actually supports, and picks the most suitable implementation automatically β€” main character energy, it just knows πŸ’…

on amd64, the environment variable ARCHLEVEL is your cheat code to override this whole mechanism (more on her in a sec πŸ‘€).

enhanced functions exist for these architectures: aarch64, arm, amd64, i386, ppc64, riscv 🌈

πŸŽ€ the function roster πŸŽ€

(the original is a big grid β€” here it is as a list, every cell preserved, i promise πŸ™ˆ)

  • bcmp β€” aarch64: A; amd64: S1; i386: S
  • bcopy β€” aarch64: A; arm: S; amd64: S; i386: S; ppc64: SV; riscv: S
  • bzero β€” aarch64: A; arm: S; amd64: S; i386: S; riscv: S
  • div β€” amd64: S; i386: S
  • index β€” aarch64: A; amd64: S1; ppc64: S
  • ldiv β€” amd64: S; i386: S
  • lldiv β€” amd64: S
  • memchr β€” aarch64: A; amd64: S1; riscv: S
  • memcmp β€” aarch64: A; arm: S; amd64: S1; i386: S
  • memccpy β€” aarch64: A; amd64: S1
  • memcpy β€” aarch64: A; arm: S; amd64: S; i386: S; ppc64: SV; riscv: S
  • memmove β€” aarch64: A; arm: S; amd64: S; i386: S; ppc64: SV
  • memrchr β€” aarch64: A; amd64: S1
  • memset β€” aarch64: A; arm: S; amd64: S; i386: S; riscv: S
  • rindex β€” aarch64: A; amd64: S1; i386: S; riscv: S
  • stpcpy β€” aarch64: A; amd64: S1
  • stpncpy β€” amd64: S1
  • strcat β€” aarch64: A; amd64: S1; i386: S
  • strchr β€” aarch64: A; amd64: S1; i386: S; riscv: S
  • strchrnul β€” aarch64: A; amd64: S1; riscv: S
  • strcmp β€” aarch64: A; arm: S; amd64: S1; i386: S
  • strcpy β€” aarch64: A; amd64: S1; i386: S; ppc64: S2
  • strcspn β€” arm: S; amd64: S2
  • strlcat β€” aarch64: A; amd64: S1
  • strlcpy β€” aarch64: A; amd64: S1
  • strlen β€” aarch64: A; arm: S; amd64: S1; riscv: S
  • strncat β€” aarch64: A; amd64: S1
  • strncmp β€” aarch64: A; arm: S; amd64: S1; i386: S
  • strncpy β€” amd64: S1; ppc64: S2
  • strnlen β€” aarch64: A; amd64: S1; riscv: S
  • strrchr β€” aarch64: A; amd64: S1; i386: S; riscv: S
  • strpbrk β€” arm: S; amd64: S2
  • strsep β€” arm: S; amd64: S2
  • strspn β€” arm: S; amd64: S2
  • swab β€” i386: S
  • timingsafe_bcmp β€” aarch64: A; amd64: S1
  • timingsafe_memcmp β€” arm: S; amd64: S
  • wcschr β€” amd64: S
  • wcscmp β€” amd64: S
  • wcslen β€” amd64: S
  • wmemchr β€” amd64: S

πŸ”‘ the legend, iykyk πŸ”‘

  • S: scalar (non-SIMD)
  • 1: amd64 baseline
  • 2: x86-64-v2 or PowerPC 2.05
  • 3: x86-64-v3
  • 4: x86-64-v4
  • V: PowerPC VSX
  • A: Arm ASIMD (NEON)

⭐ ENVIRONMENT ⭐

  • ARCHLEVEL β€” on amd64, this is the girl who controls the level of SIMD enhancements used πŸ’…. if it's set to an architecture level from the list below and the processor actually supports that level, then SIMD enhancements up to ARCHLEVEL get used. if ARCHLEVEL is unset, not recognised, or not supported by the processor, then the highest level of SIMD enhancements supported by the processor is used. she always has a fallback, queen πŸŽ€

a suffix beginning with : or + in ARCHLEVEL is ignored and may be used for future extensions. the architecture level can also be prefixed with a ! character to force use of the requested architecture level, even if the processor does not advertise that it's supported. ⚠️ this usually causes applications to crash and should only be used for testing purposes or if architecture level detection yields incorrect results. like, for real, careful babe 😭

the architecture levels follow the AMD64 SysV ABI supplement:

  • scalar β€” scalar enhancements only (no SIMD)
  • baseline β€” cmov, cx8, x87 FPU, fxsr, MMX, osfxsr, SSE, SSE2
  • x86-64-v2 β€” cx16, lahf/sahf, popcnt, SSE3, SSE3, SSE4.1, SSE4.2
  • x86-64-v3 β€” AVX, AVX2, BMI1, BMI2, F16C, FMA, lzcnt, movbe, osxsave
  • x86-64-v4 β€” AVX-512F/BW/CD/DQ/VL

🩺 DIAGNOSTICS 🩺

Illegal Instruction β€” printed by sh(1) if a command is terminated through delivery of a SIGILL signal, see signal(3).

use of an unsupported architecture level was forced by setting ARCHLEVEL to a string beginning with a ! character, causing a process to crash due to use of an unsupported instruction. the fix? unset ARCHLEVEL, remove the ! prefix, or select a supported architecture level 🫢

this message may also appear for unrelated reasons. she's not always about you πŸ’€

πŸ‘€ SEE ALSO πŸ‘€

string(3), arch(7)

H. J. Lu, Michael Matz, Milind Girkar, Jan Hubička, Andreas Jaeger, and Mark Mitchell, β€œAMD64 Architecture Processor Supplement”, System V Application Binary Interface, May 23, 2023, Version 1.0.


πŸ•°οΈ HISTORY πŸ•°οΈ

architecture-specific enhanced libc functions were added starting with FreeBSD 2.0 for i386, FreeBSD 6.0 for arm, FreeBSD 6.1 for amd64, FreeBSD 11.0 for aarch64, FreeBSD 12.0 for powerpc64, and FreeBSD 16.0 for riscv64. 🌱

SIMD-enhanced functions were first added with FreeBSD 13.0 for powerpc64 and with FreeBSD 14.1 for amd64. glow-up timeline fr fr ✨

a simd manual page appeared in FreeBSD 14.1. iconic entrance, no notes πŸ‘‘


πŸ’œ AUTHOR πŸ’œ

Robert Clausecker <fuz@FreeBSD.org> β€” ty for your service bestie 🫑


πŸ™ˆ CAVEATS πŸ™ˆ

other parts of FreeBSD β€” like cryptographic routines in the kernel or in OpenSSL β€” may also use SIMD enhancements. those enhancements are not subject to the ARCHLEVEL variable and may have their own configuration mechanism. so don't come for ARCHLEVEL about things she doesn't control πŸ’…


πŸ› BUGS πŸ›

use of SIMD enhancements cannot be configured on powerpc64. that's it, that's the bug 😭


and that's the tea, bestie πŸ“ this page is from the Debian build, dated October 21, 2025 β€” SIMD(7) β€” go forth and let your libc cook πŸ”₯πŸ’–

πŸ“¦ where this page comes from
  • freebsd 15.1: base 15.1
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms