]> Cypherpunks repositories - gostls13.git/commit
cmd/internal/obj/riscv: fix LMUL encoding for MF2 and MF8
authorMark Ryan <markdryan@rivosinc.com>
Tue, 6 May 2025 11:02:34 +0000 (13:02 +0200)
committerMark Ryan <markdryan@rivosinc.com>
Thu, 8 May 2025 08:52:12 +0000 (01:52 -0700)
commit5a1f47a7f716ce0dbd88128d18ce556dd9280c68
tree0420d31ee5c63ed05373c79a21a974c5a0023fec
parentd13da63929df73ab506314f35524ebb9b0f8a216
cmd/internal/obj/riscv: fix LMUL encoding for MF2 and MF8

The encodings for the riscv64 special operands SPOP_MF2 and SPOP_MF8
are incorrect, i.e., their values are swapped.  This leads to
incorrect encodings for the VSETVLI and VSETIVLI instructions.  The
assembler currently encodes

VSETVLI X10, E32, MF8, TA, MA, X12

as

VSETVLI X10, E32, MF2, TA, MA, X12

We update the encodings for SPOP_MF2 and SPOP_MF8 so that they match
the LMUL table in section "31.3.4. Vector type register, vtype" of
the "RISC-V Instruction Set Manual Volume 1".

Change-Id: Ic73355533d7c2a901ee060b35c2f7af6d58453e4
Reviewed-on: https://go-review.googlesource.com/c/go/+/670016
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
src/cmd/asm/internal/asm/testdata/riscv64.s
src/cmd/internal/obj/riscv/cpu.go