diff options
author | Cherry Zhang <cherryyz@google.com> | 2016-08-30 09:12:22 -0400 |
---|---|---|
committer | Cherry Zhang <cherryyz@google.com> | 2016-09-12 19:26:31 +0000 |
commit | 8ff4260777aabe4ec7a92cba8c7dcce24f7fbf2b (patch) | |
tree | 1c0b876cebdde10084006921e6ae222f1245a76b /test/intrinsic_atomic.go | |
parent | cfea26026bc49be1710ed742465514e84bd31ab5 (diff) | |
download | go-8ff4260777aabe4ec7a92cba8c7dcce24f7fbf2b.tar.gz go-8ff4260777aabe4ec7a92cba8c7dcce24f7fbf2b.zip |
cmd/compile: intrinsify Ctz, Bswap on ARM
Atomic ops on ARM are implemented with kernel calls, so they are
not intrinsified.
Change-Id: I0e7cc2e5526ae1a3d24b4b89be1bd13db071f8ef
Reviewed-on: https://go-review.googlesource.com/28977
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Diffstat (limited to 'test/intrinsic_atomic.go')
-rw-r--r-- | test/intrinsic_atomic.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/intrinsic_atomic.go b/test/intrinsic_atomic.go new file mode 100644 index 0000000000..dd765a0ff9 --- /dev/null +++ b/test/intrinsic_atomic.go @@ -0,0 +1,20 @@ +// errorcheck -0 -d=ssa/intrinsics/debug +// +build amd64 arm64 + +// Copyright 2016 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 main + +import "sync/atomic" + +var x uint32 + +func atomics() { + _ = atomic.LoadUint32(&x) // ERROR "intrinsic substitution for LoadUint32" + atomic.StoreUint32(&x, 1) // ERROR "intrinsic substitution for StoreUint32" + atomic.AddUint32(&x, 1) // ERROR "intrinsic substitution for AddUint32" + atomic.SwapUint32(&x, 1) // ERROR "intrinsic substitution for SwapUint32" + atomic.CompareAndSwapUint32(&x, 1, 2) // ERROR "intrinsic substitution for CompareAndSwapUint32" +} |