• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2014 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5import("//build/config/v8_target_cpu.gni")
6
7# These are primarily relevant in current_cpu == "arm" contexts, where
8# ARM code is being compiled.  But they can also be relevant in the
9# other contexts when the code will change its behavior based on the
10# cpu it wants to generate code for.
11if (current_cpu == "arm" || v8_current_cpu == "arm") {
12  declare_args() {
13    # Version of the ARM processor when compiling on ARM. Ignored on non-ARM
14    # platforms.
15    arm_version = 7
16
17    # The ARM architecture. This will be a string like "armv6" or "armv7-a".
18    # An empty string means to use the default for the arm_version.
19    arm_arch = ""
20
21    # The ARM floating point hardware. This will be a string like "neon" or
22    # "vfpv3". An empty string means to use the default for the arm_version.
23    arm_fpu = ""
24
25    # The ARM floating point mode. This is either the string "hard", "soft", or
26    # "softfp". An empty string means to use the default one for the
27    # arm_version.
28    arm_float_abi = ""
29
30    # The ARM variant-specific tuning mode. This will be a string like "armv6"
31    # or "cortex-a15". An empty string means to use the default for the
32    # arm_version.
33    arm_tune = ""
34
35    # Whether to use the neon FPU instruction set or not.
36    arm_use_neon = ""
37
38    # Whether to enable optional NEON code paths.
39    arm_optionally_use_neon = false
40
41    # Thumb is a reduced instruction set available on some ARM processors that
42    # has increased code density.
43    arm_use_thumb = true
44  }
45
46  assert(arm_float_abi == "" || arm_float_abi == "hard" ||
47         arm_float_abi == "soft" || arm_float_abi == "softfp")
48
49  if (arm_use_neon == "") {
50    if (current_os == "linux" && target_cpu != v8_target_cpu) {
51      # Don't use neon on V8 simulator builds as a default.
52      arm_use_neon = false
53    } else {
54      arm_use_neon = true
55    }
56  }
57
58  if (arm_version == 6) {
59    if (arm_arch == "") {
60      arm_arch = "armv6"
61    }
62    if (arm_tune != "") {
63      arm_tune = ""
64    }
65    if (arm_float_abi == "") {
66      arm_float_abi = "softfp"
67    }
68    if (arm_fpu == "") {
69      arm_fpu = "vfp"
70    }
71    arm_use_thumb = false
72    arm_use_neon = false
73  } else if (arm_version == 7) {
74    if (arm_arch == "") {
75      arm_arch = "armv7-a"
76    }
77    if (arm_tune == "") {
78      arm_tune = "generic-armv7-a"
79    }
80
81    if (arm_float_abi == "") {
82      if (current_os == "ohos" || target_os == "ohos" ||
83          target_os == "android") {
84        arm_float_abi = "softfp"
85      } else if (current_os == "linux" && target_cpu != v8_target_cpu) {
86        arm_float_abi = "softfp"
87      } else {
88        arm_float_abi = "hard"
89      }
90    }
91
92    if (arm_fpu == "") {
93      if (arm_use_neon) {
94        arm_fpu = "neon"
95      } else {
96        arm_fpu = "vfpv3-d16"
97      }
98    }
99  } else if (arm_version == 8) {
100    if (arm_arch == "") {
101      arm_arch = "armv8-a"
102    }
103    if (arm_tune == "") {
104      arm_tune = "generic-armv8-a"
105    }
106
107    if (arm_float_abi == "") {
108      if (current_os == "ohos" || target_os == "ohos" ||
109          target_os == "android") {
110        arm_float_abi = "softfp"
111      } else {
112        arm_float_abi = "hard"
113      }
114    }
115
116    if (arm_fpu == "") {
117      if (arm_use_neon) {
118        arm_fpu = "neon"
119      } else {
120        arm_fpu = "vfpv3-d16"
121      }
122    }
123  }
124} else if (current_cpu == "arm64" || v8_current_cpu == "arm64") {
125  if (!defined(board_arch)) {
126    arm_arch = "armv8-a"
127  } else {
128    arm_arch = "$board_arch"
129  }
130  if (!defined(board_cpu)) {
131    arm_cpu = "cortex-a55"
132  } else {
133    arm_cpu = "$board_cpu"
134  }
135  if (!defined(board_fpu)) {
136    arm_fpu = "neon-fp-armv8"
137  } else {
138    arm_fpu = "$board_fpu"
139  }
140
141  # arm64 supports only "hard".
142  arm_float_abi = "hard"
143  arm_use_neon = true
144}
145