...
1// Copyright 2013 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 && (ppc64 || ppc64le)
6
7#include "textflag.h"
8
9// func addMulVVW1024(z, x *uint, y uint) (c uint)
10TEXT ·addMulVVW1024(SB), $0-32
11 MOVD $16, R22 // R22 = z_len
12 JMP addMulVVWx(SB)
13
14// func addMulVVW1536(z, x *uint, y uint) (c uint)
15TEXT ·addMulVVW1536(SB), $0-32
16 MOVD $24, R22 // R22 = z_len
17 JMP addMulVVWx(SB)
18
19// func addMulVVW2048(z, x *uint, y uint) (c uint)
20TEXT ·addMulVVW2048(SB), $0-32
21 MOVD $32, R22 // R22 = z_len
22 JMP addMulVVWx(SB)
23
24TEXT addMulVVWx(SB), NOFRAME|NOSPLIT, $0
25 MOVD z+0(FP), R10 // R10 = z[]
26 MOVD x+8(FP), R8 // R8 = x[]
27 MOVD y+16(FP), R9 // R9 = y
28
29 MOVD R0, R3 // R3 will be the index register
30 CMP R0, R22
31 MOVD R0, R4 // R4 = c = 0
32 MOVD R22, CTR // Initialize loop counter
33 BEQ done
34 PCALIGN $16
35
36loop:
37 MOVD (R8)(R3), R20 // Load x[i]
38 MOVD (R10)(R3), R21 // Load z[i]
39 MULLD R9, R20, R6 // R6 = Low-order(x[i]*y)
40 MULHDU R9, R20, R7 // R7 = High-order(x[i]*y)
41 ADDC R21, R6 // R6 = z0
42 ADDZE R7 // R7 = z1
43 ADDC R4, R6 // R6 = z0 + c + 0
44 ADDZE R7, R4 // c += z1
45 MOVD R6, (R10)(R3) // Store z[i]
46 ADD $8, R3
47 BC 16, 0, loop // bdnz
48
49done:
50 MOVD R4, c+24(FP)
51 RET
View as plain text