aboutsummaryrefslogtreecommitdiff
path: root/test/codegen/bits.go
diff options
context:
space:
mode:
authorAlberto Donizetti <alb.donizetti@gmail.com>2018-04-10 11:20:20 +0200
committerAlberto Donizetti <alb.donizetti@gmail.com>2018-04-10 10:57:50 +0000
commit188e2bf89712fcb97bd5329f167fedc6dd90316b (patch)
tree0ede1d832e9ad8a5957581c0867429d244ba4b36 /test/codegen/bits.go
parentd5ff631e6b86787857913049fc5312969211a1c7 (diff)
downloadgo-188e2bf89712fcb97bd5329f167fedc6dd90316b.tar.xz
test/codegen: port arm64 BIC/EON/ORN and masking tests
And delete them from asm_test. Change-Id: I24f421b87e8cb4770c887a6dfd58eacd0088947d Reviewed-on: https://go-review.googlesource.com/106056 Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'test/codegen/bits.go')
-rw-r--r--test/codegen/bits.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/codegen/bits.go b/test/codegen/bits.go
index 53f03094d7..9de2201cb1 100644
--- a/test/codegen/bits.go
+++ b/test/codegen/bits.go
@@ -261,3 +261,32 @@ func bitcompl32(a, b uint32) (n uint32) {
return n
}
+
+// Check AND masking on arm64 (Issue #19857)
+
+func and_mask_1(a uint64) uint64 {
+ // arm64:`AND\t`
+ return a & ((1 << 63) - 1)
+}
+
+func and_mask_2(a uint64) uint64 {
+ // arm64:`AND\t`
+ return a & (1 << 63)
+}
+
+// Check generation of arm64 BIC/EON/ORN instructions
+
+func op_bic(x, y uint32) uint32 {
+ // arm64:`BIC\t`,-`AND`
+ return x &^ y
+}
+
+func op_eon(x, y uint32) uint32 {
+ // arm64:`EON\t`,-`XOR`
+ return x ^ ^y
+}
+
+func op_orn(x, y uint32) uint32 {
+ // arm64:`ORN\t`,-`ORR`
+ return x | ^y
+}