Skip to content

Commit 5ec61a1

Browse files
committed
Relax the ISA string order checking for -march
1 parent b7e0e07 commit 5ec61a1

File tree

1 file changed

+40
-3
lines changed

1 file changed

+40
-3
lines changed

README.mkd

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,50 @@ e.g. `-march=rv64g`. A target `-march` which includes floating point
5757
instructions implies a hardfloat calling convention, but can be overridden
5858
using the `-mabi` flag (see the next section).
5959

60-
The ISA subset naming conventions are described in Chapter 27 of the RISC-V
61-
user-level ISA specification. However, tools do not currently follow this
62-
specification (input is case sensitive, ...).
60+
The ISA subset naming conventions and canonical order are described in
61+
Chapter `ISA Extension Naming Conventions` of the RISC-V user-level ISA
62+
specification. However, tools do not currently follow this specification
63+
(input is case sensitive, ...).
64+
65+
The rule of ISA string become more complicated, due to extensions implication
66+
rule and more extensions added into RISC-V, the canonical order is non-obvious
67+
to human, so tools can accept the ISA string in non-canonical order for reduce
68+
the burden of remembering the canonical order.
69+
70+
Detail rule for ISA string:
71+
72+
1. First letter must be `i`, `e` or `g`.
73+
2. Single-letter may be non-canonical order.
74+
3. Multi-letter may be non-canonical order.
75+
4. Multi-letter must be separated by underscore.
76+
5. Version separator(`p`) has higher priority than `p` extension.
77+
78+
Example:
79+
```
80+
rv32ima_zicsr # Valid ISA string.
81+
rv32i_zicsr_m # Valid ISA string.
82+
rv32i_zicsr_ma # Valid ISA string.
83+
rv32imac # Valid ISA string.
84+
rv32mai # Invalid ISA string, first letter must be `i`, `e` or `g`.
85+
rv32i_zicsrzifence # Valid ISA string, but it will interpreted as rv32
86+
# with base extension and `zicsrzifence` extension
87+
# rather than `zicsr` and `zifence` extensions.
88+
rv32i2p1 # Valid ISA string, it recognized as `I` extension with
89+
# version 2.1 rather than `I` extension with with version
90+
# 2.0 and `P` extension with 1.0.
91+
```
6392

6493
If the 'C' (compressed) instruction set extension is targeted, the compiler
6594
will generate compressed instructions where possible.
6695

96+
NOTE: Single-letter extension with version (e.g. `m2p0`) still treat as
97+
single-letter extension, we won't treat it as multi-letter extension.
98+
99+
NOTE: Any output of ISA string like `Tag_RISCV_arch` must be canonical order.
100+
101+
NOTE: Cross-tool argument are highly recommended passed in canonical order for
102+
backward compatible.
103+
67104
### Issues for consideration
68105
* Whether `riscv32` and `riscv64` should be accepted as synonyms for `rv32`
69106
and `rv64`.

0 commit comments

Comments
 (0)