aboutsummaryrefslogtreecommitdiff
path: root/test/codegen
diff options
context:
space:
mode:
authorWayne Zuo <wdvxdr@golangcn.org>2022-04-08 16:44:13 +0800
committerGopher Robot <gobot@golang.org>2022-04-12 12:59:27 +0000
commitd6320f1a58f1f7820daee06a086c83a0274a777f (patch)
treec1954c75174b257abf202a986f10faed96cacbe1 /test/codegen
parent2b31abc5286e4f29f934c4123101feabf0f4aaca (diff)
downloadgo-d6320f1a58f1f7820daee06a086c83a0274a777f.tar.xz
cmd/compile: add SARX instruction for GOAMD64>=3
name old time/op new time/op delta ShiftArithmeticRight-8 0.68ns ± 5% 0.30ns ± 6% -56.14% (p=0.000 n=10+10) Change-Id: I052a0d7b9e6526d526276444e588b0cc288beff4 Reviewed-on: https://go-review.googlesource.com/c/go/+/399055 Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
Diffstat (limited to 'test/codegen')
-rw-r--r--test/codegen/bmi.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/codegen/bmi.go b/test/codegen/bmi.go
index 2908d1b796..9dd2b0039c 100644
--- a/test/codegen/bmi.go
+++ b/test/codegen/bmi.go
@@ -46,6 +46,16 @@ func blsr32(x int32) int32 {
return x & (x - 1)
}
+func sarx64(x, y int64) int64 {
+ // amd64/v3:"SARXQ"
+ return x >> y
+}
+
+func sarx32(x, y int32) int32 {
+ // amd64/v3:"SARXL"
+ return x >> y
+}
+
func shlrx64(x []uint64, i int, s uint64) uint64 {
// amd64/v3: `SHRXQ\t[A-Z]+[0-9]*, \([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\), [A-Z]+[0-9]*`
s = x[i] >> i