mirror of
https://github.com/golang/go
synced 2024-11-27 02:11:17 -07:00
5a4e09837c
And delete them from asm_test. Change-Id: I3cf0934706a640136cb0f646509174f8c1bf3363 Reviewed-on: https://go-review.googlesource.com/101395 Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Giovanni Bajo <rasky@develer.com>
39 lines
769 B
Go
39 lines
769 B
Go
// asmcheck
|
|
|
|
// Copyright 2018 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 codegen
|
|
|
|
// This file contains code generation tests related to the handling of
|
|
// map types.
|
|
|
|
// ------------------- //
|
|
// Access Const //
|
|
// ------------------- //
|
|
|
|
// Direct use of constants in fast map access calls (Issue #19015).
|
|
|
|
func AccessInt1(m map[int]int) int {
|
|
// amd64:"MOVQ\t[$]5"
|
|
return m[5]
|
|
}
|
|
|
|
func AccessInt2(m map[int]int) bool {
|
|
// amd64:"MOVQ\t[$]5"
|
|
_, ok := m[5]
|
|
return ok
|
|
}
|
|
|
|
func AccessString1(m map[string]int) int {
|
|
// amd64:`.*"abc"`
|
|
return m["abc"]
|
|
}
|
|
|
|
func AccessString2(m map[string]int) bool {
|
|
// amd64:`.*"abc"`
|
|
_, ok := m["abc"]
|
|
return ok
|
|
}
|