]> Cypherpunks repositories - gostls13.git/commit
cmd/asm, cmd/internal/obj/ppc64: avoid unnecessary load zeros
authorLynn Boger <laboger@linux.vnet.ibm.com>
Mon, 19 Feb 2018 16:10:31 +0000 (11:10 -0500)
committerLynn Boger <laboger@linux.vnet.ibm.com>
Thu, 8 Mar 2018 14:17:34 +0000 (14:17 +0000)
commit5b14c7b324dc645dd7c90b22ddd86affac0637c2
treec66617c712efaa1539d12ed1af79a7d89c558694
parent0add9a4dcfb4cbc0d99cd168752bd1bd641ce8e2
cmd/asm, cmd/internal/obj/ppc64: avoid unnecessary load zeros

When instructions add, and, or, xor, and movd have
constant operands in some cases more instructions are
generated than necessary by the assembler.

This adds more opcode/operand combinations to the optab
and improves the code generation for the cases where the
size and sign of the constant allows the use of 1
instructions instead of 2.

Example of previous code:
oris r3, r0, 0
ori  r3, r3, 65533

now:
ori r3, r0, 65533

This does not significantly reduce the overall binary size
because the improvement depends on the constant value.
Some procedures show a 1-2% reduction in size. This improvement
could also be significant in cases where the extra instructions
occur in a critical loop.

Testcase ppc64enc.s was added to cmd/asm/internal/asm/testdata
with the variations affected by this change.

Updates #23845

Change-Id: I7fdf2320c95815d99f2755ba77d0c6921cd7fad7
Reviewed-on: https://go-review.googlesource.com/95135
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
src/cmd/asm/internal/asm/endtoend_test.go
src/cmd/asm/internal/asm/testdata/ppc64enc.s [new file with mode: 0644]
src/cmd/internal/obj/ppc64/asm9.go