| 1 |
; Copyright (C) 2021-2025 Free Software Foundation, Inc. |
| 2 |
; |
| 3 |
; This file is part of GCC. |
| 4 |
; |
| 5 |
; GCC is free software; you can redistribute it and/or modify it under |
| 6 |
; the terms of the GNU General Public License as published by the Free |
| 7 |
; Software Foundation; either version 3, or (at your option) any later |
| 8 |
; version. |
| 9 |
; |
| 10 |
; GCC is distributed in the hope that it will be useful, but WITHOUT |
| 11 |
; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 12 |
; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public |
| 13 |
; License for more details. |
| 14 |
; |
| 15 |
; You should have received a copy of the GNU General Public License |
| 16 |
; along with GCC; see the file COPYING3. If not see |
| 17 |
; <http://www.gnu.org/licenses/>. |
| 18 |
; |
| 19 |
|
| 20 |
HeaderInclude |
| 21 |
config/loongarch/loongarch-opts.h |
| 22 |
|
| 23 |
HeaderInclude |
| 24 |
config/loongarch/loongarch-str.h |
| 25 |
|
| 26 |
TargetVariable |
| 27 |
unsigned int recip_mask = 0 |
| 28 |
|
| 29 |
; ISA related options |
| 30 |
;; Base ISA |
| 31 |
Enum |
| 32 |
Name(isa_base) Type(int) |
| 33 |
Basic ISAs of LoongArch: |
| 34 |
|
| 35 |
EnumValue |
| 36 |
Enum(isa_base) String(@@STR_ISA_BASE_LA64@@) Value(ISA_BASE_LA64) |
| 37 |
|
| 38 |
;; ISA extensions / adjustments |
| 39 |
Enum |
| 40 |
Name(isa_ext_fpu) Type(int) |
| 41 |
FPU types of LoongArch: |
| 42 |
|
| 43 |
EnumValue |
| 44 |
Enum(isa_ext_fpu) String(@@STR_NONE@@) Value(ISA_EXT_NONE) |
| 45 |
|
| 46 |
EnumValue |
| 47 |
Enum(isa_ext_fpu) String(@@STR_ISA_EXT_FPU32@@) Value(ISA_EXT_FPU32) |
| 48 |
|
| 49 |
EnumValue |
| 50 |
Enum(isa_ext_fpu) String(@@STR_ISA_EXT_FPU64@@) Value(ISA_EXT_FPU64) |
| 51 |
|
| 52 |
m@@OPTSTR_ISA_EXT_FPU@@= |
| 53 |
Target RejectNegative Joined ToLower Enum(isa_ext_fpu) Var(la_opt_fpu) Init(M_OPT_UNSET) Save |
| 54 |
-m@@OPTSTR_ISA_EXT_FPU@@=FPU Generate code for the given FPU. |
| 55 |
|
| 56 |
m@@OPTSTR_ISA_EXT_FPU@@=@@STR_ISA_EXT_FPU0@@ |
| 57 |
Target RejectNegative Alias(m@@OPTSTR_ISA_EXT_FPU@@=,@@STR_NONE@@) |
| 58 |
|
| 59 |
m@@OPTSTR_SOFT_FLOAT@@ |
| 60 |
Target Driver Defer Var(la_deferred_options) RejectNegative Negative(m@@OPTSTR_SINGLE_FLOAT@@) |
| 61 |
Prevent the use of all hardware floating-point instructions. |
| 62 |
|
| 63 |
m@@OPTSTR_SINGLE_FLOAT@@ |
| 64 |
Target Driver Defer Var(la_deferred_options) RejectNegative Negative(m@@OPTSTR_DOUBLE_FLOAT@@) |
| 65 |
Restrict the use of hardware floating-point instructions to 32-bit operations. |
| 66 |
|
| 67 |
m@@OPTSTR_DOUBLE_FLOAT@@ |
| 68 |
Target Driver Defer Var(la_deferred_options) RejectNegative Negative(m@@OPTSTR_SOFT_FLOAT@@) |
| 69 |
Allow hardware floating-point instructions to cover both 32-bit and 64-bit operations. |
| 70 |
|
| 71 |
Enum |
| 72 |
Name(isa_ext_simd) Type(int) |
| 73 |
SIMD extension levels of LoongArch: |
| 74 |
|
| 75 |
EnumValue |
| 76 |
Enum(isa_ext_simd) String(@@STR_NONE@@) Value(ISA_EXT_NONE) |
| 77 |
|
| 78 |
EnumValue |
| 79 |
Enum(isa_ext_simd) String(@@STR_ISA_EXT_LSX@@) Value(ISA_EXT_SIMD_LSX) |
| 80 |
|
| 81 |
EnumValue |
| 82 |
Enum(isa_ext_simd) String(@@STR_ISA_EXT_LASX@@) Value(ISA_EXT_SIMD_LASX) |
| 83 |
|
| 84 |
m@@OPTSTR_ISA_EXT_SIMD@@= |
| 85 |
Target RejectNegative Joined ToLower Enum(isa_ext_simd) Var(la_opt_simd) Init(M_OPT_UNSET) Save |
| 86 |
-m@@OPTSTR_ISA_EXT_SIMD@@=SIMD Generate code for the given SIMD extension. |
| 87 |
|
| 88 |
m@@STR_ISA_EXT_LSX@@ |
| 89 |
Target Driver Defer Var(la_deferred_options) |
| 90 |
Enable LoongArch SIMD Extension (LSX, 128-bit). |
| 91 |
|
| 92 |
m@@STR_ISA_EXT_LASX@@ |
| 93 |
Target Driver Defer Var(la_deferred_options) |
| 94 |
Enable LoongArch Advanced SIMD Extension (LASX, 256-bit). |
| 95 |
|
| 96 |
;; Base target models (implies ISA & tune parameters) |
| 97 |
Enum |
| 98 |
Name(arch_type) Type(int) |
| 99 |
LoongArch ARCH presets: |
| 100 |
|
| 101 |
EnumValue |
| 102 |
Enum(arch_type) String(@@STR_CPU_NATIVE@@) Value(ARCH_NATIVE) |
| 103 |
|
| 104 |
EnumValue |
| 105 |
Enum(arch_type) String(@@STR_ARCH_ABI_DEFAULT@@) Value(ARCH_ABI_DEFAULT) |
| 106 |
|
| 107 |
EnumValue |
| 108 |
Enum(arch_type) String(@@STR_CPU_LOONGARCH64@@) Value(ARCH_LOONGARCH64) |
| 109 |
|
| 110 |
EnumValue |
| 111 |
Enum(arch_type) String(@@STR_CPU_LA464@@) Value(ARCH_LA464) |
| 112 |
|
| 113 |
EnumValue |
| 114 |
Enum(arch_type) String(@@STR_CPU_LA664@@) Value(ARCH_LA664) |
| 115 |
|
| 116 |
EnumValue |
| 117 |
Enum(arch_type) String(@@STR_ARCH_LA64V1_0@@) Value(ARCH_LA64V1_0) |
| 118 |
|
| 119 |
EnumValue |
| 120 |
Enum(arch_type) String(@@STR_ARCH_LA64V1_1@@) Value(ARCH_LA64V1_1) |
| 121 |
|
| 122 |
m@@OPTSTR_ARCH@@= |
| 123 |
Target RejectNegative Joined Enum(arch_type) Var(la_opt_cpu_arch) Init(M_OPT_UNSET) Save |
| 124 |
-m@@OPTSTR_ARCH@@=PROCESSOR Generate code for the given PROCESSOR ISA. |
| 125 |
|
| 126 |
Enum |
| 127 |
Name(tune_type) Type(int) |
| 128 |
LoongArch TUNE presets: |
| 129 |
|
| 130 |
EnumValue |
| 131 |
Enum(tune_type) String(@@STR_CPU_NATIVE@@) Value(TUNE_NATIVE) |
| 132 |
|
| 133 |
EnumValue |
| 134 |
Enum(tune_type) String(@@STR_TUNE_GENERIC@@) Value(TUNE_GENERIC) |
| 135 |
|
| 136 |
EnumValue |
| 137 |
Enum(tune_type) String(@@STR_CPU_LOONGARCH64@@) Value(TUNE_LOONGARCH64) |
| 138 |
|
| 139 |
EnumValue |
| 140 |
Enum(tune_type) String(@@STR_CPU_LA464@@) Value(TUNE_LA464) |
| 141 |
|
| 142 |
EnumValue |
| 143 |
Enum(tune_type) String(@@STR_CPU_LA664@@) Value(TUNE_LA664) |
| 144 |
|
| 145 |
m@@OPTSTR_TUNE@@= |
| 146 |
Target RejectNegative Joined Enum(tune_type) Var(la_opt_cpu_tune) Init(M_OPT_UNSET) Save |
| 147 |
-m@@OPTSTR_TUNE@@=PROCESSOR Generate optimized code for PROCESSOR. |
| 148 |
|
| 149 |
|
| 150 |
; ABI related options |
| 151 |
; (ISA constraints on ABI are handled dynamically) |
| 152 |
|
| 153 |
;; Base ABI |
| 154 |
Enum |
| 155 |
Name(abi_base) Type(int) |
| 156 |
Base ABI types for LoongArch: |
| 157 |
|
| 158 |
EnumValue |
| 159 |
Enum(abi_base) String(@@STR_ABI_BASE_LP64D@@) Value(ABI_BASE_LP64D) |
| 160 |
|
| 161 |
EnumValue |
| 162 |
Enum(abi_base) String(@@STR_ABI_BASE_LP64F@@) Value(ABI_BASE_LP64F) |
| 163 |
|
| 164 |
EnumValue |
| 165 |
Enum(abi_base) String(@@STR_ABI_BASE_LP64S@@) Value(ABI_BASE_LP64S) |
| 166 |
|
| 167 |
m@@OPTSTR_ABI_BASE@@= |
| 168 |
Target RejectNegative Joined ToLower Enum(abi_base) Var(la_opt_abi_base) Init(M_OPT_UNSET) |
| 169 |
-m@@OPTSTR_ABI_BASE@@=BASEABI Generate code that conforms to the given BASEABI. |
| 170 |
|
| 171 |
|
| 172 |
;; ABI Extension |
| 173 |
Variable |
| 174 |
int la_opt_abi_ext = M_OPT_UNSET |
| 175 |
|
| 176 |
mbranch-cost= |
| 177 |
Target RejectNegative Joined UInteger Var(la_branch_cost) Save |
| 178 |
-mbranch-cost=COST Set the cost of branches to roughly COST instructions. |
| 179 |
|
| 180 |
maddr-reg-reg-cost= |
| 181 |
Target RejectNegative Joined UInteger Var(la_addr_reg_reg_cost) Save |
| 182 |
-maddr-reg-reg-cost=COST Set the cost of ADDRESS_REG_REG to the value calculated by COST. |
| 183 |
|
| 184 |
mcheck-zero-division |
| 185 |
Target Mask(CHECK_ZERO_DIV) Save |
| 186 |
Trap on integer divide by zero. |
| 187 |
|
| 188 |
mcond-move-int |
| 189 |
Target Mask(COND_MOVE_INT) Save |
| 190 |
Conditional moves for integral are enabled. |
| 191 |
|
| 192 |
mcond-move-float |
| 193 |
Target Mask(COND_MOVE_FLOAT) Save |
| 194 |
Conditional moves for float are enabled. |
| 195 |
|
| 196 |
mmemcpy |
| 197 |
Target Mask(MEMCPY) Save |
| 198 |
Prevent optimizing block moves, which is also the default behavior of -Os. |
| 199 |
|
| 200 |
mstrict-align |
| 201 |
Target Mask(STRICT_ALIGN) Save |
| 202 |
Do not generate unaligned memory accesses. |
| 203 |
|
| 204 |
mmax-inline-memcpy-size= |
| 205 |
Target Joined RejectNegative UInteger Var(la_max_inline_memcpy_size) Init(1024) Save |
| 206 |
-mmax-inline-memcpy-size=SIZE Set the max size of memcpy to inline, default is 1024. |
| 207 |
|
| 208 |
Enum |
| 209 |
Name(explicit_relocs) Type(int) |
| 210 |
The code model option names for -mexplicit-relocs: |
| 211 |
|
| 212 |
EnumValue |
| 213 |
Enum(explicit_relocs) String(auto) Value(EXPLICIT_RELOCS_AUTO) |
| 214 |
|
| 215 |
EnumValue |
| 216 |
Enum(explicit_relocs) String(none) Value(EXPLICIT_RELOCS_NONE) |
| 217 |
|
| 218 |
EnumValue |
| 219 |
Enum(explicit_relocs) String(always) Value(EXPLICIT_RELOCS_ALWAYS) |
| 220 |
|
| 221 |
mexplicit-relocs= |
| 222 |
Target RejectNegative Joined Enum(explicit_relocs) Var(la_opt_explicit_relocs) Init(M_OPT_UNSET) |
| 223 |
Use %reloc() assembly operators. |
| 224 |
|
| 225 |
mexplicit-relocs |
| 226 |
Target Alias(mexplicit-relocs=, always, none) |
| 227 |
Use %reloc() assembly operators (for backward compatibility). |
| 228 |
|
| 229 |
mrecip= |
| 230 |
Target RejectNegative Joined Var(la_recip_name) Save |
| 231 |
Control generation of reciprocal estimates. |
| 232 |
|
| 233 |
mrecip |
| 234 |
Target Alias(mrecip=, all, none) |
| 235 |
Generate approximate reciprocal divide and square root for better throughput. |
| 236 |
|
| 237 |
; The code model option names for -mcmodel. |
| 238 |
Enum |
| 239 |
Name(cmodel) Type(int) |
| 240 |
The code model option names for -mcmodel: |
| 241 |
|
| 242 |
EnumValue |
| 243 |
Enum(cmodel) String(@@STR_CMODEL_NORMAL@@) Value(CMODEL_NORMAL) |
| 244 |
|
| 245 |
EnumValue |
| 246 |
Enum(cmodel) String(@@STR_CMODEL_TINY@@) Value(CMODEL_TINY) |
| 247 |
|
| 248 |
EnumValue |
| 249 |
Enum(cmodel) String(@@STR_CMODEL_TS@@) Value(CMODEL_TINY_STATIC) |
| 250 |
|
| 251 |
EnumValue |
| 252 |
Enum(cmodel) String(@@STR_CMODEL_MEDIUM@@) Value(CMODEL_MEDIUM) |
| 253 |
|
| 254 |
EnumValue |
| 255 |
Enum(cmodel) String(@@STR_CMODEL_LARGE@@) Value(CMODEL_LARGE) |
| 256 |
|
| 257 |
EnumValue |
| 258 |
Enum(cmodel) String(@@STR_CMODEL_EXTREME@@) Value(CMODEL_EXTREME) |
| 259 |
|
| 260 |
mcmodel= |
| 261 |
Target RejectNegative Joined Enum(cmodel) Var(la_opt_cmodel) Init(M_OPT_UNSET) Save |
| 262 |
Specify the code model. |
| 263 |
|
| 264 |
mdirect-extern-access |
| 265 |
Target Mask(DIRECT_EXTERN_ACCESS) Save |
| 266 |
Avoid using the GOT to access external symbols. |
| 267 |
|
| 268 |
mrelax |
| 269 |
Target Mask(LINKER_RELAXATION) |
| 270 |
Take advantage of linker relaxations to reduce the number of instructions |
| 271 |
required to materialize symbol addresses. |
| 272 |
|
| 273 |
mpass-mrelax-to-as |
| 274 |
Driver Var(la_pass_mrelax_to_as) Init(HAVE_AS_MRELAX_OPTION) |
| 275 |
Pass -mrelax or -mno-relax option to the assembler. |
| 276 |
|
| 277 |
Enum |
| 278 |
Name(tls_type) Type(int) |
| 279 |
The possible TLS dialects: |
| 280 |
|
| 281 |
EnumValue |
| 282 |
Enum(tls_type) String(trad) Value(TLS_TRADITIONAL) |
| 283 |
|
| 284 |
EnumValue |
| 285 |
Enum(tls_type) String(desc) Value(TLS_DESCRIPTORS) |
| 286 |
|
| 287 |
mtls-dialect= |
| 288 |
Target RejectNegative Joined Enum(tls_type) Var(la_opt_tls_dialect) Init(M_OPT_UNSET) Save |
| 289 |
Specify TLS dialect. |
| 290 |
|
| 291 |
-param=loongarch-vect-unroll-limit= |
| 292 |
Target Joined UInteger Var(la_vect_unroll_limit) Init(6) IntegerRange(1, 64) Param |
| 293 |
Used to limit unroll factor which indicates how much the autovectorizer may |
| 294 |
unroll a loop. The default value is 6. |
| 295 |
|
| 296 |
-param=loongarch-vect-issue-info= |
| 297 |
Target Undocumented Joined UInteger Var(la_vect_issue_info) Init(4) IntegerRange(1, 64) Param |
| 298 |
Indicate how many non memory access vector instructions can be issued per |
| 299 |
cycle, it's used in unroll factor determination for autovectorizer. The |
| 300 |
default value is 4. |
| 301 |
|
| 302 |
; Features added during ISA evolution. This concept is different from ISA |
| 303 |
; extension, read Section 1.5 of LoongArch v1.10 Volume 1 for the |
| 304 |
; explanation. These features may be implemented and enumerated with |
| 305 |
; CPUCFG independently, so we use bit flags to specify them. |
| 306 |
TargetVariable |
| 307 |
HOST_WIDE_INT la_isa_evolution = 0 |
| 308 |
|
| 309 |
mannotate-tablejump |
| 310 |
Target Mask(ANNOTATE_TABLEJUMP) Save |
| 311 |
Annotate table jump instruction (jr {reg}) to correlate it with the jump table. |