mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/internal/obj: unify creation of numeric literal syms
This is a straightforward refactoring, to reduce the scope of upcoming changes. The symbol size and AttrLocal=true was not set universally, but it appears not to matter, since toolstash -cmp is happy. Passes toolstash-check -all. Change-Id: I7f8392f939592d3a1bc6f61dec992f5661f42fca Reviewed-on: https://go-review.googlesource.com/39791 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
c311488283
commit
99683483d6
9 changed files with 60 additions and 101 deletions
|
|
@ -443,17 +443,15 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
|
|||
p.To.Type = obj.TYPE_REG
|
||||
p.To.Reg = x
|
||||
case ssa.Op386MOVSSconst1, ssa.Op386MOVSDconst1:
|
||||
var literal string
|
||||
if v.Op == ssa.Op386MOVSDconst1 {
|
||||
literal = fmt.Sprintf("$f64.%016x", uint64(v.AuxInt))
|
||||
} else {
|
||||
literal = fmt.Sprintf("$f32.%08x", math.Float32bits(float32(math.Float64frombits(uint64(v.AuxInt)))))
|
||||
}
|
||||
p := s.Prog(x86.ALEAL)
|
||||
p.From.Type = obj.TYPE_MEM
|
||||
p.From.Name = obj.NAME_EXTERN
|
||||
p.From.Sym = gc.Ctxt.Lookup(literal, 0)
|
||||
p.From.Sym.Set(obj.AttrLocal, true)
|
||||
f := math.Float64frombits(uint64(v.AuxInt))
|
||||
if v.Op == ssa.Op386MOVSDconst1 {
|
||||
p.From.Sym = gc.Ctxt.Float64Sym(f)
|
||||
} else {
|
||||
p.From.Sym = gc.Ctxt.Float32Sym(float32(f))
|
||||
}
|
||||
p.To.Type = obj.TYPE_REG
|
||||
p.To.Reg = v.Reg()
|
||||
case ssa.Op386MOVSSconst2, ssa.Op386MOVSDconst2:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue