OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2014, 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 void Cleanup(); |
| 19 static const char* hardware() { |
| 20 DEBUG_ASSERT(initialized_); |
| 21 return hardware_; |
| 22 } |
| 23 static bool sse2_supported() { |
| 24 DEBUG_ASSERT(initialized_); |
| 25 return sse2_supported_; |
| 26 } |
| 27 static bool sse4_1_supported() { |
| 28 DEBUG_ASSERT(initialized_); |
| 29 return sse4_1_supported_ && FLAG_use_sse41; |
| 30 } |
| 31 |
| 32 private: |
| 33 static const uint64_t kSSE2BitMask = static_cast<uint64_t>(1) << 26; |
| 34 static const uint64_t kSSE4_1BitMask = static_cast<uint64_t>(1) << 51; |
| 35 static const char* hardware_; |
| 36 static bool sse2_supported_; |
| 37 static bool sse4_1_supported_; |
| 38 #if defined(DEBUG) |
| 39 static bool initialized_; |
| 40 #endif |
| 41 }; |
| 42 |
| 43 class TargetCPUFeatures : public AllStatic { |
| 44 public: |
| 45 static void InitOnce() { |
| 46 HostCPUFeatures::InitOnce(); |
| 47 } |
| 48 static void Cleanup() { |
| 49 HostCPUFeatures::Cleanup(); |
| 50 } |
| 51 static const char* hardware() { |
| 52 return HostCPUFeatures::hardware(); |
| 53 } |
| 54 static bool sse2_supported() { |
| 55 return HostCPUFeatures::sse2_supported(); |
| 56 } |
| 57 static bool sse4_1_supported() { |
| 58 return HostCPUFeatures::sse4_1_supported(); |
| 59 } |
| 60 static bool double_truncate_round_supported() { |
| 61 return sse4_1_supported(); |
| 62 } |
| 63 }; |
| 64 |
| 65 } // namespace dart |
| 66 |
| 67 #endif // VM_CPU_IA32_H_ |
OLD | NEW |