aboutsummaryrefslogtreecommitdiff
path: root/test/codegen
diff options
context:
space:
mode:
authorPaul E. Murphy <murp@ibm.com>2023-10-12 09:25:30 -0500
committerPaul Murphy <murp@ibm.com>2023-11-09 18:41:18 +0000
commit3128aeec87af4bf63f3df5971127f96685fb4363 (patch)
tree4b339133fc4e4d0573ca4adcdb0fd955d72f371b /test/codegen
parent6b818b08f9a3a1ecce453b94f60497986d3db27d (diff)
downloadgo-3128aeec87af4bf63f3df5971127f96685fb4363.tar.gz
go-3128aeec87af4bf63f3df5971127f96685fb4363.zip
cmd/internal/obj/ppc64: remove C_UCON optab matching class
This optab matching rule was used to match signed 16 bit values shifted left by 16 bits. Unsigned 16 bit values greater than 0x7FFF<<16 were classified as C_U32CON which led to larger than necessary codegen. Instead, rewrite logical/arithmetic operations in the preprocessor pass to use the 16 bit shifted immediate operation (e.g ADDIS vs ADD). This simplifies the optab matching rules, while also minimizing codegen size for large unsigned values. Note, ADDIS sign-extends the constant argument, all others do not. For matching opcodes, this means: MOVD $is<<16,Rx becomes ADDIS $is,Rx or ORIS $is,Rx MOVW $is<<16,Rx becomes ADDIS $is,Rx ADD $is<<16,[Rx,]Ry becomes ADDIS $is[Rx,]Ry OR $is<<16,[Rx,]Ry becomes ORIS $is[Rx,]Ry XOR $is<<16,[Rx,]Ry becomes XORIS $is[Rx,]Ry Change-Id: I1a988d9f52517a04bb8dc2e41d7caf3d5fff867c Reviewed-on: https://go-review.googlesource.com/c/go/+/536735 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Run-TryBot: Paul Murphy <murp@ibm.com> Reviewed-by: Heschi Kreinick <heschi@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Diffstat (limited to 'test/codegen')
-rw-r--r--test/codegen/mathbits.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/test/codegen/mathbits.go b/test/codegen/mathbits.go
index d80bfaeec0..184d608424 100644
--- a/test/codegen/mathbits.go
+++ b/test/codegen/mathbits.go
@@ -340,8 +340,8 @@ func TrailingZeros16(n uint16) int {
// arm:"ORR\t\\$65536","CLZ",-"MOVHU\tR"
// arm64:"ORR\t\\$65536","RBITW","CLZW",-"MOVHU\tR",-"RBIT\t",-"CLZ\t"
// s390x:"FLOGR","OR\t\\$65536"
- // ppc64x/power8:"POPCNTD","OR\\t\\$65536"
- // ppc64x/power9:"CNTTZD","OR\\t\\$65536"
+ // ppc64x/power8:"POPCNTD","ORIS\\t\\$1"
+ // ppc64x/power9:"CNTTZD","ORIS\\t\\$1"
// wasm:"I64Ctz"
return bits.TrailingZeros16(n)
}