Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
cpu_x64.h
Go to the documentation of this file.
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 RUNTIME_VM_CPU_X64_H_
6#define RUNTIME_VM_CPU_X64_H_
7
8#if !defined(RUNTIME_VM_CPU_H_)
9#error Do not include cpu_x64.h directly; use cpu.h instead.
10#endif
11
12#include "vm/allocation.h"
13#include "vm/flags.h"
14
15namespace dart {
16
17DECLARE_FLAG(bool, use_sse41);
18
19class HostCPUFeatures : public AllStatic {
20 public:
21 static void Init();
22 static void Cleanup();
23 static const char* hardware() {
24 DEBUG_ASSERT(initialized_);
25 return hardware_;
26 }
27 static bool sse2_supported() {
28 DEBUG_ASSERT(initialized_);
29 return sse2_supported_;
30 }
31 static bool sse4_1_supported() {
32 DEBUG_ASSERT(initialized_);
33 return sse4_1_supported_ && FLAG_use_sse41 && !FLAG_target_unknown_cpu;
34 }
35 static bool popcnt_supported() {
36 DEBUG_ASSERT(initialized_);
37 return popcnt_supported_ && !FLAG_target_unknown_cpu;
38 }
39 static bool abm_supported() {
40 DEBUG_ASSERT(initialized_);
41 return abm_supported_ && !FLAG_target_unknown_cpu;
42 }
43
44 private:
45 static const char* hardware_;
46 static bool sse2_supported_;
47 static bool sse4_1_supported_;
48 static bool popcnt_supported_;
49 static bool abm_supported_;
50#if defined(DEBUG)
51 static bool initialized_;
52#endif
53};
54
55class TargetCPUFeatures : public AllStatic {
56 public:
57 static void Init() { HostCPUFeatures::Init(); }
58 static void Cleanup() { HostCPUFeatures::Cleanup(); }
59 static const char* hardware() { return HostCPUFeatures::hardware(); }
67};
68
69} // namespace dart
70
71#endif // RUNTIME_VM_CPU_X64_H_
#define DEBUG_ASSERT(cond)
Definition assert.h:321
static bool popcnt_supported()
Definition cpu_x64.h:35
static const char * hardware()
Definition cpu_x64.h:23
static void Init()
static bool abm_supported()
Definition cpu_x64.h:39
static bool sse4_1_supported()
Definition cpu_x64.h:31
static bool sse2_supported()
Definition cpu_x64.h:27
static void Cleanup()
static bool sse4_1_supported()
Definition cpu_x64.h:61
static void Init()
Definition cpu_x64.h:57
static bool sse2_supported()
Definition cpu_x64.h:60
static bool popcnt_supported()
Definition cpu_x64.h:62
static bool double_truncate_round_supported()
Definition cpu_x64.h:64
static void Cleanup()
Definition cpu_x64.h:58
static const char * hardware()
Definition cpu_x64.h:59
static bool abm_supported()
Definition cpu_x64.h:63
#define DECLARE_FLAG(type, name)
Definition flags.h:14