]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: add math/bits.Mul64 intrinsic on s390x
authorRuixin Bao <ruixin.bao@ibm.com>
Sun, 8 Sep 2019 22:50:24 +0000 (18:50 -0400)
committerMichael Munday <mike.munday@ibm.com>
Fri, 13 Sep 2019 09:04:48 +0000 (09:04 +0000)
commit98aa97806b94495847f7f7151d4453f5830f0d38
treec4fb2f685551832809142a50278fe31272de270f
parent03f63654c4ce5885bf804fe242a4e15b70edc2c4
cmd/compile: add math/bits.Mul64 intrinsic on s390x

This change adds an intrinsic for Mul64 on s390x. To achieve that,
a new assembly instruction, MLGR, is introduced in s390x/asmz.go. This assembly
instruction directly uses an existing instruction on Z and supports multiplication
of two 64 bit unsigned integer and stores the result in two separate registers.

In this case, we require the multiplcand to be stored in register R3 and
the output result (the high and low 64 bit of the product) to be stored in
R2 and R3 respectively.

A test case is also added.

Benchmark:
name      old time/op  new time/op  delta
Mul-18    11.1ns ± 0%   1.4ns ± 0%  -87.39%  (p=0.002 n=8+10)
Mul32-18  2.07ns ± 0%  2.07ns ± 0%     ~     (all equal)
Mul64-18  11.1ns ± 1%   1.4ns ± 0%  -87.42%  (p=0.000 n=10+10)

Change-Id: Ieca6ad1f61fff9a48a31d50bbd3f3c6d9e6675c1
Reviewed-on: https://go-review.googlesource.com/c/go/+/194572
Reviewed-by: Michael Munday <mike.munday@ibm.com>
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/cmd/asm/internal/asm/testdata/s390x.s
src/cmd/compile/internal/gc/ssa.go
src/cmd/compile/internal/s390x/ssa.go
src/cmd/compile/internal/ssa/gen/S390X.rules
src/cmd/compile/internal/ssa/gen/S390XOps.go
src/cmd/compile/internal/ssa/opGen.go
src/cmd/compile/internal/ssa/rewriteS390X.go
src/cmd/internal/obj/s390x/a.out.go
src/cmd/internal/obj/s390x/anames.go
src/cmd/internal/obj/s390x/asmz.go
test/codegen/mathbits.go