Skip to content

Commit ed12a33

Browse files
committed
RISC-V: Support ".option [no]exact" assembler directives
This commit adds two assembler directives: ".option exact" and ".option noexact" (enable/disable the exact mode) as discussed in <riscv-non-isa/riscv-asm-manual#122> and already implemented in LLVM. When the exact mode is enabled, 1. Linker relaxations are turned off, 2. Instruction aliases that will change the encoding from the (likely non-alias) instruction with the same name are disabled (e.g. "addi" will never turn into "c.addi" even if optimizable) and 3. Assembler relaxation of branch instructions are disabled (e.g. "blt" with a long offset will not turn into "bge + j"). Macros like "li" (known to be expanded into possibly complex sequences) may still expand to complex instruction sequences but at least each instruction emitted by macros is still subject to the behavior above. Currently, interactions between ".option relax/norelax" and ".option exact/noexact" are designed to be LLVM-compatible (i.e. ".option exact/noexact" imply ".option norelax/relax", respectively) but considered flaky and strongly discouraged from using both. cf. <llvm/llvm-project#122483> gas/ChangeLog: * config/tc-riscv.c (struct riscv_set_options): Add exact option. (RELAX_BRANCH_ENCODE): Encode exact option. (RELAX_BRANCH_LENGTH): Reflect RELAX_BRANCH_ENCODE changes. (RELAX_BRANCH_EXACT): New predicate macro. (relaxed_branch_length): Handle exact mode cases. (append_insn): Pass exact option to RELAX_BRANCH_ENCODE. (riscv_ip): Skip instructions that would change the encoding when the exact mode is enabled. (s_riscv_option): Parse ".option exact" and ".option noexact" assembler directives. * doc/c-riscv.texi: Document new assembler directives. * testsuite/gas/riscv/exact.s: Test exact mode basics. * testsuite/gas/riscv/exact.d: Ditto. * testsuite/gas/riscv/exact-branch-local.s: Test conditional branches and unconditional jumps relative to a local symbol. * testsuite/gas/riscv/exact-branch-local-noexact.d: Ditto. * testsuite/gas/riscv/exact-branch-local-exact-ok.d: Ditto. * testsuite/gas/riscv/exact-branch-local-exact-fail.d: Ditto. * testsuite/gas/riscv/exact-branch-local-exact-fail.l: Ditto. * testsuite/gas/riscv/exact-branch-extern.s: Test conditional branches and unconditional jumps relative to an external symbol. * testsuite/gas/riscv/exact-branch-extern-noexact.d: Ditto. * testsuite/gas/riscv/exact-branch-extern-exact.d: Ditto. * testsuite/gas/riscv/li32.s: Enable exact mode by external option. * testsuite/gas/riscv/li64.s: Likewise. * testsuite/gas/riscv/exact-li32.d: li32.d but enable exact mode to make sure that no automatic instruction compression occurs. * testsuite/gas/riscv/exact-li64.d: Likewise. * testsuite/gas/riscv/no-relax-branch-offset-fail.s: Use exact mode to test various configurations and instructions. * testsuite/gas/riscv/no-relax-branch-offset-fail.d: Ditto. * testsuite/gas/riscv/no-relax-branch-offset-fail.l: Ditto. include/ChangeLog: * opcode/riscv.h (INSN_NON_EXACT): New flag to represent aliases to reject on the exact mode. opcodes/ChangeLog: * riscv-opc.c (riscv_opcodes): Add INSN_NON_EXACT flag to all instructions that should be rejected on the exact mode.
1 parent 8b0a598 commit ed12a33

20 files changed

+789
-109
lines changed

gas/config/tc-riscv.c

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ struct riscv_set_options
269269
int pic; /* Generate position-independent code. */
270270
int rvc; /* Generate RVC code. */
271271
int relax; /* Emit relocs the linker is allowed to relax. */
272+
int exact; /* Emit instructions without compression or relaxation. */
272273
int arch_attr; /* Emit architecture and privileged elf attributes. */
273274
int csr_check; /* Enable the CSR checking. */
274275
};
@@ -278,6 +279,7 @@ static struct riscv_set_options riscv_opts =
278279
0, /* pic */
279280
0, /* rvc */
280281
1, /* relax */
282+
0, /* exact */
281283
DEFAULT_RISCV_ATTR, /* arch_attr */
282284
0, /* csr_check */
283285
};
@@ -471,16 +473,18 @@ static bool explicit_priv_attr = false;
471473
static char *expr_parse_end;
472474

