Text file src/math/log_s390x.s

     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 approximations
     8  DATA ·logrodataL21<> + 0(SB)/8, $-.499999999999999778E+00
     9  DATA ·logrodataL21<> + 8(SB)/8, $0.333333333333343751E+00
    10  DATA ·logrodataL21<> + 16(SB)/8, $-.250000000001606881E+00
    11  DATA ·logrodataL21<> + 24(SB)/8, $0.199999999971603032E+00
    12  DATA ·logrodataL21<> + 32(SB)/8, $-.166666663114122038E+00
    13  DATA ·logrodataL21<> + 40(SB)/8, $-.125002923782692399E+00
    14  DATA ·logrodataL21<> + 48(SB)/8, $0.111142014580396256E+00
    15  DATA ·logrodataL21<> + 56(SB)/8, $0.759438932618934220E-01
    16  DATA ·logrodataL21<> + 64(SB)/8, $0.142857144267212549E+00
    17  DATA ·logrodataL21<> + 72(SB)/8, $-.993038938793590759E-01
    18  DATA ·logrodataL21<> + 80(SB)/8, $-1.0
    19  GLOBL ·logrodataL21<> + 0(SB), RODATA, $88
    20  
    21  // Constants
    22  DATA ·logxminf<> + 0(SB)/8, $0xfff0000000000000
    23  GLOBL ·logxminf<> + 0(SB), RODATA, $8
    24  DATA ·logxnan<> + 0(SB)/8, $0x7ff8000000000000
    25  GLOBL ·logxnan<> + 0(SB), RODATA, $8
    26  DATA ·logx43f<> + 0(SB)/8, $0x43f0000000000000
    27  GLOBL ·logx43f<> + 0(SB), RODATA, $8
    28  DATA ·logxl2<> + 0(SB)/8, $0x3fda7aecbeba4e46
    29  GLOBL ·logxl2<> + 0(SB), RODATA, $8
    30  DATA ·logxl1<> + 0(SB)/8, $0x3ffacde700000000
    31  GLOBL ·logxl1<> + 0(SB), RODATA, $8
    32  
    33  /* Input transform scale and add constants */
    34  DATA ·logxm<> + 0(SB)/8, $0x3fc77604e63c84b1
    35  DATA ·logxm<> + 8(SB)/8, $0x40fb39456ab53250
    36  DATA ·logxm<> + 16(SB)/8, $0x3fc9ee358b945f3f
    37  DATA ·logxm<> + 24(SB)/8, $0x40fb39418bf3b137
    38  DATA ·logxm<> + 32(SB)/8, $0x3fccfb2e1304f4b6
    39  DATA ·logxm<> + 40(SB)/8, $0x40fb393d3eda3022
    40  DATA ·logxm<> + 48(SB)/8, $0x3fd0000000000000
    41  DATA ·logxm<> + 56(SB)/8, $0x40fb393969e70000
    42  DATA ·logxm<> + 64(SB)/8, $0x3fd11117aafbfe04
    43  DATA ·logxm<> + 72(SB)/8, $0x40fb3936eaefafcf
    44  DATA ·logxm<> + 80(SB)/8, $0x3fd2492af5e658b2
    45  DATA ·logxm<> + 88(SB)/8, $0x40fb39343ff01715
    46  DATA ·logxm<> + 96(SB)/8, $0x3fd3b50c622a43dd
    47  DATA ·logxm<> + 104(SB)/8, $0x40fb39315adae2f3
    48  DATA ·logxm<> + 112(SB)/8, $0x3fd56bbeea918777
    49  DATA ·logxm<> + 120(SB)/8, $0x40fb392e21698552
    50  GLOBL ·logxm<> + 0(SB), RODATA, $128
    51  
    52  // Log returns the natural logarithm of the argument.
    53  //
    54  // Special cases are:
    55  //      Log(+Inf) = +Inf
    56  //      Log(0) = -Inf
    57  //      Log(x < 0) = NaN
    58  //      Log(NaN) = NaN
    59  // The algorithm used is minimax polynomial approximation using a table of
    60  // polynomial coefficients determined with a Remez exchange algorithm.
    61  
    62  TEXT	·logAsm(SB), NOSPLIT, $0-16
    63  	FMOVD	x+0(FP), F0
    64  	MOVD	$·logrodataL21<>+0(SB), R9
    65  	MOVH	$0x8006, R4
    66  	LGDR	F0, R1
    67  	MOVD	$0x3FF0000000000000, R6
    68  	SRAD	$48, R1, R1
    69  	MOVD	$0x40F03E8000000000, R8
    70  	SUBW	R1, R4
    71  	RISBGZ	$32, $59, $0, R4, R2
    72  	RISBGN	$0, $15, $48, R2, R6
    73  	RISBGN	$16, $31, $32, R2, R8
    74  	MOVW	R1, R7
    75  	CMPBGT	R7, $22, L17
    76  	LTDBR	F0, F0
    77  	MOVD	$·logx43f<>+0(SB), R1
    78  	FMOVD	0(R1), F2
    79  	BLEU	L3
    80  	MOVH	$0x8005, R12
    81  	MOVH	$0x8405, R0
    82  	BR	L15
    83  L7:
    84  	LTDBR	F0, F0
    85  	BLEU	L3
    86  L15:
    87  	FMUL	F2, F0
    88  	LGDR	F0, R1
    89  	SRAD	$48, R1, R1
    90  	SUBW	R1, R0, R2
    91  	SUBW	R1, R12, R3
    92  	BYTE	$0x18	//lr	%r4,%r2
    93  	BYTE	$0x42
    94  	ANDW	$0xFFFFFFF0, R3
    95  	ANDW	$0xFFFFFFF0, R2
    96  	BYTE	$0x18	//lr	%r5,%r1
    97  	BYTE	$0x51
    98  	MOVW	R1, R7
    99  	CMPBLE	R7, $22, L7
   100  	RISBGN	$0, $15, $48, R3, R6
   101  	RISBGN	$16, $31, $32, R2, R8
   102  L2:
   103  	MOVH	R5, R5
   104  	MOVH	$0x7FEF, R1
   105  	CMPW	R5, R1
   106  	BGT	L1
   107  	LDGR	R6, F2
   108  	FMUL	F2, F0
   109  	RISBGZ	$57, $59, $3, R4, R4
   110  	FMOVD	80(R9), F2
   111  	MOVD	$·logxm<>+0(SB), R7
   112  	ADD	R7, R4
   113  	FMOVD	72(R9), F4
   114  	WORD	$0xED004000	//madb	%f2,%f0,0(%r4)
   115  	BYTE	$0x20
   116  	BYTE	$0x1E
   117  	FMOVD	64(R9), F1
   118  	FMOVD	F2, F0
   119  	FMOVD	56(R9), F2
   120  	WFMADB	V0, V2, V4, V2
   121  	WFMDB	V0, V0, V6
   122  	FMOVD	48(R9), F4
   123  	WFMADB	V0, V2, V4, V2
   124  	FMOVD	40(R9), F4
   125  	WFMADB	V2, V6, V1, V2
   126  	FMOVD	32(R9), F1
   127  	WFMADB	V6, V4, V1, V4
   128  	FMOVD	24(R9), F1
   129  	WFMADB	V6, V2, V1, V2
   130  	FMOVD	16(R9), F1
   131  	WFMADB	V6, V4, V1, V4
   132  	MOVD	$·logxl1<>+0(SB), R1
   133  	FMOVD	8(R9), F1
   134  	WFMADB	V6, V2, V1, V2
   135  	FMOVD	0(R9), F1
   136  	WFMADB	V6, V4, V1, V4
   137  	FMOVD	8(R4), F1
   138  	WFMADB	V0, V2, V4, V2
   139  	LDGR	R8, F4
   140  	WFMADB	V6, V2, V0, V2
   141  	WORD	$0xED401000	//msdb	%f1,%f4,0(%r1)
   142  	BYTE	$0x10
   143  	BYTE	$0x1F
   144  	MOVD	·logxl2<>+0(SB), R1
   145  	WORD	$0xB3130001	//lcdbr	%f0,%f1
   146  	LDGR	R1, F4
   147  	WFMADB	V0, V4, V2, V0
   148  L1:
   149  	FMOVD	F0, ret+8(FP)
   150  	RET
   151  L3:
   152  	LTDBR	F0, F0
   153  	BEQ	L20
   154  	BGE	L1
   155  	BVS	L1
   156  
   157  	MOVD	$·logxnan<>+0(SB), R1
   158  	FMOVD	0(R1), F0
   159  	BR	L1
   160  L20:
   161  	MOVD	$·logxminf<>+0(SB), R1
   162  	FMOVD	0(R1), F0
   163  	FMOVD	F0, ret+8(FP)
   164  	RET
   165  L17:
   166  	BYTE	$0x18	//lr	%r5,%r1
   167  	BYTE	$0x51
   168  	BR	L2
   169  

View as plain text