Skip to content

Commit 3e00061

Browse files
committed
cmd/internal/obj/riscv: rework instruction generation
Rework instruction generation so that multiple instructions are generated from a single obj.Prog, rather than the current approach where obj.Progs are rewritten. This allows the original obj.Prog to remain intact, before being converted into an architecture specific instruction form. This simplifies the code and removes a level of indirection that results from trying to manipulate obj.Prog.To/obj.Prog.From into forms that match the instruction encoding. Furthermore, the errors reported make more sense since it matches up with the actual assembly that was parsed. Note that the CALL/JMP/JALR type sequences have not yet been migrated to this framework and will likely be converted at a later time. Updates #27532 Change-Id: I9fd12562ed1db0a08cfdc32793897d2a1920ebaa Reviewed-on: https://go-review.googlesource.com/c/go/+/211917 Reviewed-by: Cherry Zhang <[email protected]> Run-TryBot: Cherry Zhang <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
1 parent 2b920cb commit 3e00061

File tree

2 files changed

+378
-383
lines changed

2 files changed

+378
-383
lines changed

src/cmd/asm/internal/asm/testdata/riscvenc.s

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -290,19 +290,11 @@ start:
290290

291291
// F extension
292292
FNEGS F0, F1 // d3100020
293-
294-
// TODO(jsing): FNES gets encoded as FEQS+XORI - this should
295-
// be handled as a single *obj.Prog so that the full two
296-
// instruction encoding is tested here.
297-
FNES F0, F1, X7 // d3a300a0
293+
FNES F0, F1, X7 // d3a300a093c31300
298294

299295
// D extension
300296
FNEGD F0, F1 // d3100022
301-
FEQD F0, F1, X5 // d3a200a2
297+
FNED F0, F1, X5 // d3a200a293c21200
302298
FLTD F0, F1, X5 // d39200a2
303299
FLED F0, F1, X5 // d38200a2
304-
305-
// TODO(jsing): FNED gets encoded as FEQD+XORI - this should
306-
// be handled as a single *obj.Prog so that the full two
307-
// instruction encoding is tested here.
308-
FNED F0, F1, X5 // d3a200a2
300+
FEQD F0, F1, X5 // d3a200a2

0 commit comments

Comments
 (0)