github.com/emmansun/gmsm@v0.29.1/internal/bigmod/nat_s390x.s (about) 1 // Copyright 2016 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-32 11 MOVD $4, R5 12 JMP addMulVVWy(SB) 13 14 // func addMulVVW1024(z, x *uint, y uint) (c uint) 15 TEXT ·addMulVVW1024(SB), $0-32 16 MOVD $16, R5 17 JMP addMulVVWy(SB) 18 19 // func addMulVVW1536(z, x *uint, y uint) (c uint) 20 TEXT ·addMulVVW1536(SB), $0-32 21 MOVD $24, R5 22 JMP addMulVVWy(SB) 23 24 // func addMulVVW2048(z, x *uint, y uint) (c uint) 25 TEXT ·addMulVVW2048(SB), $0-32 26 MOVD $32, R5 27 JMP addMulVVWy(SB) 28 29 TEXT addMulVVWy(SB), NOFRAME|NOSPLIT, $0 30 MOVD z+0(FP), R2 31 MOVD x+8(FP), R8 32 MOVD y+16(FP), R9 33 34 MOVD $0, R1 // i*8 = 0 35 MOVD $0, R7 // i = 0 36 MOVD $0, R0 // make sure it's zero 37 MOVD $0, R4 // c = 0 38 39 MOVD R5, R12 40 AND $-2, R12 41 CMPBGE R5, $2, A6 42 BR E6 43 44 A6: 45 MOVD (R8)(R1*1), R6 46 MULHDU R9, R6 47 MOVD (R2)(R1*1), R10 48 ADDC R10, R11 // add to low order bits 49 ADDE R0, R6 50 ADDC R4, R11 51 ADDE R0, R6 52 MOVD R6, R4 53 MOVD R11, (R2)(R1*1) 54 55 MOVD (8)(R8)(R1*1), R6 56 MULHDU R9, R6 57 MOVD (8)(R2)(R1*1), R10 58 ADDC R10, R11 // add to low order bits 59 ADDE R0, R6 60 ADDC R4, R11 61 ADDE R0, R6 62 MOVD R6, R4 63 MOVD R11, (8)(R2)(R1*1) 64 65 ADD $16, R1 // i*8 + 8 66 ADD $2, R7 // i++ 67 68 CMPBLT R7, R12, A6 69 BR E6 70 71 L6: 72 // TODO: drop unused single-step loop. 73 MOVD (R8)(R1*1), R6 74 MULHDU R9, R6 75 MOVD (R2)(R1*1), R10 76 ADDC R10, R11 // add to low order bits 77 ADDE R0, R6 78 ADDC R4, R11 79 ADDE R0, R6 80 MOVD R6, R4 81 MOVD R11, (R2)(R1*1) 82 83 ADD $8, R1 // i*8 + 8 84 ADD $1, R7 // i++ 85 86 E6: 87 CMPBLT R7, R5, L6 // i < n 88 89 MOVD R4, c+24(FP) 90 RET