]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/compile/internal/ssa: correct sign extension for consts on riscv64
authorJoel Sing <joel@sing.id.au>
Sat, 20 Mar 2021 13:58:18 +0000 (00:58 +1100)
committerJoel Sing <joel@sing.id.au>
Mon, 22 Mar 2021 16:13:55 +0000 (16:13 +0000)
commit8fd0f83552d3ef9ca38c031bec93a36b189e3e11
treef40b109d5135c9a47693093bb9efa7e6f0e3fd3b
parent5437b5a24ba52c06d7ff627f01ed1876558959d2
cmd/compile/internal/ssa: correct sign extension for consts on riscv64

Correct sign extension handling for consts on riscv64. This fixes a bug
in part exposed by CL 302609 - previously 64 bit consts were rewritten into
multiple 32 bit consts and the expansion would result in sign/zero extension
not being eliminated. With this change a MOVDconst with a 64 bit value can be
followed by a MOV{B,H,W}reg, which will be eliminated without actually
truncating to a smaller value.

Change-Id: I8d9cd380217466997b341e008a1f139bc11a0d51
Reviewed-on: https://go-review.googlesource.com/c/go/+/303350
Trust: Joel Sing <joel@sing.id.au>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
src/cmd/compile/internal/ssa/gen/RISCV64.rules
src/cmd/compile/internal/ssa/rewriteRISCV64.go