cmd/compile: add s390x intrinsics for Ceil, Floor, Round and Trunc

Ceil, Floor and Trunc are pre-existing intrinsics. Round is a new
function and has been added as an intrinsic in this CL. All of the
functions can be implemented as a single 'LOAD FP INTEGER'
instruction, FIDBR, on s390x.

name   old time/op  new time/op  delta
Ceil   2.34ns ± 0%  0.85ns ± 0%  -63.74%  (p=0.000 n=5+4)
Floor  2.33ns ± 0%  0.85ns ± 1%  -63.35%  (p=0.008 n=5+5)
Round  4.23ns ± 0%  0.85ns ± 0%  -79.89%  (p=0.000 n=5+4)
Trunc  2.35ns ± 0%  0.85ns ± 0%  -63.83%  (p=0.029 n=4+4)

Change-Id: Idee7ba24a2899d12bf9afee4eedd6b4aaad3c510
Reviewed-on: https://go-review.googlesource.com/63890
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
Michael Munday 2017-09-14 20:00:02 +01:00
parent 8802b188c6
commit 7582494e06
8 changed files with 159 additions and 8 deletions

View file

@ -1448,6 +1448,7 @@ const (
OpS390XFMADD
OpS390XFMSUBS
OpS390XFMSUB
OpS390XFIDBR
OpS390XFMOVSload
OpS390XFMOVDload
OpS390XFMOVSconst
@ -1836,6 +1837,7 @@ const (
OpFloor
OpCeil
OpTrunc
OpRound
OpPhi
OpCopy
OpConvert
@ -18602,6 +18604,20 @@ var opcodeTable = [...]opInfo{
},
},
},
{
name: "FIDBR",
auxType: auxInt8,
argLen: 1,
asm: s390x.AFIDBR,
reg: regInfo{
inputs: []inputInfo{
{0, 4294901760}, // F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15
},
outputs: []outputInfo{
{0, 4294901760}, // F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15
},
},
},
{
name: "FMOVSload",
auxType: auxSymOff,
@ -22437,6 +22453,11 @@ var opcodeTable = [...]opInfo{
argLen: 1,
generic: true,
},
{
name: "Round",
argLen: 1,
generic: true,
},
{
name: "Phi",
argLen: -1,