]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: base PPC64 trunc rules on final type, not op type
authorIan Lance Taylor <iant@golang.org>
Sat, 26 Jan 2019 19:55:00 +0000 (11:55 -0800)
committerIan Lance Taylor <iant@golang.org>
Sun, 27 Jan 2019 01:43:05 +0000 (01:43 +0000)
commitd585f04fd39f86edaa2aafd776e9ad037d075396
treece57e18c64d306c21bc9ef01c40c81caeda642ca
parent4e056ade247bdab4a328776e4516a06fe7f26259
cmd/compile: base PPC64 trunc rules on final type, not op type

Whether a truncation should become a MOVWreg or a MOVWZreg doesn't
depend on the type of the operand, it depends on the type of the final
result.  If the final result is unsigned, we can use MOVWZreg.  If the
final result is signed, we can use MOVWreg.  Checking the type of the
operand does the wrong thing if truncating an unsigned value to a
signed value, or vice-versa.

Fixes #29943

Change-Id: Ia6fc7d006486fa02cffd0bec4d910bdd5b6365f8
Reviewed-on: https://go-review.googlesource.com/c/159760
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/compile/internal/ssa/gen/PPC64.rules
src/cmd/compile/internal/ssa/rewritePPC64.go
test/fixedbugs/issue29943.go [new file with mode: 0644]