Text file src/crypto/internal/bigmod/nat_386.s

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

View as plain text