github.com/emmansun/gmsm@v0.29.1/internal/bigmod/nat_386.s (about)

     1  // Copyright 2009 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  //go:build !purego
     6  
     7  #include "textflag.h"
     8  
     9  // func addMulVVW256(z, x *uint, y uint) (c uint)
    10  TEXT ·addMulVVW256(SB), $0-16
    11  	MOVL	$8, BX
    12  	JMP		addMulVVWy(SB)
    13  
    14  // func addMulVVW1024(z, x *uint, y uint) (c uint)
    15  TEXT ·addMulVVW1024(SB), $0-16
    16  	MOVL	$32, BX
    17  	JMP		addMulVVWy(SB)
    18  
    19  // func addMulVVW1536(z, x *uint, y uint) (c uint)
    20  TEXT ·addMulVVW1536(SB), $0-16
    21  	MOVL	$48, BX
    22  	JMP		addMulVVWy(SB)
    23  
    24  // func addMulVVW2048(z, x *uint, y uint) (c uint)
    25  TEXT ·addMulVVW2048(SB), $0-16
    26  	MOVL	$64, BX
    27  	JMP		addMulVVWy(SB)
    28  
    29  TEXT addMulVVWy(SB), NOFRAME|NOSPLIT, $0
    30  	MOVL z+0(FP), DI
    31  	MOVL x+4(FP), SI
    32  	MOVL y+8(FP), BP
    33  	LEAL (DI)(BX*4), DI
    34  	LEAL (SI)(BX*4), SI
    35  	NEGL BX			// i = -n
    36  	MOVL $0, CX		// c = 0
    37  	JMP E6
    38  
    39  L6:	MOVL (SI)(BX*4), AX
    40  	MULL BP
    41  	ADDL CX, AX
    42  	ADCL $0, DX
    43  	ADDL AX, (DI)(BX*4)
    44  	ADCL $0, DX
    45  	MOVL DX, CX
    46  	ADDL $1, BX		// i++
    47  
    48  E6:	CMPL BX, $0		// i < 0
    49  	JL L6
    50  
    51  	MOVL CX, c+12(FP)
    52  	RET