mirror of
https://github.com/golang/go
synced 2024-11-25 06:17:58 -07:00
[dev.ssa] cmd/compile: get rid of +0.0 hack
The conversion from -0.0 to +0.0 happens inside mpgetflt now. The SSA code doesn't need this fix any more. Change-Id: I6cd4f4a4e75b13cf284ebbb95b08af050ed9891c Reviewed-on: https://go-review.googlesource.com/18942 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Keith Randall <khr@golang.org>
This commit is contained in:
parent
3c26c0db39
commit
733bf6ef67
@ -1347,11 +1347,9 @@ func (s *state) expr(n *Node) *ssa.Value {
|
|||||||
f := n.Val().U.(*Mpflt)
|
f := n.Val().U.(*Mpflt)
|
||||||
switch n.Type.Size() {
|
switch n.Type.Size() {
|
||||||
case 4:
|
case 4:
|
||||||
// -0.0 literals need to be treated as if they were 0.0, adding 0.0 here
|
return s.constFloat32(n.Type, mpgetflt32(f))
|
||||||
// accomplishes this while not affecting other values.
|
|
||||||
return s.constFloat32(n.Type, mpgetflt32(f)+0.0)
|
|
||||||
case 8:
|
case 8:
|
||||||
return s.constFloat64(n.Type, mpgetflt(f)+0.0)
|
return s.constFloat64(n.Type, mpgetflt(f))
|
||||||
default:
|
default:
|
||||||
s.Fatalf("bad float size %d", n.Type.Size())
|
s.Fatalf("bad float size %d", n.Type.Size())
|
||||||
return nil
|
return nil
|
||||||
@ -1364,18 +1362,16 @@ func (s *state) expr(n *Node) *ssa.Value {
|
|||||||
case 8:
|
case 8:
|
||||||
{
|
{
|
||||||
pt := Types[TFLOAT32]
|
pt := Types[TFLOAT32]
|
||||||
// -0.0 literals need to be treated as if they were 0.0, adding 0.0 here
|
|
||||||
// accomplishes this while not affecting other values.
|
|
||||||
return s.newValue2(ssa.OpComplexMake, n.Type,
|
return s.newValue2(ssa.OpComplexMake, n.Type,
|
||||||
s.constFloat32(pt, mpgetflt32(r)+0.0),
|
s.constFloat32(pt, mpgetflt32(r)),
|
||||||
s.constFloat32(pt, mpgetflt32(i)+0.0))
|
s.constFloat32(pt, mpgetflt32(i)))
|
||||||
}
|
}
|
||||||
case 16:
|
case 16:
|
||||||
{
|
{
|
||||||
pt := Types[TFLOAT64]
|
pt := Types[TFLOAT64]
|
||||||
return s.newValue2(ssa.OpComplexMake, n.Type,
|
return s.newValue2(ssa.OpComplexMake, n.Type,
|
||||||
s.constFloat64(pt, mpgetflt(r)+0.0),
|
s.constFloat64(pt, mpgetflt(r)),
|
||||||
s.constFloat64(pt, mpgetflt(i)+0.0))
|
s.constFloat64(pt, mpgetflt(i)))
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
s.Fatalf("bad float size %d", n.Type.Size())
|
s.Fatalf("bad float size %d", n.Type.Size())
|
||||||
|
Loading…
Reference in New Issue
Block a user