OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | |
2 // for details. All rights reserved. Use of this source code is governed by a | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 #ifndef VM_CPU_IA32_H_ | |
6 #define VM_CPU_IA32_H_ | |
7 | |
8 #include "vm/allocation.h" | |
9 #include "vm/flags.h" | |
10 | |
11 namespace dart { | |
12 | |
13 DECLARE_FLAG(bool, use_sse41); | |
14 | |
15 class HostCPUFeatures : public AllStatic { | |
16 public: | |
17 static void InitOnce(); | |
18 static char* hardware() { | |
19 DEBUG_ASSERT(initialized_); | |
20 return hardware_; | |
21 } | |
22 static bool sse2_supported() { | |
23 DEBUG_ASSERT(initialized_); | |
24 return sse2_supported_; | |
25 } | |
26 static bool sse4_1_supported() { | |
27 DEBUG_ASSERT(initialized_); | |
28 return sse4_1_supported_ && FLAG_use_sse41; | |
29 } | |
30 | |
31 private: | |
32 static const uint64_t kSSE2BitMask = static_cast<uint64_t>(1) << 26; | |
33 static const uint64_t kSSE4_1BitMask = static_cast<uint64_t>(1) << 51; | |
34 static char* hardware_; | |
35 static bool sse2_supported_; | |
36 static bool sse4_1_supported_; | |
37 #if defined(DEBUG) | |
38 static bool initialized_; | |
39 #endif | |
40 }; | |
41 | |
42 class TargetCPUFeatures : public AllStatic { | |
43 public: | |
44 static void InitOnce() { HostCPUFeatures::InitOnce(); } | |
45 static char* hardware() { | |
46 return HostCPUFeatures::hardware(); | |
47 } | |
48 static bool sse2_supported() { | |
49 return HostCPUFeatures::sse2_supported(); | |
50 } | |
51 static bool sse4_1_supported() { | |
52 return HostCPUFeatures::sse4_1_supported(); | |
53 } | |
54 static bool double_truncate_round_supported() { | |
55 return sse4_1_supported(); | |
56 } | |
57 }; | |
58 | |
59 } // namespace dart | |
60 | |
61 #endif // VM_CPU_IA32_H_ | |
OLD | NEW |