github.com/icodeface/tls@v0.0.0-20230910023335-34df9250cd12/internal/x/crypto/curve25519/cswap_amd64.s (about)

     1  // Copyright 2012 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  // +build amd64,!gccgo,!appengine
     6  
     7  // func cswap(inout *[4][5]uint64, v uint64)
     8  TEXT ·cswap(SB),7,$0
     9  	MOVQ inout+0(FP),DI
    10  	MOVQ v+8(FP),SI
    11  
    12  	SUBQ $1, SI
    13  	NOTQ SI
    14  	MOVQ SI, X15
    15  	PSHUFD $0x44, X15, X15
    16  
    17  	MOVOU 0(DI), X0
    18  	MOVOU 16(DI), X2
    19  	MOVOU 32(DI), X4
    20  	MOVOU 48(DI), X6
    21  	MOVOU 64(DI), X8
    22  	MOVOU 80(DI), X1
    23  	MOVOU 96(DI), X3
    24  	MOVOU 112(DI), X5
    25  	MOVOU 128(DI), X7
    26  	MOVOU 144(DI), X9
    27  
    28  	MOVO X1, X10
    29  	MOVO X3, X11
    30  	MOVO X5, X12
    31  	MOVO X7, X13
    32  	MOVO X9, X14
    33  
    34  	PXOR X0, X10
    35  	PXOR X2, X11
    36  	PXOR X4, X12
    37  	PXOR X6, X13
    38  	PXOR X8, X14
    39  	PAND X15, X10
    40  	PAND X15, X11
    41  	PAND X15, X12
    42  	PAND X15, X13
    43  	PAND X15, X14
    44  	PXOR X10, X0
    45  	PXOR X10, X1
    46  	PXOR X11, X2
    47  	PXOR X11, X3
    48  	PXOR X12, X4
    49  	PXOR X12, X5
    50  	PXOR X13, X6
    51  	PXOR X13, X7
    52  	PXOR X14, X8
    53  	PXOR X14, X9
    54  
    55  	MOVOU X0, 0(DI)
    56  	MOVOU X2, 16(DI)
    57  	MOVOU X4, 32(DI)
    58  	MOVOU X6, 48(DI)
    59  	MOVOU X8, 64(DI)
    60  	MOVOU X1, 80(DI)
    61  	MOVOU X3, 96(DI)
    62  	MOVOU X5, 112(DI)
    63  	MOVOU X7, 128(DI)
    64  	MOVOU X9, 144(DI)
    65  	RET