summaryrefslogtreecommitdiffstats
path: root/common/arm64/ihevc_mem_fns.s
blob: 5b1026b5ec64a5a3c4e91ce6bf59c9dbdd998530 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
///*****************************************************************************
//*
//* Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore
//*
//* Licensed under the Apache License, Version 2.0 (the "License");
//* you may not use this file except in compliance with the License.
//* You may obtain a copy of the License at:
//*
//* http://www.apache.org/licenses/LICENSE-2.0
//*
//* Unless required by applicable law or agreed to in writing, software
//* distributed under the License is distributed on an "AS IS" BASIS,
//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//* See the License for the specific language governing permissions and
//* limitations under the License.
//*
//*****************************************************************************/
///**
// *******************************************************************************
// * ,:file
// *  ihevc_mem_fns_neon.s
// *
// * ,:brief
// *  Contains function definitions for memory manipulation
// *
// * ,:author
// *     Naveen SR
// *
// * ,:par List of Functions:
// *  - ihevc_memcpy()
// *  - ihevc_memset_mul_8()
// *  - ihevc_memset_16bit_mul_8()
// *
// * ,:remarks
// *  None
// *
// *******************************************************************************
//*/

///**
//*******************************************************************************
//*
//* ,:brief
//*   memcpy of a 1d array
//*
//* ,:par Description:
//*   Does memcpy of 8bit data from source to destination for 8,16 or 32 number of bytes
//*
//* ,:param[in] pu1_dst
//*  UWORD8 pointer to the destination
//*
//* ,:param[in] pu1_src
//*  UWORD8 pointer to the source
//*
//* ,:param[in] num_bytes
//*  number of bytes to copy
//* ,:returns
//*
//* ,:remarks
//*  None
//*
//*******************************************************************************
//*/
//void ihevc_memcpy_mul_8(UWORD8 *pu1_dst,
//                      UWORD8 *pu1_src,
//                      UWORD8 num_bytes)
//**************Variables Vs Registers*************************
//    x0 => *pu1_dst
//    x1 => *pu1_src
//    x2 => num_bytes

.text
.p2align 2


    .global ihevc_memcpy_mul_8_av8
.type ihevc_memcpy_mul_8_av8, %function

ihevc_memcpy_mul_8_av8:

LOOP_NEON_MEMCPY_MUL_8:
    // Memcpy 8 bytes
    LD1         {v0.8b},[x1],#8
    ST1         {v0.8b},[x0],#8

    SUBS        x2,x2,#8
    BNE         LOOP_NEON_MEMCPY_MUL_8
    ret



//*******************************************************************************
//*/
//void ihevc_memcpy(UWORD8 *pu1_dst,
//                  UWORD8 *pu1_src,
//                  UWORD8 num_bytes)
//**************Variables Vs Registers*************************
//    x0 => *pu1_dst
//    x1 => *pu1_src
//    x2 => num_bytes



    .global ihevc_memcpy_av8
.type ihevc_memcpy_av8, %function

ihevc_memcpy_av8:
    SUBS        x2,x2,#8
    BLT         ARM_MEMCPY
LOOP_NEON_MEMCPY:
    // Memcpy 8 bytes
    LD1         {v0.8b},[x1],#8
    ST1         {v0.8b},[x0],#8

    SUBS        x2,x2,#8
    BGE         LOOP_NEON_MEMCPY
    CMN         x2,#8
    BEQ         MEMCPY_RETURN

ARM_MEMCPY:
    ADD         x2,x2,#8

LOOP_ARM_MEMCPY:
    LDRB        w3,[x1],#1
    STRB        w3,[x0],#1
    SUBS        x2,x2,#1
    BNE         LOOP_ARM_MEMCPY
MEMCPY_RETURN:
    ret




//void ihevc_memset_mul_8(UWORD8 *pu1_dst,
//                       UWORD8 value,
//                       UWORD8 num_bytes)
//**************Variables Vs Registers*************************
//    x0 => *pu1_dst
//    x1 => value
//    x2 => num_bytes

.text
.p2align 2



    .global ihevc_memset_mul_8_av8
.type ihevc_memset_mul_8_av8, %function

ihevc_memset_mul_8_av8:

// Assumptions: numbytes is either 8, 16 or 32
    dup         v0.8b,w1
LOOP_MEMSET_MUL_8:
    // Memset 8 bytes
    ST1         {v0.8b},[x0],#8

    SUBS        x2,x2,#8
    BNE         LOOP_MEMSET_MUL_8

    ret




//void ihevc_memset(UWORD8 *pu1_dst,
//                       UWORD8 value,
//                       UWORD8 num_bytes)
//**************Variables Vs Registers*************************
//    x0 => *pu1_dst
//    x1 => value
//    x2 => num_bytes



    .global ihevc_memset_av8
.type ihevc_memset_av8, %function

ihevc_memset_av8:
    SUBS        x2,x2,#8
    BLT         ARM_MEMSET
    dup         v0.8b,w1
LOOP_NEON_MEMSET:
    // Memcpy 8 bytes
    ST1         {v0.8b},[x0],#8

    SUBS        x2,x2,#8
    BGE         LOOP_NEON_MEMSET
    CMN         x2,#8
    BEQ         MEMSET_RETURN

ARM_MEMSET:
    ADD         x2,x2,#8

LOOP_ARM_MEMSET:
    STRB        w1,[x0],#1
    SUBS        x2,x2,#1
    BNE         LOOP_ARM_MEMSET

MEMSET_RETURN:
    ret




//void ihevc_memset_16bit_mul_8(UWORD16 *pu2_dst,
//                                      UWORD16 value,
//                                      UWORD8 num_words)
//**************Variables Vs Registers*************************
//    x0 => *pu2_dst
//    x1 => value
//    x2 => num_words

.text
.p2align 2



    .global ihevc_memset_16bit_mul_8_av8
.type ihevc_memset_16bit_mul_8_av8, %function

ihevc_memset_16bit_mul_8_av8:

// Assumptions: num_words is either 8, 16 or 32

    // Memset 8 words
    dup         v0.8h,w1
LOOP_MEMSET_16BIT_MUL_8:
    ST1         {v0.8h},[x0],#16

    SUBS        x2,x2,#8
    BNE         LOOP_MEMSET_16BIT_MUL_8

    ret




//void ihevc_memset_16bit(UWORD16 *pu2_dst,
//                       UWORD16 value,
//                       UWORD8 num_words)
//**************Variables Vs Registers*************************
//    x0 => *pu2_dst
//    x1 => value
//    x2 => num_words



    .global ihevc_memset_16bit_av8
.type ihevc_memset_16bit_av8, %function

ihevc_memset_16bit_av8:
    SUBS        x2,x2,#8
    BLT         ARM_MEMSET_16BIT
    dup         v0.8h,w1
LOOP_NEON_MEMSET_16BIT:
    // Memset 8 words
    ST1         {v0.8h},[x0],#16

    SUBS        x2,x2,#8
    BGE         LOOP_NEON_MEMSET_16BIT
    CMN         x2,#8
    BEQ         MEMSET_16BIT_RETURN

ARM_MEMSET_16BIT:
    ADD         x2,x2,#8

LOOP_ARM_MEMSET_16BIT:
    STRH        w1,[x0],#2
    SUBS        x2,x2,#1
    BNE         LOOP_ARM_MEMSET_16BIT

MEMSET_16BIT_RETURN:
    ret




    .section .note.GNU-stack,"",%progbits