]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.9] 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, 29 Mar 2018 06:03:59 +0000 (06:03 +0000)
commitce68047f96c8a35d2c3598a41efbc749964e6b1c
tree5855f84562d1724d08db8bcf32068bd93d9e2ac9
parent6732fcc06df713fc737cee5c5860bad87599bc6d
[release-branch.go1.9] 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>
Reviewed-on: https://go-review.googlesource.com/102775
Run-TryBot: Andrew Bonventre <andybons@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]