From 8516ecd05f856f895dceeb7c150c98d706a0b326 Mon Sep 17 00:00:00 2001 From: Alberto Donizetti Date: Tue, 6 Mar 2018 20:10:35 +0100 Subject: test/codegen: port math/bits.ReverseBytes tests to codegen And remove them from ssa_test. Change-Id: If767af662801219774d1bdb787c77edfa6067770 Reviewed-on: https://go-review.googlesource.com/98976 Run-TryBot: Alberto Donizetti TryBot-Result: Gobot Gobot Reviewed-by: Giovanni Bajo --- test/codegen/mathbits.go | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'test/codegen') diff --git a/test/codegen/mathbits.go b/test/codegen/mathbits.go index a95c13caa9..2185b535b9 100644 --- a/test/codegen/mathbits.go +++ b/test/codegen/mathbits.go @@ -124,6 +124,36 @@ func OnesCount16(n uint16) int { return bits.OnesCount16(n) } +// ----------------------- // +// bits.ReverseBytes // +// ----------------------- // + +func ReverseBytes(n uint) uint { + //amd64:"BSWAPQ" + //s390x:"MOVDBR" + //arm64:"REV" + return bits.ReverseBytes(n) +} + +func ReverseBytes64(n uint64) uint64 { + //amd64:"BSWAPQ" + //s390x:"MOVDBR" + //arm64:"REV" + return bits.ReverseBytes64(n) +} + +func ReverseBytes32(n uint32) uint32 { + //amd64:"BSWAPL" + //s390x:"MOVWBR" + //arm64:"REVW" + return bits.ReverseBytes32(n) +} + +func ReverseBytes16(n uint16) uint16 { + //amd64:"ROLW" + return bits.ReverseBytes16(n) +} + // ------------------------ // // bits.TrailingZeros // // ------------------------ // -- cgit v1.3-5-g9baa