aboutsummaryrefslogtreecommitdiff
path: root/test/codegen/comparisons.go
diff options
context:
space:
mode:
authorAlberto Donizetti <alb.donizetti@gmail.com>2018-03-23 18:50:39 +0100
committerAlberto Donizetti <alb.donizetti@gmail.com>2018-03-24 09:35:53 +0000
commita27cd4fd317b57aadd63ff448e1b60636d4da38a (patch)
tree3ea09b664d7c4467e7db80d40f34839193958489 /test/codegen/comparisons.go
parent786899a72afe02836c003c1414ca279090e7d637 (diff)
downloadgo-a27cd4fd317b57aadd63ff448e1b60636d4da38a.tar.xz
test/codegen: port tbz/tbnz arm64 tests
And delete them from asm_test. Change-Id: I34fcf85ae8ce09cd146fe4ce6a0ae7616bd97e2d Reviewed-on: https://go-review.googlesource.com/102296 Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Giovanni Bajo <rasky@develer.com>
Diffstat (limited to 'test/codegen/comparisons.go')
-rw-r--r--test/codegen/comparisons.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/codegen/comparisons.go b/test/codegen/comparisons.go
index c0824e6ed1..15a659a4e6 100644
--- a/test/codegen/comparisons.go
+++ b/test/codegen/comparisons.go
@@ -106,3 +106,29 @@ func CmpMem5(p **int) {
// amd64:`CMPL\truntime.writeBarrier\(SB\), [$]0`
*p = nil
}
+
+// Check tbz/tbnz are generated when comparing against zero on arm64
+
+func CmpZero1(a int32, ptr *int) {
+ if a < 0 { // arm64:"TBZ"
+ *ptr = 0
+ }
+}
+
+func CmpZero2(a int64, ptr *int) {
+ if a < 0 { // arm64:"TBZ"
+ *ptr = 0
+ }
+}
+
+func CmpZero3(a int32, ptr *int) {
+ if a >= 0 { // arm64:"TBNZ"
+ *ptr = 0
+ }
+}
+
+func CmpZero4(a int64, ptr *int) {
+ if a >= 0 { // arm64:"TBNZ"
+ *ptr = 0
+ }
+}