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 arm_float_abi = "softfp" 84 } else if (current_os == "linux" && target_cpu != v8_target_cpu) { 85 arm_float_abi = "softfp" 86 } else { 87 arm_float_abi = "hard" 88 } 89 } 90 91 if (arm_fpu == "") { 92 if (arm_use_neon) { 93 arm_fpu = "neon" 94 } else { 95 arm_fpu = "vfpv3-d16" 96 } 97 } 98 } else if (arm_version == 8) { 99 if (arm_arch == "") { 100 arm_arch = "armv8-a" 101 } 102 if (arm_tune == "") { 103 arm_tune = "generic-armv8-a" 104 } 105 106 if (arm_float_abi == "") { 107 if (current_os == "ohos" || target_os == "ohos") { 108 arm_float_abi = "softfp" 109 } else { 110 arm_float_abi = "hard" 111 } 112 } 113 114 if (arm_fpu == "") { 115 if (arm_use_neon) { 116 arm_fpu = "neon" 117 } else { 118 arm_fpu = "vfpv3-d16" 119 } 120 } 121 } 122} else if (current_cpu == "arm64" || v8_current_cpu == "arm64") { 123 # arm64 supports only "hard". 124 arm_float_abi = "hard" 125 arm_use_neon = true 126} 127