Movatterモバイル変換


[0]ホーム

URL:


Next:, Previous:, Up:Machine-Dependent Options   [Contents][Index]


3.21.41 RISC-V Options

These command-line options are defined for RISC-V targets:

-mbranch-cost=n

Set the cost of branches to roughlyn instructions.

-mabi=ABI-string

Specify integer and floating-point calling convention.ABI-stringcontains two parts: the size of integer types and the registers used forfloating-point types. For example ‘-march=rv64ifd -mabi=lp64d’ means that‘long’ and pointers are 64-bit (implicitly defining ‘int’ to be32-bit), and that floating-point values up to 64 bits wide are passed in Fregisters. Contrast this with ‘-march=rv64ifd -mabi=lp64f’, which stillallows the compiler to generate code that uses the F and D extensions but onlyallows floating-point values up to 32 bits long to be passed in registers; or‘-march=rv64ifd -mabi=lp64’, in which no floating-point arguments arepassed in registers.

The default for this argument is system dependent; if you want a specificcalling convention you should specify one explicitly. The valid callingconventions are: ‘ilp32’, ‘ilp32f’, ‘ilp32d’, ‘lp64’,‘lp64f’, and ‘lp64d’. Some calling conventions are impossible toimplement on some ISAs: for example, ‘-march=rv32if -mabi=ilp32d’ isinvalid because the ABI requires 64-bit values be passed in F registers, but Fregisters are only 32 bits wide. There are also the ‘ilp32e’ ABI that canonly be used with the ‘rv32e’ architecture and the ‘lp64e’ ABI thatcan only be used with the ‘rv64e’. Those ABIs are not well-specified atpresent, and are subject to change.

-mfdiv
-mno-fdiv

Do or don’t use hardware floating-point divide and square root instructions.This requires the F or D extensions for floating-point registers. The defaultis to use them if the specified architecture has these instructions.

-mfence-tso
-mno-fence-tso

Do or don’t use the ‘fence.tso’ instruction, which is unimplemented onsome processors (including those from T-Head). If the ‘fence.tso’instruction is not available then a stronger fence is used instead.

-mdiv
-mno-div

Do or don’t use hardware instructions for integer division. This requires theM extension. The default is to use them if the specified architecture hasthese instructions.

-misa-spec=ISA-spec-string

Specify the version of the RISC-V Unprivileged (formerly User-Level)ISA specification generated code should conform to. The possibilitiesforISA-spec-string are:

2.2

Produce code conforming to version 2.2.

20190608

Produce code conforming to version 20190608.

20191213

Produce code conforming to version 20191213.

The default is-misa-spec=20191213 unless GCC has been configuredwith--with-isa-spec= specifying a different default version.

-march=[ISA|Profile|Profile_ISA|processor-string]

Generate code for given RISC-V ISA or profile or a combination of them(e.g. ‘rv64im’ ‘rvi20u64’ ‘rvi20u64_zbb’). The names ofISAs and profiles must be lower case.Examples include ‘rv64i’, ‘rv32g’,‘rv32e’, ‘rv32imaf’, ‘rva22u64’ and ‘rva23u64’.To combine a named profile with optional RISC-V ISA extensions,give the profile first and then append the extension name(s) usingan underscore as a delimiter (e.g.‘rvi20u64_zca_zcb’ ‘rva23u64_zacas’). Additionally, a special value‘help’ (-march=help) is accepted to list all supportedextensions.

-march=unset causes the compiler to ignore any-march=… optionsthat appear earlier on the command line, behaving as if the option was neverpassed. This is useful for ensuring that the architecture is taken from the-mcpu option, and an error results if no-mcpu optionis given when-march=unset is used.

The syntax of the ISA string is defined as follows:

  • The string must start with ‘rv32’ or ‘rv64’, followed by‘i’, ‘e’, or ‘g’, referred to as the base ISA.
  • The subsequent part of the string is a list of extension names. Extensionnames can be categorized as multi-letter (e.g. ‘zba’) and single-letter(e.g. ‘v’). Single-letter extensions can appear consecutively,but multi-letter extensions must be separated by underscores.
  • An underscore can appear anywhere after the base ISA. It has no specificeffect but is used to improve readability and can act as a separator.
  • Extension names may include an optional version number, following thesyntax ‘<major>p<minor>’ or ‘<major>’, (e.g. ‘m2p1’ or‘m2’).

