...

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
     8DATA ·exprodataL22<> + 0(SB)/8, $800.0E+00
     9DATA ·exprodataL22<> + 8(SB)/8, $1.0000000000000022e+00
    10DATA ·exprodataL22<> + 16(SB)/8, $0.500000000000004237e+00
    11DATA ·exprodataL22<> + 24(SB)/8, $0.166666666630345592e+00
    12DATA ·exprodataL22<> + 32(SB)/8, $0.138926439368309441e-02
    13DATA ·exprodataL22<> + 40(SB)/8, $0.833349307718286047e-02
    14DATA ·exprodataL22<> + 48(SB)/8, $0.416666664838056960e-01
    15DATA ·exprodataL22<> + 56(SB)/8, $-.231904681384629956E-16
    16DATA ·exprodataL22<> + 64(SB)/8, $-.693147180559945286E+00
    17DATA ·exprodataL22<> + 72(SB)/8, $0.144269504088896339E+01
    18DATA ·exprodataL22<> + 80(SB)/8, $704.0E+00
    19GLOBL ·exprodataL22<> + 0(SB), RODATA, $88
    20
    21DATA ·expxinf<> + 0(SB)/8, $0x7ff0000000000000
    22GLOBL ·expxinf<> + 0(SB), RODATA, $8
    23DATA ·expx4ff<> + 0(SB)/8, $0x4ff0000000000000
    24GLOBL ·expx4ff<> + 0(SB), RODATA, $8
    25DATA ·expx2ff<> + 0(SB)/8, $0x2ff0000000000000
    26GLOBL ·expx2ff<> + 0(SB), RODATA, $8
    27DATA ·expxaddexp<> + 0(SB)/8, $0xc2f0000100003fef
    28GLOBL ·expxaddexp<> + 0(SB), RODATA, $8
    29
    30// Log multipliers table
    31DATA ·exptexp<> + 0(SB)/8, $0.442737824274138381E-01
    32DATA ·exptexp<> + 8(SB)/8, $0.263602189790660309E-01
    33DATA ·exptexp<> + 16(SB)/8, $0.122565642281703586E-01
    34DATA ·exptexp<> + 24(SB)/8, $0.143757052860721398E-02
    35DATA ·exptexp<> + 32(SB)/8, $-.651375034121276075E-02
    36DATA ·exptexp<> + 40(SB)/8, $-.119317678849450159E-01
    37DATA ·exptexp<> + 48(SB)/8, $-.150868749549871069E-01
    38DATA ·exptexp<> + 56(SB)/8, $-.161992609578469234E-01
    39DATA ·exptexp<> + 64(SB)/8, $-.154492360403337917E-01
    40DATA ·exptexp<> + 72(SB)/8, $-.129850717389178721E-01
    41DATA ·exptexp<> + 80(SB)/8, $-.892902649276657891E-02
    42DATA ·exptexp<> + 88(SB)/8, $-.338202636596794887E-02
    43DATA ·exptexp<> + 96(SB)/8, $0.357266307045684762E-02
    44DATA ·exptexp<> + 104(SB)/8, $0.118665304327406698E-01
    45DATA ·exptexp<> + 112(SB)/8, $0.214434994118118914E-01
    46DATA ·exptexp<> + 120(SB)/8, $0.322580645161290314E-01
    47GLOBL ·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
    59TEXT	·expAsm(SB), NOSPLIT, $0-16
    60	FMOVD	x+0(FP), F0
    61	MOVD	$·exprodataL22<>+0(SB), R5
    62	LTDBR	F0, F0
    63	BLTU	L20
    64	FMOVD	F0, F2
    65L2:
    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	LGDR	F6, R1
    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	RISBGZ	$57, $60, $3, R1, R3
    95	WFMADB	V0, V4, V1, V0
    96	MOVD	$·exptexp<>+0(SB), R2
    97	WORD	$0x68432000	//ld	%f4,0(%r3,%r2)
    98	FMADD	F4, F2, F2
    99	SLD	$48, R1, R2
   100	WFMADB	V2, V0, V4, V2
   101	LDGR	R2, F0
   102	FMADD	F0, F2, F0
   103	FMOVD	F0, ret+8(FP)
   104	RET
   105L16:
   106	WFCEDBS	V2, V2, V4
   107	BVS	LEXITTAGexp
   108	WORD	$0xED205000	//cdb	%f2,.L33-.L22(%r5)
   109	BYTE	$0x00
   110	BYTE	$0x19
   111	BLT	L6
   112	WFCEDBS	V2, V0, V0
   113	BVS	L13
   114	MOVD	$·expxinf<>+0(SB), R1
   115	FMOVD	0(R1), F0
   116	FMOVD	F0, ret+8(FP)
   117	RET
   118L20:
   119	WORD	$0xB3130020	//lcdbr	%f2,%f0
   120	BR	L2
   121L6:
   122	MOVD	$·expxaddexp<>+0(SB), R1
   123	FMOVD	72(R5), F3
   124	FMOVD	0(R1), F4
   125	WFMSDB	V0, V3, V4, V3
   126	FMOVD	64(R5), F6
   127	FADD	F3, F4
   128	FMOVD	56(R5), F5
   129	WFMADB	V4, V6, V0, V6
   130	FMOVD	32(R5), F1
   131	WFMADB	V4, V5, V6, V4
   132	FMOVD	40(R5), F5
   133	FMUL	F6, F6
   134	WFMADB	V4, V1, V5, V1
   135	FMOVD	48(R5), F7
   136	LGDR	F3, R1
   137	FMOVD	24(R5), F5
   138	WFMADB	V4, V7, V5, V7
   139	FMOVD	16(R5), F5
   140	WFMADB	V6, V1, V7, V1
   141	FMOVD	8(R5), F7
   142	WFMADB	V4, V5, V7, V5
   143	RISBGZ	$57, $60, $3, R1, R3
   144	WFMADB	V6, V1, V5, V6
   145	MOVD	$·exptexp<>+0(SB), R2
   146	WFCHDBS	V2, V0, V0
   147	WORD	$0x68132000	//ld	%f1,0(%r3,%r2)
   148	FMADD	F1, F4, F4
   149	MOVD	$0x4086000000000000, R2
   150	WFMADB	V4, V6, V1, V4
   151	BEQ	L21
   152	ADDW	$0xF000, R1
   153	RISBGN	$0, $15, $48, R1, R2
   154	LDGR	R2, F0
   155	FMADD	F0, F4, F0
   156	MOVD	$·expx4ff<>+0(SB), R3
   157	FMOVD	0(R3), F2
   158	FMUL	F2, F0
   159	FMOVD	F0, ret+8(FP)
   160	RET
   161L13:
   162	FMOVD	$0, F0
   163	FMOVD	F0, ret+8(FP)
   164	RET
   165L21:
   166	ADDW	$0x1000, R1
   167	RISBGN	$0, $15, $48, R1, R2
   168	LDGR	R2, F0
   169	FMADD	F0, F4, F0
   170	MOVD	$·expx2ff<>+0(SB), R3
   171	FMOVD	0(R3), F2
   172	FMUL	F2, F0
   173	FMOVD	F0, ret+8(FP)
   174	RET
   175LEXITTAGexp:
   176	FMOVD	F0, ret+8(FP)
   177	RET

View as plain text