github.com/primecitizens/pcz/std@v0.2.1/runtime/sym_wasm.s (about)

     1  // SPDX-License-Identifier: Apache-2.0
     2  // Copyright 2023 The Prime Citizens
     3  //
     4  // Copyright 2018 The Go Authors. All rights reserved.
     5  // Use of this source code is governed by a BSD-style
     6  // license that can be found in the LICENSE file.
     7  
     8  //go:build pcz && wasm
     9  
    10  #include "textflag.h"
    11  
    12  TEXT runtime·wasmDiv(SB), NOSPLIT, $0-0
    13  	Get R0
    14  	I64Const $-0x8000000000000000
    15  	I64Eq
    16  	If
    17  	  Get R1
    18  	  I64Const $-1
    19  	  I64Eq
    20  	  If
    21  	    I64Const $-0x8000000000000000
    22  	    Return
    23  	  End
    24  	End
    25  	Get R0
    26  	Get R1
    27  	I64DivS
    28  	Return
    29  
    30  TEXT runtime·wasmTruncS(SB), NOSPLIT, $0-0
    31  	Get R0
    32  	Get R0
    33  	F64Ne // NaN
    34  	If
    35  	  I64Const $0x8000000000000000
    36  	  Return
    37  	End
    38  
    39  	Get R0
    40  	F64Const $0x7ffffffffffffc00p0 // Maximum truncated representation of 0x7fffffffffffffff
    41  	F64Gt
    42  	If
    43  	  I64Const $0x8000000000000000
    44  	  Return
    45  	End
    46  
    47  	Get R0
    48  	F64Const $-0x7ffffffffffffc00p0 // Minimum truncated representation of -0x8000000000000000
    49  	F64Lt
    50  	If
    51  	  I64Const $0x8000000000000000
    52  	  Return
    53  	End
    54  
    55  	Get R0
    56  	I64TruncF64S
    57  	Return
    58  
    59  TEXT runtime·wasmTruncU(SB), NOSPLIT, $0-0
    60  	Get R0
    61  	Get R0
    62  	F64Ne // NaN
    63  	If
    64  	  I64Const $0x8000000000000000
    65  	  Return
    66  	End
    67  
    68  	Get R0
    69  	F64Const $0xfffffffffffff800p0 // Maximum truncated representation of 0xffffffffffffffff
    70  	F64Gt
    71  	If
    72  	  I64Const $0x8000000000000000
    73  	  Return
    74  	End
    75  
    76  	Get R0
    77  	F64Const $0.
    78  	F64Lt
    79  	If
    80  	  I64Const $0x8000000000000000
    81  	  Return
    82  	End
    83  
    84  	Get R0
    85  	I64TruncF64U
    86  	Return