Supported extensions are listed below:

Extension NameSupported VersionDescription
g-General-purpose computing base extension; ‘g’ expands to‘i’, ‘m’, ‘a’, ‘f’, ‘d’, ‘zicsr’ and‘zifencei’.
e2.0Reduced base integer extension
i2.0 2.1Base integer extension
m2.0Integer multiplication and division extension
a2.0 2.1Atomic extension
f2.0 2.2Single-precision floating-point extension
d2.0 2.2Double-precision floating-point extension
c2.0Compressed extension
b1.0Standard extension for bit manipulation functions
v1.0Vector extension
h1.0Hypervisor extension
zic64b1.0Cache block size is 64 bytes
zicbom1.0Cache-block management extension
zicbop1.0Cache-block prefetch extension
zicboz1.0Cache-block zero extension
ziccamoa1.0Main memory supports all atomics in A
ziccif1.0Main memory supports instruction fetch with atomicity requirement
zicclsm1.0Main memory supports misaligned loads/stores
ziccrse1.0Main memory supports forward progress on LR/SC sequences
zicfilp1.0Control-flow integrity landing pad extension
zicfiss1.0Control-flow integrity shadow stack extension
zicntr2.0Standard extension for base counters and timers
zicond1.0Integer conditional operations extension
zicsr2.0Control and status register access extension
zifencei2.0Instruction-fetch fence extension
zihintntl1.0Non-temporal locality hints extension
zihintpause2.0Pause hint extension
zihpm2.0Standard extension for hardware performance counters
zimop1.0May-be-operations extension
zilsd1.0Load/store pair instructions extension
zmmul1.0Integer multiplication extension
za128rs1.0Reservation set size of 128 bytes
za64rs1.0Reservation set size of 64 bytes
zaamo1.0Atomic memory operations extension
zabha1.0Byte and halfword atomic memory operations extension
zacas1.0Atomic compare-and-swap instructions extension
zalrsc1.0Load-reserved/store-conditional subset of the A extension
zawrs1.0Wait-on-reservation-set extension
zama16b1.0Misaligned loads, stores, and AMOs that are fully contained within a naturally-aligned 16-byte boundary are atomic
zfa1.0Additional floating-point extension
zfbfmin1.0Minimal BF16 support extension
zfh1.0Half-precision floating-point extension
zfhmin1.0Minimal half-precision floating-point extension
zfinx1.0Single-precision floating-point in integer registers extension
zdinx1.0Double-precision floating-point in integer registers extension
zca1.0Integer compressed instruction extension
zcb1.0Simple compressed instruction extension
zcd1.0Compressed double-precision floating point loads and stores extension
zce1.0Compressed instruction extensions for embedded processors
zcf1.0Compressed single-precision floating point loads and stores extension
zcmop1.0Compressed may-be-operations extension
zcmp1.0Compressed push pop extension
zcmt1.0Table jump instruction extension
zclsd1.0Compressed load/store pair instructions extension
zba1.0Address calculation extension
zbb1.0Basic bit manipulation extension
zbc1.0Carry-less multiplication extension
zbkb1.0Cryptography bit-manipulation extension
zbkc1.0Cryptography carry-less multiply extension
zbkx1.0Cryptography crossbar permutation extension
zbs1.0Single-bit operation extension
zk1.0Standard scalar cryptography extension
zkn1.0NIST algorithm suite extension
zknd1.0AES Decryption extension
zkne1.0AES Encryption extension
zknh1.0Hash function extension
zkr1.0Entropy source extension
zks1.0ShangMi algorithm suite extension
zksed1.0SM4 block cipher extension
zksh1.0SM3 hash function extension
zkt1.0Data independent execution latency extension
ztso1.0Total store ordering extension
zvbb1.0Vector basic bit-manipulation extension
zvbc1.0Vector carry-less multiplication extension
zve32f1.0Vector extensions for embedded processors
zve32x1.0Vector extensions for embedded processors
zve64d1.0Vector extensions for embedded processors
zve64f1.0Vector extensions for embedded processors
zve64x1.0Vector extensions for embedded processors
zvfbfmin1.0Vector BF16 converts extension
zvfbfwma1.0Vector BF16 widening multiply/add extension
zvfh1.0Vector half-precision floating-point extension
zvfhmin1.0Vector minimal half-precision floating-point extension
zvkb1.0Vector cryptography bit-manipulation extension
zvkg1.0Vector GCM/GMAC extension
zvkn1.0Vector NIST Algorithm Suite extension, ‘zvkn’ will expand to
zvknc1.0Vector NIST Algorithm Suite with carry-less multiply extension, ‘zvknc
zvkned1.0Vector AES block cipher extension
zvkng1.0Vector NIST Algorithm Suite with GCM extension, ‘zvkng’ will expand
zvknha1.0Vector SHA-2 secure hash extension
zvknhb1.0Vector SHA-2 secure hash extension
zvks1.0Vector ShangMi algorithm suite extension, ‘zvks’ will expand
zvksc1.0Vector ShangMi algorithm suite with carry-less multiplication extension,
zvksed1.0Vector SM4 block cipher extension
zvksg1.0Vector ShangMi algorithm suite with GCM extension
zvksh1.0Vector SM3 secure hash extension
zvkt1.0Vector data independent execution latency extension
zvl1024b1.0Minimum vector length standard extensions
zvl128b1.0Minimum vector length standard extensions
zvl16384b1.0Minimum vector length standard extension
zvl2048b1.0Minimum vector length standard extensions
zvl256b1.0Minimum vector length standard extensions
zvl32768b1.0Minimum vector length standard extension
zvl32b1.0Minimum vector length standard extensions
zvl4096b1.0Minimum vector length standard extensions
zvl512b1.0Minimum vector length standard extensions
zvl64b1.0Minimum vector length standard extensions
zvl65536b1.0Minimum vector length standard extension
zvl8192b1.0Minimum vector length standard extension
zhinx1.0Half-precision floating-point in integer registers extension
zhinxmin1.0Minimal half-precision floating-point in integer registers extension
sdtrig1.0Debug triggers extension
sha1.0The augmented hypervisor extension
shcounterenw1.0Support writeable enables for any supported counter
shgatpa1.0SvNNx4 mode supported for all modes supported by satp
shlcofideleg1.0Delegating LCOFI interrupts to VS-mode
shtvala1.0The htval register provides all needed values
shvstvala1.0The vstval register provides all needed values
shvstvecd1.0The vstvec register supports direct mode
shvsatpa1.0The vsatp register supports all modes supported by satp
smaia1.0Advanced interrupt architecture extension
smcntrpmf1.0Cycle and instret privilege mode filtering
smcsrind1.0Machine-level indirect CSR access
smepmp1.0PMP enhancements for memory access and execution prevention on machine mode
smmpm1.0Supervisor-mode pointer masking extension
smnpm1.0Supervisor-mode pointer masking extension
smrnmi1.0Resumable non-maskable interrupts
smstateen1.0State enable extension
smdbltrp1.0Double trap extensions
ssaia1.0Advanced interrupt architecture extension for supervisor mode
ssccptr1.0Main memory supports page table reads
sscofpmf1.0Count overflow and filtering extension
sscounterenw1.0Support writeable enables for any supported counter
sscsrind1.0Supervisor-mode indirect CSR access
ssnpm1.0Supervisor-mode pointer masking extension
sspm1.0Supervisor-mode pointer masking extension
ssstateen1.0Supervisor-mode state-enable extension
sstc1.0Supervisor-mode timer interrupts extension
sstvala1.0Stval provides all needed values
sstvecd1.0Stvec supports direct mode
ssstrict1.0Unimplemented reserved encodings raise illegal instruction exceptions and no non-conforming extensions are present
ssdbltrp1.0Double trap extensions
ssu64xl1.0UXLEN=64 must be supported
supm1.0User-mode pointer masking extension
svinval1.0Fine-grained address-translation cache invalidation extension
svnapot1.0NAPOT translation contiguity extension
svpbmt1.0Page-based memory types extension
svvptc1.0Extension for obviating memory-management instructions after marking PTEs valid
svadu1.0Hardware updating of A/D bits extension
svade1.0Cause exception when hardware updating of A/D bits is disabled
svbare1.0Satp mode bare is supported
xcvalu1.0Core-V miscellaneous ALU extension
xcvbi1.0Core-V immediate branch extension
xcvelw1.0Core-V event load word extension
xcvmac1.0Core-V multiply-accumulate extension
xcvsimd1.0Core-V SIMD extension
xsfcease1.0SiFive CEASE instruction extension
xsfvcp1.0SiFive VCIX vector coprocessor extension
xsfvfnrclipxfqf1.0SiFive FP32-to-int8 ranged clip instructions
xsfvqmaccdod1.0SiFive int8 matrix multiplication extension
xsfvqmaccqoq1.0SiFive int8 matrix multiplication extension
xtheadba1.0T-head address calculation extension
xtheadbb1.0T-head basic bit-manipulation extension
xtheadbs1.0T-head single-bit instructions extension
xtheadcmo1.0T-head cache management operations extension
xtheadcondmov1.0T-head conditional move extension
xtheadfmemidx1.0T-head indexed memory operations for floating-point registers extension
xtheadfmv1.0T-head double floating-point high-bit data transmission extension
xtheadint1.0T-head acceleration interruption extension
xtheadmac1.0T-head multiply-accumulate extension
xtheadmemidx1.0T-head indexed memory operation extension
xtheadmempair1.0T-head two-GPR memory operation extension
xtheadsync1.0T-head multi-core synchronization extension
xtheadvector1.0T-head vector extension
xventanacondops1.0Ventana integer conditional operations extension
xmipscmov1.0Mips conditional move extension
xmipscbop1.0Mips prefetch extension
xandesperf5.0Andes performace extension
xandesbfhcvt5.0Andes bfloat16 conversion extension
xandesvbfhcvt5.0Andes vector bfloat16 conversion extension
xandesvsintload5.0Andes vector INT4 load extension
xandesvpackfph5.0Andes vector packed FP16 extension
xandesvdot5.0Andes vector dot product extension
xsmtvdot1.0SpacemiT vector dot product extension

