mirror of
https://github.com/golang/go
synced 2024-11-24 20:40:23 -07:00
33448d963c
On arm64, CMP $foo, R is encoded as from=$foo, reg=R, not as from=$foo,
to=R. The progtable entry for ACMP incorrectly described the latter
form. Because of this, the registerizer was not accounting the registers
used in CMP instructions and was incorrectly re-assigning those registers.
This was an old problem, but it only became apparent after b115c35
(cmd/internal/gc: move cgen, regalloc, et al to portable code). Previous
to this commit, the compiler used a slightly larger register set for the
temps than it used for register variables. Since it had plenty registers
dedicated to temps, the registers used in CMP instruction never clashed
with registers assigned to register variables.
Fixes #10253
Change-Id: Iedf4bd882bd59440dff310ac0f81e0f53d80d7ed
Reviewed-on: https://go-review.googlesource.com/8387
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
27 lines
418 B
Go
27 lines
418 B
Go
// run
|
|
|
|
// Copyright 2015 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.
|
|
|
|
// issue 10253: cmd/7g: bad codegen, probably regopt related
|
|
|
|
package main
|
|
|
|
func main() {
|
|
if !eq() {
|
|
panic("wrong value")
|
|
}
|
|
}
|
|
|
|
var text = "abc"
|
|
var s = &str{text}
|
|
|
|
func eq() bool {
|
|
return text[0] == s.text[0]
|
|
}
|
|
|
|
type str struct {
|
|
text string
|
|
}
|