From: Keith Randall Date: Fri, 20 Nov 2020 22:02:37 +0000 (-0800) Subject: [release-branch.go1.14] cmd/compile: sign extend constant folding properly X-Git-Tag: go1.14.13~1 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=679482fc602445b9b2d37739e7b048e2d4913646;p=gostls13.git [release-branch.go1.14] cmd/compile: sign extend constant folding properly MOVLconst must have a properly sign-extended auxint constant. The bit operations in these rules don't enforce that invariant. Fixes #42755 Change-Id: I729afcad18752d9b7739e49709020e3be7b3653e Reviewed-on: https://go-review.googlesource.com/c/go/+/272030 Trust: Keith Randall Run-TryBot: Keith Randall TryBot-Result: Go Bot Reviewed-by: David Chase --- diff --git a/src/cmd/compile/internal/ssa/gen/AMD64.rules b/src/cmd/compile/internal/ssa/gen/AMD64.rules index 2d662d5ae6..f819aefcfd 100644 --- a/src/cmd/compile/internal/ssa/gen/AMD64.rules +++ b/src/cmd/compile/internal/ssa/gen/AMD64.rules @@ -1465,11 +1465,11 @@ (NOTQ (MOVQconst [c])) -> (MOVQconst [^c]) (NOTL (MOVLconst [c])) -> (MOVLconst [^c]) (BTSQconst [c] (MOVQconst [d])) -> (MOVQconst [d|(1< (MOVLconst [d|(1< (MOVLconst [int64(int32(d|(1< (MOVQconst [d&^(1< (MOVLconst [d&^(1< (MOVLconst [int64(int32(d&^(1< (MOVQconst [d^(1< (MOVLconst [d^(1< (MOVLconst [int64(int32(d^(1<