From 5a4e09837ca9bcd7ff4b3a772984cb5bbfb6ff3b Mon Sep 17 00:00:00 2001 From: Alberto Donizetti Date: Mon, 19 Mar 2018 12:50:58 +0100 Subject: test/codegen: port maps test to codegen And delete them from asm_test. Change-Id: I3cf0934706a640136cb0f646509174f8c1bf3363 Reviewed-on: https://go-review.googlesource.com/101395 Run-TryBot: Alberto Donizetti TryBot-Result: Gobot Gobot Reviewed-by: Giovanni Bajo --- test/codegen/maps.go | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 test/codegen/maps.go (limited to 'test/codegen/maps.go') diff --git a/test/codegen/maps.go b/test/codegen/maps.go new file mode 100644 index 0000000000..57e219ca06 --- /dev/null +++ b/test/codegen/maps.go @@ -0,0 +1,38 @@ +// 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 +} -- cgit v1.3