When-march= is not specified, GCC uses the setting from-mcpu.

If both-march and-mcpu= are not specified, the default forthis argument is system dependent; if you want a specific architectureextension, you should specify one explicitly.

When the RISC-V specifications define an extension as depending on otherextensions, GCC implicitly adds the dependent extensions to the enabledextension set if they weren’t added explicitly.

Core Name

-mcpu=processor-string

Use architecture of and optimize the output for the given processor, specifiedby particular CPU name. Permissible values for this option are:

sifive-e20’,

sifive-e21’,

sifive-e24’,

sifive-e31’,

sifive-e34’,

sifive-e76’,

sifive-s21’,

sifive-s51’,

sifive-s54’,

sifive-s76’,

sifive-u54’,

sifive-u74’,

sifive-x280’,

sifive-p450’,

sifive-p670’,

thead-c906’,

xt-c908’,

xt-c908v’,

xt-c910’,

xt-c910v2’,

xt-c920’,

xt-c920v2’,

tt-ascalon-d8’,

xiangshan-nanhu’,

xiangshan-kunminghu’,

mips-p8700’,

andes-n22’,

andes-n25’,

andes-a25’,

andes-nx25’,

andes-ax25’,

andes-a27’,

andes-ax27’,

andes-n225’,

andes-d23’,

