Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2627)

Unified Diff: source/cpu_id.cc

Issue 1382803002: test xsave before calling xgetbv. (Closed) Base URL: https://chromium.googlesource.com/libyuv/libyuv@master
Patch Set: doyuv Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/libyuv/version.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: source/cpu_id.cc
diff --git a/source/cpu_id.cc b/source/cpu_id.cc
index 088afe92d12fb4b114d8baa3b97b6c72216a70c1..28155466a770a8400f910b1253e63e695de8bdd5 100644
--- a/source/cpu_id.cc
+++ b/source/cpu_id.cc
@@ -216,9 +216,8 @@ int InitCpuFlags(void) {
kCpuHasX86;
#ifdef HAS_XGETBV
- // Avoid call to xgetbv if AVX disabled for drmemory.
- // TODO(fbarchard): check xsave before calling xgetbv.
- if ((cpu_info1[2] & 0x18000000) == 0x18000000 && // AVX and OSSave
+ // AVX requires CPU has AVX, XSAVE and OSXSave for xgetbv
+ if ((cpu_info1[2] & 0x1c000000) == 0x1c000000 && // AVX and OSXSave
!TestEnv("LIBYUV_DISABLE_AVX") && TestOsSaveYmm()) { // Saves YMM.
cpu_info_ |= ((cpu_info7[1] & 0x00000020) ? kCpuHasAVX2 : 0) |
kCpuHasAVX;
« no previous file with comments | « include/libyuv/version.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698