]> Cypherpunks repositories - gostls13.git/commit
6c, 6g, 6l: add MOVQL to make truncation explicit
authorRuss Cox <rsc@golang.org>
Tue, 10 Apr 2012 16:51:59 +0000 (12:51 -0400)
committerRuss Cox <rsc@golang.org>
Tue, 10 Apr 2012 16:51:59 +0000 (12:51 -0400)
commite530d6a1e00fbc0149b71bca9f940058838c1c44
treea49c2b7abd1f1ae0e0c1ec121ac863e708b6fa10
parentb72c7e943cfbb7296bb182717642072c0e8efd5c
6c, 6g, 6l: add MOVQL to make truncation explicit

Without an explicit signal for a truncation, copy propagation
will sometimes propagate a 32-bit truncation and end up
overwriting uses of the original 64-bit value.

The case that arose in practice is in C but I believe
that the same could plausibly happen in Go.
The main reason we didn't run into the same in Go
is that I (perhaps incorrectly?) drop MOVL AX, AX
during gins, so the truncation was never generated, so
it didn't confuse the optimizer.

Fixes #1315.
Fixes #3488.

R=ken2
CC=golang-dev
https://golang.org/cl/6002043
src/cmd/6c/peep.c
src/cmd/6c/reg.c
src/cmd/6c/txt.c
src/cmd/6g/gsubr.c
src/cmd/6g/peep.c
src/cmd/6g/reg.c
src/cmd/6l/6.out.h
src/cmd/6l/optab.c