1
0
mirror of https://github.com/golang/go synced 2024-11-20 03:14:43 -07:00
go/test/codegen/rotate.go
Giovanni Bajo 89ae7045f3 test: convert all math-related tests from asm_test
Change-Id: If542f0b5c5754e6eb2f9b302fe5a148ba9a57338
Reviewed-on: https://go-review.googlesource.com/98443
Run-TryBot: Giovanni Bajo <rasky@develer.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2018-03-04 16:52:33 +00:00

24 lines
582 B
Go

// 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
func rot32(x uint32) uint32 {
var a uint32
a += x<<7 | x>>25 // amd64:"ROLL.*[$]7" arm:"MOVW.*@>25"
a += x<<8 + x>>24 // amd64:`ROLL.*\$8` arm:"MOVW.*@>24"
a += x<<9 ^ x>>23 // amd64:"ROLL.*\\$9" arm:"MOVW.*@>23"
return a
}
func rot64(x uint64) uint64 {
var a uint64
a += x<<7 | x>>57 // amd64:"ROL"
a += x<<8 + x>>56 // amd64:"ROL"
a += x<<9 ^ x>>55 // amd64:"ROL"
return a
}