Text file src/math/pow_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  #define PosInf   0x7FF0000000000000
     8  #define NaN      0x7FF8000000000001
     9  #define NegInf   0xFFF0000000000000
    10  #define PosOne   0x3FF0000000000000
    11  #define NegOne   0xBFF0000000000000
    12  #define NegZero  0x8000000000000000
    13  
    14  // Minimax polynomial approximation
    15  DATA ·powrodataL51<> + 0(SB)/8, $-1.0
    16  DATA ·powrodataL51<> + 8(SB)/8, $1.0
    17  DATA ·powrodataL51<> + 16(SB)/8, $0.24022650695910110361E+00
    18  DATA ·powrodataL51<> + 24(SB)/8, $0.69314718055994686185E+00
    19  DATA ·powrodataL51<> + 32(SB)/8, $0.96181291057109484809E-02
    20  DATA ·powrodataL51<> + 40(SB)/8, $0.15403814778342868389E-03
    21  DATA ·powrodataL51<> + 48(SB)/8, $0.55504108652095235601E-01
    22  DATA ·powrodataL51<> + 56(SB)/8, $0.13333818813168698658E-02
    23  DATA ·powrodataL51<> + 64(SB)/8, $0.68205322933914439200E-12
    24  DATA ·powrodataL51<> + 72(SB)/8, $-.18466496523378731640E-01
    25  DATA ·powrodataL51<> + 80(SB)/8, $0.19697596291603973706E-02
    26  DATA ·powrodataL51<> + 88(SB)/8, $0.23083120654155209200E+00
    27  DATA ·powrodataL51<> + 96(SB)/8, $0.55324356012093416771E-06
    28  DATA ·powrodataL51<> + 104(SB)/8, $-.40340677224649339048E-05
    29  DATA ·powrodataL51<> + 112(SB)/8, $0.30255507904062541562E-04
    30  DATA ·powrodataL51<> + 120(SB)/8, $-.77453979912413008787E-07
    31  DATA ·powrodataL51<> + 128(SB)/8, $-.23637115549923464737E-03
    32  DATA ·powrodataL51<> + 136(SB)/8, $0.11016119077267717198E-07
    33  DATA ·powrodataL51<> + 144(SB)/8, $0.22608272174486123035E-09
    34  DATA ·powrodataL51<> + 152(SB)/8, $-.15895808101370190382E-08
    35  DATA ·powrodataL51<> + 160(SB)/8, $0x4540190000000000
    36  GLOBL ·powrodataL51<> + 0(SB), RODATA, $168
    37  
    38  // Constants
    39  DATA ·pow_x001a<> + 0(SB)/8, $0x1a000000000000
    40  GLOBL ·pow_x001a<> + 0(SB), RODATA, $8
    41  DATA ·pow_xinf<> + 0(SB)/8, $0x7ff0000000000000      //+Inf
    42  GLOBL ·pow_xinf<> + 0(SB), RODATA, $8
    43  DATA ·pow_xnan<> + 0(SB)/8, $0x7ff8000000000000      //NaN
    44  GLOBL ·pow_xnan<> + 0(SB), RODATA, $8
    45  DATA ·pow_x434<> + 0(SB)/8, $0x4340000000000000
    46  GLOBL ·pow_x434<> + 0(SB), RODATA, $8
    47  DATA ·pow_x433<> + 0(SB)/8, $0x4330000000000000
    48  GLOBL ·pow_x433<> + 0(SB), RODATA, $8
    49  DATA ·pow_x43f<> + 0(SB)/8, $0x43f0000000000000
    50  GLOBL ·pow_x43f<> + 0(SB), RODATA, $8
    51  DATA ·pow_xadd<> + 0(SB)/8, $0xc2f0000100003fef
    52  GLOBL ·pow_xadd<> + 0(SB), RODATA, $8
    53  DATA ·pow_xa<> + 0(SB)/8, $0x4019000000000000
    54  GLOBL ·pow_xa<> + 0(SB), RODATA, $8
    55  
    56  // Scale correction tables
    57  DATA powiadd<> + 0(SB)/8, $0xf000000000000000
    58  DATA powiadd<> + 8(SB)/8, $0x1000000000000000
    59  GLOBL powiadd<> + 0(SB), RODATA, $16
    60  DATA powxscale<> + 0(SB)/8, $0x4ff0000000000000
    61  DATA powxscale<> + 8(SB)/8, $0x2ff0000000000000
    62  GLOBL powxscale<> + 0(SB), RODATA, $16
    63  
    64  // Fractional powers of 2 table
    65  DATA ·powtexp<> + 0(SB)/8, $0.442737824274138381E-01
    66  DATA ·powtexp<> + 8(SB)/8, $0.263602189790660309E-01
    67  DATA ·powtexp<> + 16(SB)/8, $0.122565642281703586E-01
    68  DATA ·powtexp<> + 24(SB)/8, $0.143757052860721398E-02
    69  DATA ·powtexp<> + 32(SB)/8, $-.651375034121276075E-02
    70  DATA ·powtexp<> + 40(SB)/8, $-.119317678849450159E-01
    71  DATA ·powtexp<> + 48(SB)/8, $-.150868749549871069E-01
    72  DATA ·powtexp<> + 56(SB)/8, $-.161992609578469234E-01
    73  DATA ·powtexp<> + 64(SB)/8, $-.154492360403337917E-01
    74  DATA ·powtexp<> + 72(SB)/8, $-.129850717389178721E-01
    75  DATA ·powtexp<> + 80(SB)/8, $-.892902649276657891E-02
    76  DATA ·powtexp<> + 88(SB)/8, $-.338202636596794887E-02
    77  DATA ·powtexp<> + 96(SB)/8, $0.357266307045684762E-02
    78  DATA ·powtexp<> + 104(SB)/8, $0.118665304327406698E-01
    79  DATA ·powtexp<> + 112(SB)/8, $0.214434994118118914E-01
    80  DATA ·powtexp<> + 120(SB)/8, $0.322580645161290314E-01
    81  GLOBL ·powtexp<> + 0(SB), RODATA, $128
    82  
    83  // Log multiplier tables
    84  DATA ·powtl<> + 0(SB)/8, $0xbdf9723a80db6a05
    85  DATA ·powtl<> + 8(SB)/8, $0x3e0cfe4a0babe862
    86  DATA ·powtl<> + 16(SB)/8, $0xbe163b42dd33dada
    87  DATA ·powtl<> + 24(SB)/8, $0xbe0cdf9de2a8429c
    88  DATA ·powtl<> + 32(SB)/8, $0xbde9723a80db6a05
    89  DATA ·powtl<> + 40(SB)/8, $0xbdb37fcae081745e
    90  DATA ·powtl<> + 48(SB)/8, $0xbdd8b2f901ac662c
    91  DATA ·powtl<> + 56(SB)/8, $0xbde867dc68c36cc9
    92  DATA ·powtl<> + 64(SB)/8, $0xbdd23e36b47256b7
    93  DATA ·powtl<> + 72(SB)/8, $0xbde4c9b89fcc7933
    94  DATA ·powtl<> + 80(SB)/8, $0xbdd16905cad7cf66
    95  DATA ·powtl<> + 88(SB)/8, $0x3ddb417414aa5529
    96  DATA ·powtl<> + 96(SB)/8, $0xbdce046f2889983c
    97  DATA ·powtl<> + 104(SB)/8, $0x3dc2c3865d072897
    98  DATA ·powtl<> + 112(SB)/8, $0x8000000000000000
    99  DATA ·powtl<> + 120(SB)/8, $0x3dc1ca48817f8afe
   100  DATA ·powtl<> + 128(SB)/8, $0xbdd703518a88bfb7
   101  DATA ·powtl<> + 136(SB)/8, $0x3dc64afcc46942ce
   102  DATA ·powtl<> + 144(SB)/8, $0xbd9d79191389891a
   103  DATA ·powtl<> + 152(SB)/8, $0x3ddd563044da4fa0
   104  DATA ·powtl<> + 160(SB)/8, $0x3e0f42b5e5f8f4b6
   105  DATA ·powtl<> + 168(SB)/8, $0x3e0dfa2c2cbf6ead
   106  DATA ·powtl<> + 176(SB)/8, $0x3e14e25e91661293
   107  DATA ·powtl<> + 184(SB)/8, $0x3e0aac461509e20c
   108  GLOBL ·powtl<> + 0(SB), RODATA, $192
   109  
   110  DATA ·powtm<> + 0(SB)/8, $0x3da69e13
   111  DATA ·powtm<> + 8(SB)/8, $0x100003d66fcb6
   112  DATA ·powtm<> + 16(SB)/8, $0x200003d1538df
   113  DATA ·powtm<> + 24(SB)/8, $0x300003cab729e
   114  DATA ·powtm<> + 32(SB)/8, $0x400003c1a784c
   115  DATA ·powtm<> + 40(SB)/8, $0x500003ac9b074
   116  DATA ·powtm<> + 48(SB)/8, $0x60000bb498d22
   117  DATA ·powtm<> + 56(SB)/8, $0x68000bb8b29a2
   118  DATA ·powtm<> + 64(SB)/8, $0x70000bb9a32d4
   119  DATA ·powtm<> + 72(SB)/8, $0x74000bb9946bb
   120  DATA ·powtm<> + 80(SB)/8, $0x78000bb92e34b
   121  DATA ·powtm<> + 88(SB)/8, $0x80000bb6c57dc
   122  DATA ·powtm<> + 96(SB)/8, $0x84000bb4020f7
   123  DATA ·powtm<> + 104(SB)/8, $0x8c000ba93832d
   124  DATA ·powtm<> + 112(SB)/8, $0x9000080000000
   125  DATA ·powtm<> + 120(SB)/8, $0x940003aa66c4c
   126  DATA ·powtm<> + 128(SB)/8, $0x980003b2fb12a
   127  DATA ·powtm<> + 136(SB)/8, $0xa00003bc1def6
   128  DATA ·powtm<> + 144(SB)/8, $0xa80003c1eb0eb
   129  DATA ·powtm<> + 152(SB)/8, $0xb00003c64dcec
   130  DATA ·powtm<> + 160(SB)/8, $0xc00003cc49e4e
   131  DATA ·powtm<> + 168(SB)/8, $0xd00003d12f1de
   132  DATA ·powtm<> + 176(SB)/8, $0xe00003d4a9c6f
   133  DATA ·powtm<> + 184(SB)/8, $0xf00003d846c66
   134  GLOBL ·powtm<> + 0(SB), RODATA, $192
   135  
   136  // Table of indeces into multiplier tables
   137  // Adjusted from asm to remove offset and convert
   138  DATA ·powtabi<> + 0(SB)/8, $0x1010101
   139  DATA ·powtabi<> + 8(SB)/8, $0x101020202020203
   140  DATA ·powtabi<> + 16(SB)/8, $0x303030404040405
   141  DATA ·powtabi<> + 24(SB)/8, $0x505050606060708
   142  DATA ·powtabi<> + 32(SB)/8, $0x90a0b0c0d0e0f10
   143  DATA ·powtabi<> + 40(SB)/8, $0x1011111212121313
   144  DATA ·powtabi<> + 48(SB)/8, $0x1314141414151515
   145  DATA ·powtabi<> + 56(SB)/8, $0x1516161617171717
   146  GLOBL ·powtabi<> + 0(SB), RODATA, $64
   147  
   148  // Pow returns x**y, the base-x exponential of y.
   149  //
   150  // Special cases are (in order):
   151  //      Pow(x, ±0) = 1 for any x
   152  //      Pow(1, y) = 1 for any y
   153  //      Pow(x, 1) = x for any x
   154  //      Pow(NaN, y) = NaN
   155  //      Pow(x, NaN) = NaN
   156  //      Pow(±0, y) = ±Inf for y an odd integer < 0
   157  //      Pow(±0, -Inf) = +Inf
   158  //      Pow(±0, +Inf) = +0
   159  //      Pow(±0, y) = +Inf for finite y < 0 and not an odd integer
   160  //      Pow(±0, y) = ±0 for y an odd integer > 0
   161  //      Pow(±0, y) = +0 for finite y > 0 and not an odd integer
   162  //      Pow(-1, ±Inf) = 1
   163  //      Pow(x, +Inf) = +Inf for |x| > 1
   164  //      Pow(x, -Inf) = +0 for |x| > 1
   165  //      Pow(x, +Inf) = +0 for |x| < 1
   166  //      Pow(x, -Inf) = +Inf for |x| < 1
   167  //      Pow(+Inf, y) = +Inf for y > 0
   168  //      Pow(+Inf, y) = +0 for y < 0
   169  //      Pow(-Inf, y) = Pow(-0, -y)
   170  //      Pow(x, y) = NaN for finite x < 0 and finite non-integer y
   171  
   172  TEXT	·powAsm(SB), NOSPLIT, $0-24
   173  	// special case
   174  	MOVD	x+0(FP), R1
   175  	MOVD	y+8(FP), R2
   176  
   177  	// special case Pow(1, y) = 1 for any y
   178  	MOVD	$PosOne, R3
   179  	CMPUBEQ	R1, R3, xIsOne
   180  
   181  	// special case Pow(x, 1) = x for any x
   182  	MOVD	$PosOne, R4
   183  	CMPUBEQ	R2, R4, yIsOne
   184  
   185  	// special case Pow(x, NaN) = NaN for any x
   186  	MOVD	$~(1<<63), R5
   187  	AND	R2, R5    // y = |y|
   188  	MOVD	$PosInf, R4
   189  	CMPUBLT R4, R5, yIsNan
   190  
   191  	MOVD	$NegInf, R3
   192  	CMPUBEQ	R1, R3, xIsNegInf
   193  
   194  	MOVD	$NegOne, R3
   195  	CMPUBEQ	R1, R3, xIsNegOne
   196  
   197  	MOVD	$PosInf, R3
   198  	CMPUBEQ	R1, R3, xIsPosInf
   199  
   200  	MOVD	$NegZero, R3
   201  	CMPUBEQ	R1, R3, xIsNegZero
   202  
   203  	MOVD	$PosInf, R4
   204  	CMPUBEQ	R2, R4, yIsPosInf
   205  
   206  	MOVD	$0x0, R3
   207  	CMPUBEQ	R1, R3, xIsPosZero
   208  	CMPBLT	R1, R3, xLtZero
   209  	BR	Normal
   210  xIsPosInf:
   211  	// special case Pow(+Inf, y) = +Inf for y > 0
   212  	MOVD	$0x0, R4
   213  	CMPBGT	R2, R4, posInfGeZero
   214  	BR	Normal
   215  xIsNegInf:
   216  	//Pow(-Inf, y) = Pow(-0, -y)
   217  	FMOVD y+8(FP), F2
   218  	FNEG F2, F2			// y = -y
   219  	BR negZeroNegY		// call Pow(-0, -y)
   220  xIsNegOne:
   221  	// special case Pow(-1, ±Inf) = 1
   222  	MOVD	$PosInf, R4
   223  	CMPUBEQ	R2, R4, negOnePosInf
   224  	MOVD	$NegInf, R4
   225  	CMPUBEQ	R2, R4, negOneNegInf
   226  	BR	Normal
   227  xIsPosZero:
   228  	// special case Pow(+0, -Inf) = +Inf
   229  	MOVD	$NegInf, R4
   230  	CMPUBEQ	R2, R4, zeroNegInf
   231  
   232  	// special case Pow(+0, y < 0) = +Inf
   233  	FMOVD	y+8(FP), F2
   234  	FMOVD	$(0.0), F4
   235  	FCMPU	F2, F4
   236  	BLT	posZeroLtZero				//y < 0.0
   237  	BR	Normal
   238  xIsNegZero:
   239  	// special case Pow(-0, -Inf) = +Inf
   240  	MOVD	$NegInf, R4
   241  	CMPUBEQ	R2, R4, zeroNegInf
   242  	FMOVD	y+8(FP), F2
   243  negZeroNegY:
   244  	// special case Pow(x, ±0) = 1 for any x
   245  	FMOVD	$(0.0), F4
   246  	FCMPU	F4, F2
   247  	BLT	negZeroGtZero		// y > 0.0
   248  	BEQ yIsZero				// y = 0.0
   249  
   250  	FMOVD $(-0.0), F4
   251  	FCMPU F4, F2
   252  	BLT negZeroGtZero				// y > -0.0
   253  	BEQ yIsZero				// y = -0.0
   254  
   255  	// special case Pow(-0, y) = -Inf for y an odd integer < 0
   256  	// special case Pow(-0, y) = +Inf for finite y < 0 and not an odd integer
   257  	FIDBR	$5, F2, F4		//F2 translate to integer F4
   258  	FCMPU	F2, F4
   259  	BNE	zeroNotOdd			// y is not an (odd) integer and y < 0
   260  	FMOVD	$(2.0), F4
   261  	FDIV	F4, F2			// F2 = F2 / 2.0
   262  	FIDBR	$5, F2, F4		//F2 translate to integer F4
   263  	FCMPU	F2, F4
   264  	BNE	negZeroOddInt		// y is an odd integer and y < 0
   265  	BR	zeroNotOdd			// y is not an (odd) integer and y < 0
   266  
   267  negZeroGtZero:
   268  	// special case Pow(-0, y) = -0 for y an odd integer > 0
   269  	// special case Pow(±0, y) = +0 for finite y > 0 and not an odd integer
   270  	FIDBR	$5, F2, F4      //F2 translate to integer F4
   271  	FCMPU	F2, F4
   272  	BNE	zeroNotOddGtZero    // y is not an (odd) integer and y > 0
   273  	FMOVD	$(2.0), F4
   274  	FDIV	F4, F2          // F2 = F2 / 2.0
   275  	FIDBR	$5, F2, F4      //F2 translate to integer F4
   276  	FCMPU	F2, F4
   277  	BNE	negZeroOddIntGtZero       // y is an odd integer and y > 0
   278  	BR	zeroNotOddGtZero          // y is not an (odd) integer
   279  
   280  xLtZero:
   281  	// special case Pow(x, y) = NaN for finite x < 0 and finite non-integer y
   282  	FMOVD	y+8(FP), F2
   283  	FIDBR	$5, F2, F4
   284  	FCMPU	F2, F4
   285  	BNE	ltZeroInt
   286  	BR	Normal
   287  yIsPosInf:
   288  	// special case Pow(x, +Inf) = +Inf for |x| > 1
   289  	FMOVD	x+0(FP), F1
   290  	FMOVD	$(1.0), F3
   291  	FCMPU	F1, F3
   292  	BGT	gtOnePosInf
   293  	FMOVD	$(-1.0), F3
   294  	FCMPU	F1, F3
   295  	BLT	ltNegOnePosInf
   296  Normal:
   297  	FMOVD	x+0(FP), F0
   298  	FMOVD	y+8(FP), F2
   299  	MOVD	$·powrodataL51<>+0(SB), R9
   300  	LGDR	F0, R3
   301  	WORD	$0xC0298009	//iilf	%r2,2148095317
   302  	BYTE	$0x55
   303  	BYTE	$0x55
   304  	RISBGNZ	$32, $63, $32, R3, R1
   305  	SUBW	R1, R2
   306  	RISBGNZ	$58, $63, $50, R2, R3
   307  	BYTE	$0x18	//lr	%r5,%r1
   308  	BYTE	$0x51
   309  	MOVD	$·powtabi<>+0(SB), R12
   310  	WORD	$0xE303C000	//llgc	%r0,0(%r3,%r12)
   311  	BYTE	$0x00
   312  	BYTE	$0x90
   313  	SUBW	$0x1A0000, R5
   314  	SLD	$3, R0, R3
   315  	MOVD	$·powtm<>+0(SB), R4
   316  	MOVH	$0x0, R8
   317  	ANDW	$0x7FF00000, R2
   318  	ORW	R5, R1
   319  	WORD	$0x5A234000	//a	%r2,0(%r3,%r4)
   320  	MOVD	$0x3FF0000000000000, R5
   321  	RISBGZ	$40, $63, $56, R2, R3
   322  	RISBGN	$0, $31, $32, R2, R8
   323  	ORW	$0x45000000, R3
   324  	MOVW	R1, R6
   325  	CMPBLT	R6, $0, L42
   326  	FMOVD	F0, F4
   327  L2:
   328  	VLVGF	$0, R3, V1
   329  	MOVD	$·pow_xa<>+0(SB), R2
   330  	WORD	$0xED3090A0	//lde	%f3,.L52-.L51(%r9)
   331  	BYTE	$0x00
   332  	BYTE	$0x24
   333  	FMOVD	0(R2), F6
   334  	FSUBS	F1, F3
   335  	LDGR	R8, F1
   336  	WFMSDB	V4, V1, V6, V4
   337  	FMOVD	152(R9), F6
   338  	WFMDB	V4, V4, V7
   339  	FMOVD	144(R9), F1
   340  	FMOVD	136(R9), F5
   341  	WFMADB	V4, V1, V6, V1
   342  	VLEG	$0, 128(R9), V16
   343  	FMOVD	120(R9), F6
   344  	WFMADB	V4, V5, V6, V5
   345  	FMOVD	112(R9), F6
   346  	WFMADB	V1, V7, V5, V1
   347  	WFMADB	V4, V6, V16, V16
   348  	SLD	$3, R0, R2
   349  	FMOVD	104(R9), F5
   350  	WORD	$0xED824004	//ldeb	%f8,4(%r2,%r4)
   351  	BYTE	$0x00
   352  	BYTE	$0x04
   353  	LDEBR	F3, F3
   354  	FMOVD	96(R9), F6
   355  	WFMADB	V4, V6, V5, V6
   356  	FADD	F8, F3
   357  	WFMADB	V7, V6, V16, V6
   358  	FMUL	F7, F7
   359  	FMOVD	88(R9), F5
   360  	FMADD	F7, F1, F6
   361  	WFMADB	V4, V5, V3, V16
   362  	FMOVD	80(R9), F1
   363  	WFSDB	V16, V3, V3
   364  	MOVD	$·powtl<>+0(SB), R3
   365  	WFMADB	V4, V6, V1, V6
   366  	FMADD	F5, F4, F3
   367  	FMOVD	72(R9), F1
   368  	WFMADB	V4, V6, V1, V6
   369  	WORD	$0xED323000	//adb	%f3,0(%r2,%r3)
   370  	BYTE	$0x00
   371  	BYTE	$0x1A
   372  	FMOVD	64(R9), F1
   373  	WFMADB	V4, V6, V1, V6
   374  	MOVD	$·pow_xadd<>+0(SB), R2
   375  	WFMADB	V4, V6, V3, V4
   376  	FMOVD	0(R2), F5
   377  	WFADB	V4, V16, V3
   378  	VLEG	$0, 56(R9), V20
   379  	WFMSDB	V2, V3, V5, V3
   380  	VLEG	$0, 48(R9), V18
   381  	WFADB	V3, V5, V6
   382  	LGDR	F3, R2
   383  	WFMSDB	V2, V16, V6, V16
   384  	FMOVD	40(R9), F1
   385  	WFMADB	V2, V4, V16, V4
   386  	FMOVD	32(R9), F7
   387  	WFMDB	V4, V4, V3
   388  	WFMADB	V4, V1, V20, V1
   389  	WFMADB	V4, V7, V18, V7
   390  	VLEG	$0, 24(R9), V16
   391  	WFMADB	V1, V3, V7, V1
   392  	FMOVD	16(R9), F5
   393  	WFMADB	V4, V5, V16, V5
   394  	RISBGZ	$57, $60, $3, R2, R4
   395  	WFMADB	V3, V1, V5, V1
   396  	MOVD	$·powtexp<>+0(SB), R3
   397  	WORD	$0x68343000	//ld	%f3,0(%r4,%r3)
   398  	FMADD	F3, F4, F4
   399  	RISBGN	$0, $15, $48, R2, R5
   400  	WFMADB	V4, V1, V3, V4
   401  	LGDR	F6, R2
   402  	LDGR	R5, F1
   403  	SRAD	$48, R2, R2
   404  	FMADD	F1, F4, F1
   405  	RLL	$16, R2, R2
   406  	ANDW	$0x7FFF0000, R2
   407  	WORD	$0xC22B3F71	//alfi	%r2,1064370176
   408  	BYTE	$0x00
   409  	BYTE	$0x00
   410  	ORW	R2, R1, R3
   411  	MOVW	R3, R6
   412  	CMPBLT	R6, $0, L43
   413  L1:
   414  	FMOVD	F1, ret+16(FP)
   415  	RET
   416  L43:
   417  	LTDBR	F0, F0
   418  	BLTU	L44
   419  	FMOVD	F0, F3
   420  L7:
   421  	MOVD	$·pow_xinf<>+0(SB), R3
   422  	FMOVD	0(R3), F5
   423  	WFCEDBS	V3, V5, V7
   424  	BVS	L8
   425  	WFMDB	V3, V2, V6
   426  L8:
   427  	WFCEDBS	V2, V2, V3
   428  	BVS	L9
   429  	LTDBR	F2, F2
   430  	BEQ	L26
   431  	MOVW	R1, R6
   432  	CMPBLT	R6, $0, L45
   433  L11:
   434  	WORD	$0xC0190003	//iilf	%r1,262143
   435  	BYTE	$0xFF
   436  	BYTE	$0xFF
   437  	MOVW	R2, R7
   438  	MOVW	R1, R6
   439  	CMPBLE	R7, R6, L34
   440  	RISBGNZ	$32, $63, $32, R5, R1
   441  	LGDR	F6, R2
   442  	MOVD	$powiadd<>+0(SB), R3
   443  	RISBGZ	$60, $60, $4, R2, R2
   444  	WORD	$0x5A123000	//a	%r1,0(%r2,%r3)
   445  	RISBGN	$0, $31, $32, R1, R5
   446  	LDGR	R5, F1
   447  	FMADD	F1, F4, F1
   448  	MOVD	$powxscale<>+0(SB), R1
   449  	WORD	$0xED121000	//mdb	%f1,0(%r2,%r1)
   450  	BYTE	$0x00
   451  	BYTE	$0x1C
   452  	BR	L1
   453  L42:
   454  	LTDBR	F0, F0
   455  	BLTU	L46
   456  	FMOVD	F0, F4
   457  L3:
   458  	MOVD	$·pow_x001a<>+0(SB), R2
   459  	WORD	$0xED402000	//cdb	%f4,0(%r2)
   460  	BYTE	$0x00
   461  	BYTE	$0x19
   462  	BGE	L2
   463  	BVS	L2
   464  	MOVD	$·pow_x43f<>+0(SB), R2
   465  	WORD	$0xED402000	//mdb	%f4,0(%r2)
   466  	BYTE	$0x00
   467  	BYTE	$0x1C
   468  	WORD	$0xC0298009	//iilf	%r2,2148095317
   469  	BYTE	$0x55
   470  	BYTE	$0x55
   471  	LGDR	F4, R3
   472  	RISBGNZ	$32, $63, $32, R3, R3
   473  	SUBW	R3, R2, R3
   474  	RISBGZ	$33, $43, $0, R3, R2
   475  	RISBGNZ	$58, $63, $50, R3, R3
   476  	WORD	$0xE303C000	//llgc	%r0,0(%r3,%r12)
   477  	BYTE	$0x00
   478  	BYTE	$0x90
   479  	SLD	$3, R0, R3
   480  	WORD	$0x5A234000	//a	%r2,0(%r3,%r4)
   481  	BYTE	$0x18	//lr	%r3,%r2
   482  	BYTE	$0x32
   483  	RISBGN	$0, $31, $32, R3, R8
   484  	ADDW	$0x4000000, R3
   485  	BLEU	L5
   486  	RISBGZ	$40, $63, $56, R3, R3
   487  	ORW	$0x45000000, R3
   488  	BR	L2
   489  L9:
   490  	WFCEDBS	V0, V0, V4
   491  	BVS	L35
   492  	FMOVD	F2, F1
   493  	BR	L1
   494  L46:
   495  	WORD	$0xB3130040	//lcdbr	%f4,%f0
   496  	BR	L3
   497  L44:
   498  	WORD	$0xB3130030	//lcdbr	%f3,%f0
   499  	BR	L7
   500  L35:
   501  	FMOVD	F0, F1
   502  	BR	L1
   503  L26:
   504  	FMOVD	8(R9), F1
   505  	BR	L1
   506  L34:
   507  	FMOVD	8(R9), F4
   508  L19:
   509  	LTDBR	F6, F6
   510  	BLEU	L47
   511  L18:
   512  	WFMDB	V4, V5, V1
   513  	BR	L1
   514  L5:
   515  	RISBGZ	$33, $50, $63, R3, R3
   516  	WORD	$0xC23B4000	//alfi	%r3,1073741824
   517  	BYTE	$0x00
   518  	BYTE	$0x00
   519  	RLL	$24, R3, R3
   520  	ORW	$0x45000000, R3
   521  	BR	L2
   522  L45:
   523  	WFCEDBS	V0, V0, V4
   524  	BVS	L35
   525  	LTDBR	F0, F0
   526  	BLEU	L48
   527  	FMOVD	8(R9), F4
   528  L12:
   529  	MOVW	R2, R6
   530  	CMPBLT	R6, $0, L19
   531  	FMUL	F4, F1
   532  	BR	L1
   533  L47:
   534  	BLT	L40
   535  	WFCEDBS	V0, V0, V2
   536  	BVS	L49
   537  L16:
   538  	MOVD	·pow_xnan<>+0(SB), R1
   539  	LDGR	R1, F0
   540  	WFMDB	V4, V0, V1
   541  	BR	L1
   542  L48:
   543  	LGDR	F0, R3
   544  	RISBGNZ	$32, $63, $32, R3, R1
   545  	MOVW	R1, R6
   546  	CMPBEQ	R6, $0, L29
   547  	LTDBR	F2, F2
   548  	BLTU	L50
   549  	FMOVD	F2, F4
   550  L14:
   551  	MOVD	$·pow_x433<>+0(SB), R1
   552  	FMOVD	0(R1), F7
   553  	WFCHDBS	V4, V7, V3
   554  	BEQ	L15
   555  	WFADB	V7, V4, V3
   556  	FSUB	F7, F3
   557  	WFCEDBS	V4, V3, V3
   558  	BEQ	L15
   559  	LTDBR	F0, F0
   560  	FMOVD	8(R9), F4
   561  	BNE	L16
   562  L13:
   563  	LTDBR	F2, F2
   564  	BLT	L18
   565  L40:
   566  	FMOVD	$0, F0
   567  	WFMDB	V4, V0, V1
   568  	BR	L1
   569  L49:
   570  	WFMDB	V0, V4, V1
   571  	BR	L1
   572  L29:
   573  	FMOVD	8(R9), F4
   574  	BR	L13
   575  L15:
   576  	MOVD	$·pow_x434<>+0(SB), R1
   577  	FMOVD	0(R1), F7
   578  	WFCHDBS	V4, V7, V3
   579  	BEQ	L32
   580  	WFADB	V7, V4, V3
   581  	FSUB	F7, F3
   582  	WFCEDBS	V4, V3, V4
   583  	BEQ	L32
   584  	FMOVD	0(R9), F4
   585  L17:
   586  	LTDBR	F0, F0
   587  	BNE	L12
   588  	BR	L13
   589  L32:
   590  	FMOVD	8(R9), F4
   591  	BR	L17
   592  L50:
   593  	WORD	$0xB3130042	//lcdbr	%f4,%f2
   594  	BR	L14
   595  xIsOne:			// Pow(1, y) = 1 for any y
   596  yIsOne:			// Pow(x, 1) = x for any x
   597  posInfGeZero:	// Pow(+Inf, y) = +Inf for y > 0
   598  	MOVD	R1, ret+16(FP)
   599  	RET
   600  yIsNan:			//  Pow(NaN, y) = NaN
   601  ltZeroInt:		// Pow(x, y) = NaN for finite x < 0 and finite non-integer y
   602  	MOVD	$NaN, R2
   603  	MOVD	R2, ret+16(FP)
   604  	RET
   605  negOnePosInf:	// Pow(-1, ±Inf) = 1
   606  negOneNegInf:
   607  	MOVD	$PosOne, R3
   608  	MOVD	R3, ret+16(FP)
   609  	RET
   610  negZeroOddInt:
   611  	MOVD	$NegInf, R3
   612  	MOVD	R3, ret+16(FP)
   613  	RET
   614  zeroNotOdd:		// Pow(±0, y) = +Inf for finite y < 0 and not an odd integer
   615  posZeroLtZero:	// special case Pow(+0, y < 0) = +Inf
   616  zeroNegInf:		// Pow(±0, -Inf) = +Inf
   617  	MOVD	$PosInf, R3
   618  	MOVD	R3, ret+16(FP)
   619  	RET
   620  gtOnePosInf:	//Pow(x, +Inf) = +Inf for |x| > 1
   621  ltNegOnePosInf:
   622  	MOVD	R2, ret+16(FP)
   623  	RET
   624  yIsZero:		//Pow(x, ±0) = 1 for any x
   625  	MOVD	$PosOne, R4
   626  	MOVD	R4, ret+16(FP)
   627  	RET
   628  negZeroOddIntGtZero:        // Pow(-0, y) = -0 for y an odd integer > 0
   629  	MOVD	$NegZero, R3
   630  	MOVD	R3, ret+16(FP)
   631  	RET
   632  zeroNotOddGtZero:        // Pow(±0, y) = +0 for finite y > 0 and not an odd integer
   633  	MOVD	$0, ret+16(FP)
   634  	RET
   635  

View as plain text