473475
/* Macros for encoding relaxation state for RVC branches and far jumps. */
474-
#define RELAX_BRANCH_ENCODE(uncond, rvc, length) \
476+
#define RELAX_BRANCH_ENCODE(uncond, rvc, length, exact) \
475477
((relax_substateT) \
476478
(0xc0000000 \
477479
| ((uncond) ? 1 : 0) \
478480
| ((rvc) ? 2 : 0) \
479-
| ((length) << 2)))
481+
| ((exact) ? 4 : 0) \
482+
| ((length) << 3)))
480483
#define RELAX_BRANCH_P(i) (((i) & 0xf0000000) == 0xc0000000)
481-
#define RELAX_BRANCH_LENGTH(i) (((i) >> 2) & 0xF)
484+
#define RELAX_BRANCH_LENGTH(i) (((i) >> 3) & 0xF)
482485
#define RELAX_BRANCH_RVC(i) (((i) & 2) != 0)
483486
#define RELAX_BRANCH_UNCOND(i) (((i) & 1) != 0)
487+
#define RELAX_BRANCH_EXACT(i) (((i) & 4) != 0)
484488

485489
/* Is the given value a sign-extended 32-bit value? */
486490
#define IS_SEXT_32BIT_NUM(x) \
@@ -810,22 +814,25 @@ add_relaxed_insn (struct riscv_cl_insn *insn, int max_chars, int var,
810814
static unsigned
811815
relaxed_branch_length (fragS *fragp, asection *sec, int update)
812816
{
813-
int jump, rvc, length = 8;
817+
int jump, rvc, exact, length = 8;
814818

815819
if (!fragp)
816820
return length;
817821

818822
jump = RELAX_BRANCH_UNCOND (fragp->fr_subtype);
819823
rvc = RELAX_BRANCH_RVC (fragp->fr_subtype);
824+
exact = RELAX_BRANCH_EXACT (fragp->fr_subtype);
820825
length = RELAX_BRANCH_LENGTH (fragp->fr_subtype);
821826

822827
/* Assume jumps are in range; the linker will catch any that aren't. */
823828
length = jump ? 4 : 8;
824829

825-
if (fragp->fr_symbol != NULL
826-
&& S_IS_DEFINED (fragp->fr_symbol)
827-
&& !S_IS_WEAK (fragp->fr_symbol)
828-
&& sec == S_GET_SEGMENT (fragp->fr_symbol))
830+
if (exact)
831+
length = rvc ? 2 : 4;
832+
else if (fragp->fr_symbol != NULL
833+
&& S_IS_DEFINED (fragp->fr_symbol)
834+
&& !S_IS_WEAK (fragp->fr_symbol)
835+
&& sec == S_GET_SEGMENT (fragp->fr_symbol))
829836
{
830837
offsetT val = S_GET_VALUE (fragp->fr_symbol) + fragp->fr_offset;
831838
bfd_vma rvc_range = jump ? RVC_JUMP_REACH : RVC_BRANCH_REACH;
@@ -840,7 +847,7 @@ relaxed_branch_length (fragS *fragp, asection *sec, int update)
840847
}
841848

842849
if (update)
843-
fragp->fr_subtype = RELAX_BRANCH_ENCODE (jump, rvc, length);
850+
fragp->fr_subtype = RELAX_BRANCH_ENCODE (jump, rvc, length, exact);
844851

845852
return length;
846853
}
@@ -1992,7 +1999,8 @@ append_insn (struct riscv_cl_insn *ip, expressionS *address_expr,
19921999
}
19932000

19942001
add_relaxed_insn (ip, worst_case, best_case,
1995-
RELAX_BRANCH_ENCODE (j, best_case == 2, worst_case),
2002+
RELAX_BRANCH_ENCODE (j, best_case == 2, worst_case,
2003+
riscv_opts.exact),
19962004
address_expr->X_add_symbol,
19972005
address_expr->X_add_number);
19982006
return;
@@ -2872,6 +2880,10 @@ riscv_ip (char *str, struct riscv_cl_insn *ip, expressionS *imm_expr,
28722880
if ((insn->xlen_requirement != 0) && (xlen != insn->xlen_requirement))
28732881
continue;
28742882

2883+
if (insn->pinfo != INSN_MACRO && riscv_opts.exact
2884+
&& (insn->pinfo & INSN_NON_EXACT))
2885+
continue;
2886+
28752887
if (!riscv_multi_subset_supports (&riscv_rps_as, insn->insn_class))
28762888
{
28772889
error.missing_ext = riscv_multi_subset_supports_ext (&riscv_rps_as,
@@ -5085,6 +5097,16 @@ s_riscv_option (int x ATTRIBUTE_UNUSED)
50855097
riscv_opts.relax = true;
50865098
else if (strcmp (name, "norelax") == 0)
50875099
riscv_opts.relax = false;
5100+
else if (strcmp (name, "exact") == 0)
5101+
{
5102+
riscv_opts.exact = true;
5103+
riscv_opts.relax = false;
5104+
}
5105+
else if (strcmp (name, "noexact") == 0)
5106+
{
5107+
riscv_opts.exact = false;
5108+
riscv_opts.relax = true;
5109+
}
50885110
else if (strcmp (name, "csr-check") == 0)
50895111
riscv_opts.csr_check = true;
50905112
else if (strcmp (name, "no-csr-check") == 0)

gas/doc/c-riscv.texi

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,19 @@ Enables or disables relaxation. The RISC-V assembler and linker
216216
opportunistically relax some code sequences, but sometimes this behavior is not
217217
desirable.
218218

219+
@item exact
220+
@itemx noexact
221+
Enables or disables exact mode. Not only the exact mode disables linker
222+
relaxations, it also disables automatic instruction compression and the branch
223+
relaxation (both optionally change instruction encodings and/or instruction
224+
count). This mode is useful in some cases where the instruction sequences, as
225+
exactly written, are expected to be emitted.
226+
227+
Note that, in the current implementation, @samp{.option exact} implies
228+
@samp{.option norelax} and @samp{.option noexact} implies @samp{.option relax}.
229+
Due to their flaky interactions, it is strongly discouraged to use both
230+
@samp{.option relax/norelax} and @samp{.option exact/noexact} in the same scope.
231+
219232
@item csr-check
220233
@itemx no-csr-check
221234
Enables or disables the CSR checking.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#as: -march=rv32ic --defsym exact_mode=1
2+
#source: exact-branch-extern.s
3+
#objdump: -drw -Mno-aliases
4+
5+
.*: file format .*
6+
7+
8+
Disassembly of section \.text:
9+
10+
0+ <\.text>:
11+
[ ]+[0-9a-f]+:[ ]+00b50063[ ]+beq[ ]+a0,a1,[0-9a-f]+.*[0-9a-f]+:[ ]+R_RISCV_BRANCH[ ]+ext
12+
[ ]+[0-9a-f]+:[ ]+feb51ee3[ ]+bne[ ]+a0,a1,[0-9a-f]+.*[0-9a-f]+:[ ]+R_RISCV_BRANCH[ ]+ext
13+
[ ]+[0-9a-f]+:[ ]+feb54ce3[ ]+blt[ ]+a0,a1,[0-9a-f]+.*[0-9a-f]+:[ ]+R_RISCV_BRANCH[ ]+ext
14+
[ ]+[0-9a-f]+:[ ]+feb55ae3[ ]+bge[ ]+a0,a1,[0-9a-f]+.*[0-9a-f]+:[ ]+R_RISCV_BRANCH[ ]+ext
15+
[ ]+[0-9a-f]+:[ ]+feb568e3[ ]+bltu[ ]+a0,a1,[0-9a-f]+.*[0-9a-f]+:[ ]+R_RISCV_BRANCH[ ]+ext
16+
[ ]+[0-9a-f]+:[ ]+feb576e3[ ]+bgeu[ ]+a0,a1,[0-9a-f]+.*[0-9a-f]+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a-f]+:[ ]+R_RISCV_BRANCH[ ]+ext
28+
[ ]+[0-9a-f]+:[ ]+fc0550e3[ ]+bge[ ]+a0,zero,[0-9a-f]+.*[0-9a-f]+:[ ]+R_RISCV_BRANCH[ ]+ext
29+
[ ]+[0-9a-f]+:[ ]+0001[ ]+.*
30+
[ ]+[0-9a-f]+:[ ]+fbbff56f[ ]+jal[ ]+a0,[0-9a-f]+.*[0-9a-f]+:[ ]+R_RISCV_JAL[ ]+ext
31+
[ ]+[0-9a-f]+:[ ]+bf5d[ ]+c\.j[ ]+[0-9a-f]+.*[0-9a-f]+:[ ]+R_RISCV_RVC_JUMP[ ]+ext
32+
[ ]+[0-9a-f]+:[ ]+3f55[ ]+c\.jal[ ]+[0-9a-f]+.*[0-9a-f]+:[ ]+R_RISCV_RVC_JUMP[ ]+ext
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#as: -march=rv32ic
2+
#source: exact-branch-extern.s
3+
#objdump: -drw -Mno-aliases
4+
5+
.*: file format .*
6+
7+
8+
Disassembly of section \.text:
9+
10+
0+ <\.text>:
11+
[ ]+[0-9a-f]+:[ ]+00b51463[ ]+bne[ ]+a0,a1,[0-9a-f]+.*
12+
[ ]+[0-9a-f]+:[ ]+ffdff06f[ ]+jal[ ]+zero,[0-9a-f]+.*[0-9a-f]+:[ ]+R_RISCV_JAL[ ]+ext
13+
[ ]+[0-9a-f]+:[ ]+00b50463[ ]+beq[ ]+a0,a1,[0-9a-f]+.*
14+
[ ]+[0-9a-f]+:[ ]+ff5ff06f[ ]+jal[ ]+zero,[0-9a-f]+.*[0-9a-f]+:[ ]+R_RISCV_JAL[ ]+ext
15+
[ ]+[0-9a-f]+:[ ]+00b55463[ ]+bge[ ]+a0,a1,[0-9a-f]+.*
16+
[ ]+[0-9a-f]+:[ ]+fedff06f[ ]+jal[ ]+zero,[0-9a-f]+.*[0-9a-f]+:[ ]+R_RISCV_JAL[ ]+ext
17+
[ ]+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[ ]+00054463[ ]+blt[ ]+a0,zero,[0-9a-f]+.*
46+
[ ]+[0-9a-f]+:[ ]+f75ff06f[ ]+jal[ ]+zero,[0-9a-f]+.*[0-9a-f]+:[ ]+R_RISCV_JAL[ ]+ext
47+
[ ]+[0-9a-f]+:[ ]+0001[ ]+.*
48+
[ ]+[0-9a-f]+:[ ]+f6fff56f[ ]+jal[ ]+a0,[0-9a-f]+.*[0-9a-f]+:[ ]+R_RISCV_JAL[ ]+ext
49+
[ ]+[0-9a-f]+:[ ]+f6bff06f[ ]+jal[ ]+zero,[0-9a-f]+.*[0-9a-f]+:[ ]+R_RISCV_JAL[ ]+ext
50+
[ ]+[0-9a-f]+:[ ]+f67ff0ef[ ]+jal[ ]+ra,[0-9a-f]+.*[0-9a-f]+:[ ]+R_RISCV_JAL[ ]+ext
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
.ifdef exact_mode
2+
.option exact
3+
.else
4+
.option noexact
5+
.endif
6+
.extern ext
7+
8+
## Conditional Branches
9+
10+
# Basic instructions
11+
beq a0, a1, ext
12+
bne a0, a1, ext
13+
blt a0, a1, ext
14+
bge a0, a1, ext
15+
bltu a0, a1, ext
16+
bgeu a0, a1, ext
17+
18+
# Compressed instructions
19+
c.beqz a0, ext
20+
c.bnez a0, ext
21+
22+
# Aliases
23+
bgt a0, a1, ext
24+
ble a0, a1, ext
25+
bgtu a0, a1, ext
26+
bleu a0, a1, ext
27+
beqz a0, ext
28+
bnez a0, ext
29+
bltz a0, ext
30+
bgtz a0, ext
31+
blez a0, ext
32+
bgez a0, ext
33+
34+
c.nop
35+
36+
## Unconditional Jumps (normal and compressed)
37+
38+
jal a0, ext
39+
c.j ext
40+
c.jal ext # RV32C only
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#as: -march=rv32ic --defsym exact_mode=1 --defsym long_branch=1
2+
#source: exact-branch-local.s
3+
#error_output: exact-branch-local-exact-fail.l
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
.*Assembler messages:
2+
.*:93: Error: invalid B-type offset \(\+4096\)
3+
.*:94: Error: invalid B-type offset \(-4098\)
4+
.*:95: Error: invalid B-type offset \(\+4096\)
5+
.*:96: Error: invalid B-type offset \(-4098\)
6+
.*:97: Error: invalid B-type offset \(\+4096\)
7+
.*:98: Error: invalid B-type offset \(-4098\)
8+
.*:99: Error: invalid B-type offset \(\+4096\)
9+
.*:100: Error: invalid B-type offset \(-4098\)
10+
.*:101: Error: invalid B-type offset \(\+4096\)
11+
.*:102: Error: invalid B-type offset \(-4098\)
12+
.*:103: Error: invalid B-type offset \(\+4096\)
13+
.*:104: Error: invalid B-type offset \(-4098\)
14+
.*:105: Error: invalid B-type offset \(\+4096\)
15+
.*:106: Error: invalid B-type offset \(-4098\)
16+
.*:107: Error: invalid B-type offset \(\+4096\)
17+
.*:108: Error: invalid B-type offset \(-4098\)
18+
.*:109: Error: invalid B-type offset \(\+4096\)
19+
.*:110: Error: invalid B-type offset \(-4098\)
20+
.*:111: Error: invalid B-type offset \(\+4096\)
21+
.*:112: Error: invalid B-type offset \(-4098\)
22+
.*:113: Error: invalid B-type offset \(\+4096\)
23+
.*:114: Error: invalid B-type offset \(-4098\)
24+
.*:115: Error: invalid B-type offset \(\+4096\)
25+
.*:116: Error: invalid B-type offset \(-4098\)
26+
.*:117: Error: invalid B-type offset \(\+4096\)
27+
.*:118: Error: invalid B-type offset \(-4098\)
28+
.*:119: Error: invalid B-type offset \(\+4096\)
29+
.*:120: Error: invalid B-type offset \(-4098\)
30+
.*:121: Error: invalid B-type offset \(\+4096\)
31+
.*:122: Error: invalid B-type offset \(-4098\)
32+
.*:123: Error: invalid B-type offset \(\+4096\)
33+
.*:124: Error: invalid B-type offset \(-4098\)
34+
.*:128: Error: invalid CB-type offset \(\+256\)
35+
.*:129: Error: invalid CB-type offset \(-258\)
36+
.*:130: Error: invalid CB-type offset \(\+256\)
37+
.*:131: Error: invalid CB-type offset \(-258\)
38+
.*:132: Error: invalid J-type offset \(\+1048576\)
39+
.*:133: Error: invalid J-type offset \(-1048578\)
40+
.*:134: Error: invalid CJ-type offset \(\+2048\)
41+
.*:135: Error: invalid CJ-type offset \(-2050\)
42+
.*:136: Error: invalid CJ-type offset \(\+2048\)
43+
.*:137: Error: invalid CJ-type offset \(-2050\)
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#as: -march=rv32ic --defsym exact_mode=1
2+
#source: exact-branch-local.s
3+
#objdump: -d -Mno-aliases
4+
5+
.*: file format .*
6+
7+
8+
Disassembly of section \.text:
9+
10+
0+ <\.text>:
11+
[ ]+[0-9a-f]+:[ ]+00b50063[ ]+beq[ ]+a0,a1,[0-9a-f]+.*
12+
[ ]+[0-9a-f]+:[ ]+00b51063[ ]+bne[ ]+a0,a1,[0-9a-f]+.*
13+
[ ]+[0-9a-f]+:[ ]+00b54063[ ]+blt[ ]+a0,a1,[0-9a-f]+.*
14+
[ ]+[0-9a-f]+:[ ]+00b55063[ ]+bge[ ]+a0,a1,[0-9a-f]+.*
15+
[ ]+[0-9a-f]+:[ ]+00b56063[ ]+bltu[ ]+a0,a1,[0-9a-f]+.*
16+
[ ]+[0-9a-f]+:[ ]+00b57063[ ]+bgeu[ ]+a0,a1,[0-9a-f]+.*
17+
[ ]+[0-9a-f]+:[ ]+00a5c063[ ]+blt[ ]+a1,a0,[0-9a-f]+.*
18+
[ ]+[0-9a-f]+:[ ]+00a5d063[ ]+bge[ ]+a1,a0,[0-9a-f]+.*
19+
[ ]+[0-9a-f]+:[ ]+00a5e063[ ]+bltu[ ]+a1,a0,[0-9a-f]+.*
20+
[ ]+[0-9a-f]+:[ ]+00a5f063[ ]+bgeu[ ]+a1,a0,[0-9a-f]+.*
21+
[ ]+[0-9a-f]+:[ ]+00050063[ ]+beq[ ]+a0,zero,[0-9a-f]+.*
22+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