test/codegen/shortcircuit.go
raw| 1 | // asmcheck |
| 2 | |
| 3 | // Copyright 2020 The Go Authors. All rights reserved. |
| 4 | // Use of this source code is governed by a BSD-style |
| 5 | // license that can be found in the LICENSE file. |
| 6 | |
| 7 | package codegen |
| 8 | |
| 9 | func efaceExtract(e interface{}) int { |
| 10 | // This should be compiled with only |
| 11 | // a single conditional jump. |
| 12 | // amd64:-"JMP" |
| 13 | if x, ok := e.(int); ok { |
| 14 | return x |
| 15 | } |
| 16 | return 0 |
| 17 | } |