Skip to content

Commit 371c1d2

Browse files
BoyaoWang4304a6f656c
authored andcommitted
cmd/internal/obj/riscv: add support for vector unit-stride fault-only-first load instructions
Add support for vector unit-stride fault-only-first load instructions to the RISC-V assembler. This includes vle8ff, vle16ff, vle32ff and vle64ff. Change-Id: I5575a1ea155663852f92194fb79f08b5d52203de Reviewed-on: https://go-review.googlesource.com/c/go/+/690115 Reviewed-by: Junyang Shao <[email protected]> Reviewed-by: Meng Zhuo <[email protected]> Reviewed-by: Cherry Mui <[email protected]> Reviewed-by: Joel Sing <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent 411c250 commit 371c1d2

File tree

4 files changed

+20
-1
lines changed

4 files changed

+20
-1
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,16 @@ start:
549549
VSOXEI64V V3, V2, (X10) // a771250e
550550
VSOXEI64V V3, V2, V0, (X10) // a771250c
551551

552+
// 31.7.7: Unit-stride Fault-Only-First Loads
553+
VLE8FFV (X10), V8 // 07040503
554+
VLE16FFV (X10), V8 // 07540503
555+
VLE32FFV (X10), V8 // 07640503
556+
VLE64FFV (X10), V8 // 07740503
557+
VLE8FFV (X10), V0, V8 // 07040501
558+
VLE16FFV (X10), V0, V8 // 07540501
559+
VLE32FFV (X10), V0, V8 // 07640501
560+
VLE64FFV (X10), V0, V8 // 07740501
561+
552562
// 31.7.8: Vector Load/Store Segment Instructions
553563

554564
// 31.7.8.1: Vector Unit-Stride Segment Loads and Stores

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ TEXT errors(SB),$0
7373
//
7474
VSETIVLI X10, E32, M2, TA, MA, X12 // ERROR "expected immediate value"
7575
VLE8V (X10), V1, V3 // ERROR "invalid vector mask register"
76+
VLE8FFV (X10), V1, V3 // ERROR "invalid vector mask register"
7677
VSE8V V3, V1, (X10) // ERROR "invalid vector mask register"
7778
VLSE8V (X10), X10, V1, V3 // ERROR "invalid vector mask register"
7879
VSSE8V V3, X11, V1, (X10) // ERROR "invalid vector mask register"

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ TEXT validation(SB),$0
2020
VSETVL X10, X11 // ERROR "expected integer register in rs1 position"
2121
VLE8V (X10), X10 // ERROR "expected vector register in vd position"
2222
VLE8V (V1), V3 // ERROR "expected integer register in rs1 position"
23+
VLE8FFV (X10), X10 // ERROR "expected vector register in vd position"
24+
VLE8FFV (V1), V3 // ERROR "expected integer register in rs1 position"
2325
VSE8V X10, (X10) // ERROR "expected vector register in vs1 position"
2426
VSE8V V3, (V1) // ERROR "expected integer register in rd position"
2527
VLSE8V (X10), V3 // ERROR "expected integer register in rs2 position"

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2176,6 +2176,12 @@ var instructions = [ALAST & obj.AMask]instructionData{
21762176
AVSOXEI32V & obj.AMask: {enc: sVIVEncoding},
21772177
AVSOXEI64V & obj.AMask: {enc: sVIVEncoding},
21782178

2179+
// 31.7.7: Unit-stride Fault-Only-First Loads
2180+
AVLE8FFV & obj.AMask: {enc: iVEncoding},
2181+
AVLE16FFV & obj.AMask: {enc: iVEncoding},
2182+
AVLE32FFV & obj.AMask: {enc: iVEncoding},
2183+
AVLE64FFV & obj.AMask: {enc: iVEncoding},
2184+
21792185
// 31.7.8: Vector Load/Store Segment Instructions
21802186
AVLSEG2E8V & obj.AMask: {enc: iVEncoding},
21812187
AVLSEG3E8V & obj.AMask: {enc: iVEncoding},
@@ -3839,7 +3845,7 @@ func instructionsForProg(p *obj.Prog) []*instruction {
38393845
ins.rs1 = uint32(p.From.Offset)
38403846
}
38413847

3842-
case AVLE8V, AVLE16V, AVLE32V, AVLE64V, AVSE8V, AVSE16V, AVSE32V, AVSE64V, AVLMV, AVSMV,
3848+
case AVLE8V, AVLE16V, AVLE32V, AVLE64V, AVSE8V, AVSE16V, AVSE32V, AVSE64V, AVLE8FFV, AVLE16FFV, AVLE32FFV, AVLE64FFV, AVLMV, AVSMV,
38433849
AVLSEG2E8V, AVLSEG3E8V, AVLSEG4E8V, AVLSEG5E8V, AVLSEG6E8V, AVLSEG7E8V, AVLSEG8E8V,
38443850
AVLSEG2E16V, AVLSEG3E16V, AVLSEG4E16V, AVLSEG5E16V, AVLSEG6E16V, AVLSEG7E16V, AVLSEG8E16V,
38453851
AVLSEG2E32V, AVLSEG3E32V, AVLSEG4E32V, AVLSEG5E32V, AVLSEG6E32V, AVLSEG7E32V, AVLSEG8E32V,

0 commit comments

Comments
 (0)