mirror of
https://github.com/golang/go
synced 2024-11-24 03:50:18 -07:00
cmd/compile: use reg moves for int <-> float conversions on ppc64x
This makes a change in the SSA code generated for OpPPC64Xf2i64 and OpPPC64Xi2f64 to use register based instructions to convert between float and integer. This will require at least power8. Currently the conversion is done by storing to and loading from memory, which is more expensive. This improves some of the math functions: BenchmarkExp-128 74.1 66.8 -9.85% BenchmarkExpGo-128 87.4 66.3 -24.14% BenchmarkExp2-128 72.2 64.3 -10.94% BenchmarkExp2Go-128 74.3 65.9 -11.31% BenchmarkLgamma-128 51.0 39.7 -22.16% BenchmarkLog-128 42.9 40.6 -5.36% BenchmarkLogb-128 11.5 9.16 -20.35% BenchmarkLog1p-128 38.9 36.2 -6.94% BenchmarkSin-128 29.5 23.7 -19.66% BenchmarkTan-128 32.8 27.4 -16.46% Fixes #18922 Change-Id: I8e1cf14d3880d7cd720dc5188dd174cba1f7fef7 Reviewed-on: https://go-review.googlesource.com/36725 Reviewed-by: Carlos Eduardo Seo <cseo@linux.vnet.ibm.com> Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
parent
3123df3464
commit
44053de365
@ -111,6 +111,8 @@ var progtable = [ppc64.ALAST & obj.AMask]gc.ProgInfo{
|
||||
ppc64.AFMOVSX & obj.AMask: {Flags: gc.SizeF | gc.LeftRead | gc.RightWrite | gc.Move | gc.Conv},
|
||||
ppc64.AFMOVSZ & obj.AMask: {Flags: gc.SizeF | gc.LeftRead | gc.RightWrite | gc.Move | gc.Conv},
|
||||
ppc64.AFMOVD & obj.AMask: {Flags: gc.SizeD | gc.LeftRead | gc.RightWrite | gc.Move},
|
||||
ppc64.AMFVSRD & obj.AMask: {Flags: gc.SizeD | gc.LeftRead | gc.RightWrite | gc.Move},
|
||||
ppc64.AMTVSRD & obj.AMask: {Flags: gc.SizeD | gc.LeftRead | gc.RightWrite | gc.Move},
|
||||
|
||||
// Jumps
|
||||
ppc64.ABR & obj.AMask: {Flags: gc.Jump | gc.Break},
|
||||
|
@ -177,27 +177,23 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
|
||||
{
|
||||
x := v.Args[0].Reg()
|
||||
y := v.Reg()
|
||||
p := gc.Prog(ppc64.AFMOVD)
|
||||
|
||||
p := gc.Prog(ppc64.AMFVSRD)
|
||||
p.From.Type = obj.TYPE_REG
|
||||
p.From.Reg = x
|
||||
s.AddrScratch(&p.To)
|
||||
p = gc.Prog(ppc64.AMOVD)
|
||||
p.To.Type = obj.TYPE_REG
|
||||
p.To.Reg = y
|
||||
s.AddrScratch(&p.From)
|
||||
}
|
||||
case ssa.OpPPC64Xi2f64:
|
||||
{
|
||||
x := v.Args[0].Reg()
|
||||
y := v.Reg()
|
||||
p := gc.Prog(ppc64.AMOVD)
|
||||
|
||||
p := gc.Prog(ppc64.AMTVSRD)
|
||||
p.From.Type = obj.TYPE_REG
|
||||
p.From.Reg = x
|
||||
s.AddrScratch(&p.To)
|
||||
p = gc.Prog(ppc64.AFMOVD)
|
||||
p.To.Type = obj.TYPE_REG
|
||||
p.To.Reg = y
|
||||
s.AddrScratch(&p.From)
|
||||
}
|
||||
|
||||
case ssa.OpPPC64LoweredGetClosurePtr:
|
||||
|
Loading…
Reference in New Issue
Block a user