]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: propagate constants through math.Float{32,64}{,from}bits
authorMichael Munday <mike.munday@ibm.com>
Fri, 8 Sep 2017 00:31:13 +0000 (01:31 +0100)
committerMichael Munday <mike.munday@ibm.com>
Fri, 8 Sep 2017 17:24:03 +0000 (17:24 +0000)
commit9da29b687f9372cc9e4506475b13edfe7a79a790
tree662e6d500c60fc1fea965087a8883629f69599d0
parent4439b21d0cf1fa3be7bd52ff79e83149f314458c
cmd/compile: propagate constants through math.Float{32,64}{,from}bits

This CL adds generic SSA rules to propagate constants through raw bits
conversions between floats and integers. This allows constants to
propagate through some math functions. For example, math.Copysign(0, -1)
is now constant folded to a load of -0.0.

Requires a fix to the ARM assembler which loaded -0.0 as +0.0.

Change-Id: I52649a4691077c7414f19d17bb599a6743c23ac2
Reviewed-on: https://go-review.googlesource.com/62250
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
src/cmd/compile/internal/gc/asm_test.go
src/cmd/compile/internal/ssa/check.go
src/cmd/compile/internal/ssa/gen/generic.rules
src/cmd/compile/internal/ssa/rewritegeneric.go
src/cmd/internal/obj/arm/asm5.go