...
Run Format

Text file src/math/exp_s390x.s

Documentation: math

     1	// Copyright 2017 The Go Authors. All rights reserved.
     2	// Use of this source code is governed by a BSD-style
     3	// license that can be found in the LICENSE file.
     4	
     5	#include "textflag.h"
     6	
     7	// Minimax polynomial approximation and other constants
     8	DATA ·exprodataL22<> + 0(SB)/8, $800.0E+00
     9	DATA ·exprodataL22<> + 8(SB)/8, $1.0000000000000022e+00
    10	DATA ·exprodataL22<> + 16(SB)/8, $0.500000000000004237e+00
    11	DATA ·exprodataL22<> + 24(SB)/8, $0.166666666630345592e+00
    12	DATA ·exprodataL22<> + 32(SB)/8, $0.138926439368309441e-02
    13	DATA ·exprodataL22<> + 40(SB)/8, $0.833349307718286047e-02
    14	DATA ·exprodataL22<> + 48(SB)/8, $0.416666664838056960e-01
    15	DATA ·exprodataL22<> + 56(SB)/8, $-.231904681384629956E-16
    16	DATA ·exprodataL22<> + 64(SB)/8, $-.693147180559945286E+00
    17	DATA ·exprodataL22<> + 72(SB)/8, $0.144269504088896339E+01
    18	DATA ·exprodataL22<> + 80(SB)/8, $704.0E+00
    19	GLOBL ·exprodataL22<> + 0(SB), RODATA, $88
    20	
    21	DATA ·expxinf<> + 0(SB)/8, $0x7ff0000000000000
    22	GLOBL ·expxinf<> + 0(SB), RODATA, $8
    23	DATA ·expx4ff<> + 0(SB)/8, $0x4ff0000000000000
    24	GLOBL ·expx4ff<> + 0(SB), RODATA, $8
    25	DATA ·expx2ff<> + 0(SB)/8, $0x2ff0000000000000
    26	GLOBL ·expx2ff<> + 0(SB), RODATA, $8
    27	DATA ·expxaddexp<> + 0(SB)/8, $0xc2f0000100003fef
    28	GLOBL ·expxaddexp<> + 0(SB), RODATA, $8
    29	
    30	// Log multipliers table
    31	DATA ·exptexp<> + 0(SB)/8, $0.442737824274138381E-01
    32	DATA ·exptexp<> + 8(SB)/8, $0.263602189790660309E-01
    33	DATA ·exptexp<> + 16(SB)/8, $0.122565642281703586E-01
    34	DATA ·exptexp<> + 24(SB)/8, $0.143757052860721398E-02
    35	DATA ·exptexp<> + 32(SB)/8, $-.651375034121276075E-02
    36	DATA ·exptexp<> + 40(SB)/8, $-.119317678849450159E-01
    37	DATA ·exptexp<> + 48(SB)/8, $-.150868749549871069E-01
    38	DATA ·exptexp<> + 56(SB)/8, $-.161992609578469234E-01
    39	DATA ·exptexp<> + 64(SB)/8, $-.154492360403337917E-01
    40	DATA ·exptexp<> + 72(SB)/8, $-.129850717389178721E-01
    41	DATA ·exptexp<> + 80(SB)/8, $-.892902649276657891E-02
    42	DATA ·exptexp<> + 88(SB)/8, $-.338202636596794887E-02
    43	DATA ·exptexp<> + 96(SB)/8, $0.357266307045684762E-02
    44	DATA ·exptexp<> + 104(SB)/8, $0.118665304327406698E-01
    45	DATA ·exptexp<> + 112(SB)/8, $0.214434994118118914E-01
    46	DATA ·exptexp<> + 120(SB)/8, $0.322580645161290314E-01
    47	GLOBL ·exptexp<> + 0(SB), RODATA, $128
    48	
    49	// Exp returns e**x, the base-e exponential of x.
    50	//
    51	// Special cases are:
    52	//      Exp(+Inf) = +Inf
    53	//      Exp(NaN) = NaN
    54	// Very large values overflow to 0 or +Inf.
    55	// Very small values underflow to 1.
    56	// The algorithm used is minimax polynomial approximation using a table of
    57	// polynomial coefficients determined with a Remez exchange algorithm.
    58	
    59	TEXT	·expAsm(SB), NOSPLIT, $0-16
    60		FMOVD	x+0(FP), F0
    61		MOVD	$·exprodataL22<>+0(SB), R5
    62		WORD	$0xB3120000	//ltdbr	%f0,%f0
    63		BLTU	L20
    64		FMOVD	F0, F2
    65	L2:
    66		WORD	$0xED205050	//cdb	%f2,.L23-.L22(%r5)
    67		BYTE	$0x00
    68		BYTE	$0x19
    69		BGE	L16
    70		BVS	L16
    71		WFCEDBS	V2, V2, V2
    72		BVS	LEXITTAGexp
    73		MOVD	$·expxaddexp<>+0(SB), R1
    74		FMOVD	72(R5), F6
    75		FMOVD	0(R1), F2
    76		WFMSDB	V0, V6, V2, V6
    77		FMOVD	64(R5), F4
    78		FADD	F6, F2
    79		FMOVD	56(R5), F1
    80		FMADD	F4, F2, F0
    81		FMOVD	48(R5), F3
    82		WFMADB	V2, V1, V0, V2
    83		FMOVD	40(R5), F1
    84		FMOVD	32(R5), F4
    85		FMUL	F0, F0
    86		WFMADB	V2, V4, V1, V4
    87		WORD	$0xB3CD0016	//lgdr	%r1,%f6
    88		FMOVD	24(R5), F1
    89		WFMADB	V2, V3, V1, V3
    90		FMOVD	16(R5), F1
    91		WFMADB	V0, V4, V3, V4
    92		FMOVD	8(R5), F3
    93		WFMADB	V2, V1, V3, V1
    94		WORD	$0xEC3139BC	//risbg	%r3,%r1,57,128+60,3
    95		BYTE	$0x03
    96		BYTE	$0x55
    97		WFMADB	V0, V4, V1, V0
    98		MOVD	$·exptexp<>+0(SB), R2
    99		WORD	$0x68432000	//ld	%f4,0(%r3,%r2)
   100		FMADD	F4, F2, F2
   101		SLD	$48, R1, R2
   102		WFMADB	V2, V0, V4, V2
   103		WORD	$0xB3C10002	//ldgr	%f0,%r2
   104		FMADD	F0, F2, F0
   105		FMOVD	F0, ret+8(FP)
   106		RET
   107	L16:
   108		WFCEDBS	V2, V2, V4
   109		BVS	LEXITTAGexp
   110		WORD	$0xED205000	//cdb	%f2,.L33-.L22(%r5)
   111		BYTE	$0x00
   112		BYTE	$0x19
   113		BLT	L6
   114		WFCEDBS	V2, V0, V0
   115		BVS	L13
   116		MOVD	$·expxinf<>+0(SB), R1
   117		FMOVD	0(R1), F0
   118		FMOVD	F0, ret+8(FP)
   119		RET
   120	L20:
   121		WORD	$0xB3130020	//lcdbr	%f2,%f0
   122		BR	L2
   123	L6:
   124		MOVD	$·expxaddexp<>+0(SB), R1
   125		FMOVD	72(R5), F3
   126		FMOVD	0(R1), F4
   127		WFMSDB	V0, V3, V4, V3
   128		FMOVD	64(R5), F6
   129		FADD	F3, F4
   130		FMOVD	56(R5), F5
   131		WFMADB	V4, V6, V0, V6
   132		FMOVD	32(R5), F1
   133		WFMADB	V4, V5, V6, V4
   134		FMOVD	40(R5), F5
   135		FMUL	F6, F6
   136		WFMADB	V4, V1, V5, V1
   137		FMOVD	48(R5), F7
   138		WORD	$0xB3CD0013	//lgdr	%r1,%f3
   139		FMOVD	24(R5), F5
   140		WFMADB	V4, V7, V5, V7
   141		FMOVD	16(R5), F5
   142		WFMADB	V6, V1, V7, V1
   143		FMOVD	8(R5), F7
   144		WFMADB	V4, V5, V7, V5
   145		WORD	$0xEC3139BC	//risbg	%r3,%r1,57,128+60,3
   146		BYTE	$0x03
   147		BYTE	$0x55
   148		WFMADB	V6, V1, V5, V6
   149		MOVD	$·exptexp<>+0(SB), R2
   150		WFCHDBS	V2, V0, V0
   151		WORD	$0x68132000	//ld	%f1,0(%r3,%r2)
   152		FMADD	F1, F4, F4
   153		MOVD	$0x4086000000000000, R2
   154		WFMADB	V4, V6, V1, V4
   155		BEQ	L21
   156		ADDW	$0xF000, R1
   157		WORD	$0xEC21000F	//risbgn	%r2,%r1,64-64+0,64-64+0+16-1,64-0-16
   158		BYTE	$0x30
   159		BYTE	$0x59
   160		WORD	$0xB3C10002	//ldgr	%f0,%r2
   161		FMADD	F0, F4, F0
   162		MOVD	$·expx4ff<>+0(SB), R3
   163		FMOVD	0(R3), F2
   164		FMUL	F2, F0
   165		FMOVD	F0, ret+8(FP)
   166		RET
   167	L13:
   168		FMOVD	$0, F0
   169		FMOVD	F0, ret+8(FP)
   170		RET
   171	L21:
   172		ADDW	$0x1000, R1
   173		WORD	$0xEC21000F	//risbgn	%r2,%r1,64-64+0,64-64+0+16-1,64-0-16
   174		BYTE	$0x30
   175		BYTE	$0x59
   176		WORD	$0xB3C10002	//ldgr	%f0,%r2
   177		FMADD	F0, F4, F0
   178		MOVD	$·expx2ff<>+0(SB), R3
   179		FMOVD	0(R3), F2
   180		FMUL	F2, F0
   181		FMOVD	F0, ret+8(FP)
   182		RET
   183	LEXITTAGexp:
   184		FMOVD	F0, ret+8(FP)
   185		RET

View as plain text