ppc64/ppc64asm: fix decoding of several CC opcodes
A few of them decoded to invalid plan9 opcodes, and
some did not swap there input arguments similar to
their non-CC variants.
Change-Id: I26b2b4e318891a75d9c4973bb88efaff8b188bbf
Reviewed-on: https://go-review.googlesource.com/c/arch/+/431475
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
diff --git a/ppc64/ppc64asm/plan9.go b/ppc64/ppc64asm/plan9.go
index 88e8e1c..5fe4077 100644
--- a/ppc64/ppc64asm/plan9.go
+++ b/ppc64/ppc64asm/plan9.go
@@ -251,7 +251,7 @@
return true
case FADDCC, FADDSCC, FSUBCC, FMULCC, FDIVCC, FDIVSCC:
return true
- case OR, ORC, AND, ANDC, XOR, NAND, EQV, NOR, ANDCC, ORCC, XORCC, EQVCC, NORCC, NANDCC:
+ case OR, ORCC, ORC, ORCCC, AND, ANDCC, ANDC, ANDCCC, XOR, XORCC, NAND, NANDCC, EQV, EQVCC, NOR, NORCC:
return true
case SLW, SLWCC, SLD, SLDCC, SRW, SRAW, SRWCC, SRAWCC, SRD, SRDCC, SRAD, SRADCC:
return true
@@ -305,6 +305,7 @@
ORI: "OR",
ANDICC: "ANDCC",
ANDC: "ANDN",
+ ANDCCC: "ANDNCC",
ADDEO: "ADDEV",
ADDEOCC: "ADDEVCC",
ADDO: "ADDV",
@@ -321,8 +322,12 @@
SUBFZECC: "SUBZECC",
SUBFZEO: "SUBZEV",
SUBFZEOCC: "SUBZEVCC",
+ SUBF: "SUB",
SUBFC: "SUBC",
+ SUBFCC: "SUBCC",
+ SUBFCCC: "SUBCCC",
ORC: "ORN",
+ ORCCC: "ORNCC",
MULLWO: "MULLWV",
MULLWOCC: "MULLWVCC",
MULLDO: "MULLDV",
@@ -334,7 +339,6 @@
ADDI: "ADD",
MULLI: "MULLD",
SRADI: "SRAD",
- SUBF: "SUB",
STBCXCC: "STBCCC",
STWCXCC: "STWCCC",
STDCXCC: "STDCCC",
diff --git a/ppc64/ppc64asm/testdata/decode.txt b/ppc64/ppc64asm/testdata/decode.txt
index 3213903..54fcafd 100644
--- a/ppc64/ppc64asm/testdata/decode.txt
+++ b/ppc64/ppc64asm/testdata/decode.txt
@@ -126,24 +126,31 @@
7c032000| plan9 CMPW R3,R4
7c032040| plan9 CMPWU R3,R4
7ca41a14| plan9 ADD R3,R4,R5
+7ca41a15| plan9 ADDCC R3,R4,R5
7ca41814| plan9 ADDC R3,R4,R5
7ca41815| plan9 ADDCCC R3,R4,R5
7c851838| plan9 AND R3,R4,R5
-7c851878| plan9 ANDN R3,R4,R5
7c851839| plan9 ANDCC R3,R4,R5
+7c851878| plan9 ANDN R3,R4,R5
+7c851879| plan9 ANDNCC R3,R4,R5
7c851b78| plan9 OR R3,R4,R5
-7c851b38| plan9 ORN R3,R4,R5
7c851b79| plan9 ORCC R3,R4,R5
+7c851b38| plan9 ORN R3,R4,R5
+7c851b39| plan9 ORNCC R3,R4,R5
7c851a78| plan9 XOR R3,R4,R5
7c851a79| plan9 XORCC R3,R4,R5
7c851bb8| plan9 NAND R3,R4,R5
7c851bb9| plan9 NANDCC R3,R4,R5
7c851a38| plan9 EQV R3,R4,R5
7c851a39| plan9 EQVCC R3,R4,R5
+7c8300d0| plan9 NEG R3,R4
+7c8300d1| plan9 NEGCC R3,R4
7c8518f8| plan9 NOR R3,R4,R5
7c8518f9| plan9 NORCC R3,R4,R5
7ca32050| plan9 SUB R3,R4,R5
+7ca32051| plan9 SUBCC R3,R4,R5
7ca32010| plan9 SUBC R3,R4,R5
+7ca32011| plan9 SUBCCC R3,R4,R5
7ca419d6| plan9 MULLW R3,R4,R5
7ca419d7| plan9 MULLWCC R3,R4,R5
7ca41896| plan9 MULHW R3,R4,R5