github.com/primecitizens/pcz/std@v0.2.1/core/emu64/emu64_386.s (about)

     1  // SPDX-License-Identifier: Apache-2.0
     2  // Copyright 2023 The Prime Citizens
     3  //
     4  // Copyright 2009 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  #include "funcdata.h"
     9  #include "textflag.h"
    10  
    11  TEXT ·Uint32ToFloat64(SB),NOSPLIT,$8-12
    12  	MOVL a+0(FP), AX
    13  	MOVL AX, 0(SP)
    14  	MOVL $0, 4(SP)
    15  	FMOVV 0(SP), F0
    16  	FMOVDP F0, ret+4(FP)
    17  	RET
    18  
    19  TEXT ·Float64ToUint32(SB),NOSPLIT,$12-12
    20  	FMOVD a+0(FP), F0
    21  	FSTCW 0(SP)
    22  	FLDCW ·controlWord64trunc(SB)
    23  	FMOVVP F0, 4(SP)
    24  	FLDCW 0(SP)
    25  	MOVL 4(SP), AX
    26  	MOVL AX, ret+8(FP)
    27  	RET
    28  
    29  // _mul64x32(lo64 *uint64, a uint64, b uint32) (hi32 uint32)
    30  // sets *lo64 = low 64 bits of 96-bit product a*b; returns high 32 bits.
    31  TEXT ·_mul64by32(SB), NOSPLIT, $0
    32  	MOVL lo64+0(FP), CX
    33  	MOVL a_lo+4(FP), AX
    34  	MULL b+12(FP)
    35  	MOVL AX, 0(CX)
    36  	MOVL DX, BX
    37  	MOVL a_hi+8(FP), AX
    38  	MULL b+12(FP)
    39  	ADDL AX, BX
    40  	ADCL $0, DX
    41  	MOVL BX, 4(CX)
    42  	MOVL DX, AX
    43  	MOVL AX, hi32+16(FP)
    44  	RET
    45  
    46  TEXT ·_div64by32(SB), NOSPLIT, $0
    47  	MOVL r+12(FP), CX
    48  	MOVL a_lo+0(FP), AX
    49  	MOVL a_hi+4(FP), DX
    50  	DIVL b+8(FP)
    51  	MOVL DX, 0(CX)
    52  	MOVL AX, q+16(FP)
    53  	RET