]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.18] cmd/compile: fix If lowering on ARM64
authorCherry Mui <cherryyz@google.com>
Mon, 9 May 2022 15:29:36 +0000 (11:29 -0400)
committerThan McIntosh <thanm@google.com>
Mon, 8 Aug 2022 16:24:27 +0000 (16:24 +0000)
commite05bd7572247b680c3382c9f9c4e6e06179d5354
tree80b48d26e34bdafe08dbc5ad7640cc246218cfe9
parentfcdd099a967e7f661eb2ddf28fdb06f46c188194
[release-branch.go1.18] cmd/compile: fix If lowering on ARM64

On ARM64, an If block is lowered to (NZ cond yes no). This is
incorrect because cond is a boolean value and therefore only the
last byte is meaningful (same as AMD64, see ARM64Ops.go). But here
we are comparing a full register width with 0. Correct it by
comparing only the last bit.

For #52788.
Fixes #53397.

Change-Id: I2cacf9f3d2f45e149c361a290f511b2d4ed845c4
Reviewed-on: https://go-review.googlesource.com/c/go/+/405114
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/421457
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
src/cmd/compile/internal/ssa/gen/ARM64.rules
src/cmd/compile/internal/ssa/rewriteARM64.go
test/fixedbugs/issue52788.go [new file with mode: 0644]