From f94de9c9fbed2a8d52a84b565c54da6efb015c4d Mon Sep 17 00:00:00 2001 From: Michael Munday Date: Mon, 3 Sep 2018 10:47:58 -0400 Subject: cmd/compile: make math/bits.RotateLeft{32,64} intrinsics on s390x Extends CL 132435 to s390x. s390x has 32- and 64-bit variable rotate left instructions. Change-Id: Ic4f1ebb0e0543207ed2fc8c119e0163b428138a5 Reviewed-on: https://go-review.googlesource.com/133035 Run-TryBot: Michael Munday TryBot-Result: Gobot Gobot Reviewed-by: Cherry Zhang --- test/codegen/mathbits.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'test') diff --git a/test/codegen/mathbits.go b/test/codegen/mathbits.go index ad2c5abb02..b8844c518f 100644 --- a/test/codegen/mathbits.go +++ b/test/codegen/mathbits.go @@ -171,6 +171,7 @@ func RotateLeft64(n uint64) uint64 { // amd64:"ROLQ" // arm64:"ROR" // ppc64:"ROTL" + // s390x:"RLLG" return bits.RotateLeft64(n, 37) } @@ -178,6 +179,7 @@ func RotateLeft32(n uint32) uint32 { // amd64:"ROLL" 386:"ROLL" // arm64:"RORW" // ppc64:"ROTLW" + // s390x:"RLL" return bits.RotateLeft32(n, 9) } @@ -191,6 +193,27 @@ func RotateLeft8(n uint8) uint8 { return bits.RotateLeft8(n, 5) } +func RotateLeftVariable(n uint, m int) uint { + // amd64:"ROLQ" + // ppc64:"ROTL" + // s390x:"RLLG" + return bits.RotateLeft(n, m) +} + +func RotateLeftVariable64(n uint64, m int) uint64 { + // amd64:"ROLQ" + // ppc64:"ROTL" + // s390x:"RLLG" + return bits.RotateLeft64(n, m) +} + +func RotateLeftVariable32(n uint32, m int) uint32 { + // amd64:"ROLL" + // ppc64:"ROTLW" + // s390x:"RLL" + return bits.RotateLeft32(n, m) +} + // ------------------------ // // bits.TrailingZeros // // ------------------------ // -- cgit v1.3