aboutsummaryrefslogtreecommitdiff
path: root/test/codegen/arithmetic.go
diff options
context:
space:
mode:
authorlimeidan <limeidan@loongson.cn>2025-07-18 10:36:06 +0800
committerKeith Randall <khr@google.com>2025-08-25 12:30:16 -0700
commitbd71b9465948ec523c26dd2d9fea888bd83a2e6c (patch)
tree59eae1fbf88cb5395818715d9313318fbd1e3283 /test/codegen/arithmetic.go
parentea55ca360005c607fa54304d95c6821a6ce20e7c (diff)
downloadgo-bd71b9465948ec523c26dd2d9fea888bd83a2e6c.tar.xz
cmd/compile/internal: optimizing add+sll rule using ALSLV instruction on loong64
Reduce the number of go toolchain instructions on loong64 as follows: file before after Δ % go 1573148 1571708 -1,440 -0.0915% gofmt 320578 320090 -488 -0.1522% asm 555066 554406 -660 -0.1189% cgo 481566 480926 -640 -0.1329% compile 2475962 2473880 -2,082 -0.0841% cover 516536 515920 -616 -0.1193% link 702172 701404 -768 -0.1094% preprofile 238626 238274 -352 -0.1475% vet 792928 792100 -828 -0.1044% Change-Id: I61e462726835959c60e1b4e5256d4020202418ab Reviewed-on: https://go-review.googlesource.com/c/go/+/693877 Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Diffstat (limited to 'test/codegen/arithmetic.go')
-rw-r--r--test/codegen/arithmetic.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/codegen/arithmetic.go b/test/codegen/arithmetic.go
index 67adb50fa5..beabfe24eb 100644
--- a/test/codegen/arithmetic.go
+++ b/test/codegen/arithmetic.go
@@ -624,6 +624,11 @@ func AddMul(x int) int {
return 2*x + 1
}
+func AddShift(a, b int) int {
+ // loong64: "ALSLV"
+ return a + (b << 4)
+}
+
func MULA(a, b, c uint32) (uint32, uint32, uint32) {
// arm:`MULA`,-`MUL\s`
// arm64:`MADDW`,-`MULW`