]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: fix If lowering on ARM64
authorCherry Mui <cherryyz@google.com>
Mon, 9 May 2022 15:29:36 +0000 (11:29 -0400)
committerCherry Mui <cherryyz@google.com>
Mon, 9 May 2022 16:02:28 +0000 (16:02 +0000)
commit9ae7dc304082cc36d0d587c5edcc899497f2d06f
tree8cb40455be682ceeb5cd8b79f704caa7d74dd5a4
parent53f13128a7a4c7d16af5ea9ca5f25b56ff9881fe
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.

Fixes #52788.

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>
src/cmd/compile/internal/ssa/gen/ARM64.rules
src/cmd/compile/internal/ssa/rewriteARM64.go
test/fixedbugs/issue52788.go [new file with mode: 0644]