Skip to content

Instantly share code, notes, and snippets.

@CKingX
Last active April 20, 2024 05:48
Show Gist options
  • Save CKingX/0d555071fa5555c4a982b20e8273077f to your computer and use it in GitHub Desktop.
Save CKingX/0d555071fa5555c4a982b20e8273077f to your computer and use it in GitHub Desktop.
Windows 11 CPU instructions common to all supported CPUs

Supported Intel

  • Elkhart Lake
  • Tiger Lake
  • Kaby Lake R
  • Whiskey Lake
  • Comet Lake
  • Coffee Lake
  • Gemini Lake
  • Gemini Lake Refresh
  • Jasper Lake
  • Ice Lake
  • Amber Lake Y
  • Coffee Lake
  • Lakefield
  • Rocket Lake
  • Alder Lake
  • Kaby Lake G
  • Skylake
  • Kaby Lake
  • Cascade Lake
  • Amber Lake

AMD Codenames

  • Pallock
  • Dali
  • Picasso
  • Raven Ridge
  • Rome
  • Milan
  • Matisse
  • Pinnacle Ridge
  • Renoir
  • Lucienne

However, I never really finished going through AMD codenames as all cores are either Zen(+), Zen 2 or Zen 3, so I simplified on that.

So based on the overlap, it seems Gemini Lake (but without sha instructions) is the Common Denominator and this is actually better than x86-64-v2 (but if you target that, you are still fully compatible, just that you don't use all of the instructions that are common to all supported Windows 11 computers. These are the supported features common to all supported Windows 11 CPUs:

target_feature="aes"
target_feature="cmpxchg16b"
target_feature="fxsr"
target_feature="lahfsahf"
target_feature="movbe"
target_feature="pclmulqdq"
target_feature="popcnt"
target_feature="rdrand"
target_feature="rdseed"
target_feature="sse"
target_feature="sse2"
target_feature="sse3"
target_feature="sse4.1"
target_feature="sse4.2"
target_feature="ssse3"
target_feature="xsave"
target_feature="xsavec"
target_feature="xsaveopt"
target_feature="xsaves"

Sadly, AVX and AVX2 support is not common to all Windows 11 CPUs due to Atom chips and segmentation in the Pentium and Celeron lineup until Tiger Lake. So you need to use it behind feature test or not use it at all if you just want portable SIMD code

@CKingX
Copy link
Author

CKingX commented May 28, 2022

This is x86-64-v2 (in LLVM) for context (equivalent to Nehalem features):

target_feature="cmpxchg16b"
target_feature="fxsr"
target_feature="lahfsahf"
target_feature="popcnt"
target_feature="sse"
target_feature="sse2"
target_feature="sse3"
target_feature="sse4.1"
target_feature="sse4.2"
target_feature="ssse3"

So the current common denominator of supported CPUs have more instructions supported than V2 but missing many that are in V3 (V3 is close to Haswell but V3 is missing some that are in Goldmont-plus as well). But SSE 4.2 and SSSE3 can now be fully used if Windows 11 is the minimum requirement (and Windows 11 can be compiled to use these instructions throughout)

@CKingX
Copy link
Author

CKingX commented May 28, 2022

x86-64-v3 (close to Haswell) for comparison:

target_feature="avx"
target_feature="avx2"
target_feature="bmi1"
target_feature="bmi2"
target_feature="cmpxchg16b"
target_feature="f16c" 
target_feature="fma"
target_feature="fxsr"
target_feature="lahfsahf"
target_feature="lzcnt"
target_feature="movbe"
target_feature="popcnt"
target_feature="sse"
target_feature="sse2"
target_feature="sse3"
target_feature="sse4.1"
target_feature="sse4.2"
target_feature="ssse3"
target_feature="xsave"

@CKingX
Copy link
Author

CKingX commented Feb 25, 2024

Just an update, the compiler at the time didn't show cmpxchg16b, movbe, and sahf/lahf for the processors. Since cmpxchg16b and sahf/lahf were already requirements for windows 10, all the processors support them and it is in x86-64-v2 onwards. As for movbe, this is in x86-64-v3 onwards as well as in all processors that support Windows 11.

@CKingX
Copy link
Author

CKingX commented Apr 19, 2024

Turns out Windows 11 supported CPUs also includes Goldmont Plus (including the Gemini Lake). Although I listed Gemini Lake, I said the common denominator is Tremont without SHA instructions, rather than Goldmont Plus

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment