aboutsummaryrefslogtreecommitdiff
path: root/test/codegen/shift.go
diff options
context:
space:
mode:
authorWayne Zuo <wdvxdr@golangcn.org>2022-08-11 00:07:40 +0800
committerGopher Robot <gobot@golang.org>2022-08-31 20:21:00 +0000
commitda6556968f3545aa6c4e5a3c3aef151bb9b1d439 (patch)
tree8357dbb33a57534532d4848abf1a140547bd47d3 /test/codegen/shift.go
parent971373f56a5e47e523c7ac7f097349b83f5d31b5 (diff)
downloadgo-da6556968f3545aa6c4e5a3c3aef151bb9b1d439.tar.xz
cmd/compile: simplify bounded shift on riscv64
The prove pass will mark some shifts bounded, and then we can use that information to generate better code on riscv64. Change-Id: Ia22f43d0598453c9417adac7017db28d7240948b Reviewed-on: https://go-review.googlesource.com/c/go/+/422616 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Joel Sing <joel@sing.id.au> Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Keith Randall <khr@golang.org> Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
Diffstat (limited to 'test/codegen/shift.go')
-rw-r--r--test/codegen/shift.go34
1 files changed, 17 insertions, 17 deletions
diff --git a/test/codegen/shift.go b/test/codegen/shift.go
index 66a5c62391..293924a3db 100644
--- a/test/codegen/shift.go
+++ b/test/codegen/shift.go
@@ -80,7 +80,7 @@ func rshConst64x32(v int64) int64 {
func lshMask64x64(v int64, s uint64) int64 {
// ppc64:"ANDCC",-"ORN",-"ISEL"
// ppc64le:"ANDCC",-"ORN",-"ISEL"
- // riscv64:"SLL","AND","SLTIU"
+ // riscv64:"SLL",-"AND\t",-"SLTIU"
// s390x:-"RISBGZ",-"AND",-"LOCGR"
return v << (s & 63)
}
@@ -88,7 +88,7 @@ func lshMask64x64(v int64, s uint64) int64 {
func rshMask64Ux64(v uint64, s uint64) uint64 {
// ppc64:"ANDCC",-"ORN",-"ISEL"
// ppc64le:"ANDCC",-"ORN",-"ISEL"
- // riscv64:"SRL","AND","SLTIU"
+ // riscv64:"SRL",-"AND\t",-"SLTIU"
// s390x:-"RISBGZ",-"AND",-"LOCGR"
return v >> (s & 63)
}
@@ -96,7 +96,7 @@ func rshMask64Ux64(v uint64, s uint64) uint64 {
func rshMask64x64(v int64, s uint64) int64 {
// ppc64:"ANDCC",-"ORN",-"ISEL"
// ppc64le:"ANDCC",-ORN",-"ISEL"
- // riscv64:"SRA","OR","SLTIU"
+ // riscv64:"SRA",-"OR",-"SLTIU"
// s390x:-"RISBGZ",-"AND",-"LOCGR"
return v >> (s & 63)
}
@@ -128,7 +128,7 @@ func rshMask32x64(v int32, s uint64) int32 {
func lshMask64x32(v int64, s uint32) int64 {
// ppc64:"ANDCC",-"ORN"
// ppc64le:"ANDCC",-"ORN"
- // riscv64:"SLL","AND","SLTIU"
+ // riscv64:"SLL",-"AND\t",-"SLTIU"
// s390x:-"RISBGZ",-"AND",-"LOCGR"
return v << (s & 63)
}
@@ -136,7 +136,7 @@ func lshMask64x32(v int64, s uint32) int64 {
func rshMask64Ux32(v uint64, s uint32) uint64 {
// ppc64:"ANDCC",-"ORN"
// ppc64le:"ANDCC",-"ORN"
- // riscv64:"SRL","AND","SLTIU"
+ // riscv64:"SRL",-"AND\t",-"SLTIU"
// s390x:-"RISBGZ",-"AND",-"LOCGR"
return v >> (s & 63)
}
@@ -144,7 +144,7 @@ func rshMask64Ux32(v uint64, s uint32) uint64 {
func rshMask64x32(v int64, s uint32) int64 {
// ppc64:"ANDCC",-"ORN",-"ISEL"
// ppc64le:"ANDCC",-"ORN",-"ISEL"
- // riscv64:"SRA","OR","SLTIU"
+ // riscv64:"SRA",-"OR",-"SLTIU"
// s390x:-"RISBGZ",-"AND",-"LOCGR"
return v >> (s & 63)
}
@@ -207,7 +207,7 @@ func lshSignedMasked(v8 int8, v16 int16, v32 int32, v64 int64, x int) {
func lshGuarded64(v int64, s uint) int64 {
if s < 64 {
- // riscv64:"SLL","AND","SLTIU"
+ // riscv64:"SLL",-"AND",-"SLTIU"
// s390x:-"RISBGZ",-"AND",-"LOCGR"
// wasm:-"Select",-".*LtU"
return v << s
@@ -217,7 +217,7 @@ func lshGuarded64(v int64, s uint) int64 {
func rshGuarded64U(v uint64, s uint) uint64 {
if s < 64 {
- // riscv64:"SRL","AND","SLTIU"
+ // riscv64:"SRL",-"AND",-"SLTIU"
// s390x:-"RISBGZ",-"AND",-"LOCGR"
// wasm:-"Select",-".*LtU"
return v >> s
@@ -227,7 +227,7 @@ func rshGuarded64U(v uint64, s uint) uint64 {
func rshGuarded64(v int64, s uint) int64 {
if s < 64 {
- // riscv64:"SRA","OR","SLTIU"
+ // riscv64:"SRA",-"OR",-"SLTIU"
// s390x:-"RISBGZ",-"AND",-"LOCGR"
// wasm:-"Select",-".*LtU"
return v >> s
@@ -357,17 +357,17 @@ func checkShiftAndMask32(v []uint32) {
}
func checkMergedShifts32(a [256]uint32, b [256]uint64, u uint32, v uint32) {
- //ppc64le: -"CLRLSLDI", "RLWNM\t[$]10, R[0-9]+, [$]22, [$]29, R[0-9]+"
- //ppc64: -"CLRLSLDI", "RLWNM\t[$]10, R[0-9]+, [$]22, [$]29, R[0-9]+"
+ // ppc64le: -"CLRLSLDI", "RLWNM\t[$]10, R[0-9]+, [$]22, [$]29, R[0-9]+"
+ // ppc64: -"CLRLSLDI", "RLWNM\t[$]10, R[0-9]+, [$]22, [$]29, R[0-9]+"
a[0] = a[uint8(v>>24)]
- //ppc64le: -"CLRLSLDI", "RLWNM\t[$]11, R[0-9]+, [$]21, [$]28, R[0-9]+"
- //ppc64: -"CLRLSLDI", "RLWNM\t[$]11, R[0-9]+, [$]21, [$]28, R[0-9]+"
+ // ppc64le: -"CLRLSLDI", "RLWNM\t[$]11, R[0-9]+, [$]21, [$]28, R[0-9]+"
+ // ppc64: -"CLRLSLDI", "RLWNM\t[$]11, R[0-9]+, [$]21, [$]28, R[0-9]+"
b[0] = b[uint8(v>>24)]
- //ppc64le: -"CLRLSLDI", "RLWNM\t[$]15, R[0-9]+, [$]21, [$]28, R[0-9]+"
- //ppc64: -"CLRLSLDI", "RLWNM\t[$]15, R[0-9]+, [$]21, [$]28, R[0-9]+"
+ // ppc64le: -"CLRLSLDI", "RLWNM\t[$]15, R[0-9]+, [$]21, [$]28, R[0-9]+"
+ // ppc64: -"CLRLSLDI", "RLWNM\t[$]15, R[0-9]+, [$]21, [$]28, R[0-9]+"
b[1] = b[(v>>20)&0xFF]
- //ppc64le: -"SLD", "RLWNM\t[$]10, R[0-9]+, [$]22, [$]28, R[0-9]+"
- //ppc64: -"SLD", "RLWNM\t[$]10, R[0-9]+, [$]22, [$]28, R[0-9]+"
+ // ppc64le: -"SLD", "RLWNM\t[$]10, R[0-9]+, [$]22, [$]28, R[0-9]+"
+ // ppc64: -"SLD", "RLWNM\t[$]10, R[0-9]+, [$]22, [$]28, R[0-9]+"
b[2] = b[v>>25]
}