aboutsummaryrefslogtreecommitdiff
path: root/test/codegen
diff options
context:
space:
mode:
authorLynn Boger <laboger@linux.vnet.ibm.com>2020-04-01 10:30:05 -0400
committerLynn Boger <laboger@linux.vnet.ibm.com>2020-04-09 19:18:56 +0000
commita1550d3ca3a6a90b8bbb610950d1b30649411243 (patch)
treeab0fd924a51e78b8615baf584d63d7336fd101bd /test/codegen
parent7c0ee1127bf41bf274b08170de3e42b171a903c0 (diff)
downloadgo-a1550d3ca3a6a90b8bbb610950d1b30649411243.tar.gz
go-a1550d3ca3a6a90b8bbb610950d1b30649411243.zip
cmd/compile: use isel with variable shifts on ppc64x
This changes the code generated for variable length shift counts to use isel instead of instructions that set and read the carry flag. This reduces the generated code for shifts like this by 1 instruction and avoids the use of instructions to set and read the carry flag. This sequence can be found in strconv with these results on power9: Atof64Decimal 71.6ns ± 0% 68.3ns ± 0% -4.61% Atof64Float 95.3ns ± 0% 90.9ns ± 0% -4.62% Atof64FloatExp 153ns ± 0% 149ns ± 0% -2.61% Atof64Big 234ns ± 0% 232ns ± 0% -0.85% Atof64RandomBits 348ns ± 0% 369ns ± 0% +6.03% Atof64RandomFloats 262ns ± 0% 262ns ± 0% ~ Atof32Decimal 72.0ns ± 0% 68.2ns ± 0% -5.28% Atof32Float 92.1ns ± 0% 87.1ns ± 0% -5.43% Atof32FloatExp 159ns ± 0% 158ns ± 0% -0.63% Atof32Random 194ns ± 0% 191ns ± 0% -1.55% Some tests in codegen/shift.go are enabled to verify the expected instructions are generated. Change-Id: I968715d10ada405a8c46132bf19b8ed9b85796d1 Reviewed-on: https://go-review.googlesource.com/c/go/+/227337 Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'test/codegen')
-rw-r--r--test/codegen/shift.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/codegen/shift.go b/test/codegen/shift.go
index 305c39a1d8..5e50ea6bff 100644
--- a/test/codegen/shift.go
+++ b/test/codegen/shift.go
@@ -12,61 +12,85 @@ package codegen
func lshMask64x64(v int64, s uint64) int64 {
// s390x:-".*AND",-".*MOVDGE"
+ // ppc64le:"ANDCC",-"ORN",-"ISEL"
+ // ppc64:"ANDCC",-"ORN",-"ISEL"
return v << (s & 63)
}
func rshMask64Ux64(v uint64, s uint64) uint64 {
// s390x:-".*AND",-".*MOVDGE"
+ // ppc64le:"ANDCC",-"ORN",-"ISEL"
+ // ppc64:"ANDCC",-"ORN",-"ISEL"
return v >> (s & 63)
}
func rshMask64x64(v int64, s uint64) int64 {
// s390x:-".*AND",-".*MOVDGE"
+ // ppc64le:"ANDCC",-ORN",-"ISEL"
+ // ppc64:"ANDCC",-"ORN",-"ISEL"
return v >> (s & 63)
}
func lshMask32x64(v int32, s uint64) int32 {
// s390x:-".*AND",-".*MOVDGE"
+ // ppc64le:"ISEL",-"ORN"
+ // ppc64:"ISEL",-"ORN"
return v << (s & 63)
}
func rshMask32Ux64(v uint32, s uint64) uint32 {
// s390x:-".*AND",-".*MOVDGE"
+ // ppc64le:"ISEL",-"ORN"
+ // ppc64:"ISEL",-"ORN"
return v >> (s & 63)
}
func rshMask32x64(v int32, s uint64) int32 {
// s390x:-".*AND",-".*MOVDGE"
+ // ppc64le:"ISEL",-"ORN"
+ // ppc64:"ISEL",-"ORN"
return v >> (s & 63)
}
func lshMask64x32(v int64, s uint32) int64 {
// s390x:-".*AND",-".*MOVDGE"
+ // ppc64le:"ANDCC",-"ORN"
+ // ppc64:"ANDCC",-"ORN"
return v << (s & 63)
}
func rshMask64Ux32(v uint64, s uint32) uint64 {
// s390x:-".*AND",-".*MOVDGE"
+ // ppc64le:"ANDCC",-"ORN"
+ // ppc64:"ANDCC",-"ORN"
return v >> (s & 63)
}
func rshMask64x32(v int64, s uint32) int64 {
// s390x:-".*AND",-".*MOVDGE"
+ // ppc64le:"ANDCC",-"ORN",-"ISEL"
+ // ppc64:"ANDCC",-"ORN",-"ISEL"
return v >> (s & 63)
}
func lshMask64x32Ext(v int64, s int32) int64 {
// s390x:-".*AND",-".*MOVDGE"
+ // ppc64le:"ANDCC",-"ORN",-"ISEL"
+ // ppc64:"ANDCC",-"ORN",-"ISEL"
return v << uint(s&63)
}
func rshMask64Ux32Ext(v uint64, s int32) uint64 {
// s390x:-".*AND",-".*MOVDGE"
+ // ppc64le:"ANDCC",-"ORN",-"ISEL"
+ // ppc64:"ANDCC",-"ORN",-"ISEL"
return v >> uint(s&63)
}
func rshMask64x32Ext(v int64, s int32) int64 {
// s390x:-".*AND",-".*MOVDGE"
+ // ppc64le:"ANDCC",-"ORN",-"ISEL"
+ // ppc64:"ANDCC",-"ORN",-"ISEL"
return v >> uint(s&63)
}