]> Cypherpunks repositories - gostls13.git/commit
cmd/compile,cmd/internal/obj: provide rotation pseudo-instructions for riscv64
authorJoel Sing <joel@sing.id.au>
Thu, 8 Feb 2024 02:54:10 +0000 (13:54 +1100)
committerJoel Sing <joel@sing.id.au>
Thu, 7 Mar 2024 14:57:07 +0000 (14:57 +0000)
commit997636760e2d981bb2f5ba486e0702e60a07ba16
treef4272eb6f8f4bd67d8b8c73e857f09233419a412
parent58052fe8e707cc0285cffb239bc7a5343243e316
cmd/compile,cmd/internal/obj: provide rotation pseudo-instructions for riscv64

Provide and use rotation pseudo-instructions for riscv64. The RISC-V bitmanip
extension adds support for hardware rotation instructions in the form of ROL,
ROLW, ROR, RORI, RORIW and RORW. These are easily implemented in the assembler
as pseudo-instructions for CPUs that do not support the bitmanip extension.

This approach provides a number of advantages, including reducing the rewrite
rules needed in the compiler, simplifying codegen tests and most importantly,
allowing these instructions to be used in assembly (for example, riscv64
optimised versions of SHA-256 and SHA-512). When bitmanip support is added,
these instruction sequences can simply be replaced with a single instruction
if permitted by the GORISCV64 profile.

Change-Id: Ia23402e1a82f211ac760690deb063386056ae1fa
Reviewed-on: https://go-review.googlesource.com/c/go/+/565015
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: M Zhuo <mengzhuo1203@gmail.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Run-TryBot: Joel Sing <joel@sing.id.au>
src/cmd/asm/internal/asm/testdata/riscv64.s
src/cmd/compile/internal/riscv64/ssa.go
src/cmd/compile/internal/ssa/_gen/RISCV64.rules
src/cmd/compile/internal/ssa/_gen/RISCV64Ops.go
src/cmd/compile/internal/ssa/opGen.go
src/cmd/compile/internal/ssa/rewriteRISCV64.go
src/cmd/internal/obj/riscv/anames.go
src/cmd/internal/obj/riscv/cpu.go
src/cmd/internal/obj/riscv/obj.go
src/crypto/sha512/sha512block_riscv64.s
test/codegen/rotate.go