aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorCuong Manh Le <cuong.manhle.vn@gmail.com>2020-10-24 10:40:09 +0700
committerCuong Manh Le <cuong.manhle.vn@gmail.com>2020-10-27 03:11:45 +0000
commita19cf510af8182751fefc16ce962f91fe17c1e1b (patch)
tree20e7b93b381a5ce33e088748be8a90fd04e06462 /test
parentfb7134e4e3a45fee4ab662ef0d467ef864c23e2e (diff)
downloadgo-a19cf510af8182751fefc16ce962f91fe17c1e1b.tar.gz
go-a19cf510af8182751fefc16ce962f91fe17c1e1b.zip
cmd/compile: defer lowering OANDNOT until SSA
Currently, "x &^ y" gets rewriten into "x & ^y" during walk. It adds unnecessary complexity to other parts, which must aware about this. Instead, we can just implement "&^" in the conversion to SSA, so "&^" can be handled like other binary operators. However, this CL does not pass toolstash-check. It seems that implements "&^" in the conversion to SSA causes registers allocation change. With the parent: obj: 00212 (.../src/runtime/complex.go:47) MOVQ X0, AX obj: 00213 (.../src/runtime/complex.go:47) BTRQ $63, AX obj: 00214 (.../src/runtime/complex.go:47) MOVQ "".n(SP), CX obj: 00215 (.../src/runtime/complex.go:47) MOVQ $-9223372036854775808, DX obj: 00216 (.../src/runtime/complex.go:47) ANDQ DX, CX obj: 00217 (.../src/runtime/complex.go:47) ORQ AX, CX With this CL: obj: 00212 (.../src/runtime/complex.go:47) MOVQ X0, AX obj: 00213 (.../src/runtime/complex.go:47) BTRQ $63, AX obj: 00214 (.../src/runtime/complex.go:47) MOVQ $-9223372036854775808, CX obj: 00215 (.../src/runtime/complex.go:47) MOVQ "".n(SP), DX obj: 00216 (.../src/runtime/complex.go:47) ANDQ CX, DX obj: 00217 (.../src/runtime/complex.go:47) ORQ AX, DX Change-Id: I80acf8496a91be4804fb7ef3df04c19baae2754c Reviewed-on: https://go-review.googlesource.com/c/go/+/264660 Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com> Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'test')
-rw-r--r--test/bounds.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/bounds.go b/test/bounds.go
index 4a9c3b2d39..aa1d51b6f9 100644
--- a/test/bounds.go
+++ b/test/bounds.go
@@ -209,6 +209,11 @@ func main() {
use(a1k[i&^0])
use(a1k[i&^-2]) // ERROR "index bounds check elided"
use(a1k[i&^1])
+ use(a1k[i8&^0])
+ use(a1k[i8&^-128]) // ERROR "index bounds check elided"
+ use(a1k[ui8&^1]) // ERROR "index bounds check elided"
+ use(a1k[ui16&^0xf000])
+ use(a1k[ui16&^0xff00]) // ERROR "index bounds check elided"
// Right shift cuts the effective number of bits in the index,
// but only for unsigned (signed stays negative).