]> Cypherpunks repositories - gostls13.git/commit
cmd/asm: improve argument to obj.Prog assignment on PPC64
authorPaul E. Murphy <murp@ibm.com>
Thu, 1 Sep 2022 14:23:49 +0000 (09:23 -0500)
committerPaul Murphy <murp@ibm.com>
Wed, 7 Sep 2022 20:53:33 +0000 (20:53 +0000)
commita50c434308d474212557b7fa73583d68d09bd60d
treef003d401a35822809e02de41b230d3c4df3b0bb5
parent85c0d26c6a107b532ce0298c494456dac8d3b97c
cmd/asm: improve argument to obj.Prog assignment on PPC64

These can be simplified with the knowledge of how arguments are
assigned to obj.Prog objects on PPC64. If the argument is not
a register type, the Reg argument (a2 in optab) of obj.Prog is
not used, and those arguments are placed into RestArgs (a3, a4, a5
in optab).

This relaxes the special case handling enforced by IsPPC64RLD and
IsPPC64ISEL. Instead, arguments are assigned as noted above, and
incorrect usage of such opcodes is checked by optab rules, not by
the assembler front-end.

Likewise, add support for handling 6 argument opcodes, these do
not exist today, but will be added with ISA 3.1 (Power10).

Finally, to maintain backwards compatibility, some 4-arg opcodes
whose middle arguments are a register and immediate, could swap
these arguments and generate identical machine code. This likely
wasn't intended, but is possible. These are explicitly fixed up
in the backend, and the asm tests are extended to check these.

Change-Id: I5f8190212427dfe8e6f062185bfefb5fa4fd0e75
Reviewed-on: https://go-review.googlesource.com/c/go/+/427516
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
src/cmd/asm/internal/arch/ppc64.go
src/cmd/asm/internal/asm/asm.go
src/cmd/asm/internal/asm/testdata/ppc64.s
src/cmd/internal/obj/ppc64/obj9.go