OLD | NEW |
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 | 6 |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 | 8 |
9 // Tests whether we can run extended instructions represented by the CPU | 9 // Tests whether we can run extended instructions represented by the CPU |
10 // information. This test actually executes some extended instructions (such as | 10 // information. This test actually executes some extended instructions (such as |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 | 44 |
45 if (cpu.has_sse41()) { | 45 if (cpu.has_sse41()) { |
46 // Execute an SSE 4.1 instruction. | 46 // Execute an SSE 4.1 instruction. |
47 __asm pmuldq xmm0, xmm0; | 47 __asm pmuldq xmm0, xmm0; |
48 } | 48 } |
49 | 49 |
50 if (cpu.has_sse42()) { | 50 if (cpu.has_sse42()) { |
51 // Execute an SSE 4.2 instruction. | 51 // Execute an SSE 4.2 instruction. |
52 __asm crc32 eax, eax; | 52 __asm crc32 eax, eax; |
53 } | 53 } |
54 #elif defined(OS_POSIX) | 54 #elif defined(OS_POSIX) || defined(__x86_64__) |
55 ASSERT_TRUE(cpu.has_mmx()); | 55 ASSERT_TRUE(cpu.has_mmx()); |
56 | 56 |
57 // Execute an MMX instruction. | 57 // Execute an MMX instruction. |
58 __asm__ __volatile__("emms\n" : : : "mm0"); | 58 __asm__ __volatile__("emms\n" : : : "mm0"); |
59 | 59 |
60 if (cpu.has_sse()) { | 60 if (cpu.has_sse()) { |
61 // Execute an SSE instruction. | 61 // Execute an SSE instruction. |
62 __asm__ __volatile__("xorps %%xmm0, %%xmm0\n" : : : "xmm0"); | 62 __asm__ __volatile__("xorps %%xmm0, %%xmm0\n" : : : "xmm0"); |
63 } | 63 } |
64 | 64 |
(...skipping 17 matching lines...) Expand all Loading... |
82 __asm__ __volatile__("pmuldq %%xmm0, %%xmm0\n" : : : "xmm0"); | 82 __asm__ __volatile__("pmuldq %%xmm0, %%xmm0\n" : : : "xmm0"); |
83 } | 83 } |
84 | 84 |
85 if (cpu.has_sse42()) { | 85 if (cpu.has_sse42()) { |
86 // Execute an SSE 4.2 instruction. | 86 // Execute an SSE 4.2 instruction. |
87 __asm__ __volatile__("crc32 %%eax, %%eax\n" : : : "eax"); | 87 __asm__ __volatile__("crc32 %%eax, %%eax\n" : : : "eax"); |
88 } | 88 } |
89 #endif | 89 #endif |
90 #endif | 90 #endif |
91 } | 91 } |
OLD | NEW |