0
1
mirror of https://github.com/golang/go synced 2024-12-11 15:21:00 +00:00
go/test/codegen/unsafe.go
Keith Randall f0b0109242 cmd/compile: pull multiple adds out of an unsafe.Pointer<->uintptr conversion
This came up in some swissmap code.

Change-Id: I3c6705a5cafec8cb4953dfa9535cf0b45255cc83
Reviewed-on: https://go-review.googlesource.com/c/go/+/629516
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: David Chase <drchase@google.com>
2024-11-21 22:57:04 +00:00

17 lines
396 B
Go

// asmcheck
// Copyright 2024 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
import "unsafe"
func f(p unsafe.Pointer, x, y uintptr) int64 {
p = unsafe.Pointer(uintptr(p) + x + y)
// amd64:`MOVQ\s\(.*\)\(.*\*1\), `
// arm64:`MOVD\s\(R[0-9]+\)\(R[0-9]+\), `
return *(*int64)(p)
}