From c1806906d89ecc65136be4bbdfb9020c797be46c Mon Sep 17 00:00:00 2001 From: Alberto Donizetti Date: Fri, 2 Mar 2018 15:16:27 +0100 Subject: test: port bits.Len intrinsics tests to the new codegen harness This change move bits.Len* intrinsification tests to the new codegen test harness, removing them from the old ssa_test file. Five different test functions (one for each bit.Len function tested) was used, to avoid possible unwanted interactions between multiple calls inside one function. Change-Id: Iffd5be55b58e88597fa30a562a28dacb01236d8b Reviewed-on: https://go-review.googlesource.com/98156 Run-TryBot: Alberto Donizetti TryBot-Result: Gobot Gobot Reviewed-by: Giovanni Bajo --- test/codegen/mathbits.go | 53 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 test/codegen/mathbits.go (limited to 'test/codegen/mathbits.go') diff --git a/test/codegen/mathbits.go b/test/codegen/mathbits.go new file mode 100644 index 0000000000..02552e1fdb --- /dev/null +++ b/test/codegen/mathbits.go @@ -0,0 +1,53 @@ +// asmcheck + +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package codegen + +import "math/bits" + +// --------------- // +// bits.Len* // +// --------------- // + +func Len(n uint) int { + //amd64:"BSRQ" + //s390x:"FLOGR" + //arm:"CLZ" arm64:"CLZ" + //mips:"CLZ" + return bits.Len(n) +} + +func Len64(n uint64) int { + //amd64:"BSRQ" + //s390x:"FLOGR" + //arm:"CLZ" arm64:"CLZ" + //mips:"CLZ" + return bits.Len64(n) +} + +func Len32(n uint32) int { + //amd64:"BSRQ" + //s390x:"FLOGR" + //arm:"CLZ" arm64:"CLZ" + //mips:"CLZ" + return bits.Len32(n) +} + +func Len16(n uint16) int { + //amd64:"BSRQ" + //s390x:"FLOGR" + //arm:"CLZ" arm64:"CLZ" + //mips:"CLZ" + return bits.Len16(n) +} + +func Len8(n uint8) int { + //amd64 Len8 not intrisified + //s390x:"FLOGR" + //arm:"CLZ" arm64:"CLZ" + //mips:"CLZ" + return bits.Len8(n) +} -- cgit v1.3