...
Run Format

Text file src/math/cosh_s390x.s

Documentation: math

     1	// Copyright 2016 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	// Constants
     8	DATA coshrodataL23<>+0(SB)/8, $0.231904681384629956E-16
     9	DATA coshrodataL23<>+8(SB)/8, $0.693147180559945286E+00
    10	DATA coshrodataL23<>+16(SB)/8, $0.144269504088896339E+01
    11	DATA coshrodataL23<>+24(SB)/8, $704.E0
    12	GLOBL coshrodataL23<>+0(SB), RODATA, $32
    13	DATA coshxinf<>+0(SB)/8, $0x7FF0000000000000
    14	GLOBL coshxinf<>+0(SB), RODATA, $8
    15	DATA coshxlim1<>+0(SB)/8, $800.E0
    16	GLOBL coshxlim1<>+0(SB), RODATA, $8
    17	DATA coshxaddhy<>+0(SB)/8, $0xc2f0000100003fdf
    18	GLOBL coshxaddhy<>+0(SB), RODATA, $8
    19	DATA coshx4ff<>+0(SB)/8, $0x4ff0000000000000
    20	GLOBL coshx4ff<>+0(SB), RODATA, $8
    21	DATA coshe1<>+0(SB)/8, $0x3ff000000000000a
    22	GLOBL coshe1<>+0(SB), RODATA, $8
    23	
    24	// Log multiplier table
    25	DATA coshtab<>+0(SB)/8, $0.442737824274138381E-01
    26	DATA coshtab<>+8(SB)/8, $0.263602189790660309E-01
    27	DATA coshtab<>+16(SB)/8, $0.122565642281703586E-01
    28	DATA coshtab<>+24(SB)/8, $0.143757052860721398E-02
    29	DATA coshtab<>+32(SB)/8, $-.651375034121276075E-02
    30	DATA coshtab<>+40(SB)/8, $-.119317678849450159E-01
    31	DATA coshtab<>+48(SB)/8, $-.150868749549871069E-01
    32	DATA coshtab<>+56(SB)/8, $-.161992609578469234E-01
    33	DATA coshtab<>+64(SB)/8, $-.154492360403337917E-01
    34	DATA coshtab<>+72(SB)/8, $-.129850717389178721E-01
    35	DATA coshtab<>+80(SB)/8, $-.892902649276657891E-02
    36	DATA coshtab<>+88(SB)/8, $-.338202636596794887E-02
    37	DATA coshtab<>+96(SB)/8, $0.357266307045684762E-02
    38	DATA coshtab<>+104(SB)/8, $0.118665304327406698E-01
    39	DATA coshtab<>+112(SB)/8, $0.214434994118118914E-01
    40	DATA coshtab<>+120(SB)/8, $0.322580645161290314E-01
    41	GLOBL coshtab<>+0(SB), RODATA, $128
    42	
    43	// Minimax polynomial approximations
    44	DATA coshe2<>+0(SB)/8, $0.500000000000004237e+00
    45	GLOBL coshe2<>+0(SB), RODATA, $8
    46	DATA coshe3<>+0(SB)/8, $0.166666666630345592e+00
    47	GLOBL coshe3<>+0(SB), RODATA, $8
    48	DATA coshe4<>+0(SB)/8, $0.416666664838056960e-01
    49	GLOBL coshe4<>+0(SB), RODATA, $8
    50	DATA coshe5<>+0(SB)/8, $0.833349307718286047e-02
    51	GLOBL coshe5<>+0(SB), RODATA, $8
    52	DATA coshe6<>+0(SB)/8, $0.138926439368309441e-02
    53	GLOBL coshe6<>+0(SB), RODATA, $8
    54	
    55	// Cosh returns the hyperbolic cosine of x.
    56	//
    57	// Special cases are:
    58	//      Cosh(±0) = 1
    59	//      Cosh(±Inf) = +Inf
    60	//      Cosh(NaN) = NaN
    61	// The algorithm used is minimax polynomial approximation
    62	// with coefficients determined with a Remez exchange algorithm.
    63	
    64	TEXT ·coshAsm(SB),NOSPLIT,$0-16
    65		FMOVD   x+0(FP), F0
    66		MOVD    $coshrodataL23<>+0(SB), R9
    67		WORD    $0xB3120000     //ltdbr %f0,%f0
    68		MOVD    $0x4086000000000000, R2
    69		MOVD    $0x4086000000000000, R3
    70		BLTU    L19
    71		FMOVD   F0, F4
    72	L2:
    73		WORD    $0xED409018     //cdb %f4,.L24-.L23(%r9)
    74		BYTE    $0x00
    75		BYTE    $0x19
    76		BGE     L14     //jnl   .L14
    77		BVS     L14
    78		WFCEDBS V4, V4, V2
    79		BEQ     L20
    80	L1:
    81		FMOVD   F0, ret+8(FP)
    82		RET
    83	
    84	L14:
    85		WFCEDBS V4, V4, V2
    86		BVS     L1
    87		MOVD    $coshxlim1<>+0(SB), R1
    88		FMOVD   0(R1), F2
    89		WFCHEDBS        V4, V2, V2
    90		BEQ     L21
    91		MOVD    $coshxaddhy<>+0(SB), R1
    92		FMOVD   coshrodataL23<>+16(SB), F5
    93		FMOVD   0(R1), F2
    94		WFMSDB  V0, V5, V2, V5
    95		FMOVD   coshrodataL23<>+8(SB), F3
    96		FADD    F5, F2
    97		MOVD    $coshe6<>+0(SB), R1
    98		WFMSDB  V2, V3, V0, V3
    99		FMOVD   0(R1), F6
   100		WFMDB   V3, V3, V1
   101		MOVD    $coshe4<>+0(SB), R1
   102		FMOVD   coshrodataL23<>+0(SB), F7
   103		WFMADB  V2, V7, V3, V2
   104		FMOVD   0(R1), F3
   105		MOVD    $coshe5<>+0(SB), R1
   106		WFMADB  V1, V6, V3, V6
   107		FMOVD   0(R1), F7
   108		MOVD    $coshe3<>+0(SB), R1
   109		FMOVD   0(R1), F3
   110		WFMADB  V1, V7, V3, V7
   111		FNEG    F2, F3
   112		LGDR    F5, R1
   113		MOVD    $coshe2<>+0(SB), R3
   114		WFCEDBS V4, V0, V0
   115		FMOVD   0(R3), F5
   116		MOVD    $coshe1<>+0(SB), R3
   117		WFMADB  V1, V6, V5, V6
   118		FMOVD   0(R3), F5
   119		WORD    $0xEC21000F     //risbgn %r2,%r1,64-64+0,64-64+0+16-1,64-0-16
   120		BYTE    $0x30
   121		BYTE    $0x59
   122		WFMADB  V1, V7, V5, V1
   123		BVS     L22
   124		WORD    $0xEC4139BC     //risbg %r4,%r1,57,128+60,3
   125		BYTE    $0x03
   126		BYTE    $0x55
   127		MOVD    $coshtab<>+0(SB), R3
   128		WFMADB  V3, V6, V1, V6
   129		WORD    $0x68043000     //ld    %f0,0(%r4,%r3)
   130		FMSUB   F0, F3, F2
   131		WORD    $0xA71AF000     //ahi   %r1,-4096
   132		WFMADB  V2, V6, V0, V6
   133	L17:
   134		WORD    $0xEC21000F     //risbgn %r2,%r1,64-64+0,64-64+0+16-1,64-0-16
   135		BYTE    $0x30
   136		BYTE    $0x59
   137		LDGR    R2, F2
   138		FMADD   F2, F6, F2
   139		MOVD    $coshx4ff<>+0(SB), R1
   140		FMOVD   0(R1), F0
   141		FMUL    F2, F0
   142		FMOVD   F0, ret+8(FP)
   143		RET
   144	
   145	L19:
   146		FNEG    F0, F4
   147		BR      L2
   148	L20:
   149		MOVD    $coshxaddhy<>+0(SB), R1
   150		FMOVD   coshrodataL23<>+16(SB), F3
   151		FMOVD   0(R1), F2
   152		WFMSDB  V0, V3, V2, V3
   153		FMOVD   coshrodataL23<>+8(SB), F4
   154		FADD    F3, F2
   155		MOVD    $coshe6<>+0(SB), R1
   156		FMSUB   F4, F2, F0
   157		FMOVD   0(R1), F6
   158		WFMDB   V0, V0, V1
   159		MOVD    $coshe4<>+0(SB), R1
   160		FMOVD   0(R1), F4
   161		MOVD    $coshe5<>+0(SB), R1
   162		FMOVD   coshrodataL23<>+0(SB), F5
   163		WFMADB  V1, V6, V4, V6
   164		FMADD   F5, F2, F0
   165		FMOVD   0(R1), F2
   166		MOVD    $coshe3<>+0(SB), R1
   167		FMOVD   0(R1), F4
   168		WFMADB  V1, V2, V4, V2
   169		MOVD    $coshe2<>+0(SB), R1
   170		FMOVD   0(R1), F5
   171		FNEG    F0, F4
   172		WFMADB  V1, V6, V5, V6
   173		MOVD    $coshe1<>+0(SB), R1
   174		FMOVD   0(R1), F5
   175		WFMADB  V1, V2, V5, V1
   176		LGDR    F3, R1
   177		MOVD    $coshtab<>+0(SB), R5
   178		WFMADB  V4, V6, V1, V3
   179		WORD    $0xEC4139BC     //risbg %r4,%r1,57,128+60,3
   180		BYTE    $0x03
   181		BYTE    $0x55
   182		WFMSDB  V4, V6, V1, V6
   183		WORD    $0x68145000     //ld %f1,0(%r4,%r5)
   184		WFMSDB  V4, V1, V0, V2
   185		WORD    $0xA7487FBE     //lhi %r4,32702
   186		FMADD   F3, F2, F1
   187		SUBW    R1, R4
   188		WORD    $0xECC439BC     //risbg %r12,%r4,57,128+60,3
   189		BYTE    $0x03
   190		BYTE    $0x55
   191		WORD    $0x682C5000     //ld %f2,0(%r12,%r5)
   192		FMSUB   F2, F4, F0
   193		WORD    $0xEC21000F     //risbgn %r2,%r1,64-64+0,64-64+0+16-1,64-0-16
   194		BYTE    $0x30
   195		BYTE    $0x59
   196		WFMADB  V0, V6, V2, V6
   197		WORD    $0xEC34000F     //risbgn %r3,%r4,64-64+0,64-64+0+16-1,64-0-16
   198		BYTE    $0x30
   199		BYTE    $0x59
   200		LDGR    R2, F2
   201		LDGR    R3, F0
   202		FMADD   F2, F1, F2
   203		FMADD   F0, F6, F0
   204		FADD    F2, F0
   205		FMOVD   F0, ret+8(FP)
   206		RET
   207	
   208	L22:
   209		WORD    $0xA7387FBE     //lhi %r3,32702
   210		MOVD    $coshtab<>+0(SB), R4
   211		SUBW    R1, R3
   212		WFMSDB  V3, V6, V1, V6
   213		WORD    $0xEC3339BC     //risbg %r3,%r3,57,128+60,3
   214		BYTE    $0x03
   215		BYTE    $0x55
   216		WORD    $0x68034000     //ld %f0,0(%r3,%r4)
   217		FMSUB   F0, F3, F2
   218		WORD    $0xA7386FBE     //lhi %r3,28606
   219		WFMADB  V2, V6, V0, V6
   220		SUBW    R1, R3, R1
   221		BR      L17
   222	L21:
   223		MOVD    $coshxinf<>+0(SB), R1
   224		FMOVD   0(R1), F0
   225		FMOVD   F0, ret+8(FP)
   226		RET
   227	

View as plain text