Debian Codegraph @

utils/xor/xor_arm.s

raw
1 // Copyright 2022 The Pion Authors. All rights reserved.
2 // Use of this source code is governed by an MIT
3 // license that can be found in the LICENSE file.
4
5 #include "textflag.h"
6
7 // func xorBytesARM32(dst, a, b *byte, n int)
8 TEXT ·xorBytesARM32(SB), NOSPLIT|NOFRAME, $0
9 MOVW dst+0(FP), R0
10 MOVW a+4(FP), R1
11 MOVW b+8(FP), R2
12 MOVW n+12(FP), R3
13 CMP $4, R3
14 BLT less_than4
15
16 loop_4:
17 MOVW.P 4(R1), R4
18 MOVW.P 4(R2), R5
19 EOR R4, R5, R5
20 MOVW.P R5, 4(R0)
21
22 SUB $4, R3
23 CMP $4, R3
24 BGE loop_4
25
26 less_than4:
27 CMP $2, R3
28 BLT less_than2
29 MOVH.P 2(R1), R4
30 MOVH.P 2(R2), R5
31 EOR R4, R5, R5
32 MOVH.P R5, 2(R0)
33
34 SUB $2, R3
35
36 less_than2:
37 CMP $0, R3
38 BEQ end
39 MOVB (R1), R4
40 MOVB (R2), R5
41 EOR R4, R5, R5
42 MOVB R5, (R0)
43 end:
44 RET
45
46 // func xorBytesNEON32(dst, a, b *byte, n int)
47 TEXT ·xorBytesNEON32(SB), NOSPLIT|NOFRAME, $0
48 MOVW dst+0(FP), R0
49 MOVW a+4(FP), R1
50 MOVW b+8(FP), R2
51 MOVW n+12(FP), R3
52 CMP $32, R3
53 BLT less_than32
54
55 loop_32:
56 WORD $0xF421020D // vld1.u8 {q0, q1}, [r1]!
57 WORD $0xF422420D // vld1.u8 {q2, q3}, [r2]!
58 WORD $0xF3004154 // veor q2, q0, q2
59 WORD $0xF3026156 // veor q3, q1, q3
60 WORD $0xF400420D // vst1.u8 {q2, q3}, [r0]!
61
62 SUB $32, R3
63 CMP $32, R3
64 BGE loop_32
65
66 less_than32:
67 CMP $16, R3
68 BLT less_than16
69 WORD $0xF4210A0D // vld1.u8 q0, [r1]!
70 WORD $0xF4222A0D // vld1.u8 q1, [r2]!
71 WORD $0xF3002152 // veor q1, q0, q1
72 WORD $0xF4002A0D // vst1.u8 {q1}, [r0]!
73
74 SUB $16, R3
75
76 less_than16:
77 CMP $8, R3
78 BLT less_than8
79 WORD $0xF421070D // vld1.u8 d0, [r1]!
80 WORD $0xF422170D // vld1.u8 d1, [r2]!
81 WORD $0xF3001111 // veor d1, d0, d1
82 WORD $0xF400170D // vst1.u8 {d1}, [r0]!
83
84 SUB $8, R3
85
86 less_than8:
87 CMP $4, R3
88 BLT less_than4
89 MOVW.P 4(R1), R4
90 MOVW.P 4(R2), R5
91 EOR R4, R5, R5
92 MOVW.P R5, 4(R0)
93
94 SUB $4, R3
95
96 less_than4:
97 CMP $2, R3
98 BLT less_than2
99 MOVH.P 2(R1), R4
100 MOVH.P 2(R2), R5
101 EOR R4, R5, R5
102 MOVH.P R5, 2(R0)
103
104 SUB $2, R3
105
106 less_than2:
107 CMP $0, R3
108 BEQ end
109 MOVB (R1), R4
110 MOVB (R2), R5
111 EOR R4, R5, R5
112 MOVB R5, (R0)
113 end:
114 RET