aboutsummaryrefslogtreecommitdiff
path: root/test/codegen
diff options
context:
space:
mode:
authorMeng Zhuo <mengzhuo@iscas.ac.cn>2025-09-11 17:21:02 +0800
committerGopher Robot <gobot@golang.org>2025-09-15 17:31:56 -0700
commit2469e92d8c49536617136f744c9767e14f6461d2 (patch)
tree8c4e4429e2f8d8e7c74ced279c3c9a745046b7b1 /test/codegen
parentaa83aee7de1d69b207ab9669bb2b7dcdcbdf9383 (diff)
downloadgo-2469e92d8c49536617136f744c9767e14f6461d2.tar.xz
cmd/compile: combine doubling with shift on riscv64
Change-Id: I4bee2770fedf97e35b5a5b9187a8ba3c41f9ec2e Reviewed-on: https://go-review.googlesource.com/c/go/+/702697 Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Joel Sing <joel@sing.id.au> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Keith Randall <khr@google.com>
Diffstat (limited to 'test/codegen')
-rw-r--r--test/codegen/shift.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/codegen/shift.go b/test/codegen/shift.go
index 1c71b0f3ef..7385058726 100644
--- a/test/codegen/shift.go
+++ b/test/codegen/shift.go
@@ -122,27 +122,41 @@ func rshConst64x32(v int64) int64 {
func lshConst32x1Add(x int32) int32 {
// amd64:"SHLL\t[$]2"
// loong64:"SLL\t[$]2"
+ // riscv64:"SLLI\t[$]2"
return (x + x) << 1
}
func lshConst64x1Add(x int64) int64 {
// amd64:"SHLQ\t[$]2"
// loong64:"SLLV\t[$]2"
+ // riscv64:"SLLI\t[$]2"
return (x + x) << 1
}
func lshConst32x2Add(x int32) int32 {
// amd64:"SHLL\t[$]3"
// loong64:"SLL\t[$]3"
+ // riscv64:"SLLI\t[$]3"
return (x + x) << 2
}
func lshConst64x2Add(x int64) int64 {
// amd64:"SHLQ\t[$]3"
// loong64:"SLLV\t[$]3"
+ // riscv64:"SLLI\t[$]3"
return (x + x) << 2
}
+func lshConst32x31Add(x int32) int32 {
+ // riscv64:-"SLLI","MOV\t[$]0"
+ return (x + x) << 31
+}
+
+func lshConst64x63Add(x int64) int64 {
+ // riscv64:-"SLLI","MOV\t[$]0"
+ return (x + x) << 63
+}
+
// ------------------ //
// masked shifts //
// ------------------ //