andes-n45’,

andes-nx45’,

andes-a45’,

andes-ax45’,

spacemit-x60’.

Note that-mcpu does not override-march or-mtune.

Tune Name

-mtune=processor-string

Optimize the output for the given processor, specified by microarchitecture orparticular CPU name. Permissible values for this option are:

generic’,

rocket’,

sifive-3-series’,

sifive-5-series’,

sifive-7-series’,

sifive-p400-series’,

sifive-p600-series’,

tt-ascalon-d8’,

thead-c906’,

xt-c908’,

xt-c908v’,

xt-c910’,

xt-c910v2’,

xt-c920’,

xt-c920v2’,

xiangshan-nanhu’,

xiangshan-kunminghu’,

spacemit-x60’,

generic-ooo’,

size’,

mips-p8700’,

andes-25-series’,

andes-23-series’,

andes-45-series’,

and all valid options for-mcpu=.

When-mtune= is not specified, GCC uses the setting from-mcpu. The default is ‘generic’ if neither is specified.

The ‘size’ choice is not intended for use by end-users. This is usedwhen-Os is specified. It overrides the instruction cost infoprovided by-mtune=, but does not override the pipeline info. Thishelps reduce code size while still giving good performance.

-mpreferred-stack-boundary=num

Attempt to keep the stack boundary aligned to a 2 raised tonumbyte boundary. If-mpreferred-stack-boundary is not specified,the default is 4 (16 bytes or 128-bits).

