]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.10] cmd/compile: fix constant folding of right shifts
authorKeith Randall <khr@google.com>
Tue, 13 Feb 2018 20:33:55 +0000 (12:33 -0800)
committerAndrew Bonventre <andybons@golang.org>
Thu, 15 Feb 2018 03:01:30 +0000 (03:01 +0000)
commit419e6f0835b8ae24b66304b6a2e56458e14b15db
tree192b0e536aeec1fe83c50026ebc2055ab5933ce9
parent4c4ce3dc79fcf535045e69068b15142d8b7259cd
[release-branch.go1.10] cmd/compile: fix constant folding of right shifts

The sub-word shifts need to sign-extend before shifting, to avoid
bringing in data from higher in the argument.

Fixes #23812

Change-Id: I0a95a0b49c48f3b40b85765bb4a9bb492be0cd73
Reviewed-on: https://go-review.googlesource.com/93716
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
(cherry picked from commit 755b36aa532f6b23081bf5eaf83449c1a6dd8114)
Reviewed-on: https://go-review.googlesource.com/94215
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/cmd/compile/internal/ssa/gen/AMD64.rules
src/cmd/compile/internal/ssa/gen/AMD64Ops.go
src/cmd/compile/internal/ssa/rewriteAMD64.go
test/fixedbugs/issue23812.go [new file with mode: 0644]