]> Cypherpunks repositories - gostls13.git/commit
cmd/internal/obj/riscv: improve constant construction
authorJoel Sing <joel@sing.id.au>
Thu, 27 Feb 2025 11:54:51 +0000 (22:54 +1100)
committerJoel Sing <joel@sing.id.au>
Thu, 27 Mar 2025 11:26:47 +0000 (04:26 -0700)
commitd37624881f60f79dfba4ef81661024bee9dfc2d3
treeaf83af8b36424b821faf933e2c3553ee09ce3b10
parent1763ee199d33d2592332a29cfc3da7811718a4fd
cmd/internal/obj/riscv: improve constant construction

Attempt to construct large constants that have a consecutive sequence
of ones from a small negative constant, with a logical right and/or
left shift. This allows for a large range of mask like constants to be
constructed with only two or three instructions, avoiding the need to
load from memory.

Change-Id: I35a77fecdd2df0ed3f33b772d518f85119d4ff66
Reviewed-on: https://go-review.googlesource.com/c/go/+/652778
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Mark Ryan <markdryan@rivosinc.com>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
src/cmd/asm/internal/asm/testdata/riscv64.s
src/cmd/internal/obj/riscv/obj.go
src/cmd/internal/obj/riscv/obj_test.go