]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: generate subfic on ppc64
authorPaul E. Murphy <murp@ibm.com>
Thu, 20 Aug 2020 20:06:23 +0000 (15:06 -0500)
committerLynn Boger <laboger@linux.vnet.ibm.com>
Thu, 27 Aug 2020 20:10:15 +0000 (20:10 +0000)
commit7615b20d06500fe5c95c061f6ff32e0c97639a60
tree6c9b3f6f529db38b69d45dc915a5e32fd0e478cf
parent2013f70256e55f5f6f826757333aae42b4667561
cmd/compile: generate subfic on ppc64

This merges an lis + subf into subfic, and for 32b constants
lwa + subf into oris + ori + subf.

The carry bit is no longer used in code generation, therefore
I think we can clobber it as needed.  Note, lowered borrow/carry
arithmetic is self-contained and thus is not affected.

A few extra rules are added to ensure early transformations to
SUBFCconst don't trip up earlier rules, fold constant operations,
or otherwise simplify lowering.  Likewise, tests are added to
ensure all rules are hit.  Generic constant folding catches
trivial cases, however some lowering rules insert arithmetic
which can introduce new opportunities (e.g BitLen or Slicemask).

I couldn't find a specific benchmark to demonstrate noteworthy
improvements, but this is generating subfic in many of the default
bent test binaries, so we are at least saving a little code space.

Change-Id: Iad7c6e5767eaa9dc24dc1c989bd1c8cfe1982012
Reviewed-on: https://go-review.googlesource.com/c/go/+/249461
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Carlos Eduardo Seo <cseo@linux.vnet.ibm.com>
src/cmd/compile/internal/ppc64/ssa.go
src/cmd/compile/internal/ssa/gen/PPC64.rules
src/cmd/compile/internal/ssa/gen/PPC64Ops.go
src/cmd/compile/internal/ssa/opGen.go
src/cmd/compile/internal/ssa/rewritePPC64.go
test/codegen/arithmetic.go
test/codegen/mathbits.go
test/codegen/slices.go