Home | History | Annotate | Download | only in 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 TEXT Asin(SB),NOSPLIT,$0
      8 	BR asin(SB)
      9 
     10 TEXT Acos(SB),NOSPLIT,$0
     11 	BR acos(SB)
     12 
     13 TEXT Atan2(SB),NOSPLIT,$0
     14 	BR atan2(SB)
     15 
     16 TEXT Atan(SB),NOSPLIT,$0
     17 	BR atan(SB)
     18 
     19 TEXT Exp2(SB),NOSPLIT,$0
     20 	BR exp2(SB)
     21 
     22 TEXT Expm1(SB),NOSPLIT,$0
     23 	BR expm1(SB)
     24 
     25 TEXT Exp(SB),NOSPLIT,$0
     26 	BR exp(SB)
     27 
     28 TEXT Frexp(SB),NOSPLIT,$0
     29 	BR frexp(SB)
     30 
     31 TEXT Hypot(SB),NOSPLIT,$0
     32 	BR hypot(SB)
     33 
     34 TEXT Ldexp(SB),NOSPLIT,$0
     35 	BR ldexp(SB)
     36 
     37 TEXT Log2(SB),NOSPLIT,$0
     38 	BR log2(SB)
     39 
     40 TEXT Log1p(SB),NOSPLIT,$0
     41 	BR log1p(SB)
     42 
     43 TEXT Log(SB),NOSPLIT,$0
     44 	BR log(SB)
     45 
     46 TEXT Modf(SB),NOSPLIT,$0
     47 	BR modf(SB)
     48 
     49 TEXT Mod(SB),NOSPLIT,$0
     50 	BR mod(SB)
     51 
     52 TEXT Remainder(SB),NOSPLIT,$0
     53 	BR remainder(SB)
     54 
     55 TEXT Sincos(SB),NOSPLIT,$0
     56 	BR sincos(SB)
     57 
     58 TEXT Tan(SB),NOSPLIT,$0
     59 	BR tan(SB)
     60 
     61 //if go assembly use vector instruction
     62 TEXT hasVectorFacility(SB),NOSPLIT,$24-1
     63 	MOVD    $x-24(SP), R1
     64 	XC      $24, 0(R1), 0(R1) // clear the storage
     65 	MOVD    $2, R0            // R0 is the number of double words stored -1
     66 	WORD    $0xB2B01000       // STFLE 0(R1)
     67 	XOR     R0, R0            // reset the value of R0
     68 	MOVBZ   z-8(SP), R1
     69 	AND     $0x40, R1
     70 	BEQ     novector
     71 vectorinstalled:
     72 	// check if the vector instruction has been enabled
     73 	VLEIB   $0, $0xF, V16
     74 	VLGVB   $0, V16, R1
     75 	CMPBNE  R1, $0xF, novector
     76 	MOVB    $1, ret+0(FP) // have vx
     77 	RET
     78 novector:
     79 	MOVB    $0, ret+0(FP) // no vx
     80 	RET
     81 
     82 TEXT Log10(SB),NOSPLIT,$0
     83 	MOVD    log10vectorfacility+0x00(SB),R1
     84 	BR      (R1)
     85 
     86 TEXT log10TrampolineSetup(SB),NOSPLIT, $0
     87 	MOVB    hasVX(SB), R1
     88 	CMPBEQ  R1, $1, vectorimpl      // vectorfacility = 1, vector supported
     89 	MOVD    $log10vectorfacility+0x00(SB), R1
     90 	MOVD    $log10(SB), R2
     91 	MOVD    R2, 0(R1)
     92 	BR      log10(SB)
     93 vectorimpl:
     94 	MOVD    $log10vectorfacility+0x00(SB), R1
     95 	MOVD    $log10Asm(SB), R2
     96 	MOVD    R2, 0(R1)
     97 	BR      log10Asm(SB)
     98 
     99 GLOBL log10vectorfacility+0x00(SB), NOPTR, $8
    100 DATA log10vectorfacility+0x00(SB)/8, $log10TrampolineSetup(SB)
    101 
    102 
    103 TEXT Cos(SB),NOSPLIT,$0
    104 	MOVD    cosvectorfacility+0x00(SB),R1
    105 	BR      (R1)
    106 
    107 TEXT cosTrampolineSetup(SB),NOSPLIT, $0
    108 	MOVB    hasVX(SB), R1
    109 	CMPBEQ  R1, $1, vectorimpl      // vectorfacility = 1, vector supported
    110 	MOVD    $cosvectorfacility+0x00(SB), R1
    111 	MOVD    $cos(SB), R2
    112 	MOVD    R2, 0(R1)
    113 	BR      cos(SB)
    114 vectorimpl:
    115 	MOVD    $cosvectorfacility+0x00(SB), R1
    116 	MOVD    $cosAsm(SB), R2
    117 	MOVD    R2, 0(R1)
    118 	BR      cosAsm(SB)
    119 
    120 GLOBL cosvectorfacility+0x00(SB), NOPTR, $8
    121 DATA cosvectorfacility+0x00(SB)/8, $cosTrampolineSetup(SB)
    122 
    123 
    124 TEXT Cosh(SB),NOSPLIT,$0
    125 	MOVD    coshvectorfacility+0x00(SB),R1
    126 	BR      (R1)
    127 
    128 TEXT coshTrampolineSetup(SB),NOSPLIT, $0
    129 	MOVB    hasVX(SB), R1
    130 	CMPBEQ  R1, $1, vectorimpl      // vectorfacility = 1, vector supported
    131 	MOVD    $coshvectorfacility+0x00(SB), R1
    132 	MOVD    $cosh(SB), R2
    133 	MOVD    R2, 0(R1)
    134 	BR      cosh(SB)
    135 vectorimpl:
    136 	MOVD    $coshvectorfacility+0x00(SB), R1
    137 	MOVD    $coshAsm(SB), R2
    138 	MOVD    R2, 0(R1)
    139 	BR      coshAsm(SB)
    140 
    141 GLOBL coshvectorfacility+0x00(SB), NOPTR, $8
    142 DATA coshvectorfacility+0x00(SB)/8, $coshTrampolineSetup(SB)
    143 
    144 
    145 TEXT Sin(SB),NOSPLIT,$0
    146 	MOVD    sinvectorfacility+0x00(SB),R1
    147 	BR      (R1)
    148 
    149 TEXT sinTrampolineSetup(SB),NOSPLIT, $0
    150 	MOVB    hasVX(SB), R1
    151 	CMPBEQ  R1, $1, vectorimpl      // vectorfacility = 1, vector supported
    152 	MOVD    $sinvectorfacility+0x00(SB), R1
    153 	MOVD    $sin(SB), R2
    154 	MOVD    R2, 0(R1)
    155 	BR      sin(SB)
    156 vectorimpl:
    157 	MOVD    $sinvectorfacility+0x00(SB), R1
    158 	MOVD    $sinAsm(SB), R2
    159 	MOVD    R2, 0(R1)
    160 	BR      sinAsm(SB)
    161 
    162 GLOBL sinvectorfacility+0x00(SB), NOPTR, $8
    163 DATA sinvectorfacility+0x00(SB)/8, $sinTrampolineSetup(SB)
    164 
    165 
    166 TEXT Sinh(SB),NOSPLIT,$0
    167 	MOVD    sinhvectorfacility+0x00(SB),R1
    168 	BR      (R1)
    169 
    170 TEXT sinhTrampolineSetup(SB),NOSPLIT, $0
    171 	MOVB    hasVX(SB), R1
    172 	CMPBEQ  R1, $1, vectorimpl      // vectorfacility = 1, vector supported
    173 	MOVD    $sinhvectorfacility+0x00(SB), R1
    174 	MOVD    $sinh(SB), R2
    175 	MOVD    R2, 0(R1)
    176 	BR      sinh(SB)
    177 vectorimpl:
    178 	MOVD    $sinhvectorfacility+0x00(SB), R1
    179 	MOVD    $sinhAsm(SB), R2
    180 	MOVD    R2, 0(R1)
    181 	BR      sinhAsm(SB)
    182 
    183 GLOBL sinhvectorfacility+0x00(SB), NOPTR, $8
    184 DATA sinhvectorfacility+0x00(SB)/8, $sinhTrampolineSetup(SB)
    185 
    186 
    187 
    188 TEXT Tanh(SB),NOSPLIT,$0
    189 	MOVD    tanhvectorfacility+0x00(SB),R1
    190 	BR      (R1)
    191 
    192 TEXT tanhTrampolineSetup(SB),NOSPLIT, $0
    193 	MOVB    hasVX(SB), R1
    194 	CMPBEQ  R1, $1, vectorimpl      // vectorfacility = 1, vector supported
    195 	MOVD    $tanhvectorfacility+0x00(SB), R1
    196 	MOVD    $tanh(SB), R2
    197 	MOVD    R2, 0(R1)
    198 	BR      tanh(SB)
    199 vectorimpl:
    200 	MOVD    $tanhvectorfacility+0x00(SB), R1
    201 	MOVD    $tanhAsm(SB), R2
    202 	MOVD    R2, 0(R1)
    203 	BR      tanhAsm(SB)
    204 
    205 GLOBL tanhvectorfacility+0x00(SB), NOPTR, $8
    206 DATA tanhvectorfacility+0x00(SB)/8, $tanhTrampolineSetup(SB)
    207 
    208 
    209