]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: fix constant folding of right shifts
authorKeith Randall <khr@google.com>
Tue, 13 Feb 2018 20:33:55 +0000 (12:33 -0800)
committerKeith Randall <khr@golang.org>
Wed, 14 Feb 2018 00:03:36 +0000 (00:03 +0000)
commit755b36aa532f6b23081bf5eaf83449c1a6dd8114
tree149151d71f957eab398356d0ee16b3eb15aac425
parent8de2f604c0b225aa41cb1b4e2ab97e3512a51445
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>
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]