Skip to content

Commit e1992eb

Browse files
committed
Use assembler relocation functions in the psedoinstructions table
1 parent f655e06 commit e1992eb

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

riscv-asm.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -607,14 +607,14 @@ fail_msg:
607607

608608
Pseudoinstruction | Base Instruction(s) | Meaning | Comment
609609
:----------------------------|:--------------------------------------------------------------|:----------|:--------|
610-
la rd, symbol | auipc rd, symbol[31:12]; addi rd, rd, symbol[11:0] | Load address | With `.option nopic` (Default)
611-
la rd, symbol | auipc rd, symbol@GOT[31:12]; l{w\|d} rd, symbol@GOT[11:0]\(rd\) | Load address | With `.option pic`
612-
lla rd, symbol | auipc rd, symbol[31:12]; addi rd, rd, symbol[11:0] | Load local address
613-
lga rd, symbol | auipc rd, symbol@GOT[31:12]; l{w\|d} rd, symbol@GOT[11:0]\(rd\) | Load global address
614-
l{b\|h\|w\|d} rd, symbol | auipc rd, symbol[31:12]; l{b\|h\|w\|d} rd, symbol[11:0]\(rd\) | Load global
615-
s{b\|h\|w\|d} rd, symbol, rt | auipc rt, symbol[31:12]; s{b\|h\|w\|d} rd, symbol[11:0]\(rt\) | Store global
616-
fl{w\|d} rd, symbol, rt | auipc rt, symbol[31:12]; fl{w\|d} rd, symbol[11:0]\(rt\) | Floating-point load global
617-
fs{w\|d} rd, symbol, rt | auipc rt, symbol[31:12]; fs{w\|d} rd, symbol[11:0]\(rt\) | Floating-point store global
610+
la rd, symbol | auipc rd, %pcrel_hi(symbol); addi rd, rd, %pcrel_lo(symbol) | Load address | With `.option nopic` (Default)
611+
la rd, symbol | auipc rd, %got_pcrel_hi(symbol); l{w\|d} rd, %pcrel_lo(symbol)(rd) | Load address | With `.option pic`
612+
lla rd, symbol | auipc rd, %pcrel_hi(symbol); addi rd, rd, %pcrel_lo(symbol) | Load local address
613+
lga rd, symbol | auipc rd, %got_pcrel_hi(symbol); l{w\|d} rd, %pcrel_lo(symbol)(rd) | Load global address
614+
l{b\|h\|w\|d} rd, symbol | auipc rd, %pcrel_hi(symbol); l{b\|h\|w\|d} rd, %pcrel_lo(symbol)(rd) | Load global
615+
s{b\|h\|w\|d} rd, symbol, rt | auipc rt, %pcrel_hi(symbol); s{b\|h\|w\|d} rd, %pcrel_lo(symbol)(rt) | Store global
616+
fl{w\|d} rd, symbol, rt | auipc rt, %pcrel_hi(symbol); fl{w\|d} rd, %pcrel_lo(symbol)(rt) | Floating-point load global
617+
fs{w\|d} rd, symbol, rt | auipc rt, %pcrel_hi(symbol); fs{w\|d} rd, %pcrel_lo(symbol)(rt) | Floating-point store global
618618
nop | addi x0, x0, 0 | No operation
619619
li rd, immediate | *Myriad sequences* | Load immediate
620620
mv rd, rs | addi rd, rs, 0 | Copy register
@@ -652,8 +652,8 @@ jal offset | jal x1, offset
652652
jr rs | jalr x0, rs, 0 | Jump register
653653
jalr rs | jalr x1, rs, 0 | Jump and link register
654654
ret | jalr x0, x1, 0 | Return from subroutine
655-
call offset | auipc x6, offset[31:12]; jalr x1, x6, offset[11:0] | Call far-away subroutine
656-
tail offset | auipc x6, offset[31:12]; jalr x0, x6, offset[11:0] | Tail call far-away subroutine
655+
call offset | auipc x6, %pcrel_hi(offset); jalr x1, x6, %pcrel_lo(offset) | Call far-away subroutine
656+
tail offset | auipc x6, %pcrel_hi(offset); jalr x0, x6, %pcrel_lo(offset) | Tail call far-away subroutine
657657
fence | fence iorw, iorw | Fence on all memory and I/O
658658

659659
* [1] We don't specify the code sequence when the B-extension is present, since B-extension still not ratified or frozen. We will specify the expansion sequence once it's frozen.

0 commit comments

Comments
 (0)