| 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 // Code in this file is taked from | 5 // Code in this file is taked from |
| 6 // third_party/skia/src/opts/opts_check_SSE2.cpp. | 6 // third_party/skia/src/opts/opts_check_SSE2.cpp. |
| 7 | 7 |
| 8 // Note that this file cannot be compiled with -msse2 in gcc. | 8 // Note that this file cannot be compiled with -msse2 in gcc. |
| 9 | 9 |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 // does not use ebx (or rbx) as a GOT register. | 41 // does not use ebx (or rbx) as a GOT register. |
| 42 asm volatile ( | 42 asm volatile ( |
| 43 "cpuid \n\t" | 43 "cpuid \n\t" |
| 44 : "=a"(info[0]), "=r"(info[1]), "=c"(info[2]), "=d"(info[3]) | 44 : "=a"(info[0]), "=r"(info[1]), "=c"(info[2]), "=d"(info[3]) |
| 45 : "a"(info_type) | 45 : "a"(info_type) |
| 46 ); | 46 ); |
| 47 #endif | 47 #endif |
| 48 } | 48 } |
| 49 #endif | 49 #endif |
| 50 | 50 |
| 51 bool hasMMX() { |
| 52 // TODO(hclam): Acutually checks it. |
| 53 return true; |
| 54 } |
| 55 |
| 56 bool hasSSE() { |
| 57 // TODO(hclam): Actually checks it. |
| 58 return true; |
| 59 } |
| 60 |
| 51 bool hasSSE2() { | 61 bool hasSSE2() { |
| 52 #if defined(ARCH_CPU_X86_64) | 62 #if defined(ARCH_CPU_X86_64) |
| 53 /* All x86_64 machines have SSE2, so don't even bother checking. */ | 63 /* All x86_64 machines have SSE2, so don't even bother checking. */ |
| 54 return true; | 64 return true; |
| 55 #else | 65 #else |
| 56 int cpu_info[4] = { 0 }; | 66 int cpu_info[4] = { 0 }; |
| 57 getcpuid(1, cpu_info); | 67 getcpuid(1, cpu_info); |
| 58 return (cpu_info[3] & (1<<26)) != 0; | 68 return (cpu_info[3] & (1<<26)) != 0; |
| 59 #endif | 69 #endif |
| 60 } | 70 } |
| 61 | 71 |
| 62 bool hasSSSE3() { | 72 bool hasSSSE3() { |
| 63 int cpu_info[4] = { 0 }; | 73 int cpu_info[4] = { 0 }; |
| 64 getcpuid(1, cpu_info); | 74 getcpuid(1, cpu_info); |
| 65 return (cpu_info[3] & 0x04000000) != 0 && (cpu_info[2] & 0x00000001) != 0 && | 75 return (cpu_info[3] & 0x04000000) != 0 && (cpu_info[2] & 0x00000001) != 0 && |
| 66 (cpu_info[2] & 0x00000200) != 0; | 76 (cpu_info[2] & 0x00000200) != 0; |
| 67 } | 77 } |
| 68 | 78 |
| 69 } // namespace media | 79 } // namespace media |
| OLD | NEW |