From aef81a75516fa10338cf2e770914fad70037c49c Mon Sep 17 00:00:00 2001 From: Xiaolin Zhao Date: Thu, 10 Oct 2024 19:46:13 +0800 Subject: cmd/compile: add rules to optimize go codes to constant 0 on loong64 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit goos: linux goarch: loong64 pkg: test/bench/go1 cpu: Loongson-3A6000 @ 2500.00MHz │ old.bench │ new.bench │ │ sec/op │ sec/op vs base │ BinaryTree17 7.735 ± 1% 7.716 ± 1% -0.23% (p=0.041 n=15) Fannkuch11 2.645 ± 0% 2.646 ± 0% +0.05% (p=0.013 n=15) FmtFprintfEmpty 35.87n ± 0% 35.89n ± 0% +0.06% (p=0.000 n=15) FmtFprintfString 59.54n ± 0% 59.47n ± 0% ~ (p=0.213 n=15) FmtFprintfInt 62.23n ± 0% 62.06n ± 0% ~ (p=0.212 n=15) FmtFprintfIntInt 98.16n ± 0% 97.90n ± 0% -0.26% (p=0.000 n=15) FmtFprintfPrefixedInt 117.0n ± 0% 116.7n ± 0% -0.26% (p=0.000 n=15) FmtFprintfFloat 204.6n ± 0% 204.2n ± 0% -0.20% (p=0.000 n=15) FmtManyArgs 456.3n ± 0% 455.4n ± 0% -0.20% (p=0.000 n=15) GobDecode 7.210m ± 0% 7.156m ± 1% -0.75% (p=0.000 n=15) GobEncode 8.143m ± 1% 8.177m ± 1% ~ (p=0.806 n=15) Gzip 280.2m ± 0% 279.7m ± 0% -0.19% (p=0.005 n=15) Gunzip 32.71m ± 0% 32.65m ± 0% -0.19% (p=0.000 n=15) HTTPClientServer 53.76µ ± 0% 53.65µ ± 0% ~ (p=0.083 n=15) JSONEncode 9.297m ± 0% 9.295m ± 0% ~ (p=0.806 n=15) JSONDecode 46.97m ± 1% 47.07m ± 1% ~ (p=0.683 n=15) Mandelbrot200 4.602m ± 0% 4.600m ± 0% -0.05% (p=0.001 n=15) GoParse 4.682m ± 0% 4.670m ± 1% -0.25% (p=0.001 n=15) RegexpMatchEasy0_32 59.80n ± 0% 59.63n ± 0% -0.28% (p=0.000 n=15) RegexpMatchEasy0_1K 458.3n ± 0% 457.3n ± 0% -0.22% (p=0.001 n=15) RegexpMatchEasy1_32 59.39n ± 0% 59.23n ± 0% -0.27% (p=0.000 n=15) RegexpMatchEasy1_1K 557.9n ± 0% 556.6n ± 0% -0.23% (p=0.001 n=15) RegexpMatchMedium_32 803.6n ± 0% 801.8n ± 0% -0.22% (p=0.001 n=15) RegexpMatchMedium_1K 27.32µ ± 0% 27.26µ ± 0% -0.21% (p=0.000 n=15) RegexpMatchHard_32 1.385µ ± 0% 1.382µ ± 0% -0.22% (p=0.000 n=15) RegexpMatchHard_1K 40.93µ ± 0% 40.83µ ± 0% -0.24% (p=0.000 n=15) Revcomp 474.8m ± 0% 474.3m ± 0% ~ (p=0.250 n=15) Template 77.41m ± 1% 76.63m ± 1% -1.01% (p=0.023 n=15) TimeParse 271.1n ± 0% 271.2n ± 0% +0.04% (p=0.022 n=15) TimeFormat 290.0n ± 0% 289.8n ± 0% ~ (p=0.118 n=15) geomean 51.73µ 51.64µ -0.18% Change-Id: I45a1e6c85bb3cea0f62766ec932432803e9af10a Reviewed-on: https://go-review.googlesource.com/c/go/+/619315 Reviewed-by: Qiqi Huang Reviewed-by: Meidan Li Reviewed-by: abner chenc Reviewed-by: Michael Pratt LUCI-TryBot-Result: Go LUCI Reviewed-by: Carlos Amedee --- test/codegen/bitfield.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'test/codegen') diff --git a/test/codegen/bitfield.go b/test/codegen/bitfield.go index 3276af3de0..44cf09f86f 100644 --- a/test/codegen/bitfield.go +++ b/test/codegen/bitfield.go @@ -358,11 +358,15 @@ func rev16w(c uint32) (uint32, uint32, uint32) { func shift(x uint32, y uint16, z uint8) uint64 { // arm64:-`MOVWU`,-`LSR\t[$]32` + // loong64:-`MOVWU`,-`SRLV\t[$]32` a := uint64(x) >> 32 // arm64:-`MOVHU + // loong64:-`MOVHU`,-`SRLV\t[$]16` b := uint64(y) >> 16 // arm64:-`MOVBU` + // loong64:-`MOVBU`,-`SRLV\t[$]8` c := uint64(z) >> 8 // arm64:`MOVD\tZR`,-`ADD\tR[0-9]+>>16`,-`ADD\tR[0-9]+>>8`, + // loong64:`MOVV\t[$]0`,-`ADDVU` return a + b + c } -- cgit v1.3-5-g9baa