Warning: If you use this switch, then you must build all modules withthe same value, including any libraries. This includes the system librariesand startup modules.

-msmall-data-limit=n

Put global and static data smaller thann bytes into a special section(on some targets).

-msave-restore
-mno-save-restore

Do or don’t use smaller but slower prologue and epilogue code that useslibrary function calls. The default is to use fast inline prologues andepilogues.

-mmovcc
-mno-movcc

Do or don’t produce branchless conditional-move code sequences even withtargets that do not have specific instructions for conditional operations.If enabled, sequences of ALU operations are produced using base integerISA instructions where profitable.

-minline-atomics
-mno-inline-atomics

Do or don’t use smaller but slower subword atomic emulation code that useslibatomic function calls. The default is to use fast inline subword atomicsthat do not require libatomic.

-minline-strlen
-mno-inline-strlen

Do or do not attempt to inlinestrlen calls if possible.Inlining can only be done if the string is properly alignedand instructions for accelerated processing are available.The default is to inlinestrlen calls.

-minline-strcmp
-mno-inline-strcmp

Do or do not attempt to inlinestrcmp calls if possible.Inlining can only be done if the strings are properly alignedand instructions for accelerated processing are available.The default is to inlinestrcmp calls.

-minline-strncmp
-mno-inline-strncmp

Do or do not attempt to inlinestrncmp calls if possible.Inlining can only be done if the strings are properly alignedand instructions for accelerated processing are available.The default is to inlinestrncmp calls.

-mstringop-strategy=strategy

Specify a particular strategy for inlining string and memory operations.strategy may be one of ‘auto’, ‘libcall’, ‘scalar’,or ‘vector’.

-mshorten-memrefs
-mno-shorten-memrefs

Do or do not attempt to make more use of compressed load/store instructions byreplacing a load/store of ’base register + large offset’ with a new load/storeof ’new base + small offset’. If the new base gets stored in a compressedregister, then the new load/store can be compressed. Currently targets 32-bitinteger load/stores only.

-mstrict-align
-mno-strict-align

Do not or do generate unaligned memory accesses. The default is set dependingon whether the processor we are optimizing for supports fast unaligned accessor not.

-mscalar-strict-align
-mno-scalar-strict-align

Do not or do generate unaligned memory accesses. The default is set dependingon whether the processor we are optimizing for supports fast unaligned accessor not. This is an alias for-mstrict-align.

-mvector-strict-align
-mno-vector-strict-align

Do not or do generate unaligned vector memory accesses. The default is setto off unless the processor we are optimizing for explicitly supportselement-misaligned vector memory access.

-mmax-vectorization
-mno-max-vectorization

Enable or disable an override to vectorizer cost model making vectorizationalways appear profitable. Unlike-fno-vect-cost-model or-fvect-cost-model=unlimited this option does not turn off costcomparison between different vector modes.

-mcmodel=medlow

