aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/asm
diff options
context:
space:
mode:
authorPaul E. Murphy <murp@ibm.com>2024-05-13 11:56:42 -0500
committerPaul Murphy <murp@ibm.com>2024-05-15 13:55:28 +0000
commit408739fc96f00a50642673544e803a3c3f3e27df (patch)
treedfdefff56180661408202a77de0456af3324b47c /src/cmd/asm
parent6ccd8e4cf69efbc8983a9873a41158f554ea5363 (diff)
downloadgo-408739fc96f00a50642673544e803a3c3f3e27df.tar.xz
cmd/compile,cmd/asm: on PPC64, generate compares against constant 0
Merge the handling of CMPx r,r,cr and CMPx r,i,cr when assembling. This prevents generating machine code like cmpd rx,r0 when cmpdi rx,0 is preferred. The preferred form can be fused on Power10 for faster execution of some instruction sequences. Likewise, update a common case to use $0 instead of R0 to take advantage of this. Change-Id: If2549ca25a5f7d23001885ad444c70d829b3b066 Cq-Include-Trybots: luci.golang.try:gotip-linux-ppc64_power10,gotip-linux-ppc64_power8,gotip-linux-ppc64le_power10,gotip-linux-ppc64le_power8,gotip-linux-ppc64le_power9 Reviewed-on: https://go-review.googlesource.com/c/go/+/585137 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com> Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/cmd/asm')
-rw-r--r--src/cmd/asm/internal/asm/testdata/ppc64.s23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/cmd/asm/internal/asm/testdata/ppc64.s b/src/cmd/asm/internal/asm/testdata/ppc64.s
index 8627408f06..7e8c6f9cf2 100644
--- a/src/cmd/asm/internal/asm/testdata/ppc64.s
+++ b/src/cmd/asm/internal/asm/testdata/ppc64.s
@@ -260,13 +260,32 @@ TEXT asmtest(SB),DUPOK|NOSPLIT,$0
XORIS $15, R3, R4 // 6c64000f
XOR $983040, R3, R4 // 6c64000f
- // TODO: the order of CR operands don't match
+ // TODO: cleanup inconsistency of printing CMPx opcodes with explicit CR arguments.
CMP R3, R4 // 7c232000
+ CMP R3, R0 // 7c230000
+ CMP R3, R0, CR1 // CMP R3,CR1,R0 // 7ca30000
CMPU R3, R4 // 7c232040
+ CMPU R3, R0 // 7c230040
+ CMPU R3, R0, CR2 // CMPU R3,CR2,R0 // 7d230040
CMPW R3, R4 // 7c032000
+ CMPW R3, R0 // 7c030000
+ CMPW R3, R0, CR3 // CMPW R3,CR3,R0 // 7d830000
CMPWU R3, R4 // 7c032040
- CMPB R3,R4,R4 // 7c6423f8
+ CMPWU R3, R0 // 7c030040
+ CMPWU R3, R0, CR4 // CMPWU R3,CR4,R0 // 7e030040
+ CMP R3, $0 // 2c230000
+ CMPU R3, $0 // 28230000
+ CMPW R3, $0 // 2c030000
+ CMPWU R3, $0 // 28030000
+ CMP R3, $0, CR0 // CMP R3,CR0,$0 // 2c230000
+ CMPU R3, $0, CR1 // CMPU R3,CR1,$0 // 28a30000
+ CMPW R3, $0, CR2 // CMPW R3,CR2,$0 // 2d030000
+ CMPW R3, $-32768, CR2 // CMPW R3,CR2,$-32768 // 2d038000
+ CMPWU R3, $0, CR3 // CMPWU R3,CR3,$0 // 29830000
+ CMPWU R3, $0x8008, CR3 // CMPWU R3,CR3,$32776 // 29838008
+
CMPEQB R3,R4,CR6 // 7f0321c0
+ CMPB R3,R4,R4 // 7c6423f8
ADD R3, R4 // 7c841a14
ADD R3, R4, R5 // 7ca41a14