2019-07-19 13:11:01 +00:00
|
|
|
#include "textflag.h"
|
|
|
|
|
2021-12-30 08:29:59 +00:00
|
|
|
#define mulBit(bit, in_1, in_2, out_1, out_2) \
|
2022-03-10 19:44:16 +00:00
|
|
|
VPSLLW bit, Y10, Y11 \
|
2022-03-09 11:38:53 +00:00
|
|
|
VPSLLQ $1, in_1, Y1 \
|
2022-03-10 19:44:16 +00:00
|
|
|
VPSRAW $15, Y11, Y12 \
|
2022-03-09 11:38:53 +00:00
|
|
|
VPALIGNR $8, Y1, in_1, Y2 \
|
|
|
|
VPAND Y1, Y14, Y3 \
|
2022-03-10 19:44:16 +00:00
|
|
|
VPSRLQ $63, Y2, Y2 \
|
2022-03-09 11:38:53 +00:00
|
|
|
VPUNPCKHQDQ Y3, Y3, Y3 \
|
2022-03-10 19:44:16 +00:00
|
|
|
VPXOR Y1, Y2, Y7 \
|
2022-03-09 11:38:53 +00:00
|
|
|
VPXOR Y3, in_2, out_1 \
|
2022-03-10 19:44:16 +00:00
|
|
|
VPXOR Y7, out_1, out_1 \
|
|
|
|
VPAND out_1, Y12, Y4 \
|
2022-03-09 11:38:53 +00:00
|
|
|
VPXOR Y4, in_1, out_2 \
|
2019-10-09 15:11:53 +00:00
|
|
|
|
2022-01-10 15:01:15 +00:00
|
|
|
// func mulByteSliceRightx2(c00c10, c01c11 *[4]uint64, n int, data *byte)
|
2022-03-09 11:38:53 +00:00
|
|
|
TEXT ·mulByteSliceRightx2(SB), NOSPLIT, $0
|
2022-03-10 19:44:16 +00:00
|
|
|
MOVQ c00c10+0(FP), AX
|
|
|
|
MOVQ c01c11+8(FP), BX
|
2021-12-28 17:24:59 +00:00
|
|
|
|
2022-03-09 11:38:53 +00:00
|
|
|
VPXOR Y13, Y13, Y13 // Y13 = 0x0000...
|
|
|
|
VPCMPEQB Y14, Y14, Y14 // Y14 = 0xFFFF...
|
|
|
|
VPSUBQ Y14, Y13, Y10
|
|
|
|
VPSLLQ $63, Y10, Y14 // Y14 = 0x10000000... (packed quad-words with HSB set)
|
2021-12-28 17:24:59 +00:00
|
|
|
|
2022-03-09 11:38:53 +00:00
|
|
|
MOVQ n+16(FP), CX
|
|
|
|
MOVQ data+24(FP), DX
|
2022-01-10 15:01:15 +00:00
|
|
|
|
2022-03-10 19:44:16 +00:00
|
|
|
VMOVDQU (AX), Y0
|
|
|
|
VMOVDQU (BX), Y8
|
|
|
|
|
2022-01-10 15:01:15 +00:00
|
|
|
loop:
|
2022-03-09 11:38:53 +00:00
|
|
|
CMPQ CX, $0
|
|
|
|
JEQ finish
|
2022-01-10 15:01:15 +00:00
|
|
|
|
2022-03-10 19:44:16 +00:00
|
|
|
VPBROADCASTB (DX), Y10
|
2022-03-09 11:38:53 +00:00
|
|
|
ADDQ $1, DX
|
2022-03-10 19:44:16 +00:00
|
|
|
SUBQ $1, CX
|
2019-07-19 13:11:01 +00:00
|
|
|
|
2022-03-10 19:44:16 +00:00
|
|
|
mulBit($8, Y0, Y8, Y5, Y6)
|
|
|
|
mulBit($9, Y5, Y6, Y0, Y8)
|
|
|
|
mulBit($10, Y0, Y8, Y5, Y6)
|
|
|
|
mulBit($11, Y5, Y6, Y0, Y8)
|
|
|
|
mulBit($12, Y0, Y8, Y5, Y6)
|
|
|
|
mulBit($13, Y5, Y6, Y0, Y8)
|
|
|
|
mulBit($14, Y0, Y8, Y5, Y6)
|
|
|
|
mulBit($15, Y5, Y6, Y0, Y8)
|
2019-07-19 13:11:01 +00:00
|
|
|
|
2022-03-09 11:38:53 +00:00
|
|
|
JMP loop
|
2022-01-10 15:01:15 +00:00
|
|
|
|
|
|
|
finish:
|
2022-03-09 11:38:53 +00:00
|
|
|
VMOVDQU Y0, (AX)
|
2022-03-10 19:44:16 +00:00
|
|
|
VMOVDQU Y8, (BX)
|
2019-10-09 15:11:53 +00:00
|
|
|
|
2022-03-09 11:38:53 +00:00
|
|
|
RET
|