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

Side by Side Diff: base/cpu_unittest.cc

Issue 9836125: Fix base::CPU detection. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: move drift test Created 8 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/cpu.cc ('k') | base/time_win_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/cpu.h" 5 #include "base/cpu.h"
6 #include "build/build_config.h"
6 7
7 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
8 9
9 // Tests whether we can run extended instructions represented by the CPU 10 // Tests whether we can run extended instructions represented by the CPU
10 // information. This test actually executes some extended instructions (such as 11 // information. This test actually executes some extended instructions (such as
11 // MMX, SSE, etc.) supported by the CPU and sees we can run them without 12 // MMX, SSE, etc.) supported by the CPU and sees we can run them without
12 // "undefined instruction" exceptions. That is, this test succeeds when this 13 // "undefined instruction" exceptions. That is, this test succeeds when this
13 // test finishes without a crash. 14 // test finishes without a crash.
14 TEST(CPU, RunExtendedInstructions) { 15 TEST(CPU, RunExtendedInstructions) {
15 #if defined(ARCH_CPU_X86_FAMILY) 16 #if defined(ARCH_CPU_X86_FAMILY)
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 __asm__ __volatile__("pmuldq %%xmm0, %%xmm0\n" : : : "xmm0"); 83 __asm__ __volatile__("pmuldq %%xmm0, %%xmm0\n" : : : "xmm0");
83 } 84 }
84 85
85 if (cpu.has_sse42()) { 86 if (cpu.has_sse42()) {
86 // Execute an SSE 4.2 instruction. 87 // Execute an SSE 4.2 instruction.
87 __asm__ __volatile__("crc32 %%eax, %%eax\n" : : : "eax"); 88 __asm__ __volatile__("crc32 %%eax, %%eax\n" : : : "eax");
88 } 89 }
89 #endif 90 #endif
90 #endif 91 #endif
91 } 92 }
OLDNEW
« no previous file with comments | « base/cpu.cc ('k') | base/time_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698