Generate code for the medium-low code model. The program and its staticallydefined symbols must lie within a single 2 GiB address range and must liebetween absolute addresses −2 GiB and +2 GiB. Programs can be staticallyor dynamically linked. This is the default code model unless GCC has beenconfigured with--with-cmodel= specifying a different default codemodel.

-mcmodel=medany

Generate code for the medium-any code model. The program and its staticallydefined symbols must be within any single 2 GiB address range. Programs can bestatically or dynamically linked.

The code generated by the medium-any code model is position-independent, but isnot guaranteed to function correctly when linked into position-independentexecutables or libraries.

-mcmodel=large

Generate code for a large code model, which has no restrictions on size orplacement of symbols.

-mexplicit-relocs
-mno-explicit-relocs

Use or do not use assembler relocation operators when dealing with symbolicaddresses. The alternative is to use assembler macros instead, which maylimit optimization.

-mrelax
-mno-relax

Take advantage of linker relaxations to reduce the number of instructionsrequired to materialize symbol addresses. The default is to take advantage oflinker relaxations.

-mriscv-attribute
-mno-riscv-attribute

Emit (do not emit) RISC-V attribute to record extra information into ELFobjects. This feature requires at least binutils 2.32.

-mcsr-check
-mno-csr-check

Enables or disables the CSR checking.

-momit-leaf-frame-pointer

Don’t keep the frame pointer in a register for leaf functions. Thisavoids the instructions to save, set up and restore frame pointers andmakes an extra register available in leaf functions.

-malign-data=type

Control how GCC aligns variables and constants of array, structure, or uniontypes. Supported values fortype are ‘xlen’ which uses x registerwidth as the alignment value, and ‘natural’ which uses natural alignment.‘xlen’ is the default.

-mbig-endian

Generate big-endian code. This is the default when GCC is configured for a‘riscv64be-*-*’ or ‘riscv32be-*-*’ target.

-mlittle-endian

Generate little-endian code. This is the default when GCC is configured for a‘riscv64-*-*’ or ‘riscv32-*-*’ but not a ‘riscv64be-*-*’ or‘riscv32be-*-*’ target.

-mstack-protector-guard=guard
-mstack-protector-guard-reg=reg
-mstack-protector-guard-offset=offset

Generate stack protection code using canary atguard. Supportedlocations are ‘global’ for a global canary or ‘tls’ for per-threadcanary in the TLS block.

With the latter choice the options-mstack-protector-guard-reg=reg and-mstack-protector-guard-offset=offset furthermore specifywhich register to use as base register for reading the canary,and from what offset from that base register. There is no defaultregister or offset as this is entirely for use within the Linuxkernel.

-mtls-dialect=desc

Use TLS descriptors as the thread-local storage mechanism for dynamic accessesof TLS variables.

-mtls-dialect=trad

Use traditional TLS as the thread-local storage mechanism for dynamic accessesof TLS variables. This is the default.

-mrvv-vector-bits=value

Specify how the number of bits for an RVV vector register, as taken fromthe-march= option, is interpreted.Thevalue parameter is specified as a string keyword and may be one of‘scalable’ or ‘zvl’. The default is ‘scalable’, which tellsGCC to interpret the number as a minimum, while ‘zvl’ tells GCC to useexactly the number of bits specified.

-mrvv-max-lmul=value

This option allows explicit control over the maximum length multiplier (LMUL)used when generating code for the RISC-V Vector Extensions (RVV).Thevalue parameter is specified as a string keyword and may beone of ‘m1’, ‘m2’, ‘m4’, ‘m8’, or ‘dynamic’. Thedefault is ‘m1’ for compatibility with existing hardware that does notsupport the other options.

-madjust-lmul-cost
-mno-adjust-lmul-cost

This option adjusts the cost model used to schedule vector instructions tomultiply the latency of instructions by the RVV length multiplier, LMUL.It is disabled by default.

-mautovec-segment
-mno-autovec-segment

Enable or disable generation of vector segment load/store instructions.This option is enabled by default.


Next:RL78 Options, Previous:PRU Options, Up:Machine-Dependent Options   [Contents][Index]


[8]ページ先頭

©2009-2026 Movatter.jp