[PATCH] D65766: Test the right bit to detect BMI2

Ori Livneh via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 5 11:35:17 PDT 2019


atdt created this revision.
Herald added projects: Sanitizers, LLVM.
Herald added subscribers: llvm-commits, Sanitizers.

BMI2 support is indicated in bit eight of EBX, not nine.
See Intel SDM, Vol 2A, Table 3-8.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D65766

Files:
  compiler-rt/lib/builtins/cpu_model.c


Index: compiler-rt/lib/builtins/cpu_model.c
===================================================================
--- compiler-rt/lib/builtins/cpu_model.c
+++ compiler-rt/lib/builtins/cpu_model.c
@@ -543,7 +543,7 @@
     setFeature(FEATURE_BMI);
   if (HasLeaf7 && ((EBX >> 5) & 1) && HasAVX)
     setFeature(FEATURE_AVX2);
-  if (HasLeaf7 && ((EBX >> 9) & 1))
+  if (HasLeaf7 && ((EBX >> 8) & 1))
     setFeature(FEATURE_BMI2);
   if (HasLeaf7 && ((EBX >> 16) & 1) && HasAVX512Save)
     setFeature(FEATURE_AVX512F);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65766.213421.patch
Type: text/x-patch
Size: 516 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190805/a615a7f1/attachment.bin>


More information about the llvm-commits mailing list