Skip to content

Commit c4006c0

Browse files
committed
cmd/internal/obj/riscv: implement Zicond assembly and disassembly on riscv64
This patch implement assembler and disassembler support for the Zicond extension: CZEROEQZ and CZERONEZ. Update opcode names and encodings in obj/riscv, enable rv_zicond in generated tables, and add basic test coverage in riscv64.s. Follow-up to CL 631576 Update #75350
1 parent c5737dc commit c4006c0

File tree

6 files changed

+29
-1
lines changed

6 files changed

+29
-1
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,12 @@ start:
177177
RDTIME X5 // f32210c0
178178
RDINSTRET X5 // f32220c0
179179

180+
// 11.: Zicond Instructions
181+
CZEROEQZ X1, X13, X5 // b3d2160e
182+
CZEROEQZ X1, X13 // b3d6160e
183+
CZERONEZ X31, X3, X11 // b3f5f10f
184+
CZERONEZ X31, X3 // b3f1f10f
185+
180186
// 13.1: Multiplication Operations
181187
MUL X5, X6, X7 // b3035302
182188
MULH X5, X6, X7 // b3135302

src/cmd/internal/obj/riscv/anames.go

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/cmd/internal/obj/riscv/cpu.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,10 @@ const (
407407
ACSRRSI
408408
ACSRRCI
409409

410+
// 11.: Zicond Instructions
411+
ACZEROEQZ
412+
ACZERONEZ
413+
410414
// 13.1: Multiplication Operations
411415
AMUL
412416
AMULH

src/cmd/internal/obj/riscv/inst.go

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/cmd/internal/obj/riscv/obj.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2007,6 +2007,10 @@ var instructions = [ALAST & obj.AMask]instructionData{
20072007
AFLD & obj.AMask: {enc: iFEncoding},
20082008
AFSD & obj.AMask: {enc: sFEncoding},
20092009

2010+
// 11. "Zicond" Extension for Integer Conditional Operations
2011+
ACZERONEZ & obj.AMask: {enc: rIIIEncoding, ternary: true},
2012+
ACZEROEQZ & obj.AMask: {enc: rIIIEncoding, ternary: true},
2013+
20102014
// 21.4: Double-Precision Floating-Point Computational Instructions
20112015
AFADDD & obj.AMask: {enc: rFFFEncoding},
20122016
AFSUBD & obj.AMask: {enc: rFFFEncoding},

src/cmd/vendor/golang.org/x/arch/riscv64/riscv64asm/tables.go

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)