From: Alberto Donizetti Date: Fri, 23 Mar 2018 17:50:39 +0000 (+0100) Subject: test/codegen: port tbz/tbnz arm64 tests X-Git-Tag: go1.11beta1~1122 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=a27cd4fd317b57aadd63ff448e1b60636d4da38a;p=gostls13.git 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 TryBot-Result: Gobot Gobot Reviewed-by: Giovanni Bajo --- diff --git a/src/cmd/compile/internal/gc/asm_test.go b/src/cmd/compile/internal/gc/asm_test.go index 852f8e3a17..0fe3d31734 100644 --- a/src/cmd/compile/internal/gc/asm_test.go +++ b/src/cmd/compile/internal/gc/asm_test.go @@ -481,46 +481,6 @@ var linuxARM64Tests = []*asmTest{ pos: []string{"LSL\t\\$17"}, neg: []string{"CMP"}, }, - { - fn: ` - func $(a int32, ptr *int) { - if a >= 0 { - *ptr = 0 - } - } - `, - pos: []string{"TBNZ"}, - }, - { - fn: ` - func $(a int64, ptr *int) { - if a >= 0 { - *ptr = 0 - } - } - `, - pos: []string{"TBNZ"}, - }, - { - fn: ` - func $(a int32, ptr *int) { - if a < 0 { - *ptr = 0 - } - } - `, - pos: []string{"TBZ"}, - }, - { - fn: ` - func $(a int64, ptr *int) { - if a < 0 { - *ptr = 0 - } - } - `, - pos: []string{"TBZ"}, - }, // Load-combining tests. { fn: ` 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 + } +}