summaryrefslogtreecommitdiffstats
path: root/media/libvpx/libvpx/vpx_dsp/mips/loopfilter_macros_dspr2.h
blob: 9af0b42360f0de271b210b038c08c14742183785 (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
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
/*
 *  Copyright (c) 2013 The WebM project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree. An additional intellectual property rights grant can be found
 *  in the file PATENTS.  All contributing project authors may
 *  be found in the AUTHORS file in the root of the source tree.
 */

#ifndef VPX_VPX_DSP_MIPS_LOOPFILTER_MACROS_DSPR2_H_
#define VPX_VPX_DSP_MIPS_LOOPFILTER_MACROS_DSPR2_H_

#include <stdlib.h>

#include "./vpx_dsp_rtcd.h"
#include "vpx/vpx_integer.h"
#include "vpx_mem/vpx_mem.h"

#ifdef __cplusplus
extern "C" {
#endif

#if HAVE_DSPR2
#define STORE_F0()                                                       \
  {                                                                      \
    __asm__ __volatile__(                                                \
        "sb     %[q1_f0],    1(%[s4])           \n\t"                    \
        "sb     %[q0_f0],    0(%[s4])           \n\t"                    \
        "sb     %[p0_f0],   -1(%[s4])           \n\t"                    \
        "sb     %[p1_f0],   -2(%[s4])           \n\t"                    \
                                                                         \
        :                                                                \
        : [q1_f0] "r"(q1_f0), [q0_f0] "r"(q0_f0), [p0_f0] "r"(p0_f0),    \
          [p1_f0] "r"(p1_f0), [s4] "r"(s4));                             \
                                                                         \
    __asm__ __volatile__(                                                \
        "srl    %[q1_f0],   %[q1_f0],   8       \n\t"                    \
        "srl    %[q0_f0],   %[q0_f0],   8       \n\t"                    \
        "srl    %[p0_f0],   %[p0_f0],   8       \n\t"                    \
        "srl    %[p1_f0],   %[p1_f0],   8       \n\t"                    \
                                                                         \
        : [q1_f0] "+r"(q1_f0), [q0_f0] "+r"(q0_f0), [p0_f0] "+r"(p0_f0), \
          [p1_f0] "+r"(p1_f0)                                            \
        :);                                                              \
                                                                         \
    __asm__ __volatile__(                                                \
        "sb     %[q1_f0],    1(%[s3])           \n\t"                    \
        "sb     %[q0_f0],    0(%[s3])           \n\t"                    \
        "sb     %[p0_f0],   -1(%[s3])           \n\t"                    \
        "sb     %[p1_f0],   -2(%[s3])           \n\t"                    \
                                                                         \
        : [p1_f0] "+r"(p1_f0)                                            \
        : [q1_f0] "r"(q1_f0), [q0_f0] "r"(q0_f0), [s3] "r"(s3),          \
          [p0_f0] "r"(p0_f0));                                           \
                                                                         \
    __asm__ __volatile__(                                                \
        "srl    %[q1_f0],   %[q1_f0],   8       \n\t"                    \
        "srl    %[q0_f0],   %[q0_f0],   8       \n\t"                    \
        "srl    %[p0_f0],   %[p0_f0],   8       \n\t"                    \
        "srl    %[p1_f0],   %[p1_f0],   8       \n\t"                    \
                                                                         \
        : [q1_f0] "+r"(q1_f0), [q0_f0] "+r"(q0_f0), [p0_f0] "+r"(p0_f0), \
          [p1_f0] "+r"(p1_f0)                                            \
        :);                                                              \
                                                                         \
    __asm__ __volatile__(                                                \
        "sb     %[q1_f0],    1(%[s2])           \n\t"                    \
        "sb     %[q0_f0],    0(%[s2])           \n\t"                    \
        "sb     %[p0_f0],   -1(%[s2])           \n\t"                    \
        "sb     %[p1_f0],   -2(%[s2])           \n\t"                    \
                                                                         \
        :                                                                \
        : [q1_f0] "r"(q1_f0), [q0_f0] "r"(q0_f0), [p0_f0] "r"(p0_f0),    \
          [p1_f0] "r"(p1_f0), [s2] "r"(s2));                             \
                                                                         \
    __asm__ __volatile__(                                                \
        "srl    %[q1_f0],   %[q1_f0],   8       \n\t"                    \
        "srl    %[q0_f0],   %[q0_f0],   8       \n\t"                    \
        "srl    %[p0_f0],   %[p0_f0],   8       \n\t"                    \
        "srl    %[p1_f0],   %[p1_f0],   8       \n\t"                    \
                                                                         \
        : [q1_f0] "+r"(q1_f0), [q0_f0] "+r"(q0_f0), [p0_f0] "+r"(p0_f0), \
          [p1_f0] "+r"(p1_f0)                                            \
        :);                                                              \
                                                                         \
    __asm__ __volatile__(                                                \
        "sb     %[q1_f0],    1(%[s1])           \n\t"                    \
        "sb     %[q0_f0],    0(%[s1])           \n\t"                    \
        "sb     %[p0_f0],   -1(%[s1])           \n\t"                    \
        "sb     %[p1_f0],   -2(%[s1])           \n\t"                    \
                                                                         \
        :                                                                \
        : [q1_f0] "r"(q1_f0), [q0_f0] "r"(q0_f0), [p0_f0] "r"(p0_f0),    \
          [p1_f0] "r"(p1_f0), [s1] "r"(s1));                             \
  }

#define STORE_F1()                                                             \
  {                                                                            \
    __asm__ __volatile__(                                                      \
        "sb     %[q2_r],     2(%[s4])           \n\t"                          \
        "sb     %[q1_r],     1(%[s4])           \n\t"                          \
        "sb     %[q0_r],     0(%[s4])           \n\t"                          \
        "sb     %[p0_r],    -1(%[s4])           \n\t"                          \
        "sb     %[p1_r],    -2(%[s4])           \n\t"                          \
        "sb     %[p2_r],    -3(%[s4])           \n\t"                          \
                                                                               \
        :                                                                      \
        : [q2_r] "r"(q2_r), [q1_r] "r"(q1_r), [q0_r] "r"(q0_r),                \
          [p0_r] "r"(p0_r), [p1_r] "r"(p1_r), [p2_r] "r"(p2_r), [s4] "r"(s4)); \
                                                                               \
    __asm__ __volatile__(                                                      \
        "srl    %[q2_r],    %[q2_r],    16      \n\t"                          \
        "srl    %[q1_r],    %[q1_r],    16      \n\t"                          \
        "srl    %[q0_r],    %[q0_r],    16      \n\t"                          \
        "srl    %[p0_r],    %[p0_r],    16      \n\t"                          \
        "srl    %[p1_r],    %[p1_r],    16      \n\t"                          \
        "srl    %[p2_r],    %[p2_r],    16      \n\t"                          \
                                                                               \
        : [q2_r] "+r"(q2_r), [q1_r] "+r"(q1_r), [q0_r] "+r"(q0_r),             \
          [p0_r] "+r"(p0_r), [p1_r] "+r"(p1_r), [p2_r] "+r"(p2_r)              \
        :);                                                                    \
                                                                               \
    __asm__ __volatile__(                                                      \
        "sb     %[q2_r],     2(%[s3])           \n\t"                          \
        "sb     %[q1_r],     1(%[s3])           \n\t"                          \
        "sb     %[q0_r],     0(%[s3])           \n\t"                          \
        "sb     %[p0_r],    -1(%[s3])           \n\t"                          \
        "sb     %[p1_r],    -2(%[s3])           \n\t"                          \
        "sb     %[p2_r],    -3(%[s3])           \n\t"                          \
                                                                               \
        :                                                                      \
        : [q2_r] "r"(q2_r), [q1_r] "r"(q1_r), [q0_r] "r"(q0_r),                \
          [p0_r] "r"(p0_r), [p1_r] "r"(p1_r), [p2_r] "r"(p2_r), [s3] "r"(s3)); \
                                                                               \
    __asm__ __volatile__(                                                      \
        "sb     %[q2_l],     2(%[s2])           \n\t"                          \
        "sb     %[q1_l],     1(%[s2])           \n\t"                          \
        "sb     %[q0_l],     0(%[s2])           \n\t"                          \
        "sb     %[p0_l],    -1(%[s2])           \n\t"                          \
        "sb     %[p1_l],    -2(%[s2])           \n\t"                          \
        "sb     %[p2_l],    -3(%[s2])           \n\t"                          \
                                                                               \
        :                                                                      \
        : [q2_l] "r"(q2_l), [q1_l] "r"(q1_l), [q0_l] "r"(q0_l),                \
          [p0_l] "r"(p0_l), [p1_l] "r"(p1_l), [p2_l] "r"(p2_l), [s2] "r"(s2)); \
                                                                               \
    __asm__ __volatile__(                                                      \
        "srl    %[q2_l],    %[q2_l],    16      \n\t"                          \
        "srl    %[q1_l],    %[q1_l],    16      \n\t"                          \
        "srl    %[q0_l],    %[q0_l],    16      \n\t"                          \
        "srl    %[p0_l],    %[p0_l],    16      \n\t"                          \
        "srl    %[p1_l],    %[p1_l],    16      \n\t"                          \
        "srl    %[p2_l],    %[p2_l],    16      \n\t"                          \
                                                                               \
        : [q2_l] "+r"(q2_l), [q1_l] "+r"(q1_l), [q0_l] "+r"(q0_l),             \
          [p0_l] "+r"(p0_l), [p1_l] "+r"(p1_l), [p2_l] "+r"(p2_l)              \
        :);                                                                    \
                                                                               \
    __asm__ __volatile__(                                                      \
        "sb     %[q2_l],     2(%[s1])           \n\t"                          \
        "sb     %[q1_l],     1(%[s1])           \n\t"                          \
        "sb     %[q0_l],     0(%[s1])           \n\t"                          \
        "sb     %[p0_l],    -1(%[s1])           \n\t"                          \
        "sb     %[p1_l],    -2(%[s1])           \n\t"                          \
        "sb     %[p2_l],    -3(%[s1])           \n\t"                          \
                                                                               \
        :                                                                      \
        : [q2_l] "r"(q2_l), [q1_l] "r"(q1_l), [q0_l] "r"(q0_l),                \
          [p0_l] "r"(p0_l), [p1_l] "r"(p1_l), [p2_l] "r"(p2_l), [s1] "r"(s1)); \
  }

#define STORE_F2()                                                 \
  {                                                                \
    __asm__ __volatile__(                                          \
        "sb     %[q6_r],     6(%[s4])           \n\t"              \
        "sb     %[q5_r],     5(%[s4])           \n\t"              \
        "sb     %[q4_r],     4(%[s4])           \n\t"              \
        "sb     %[q3_r],     3(%[s4])           \n\t"              \
        "sb     %[q2_r],     2(%[s4])           \n\t"              \
        "sb     %[q1_r],     1(%[s4])           \n\t"              \
        "sb     %[q0_r],     0(%[s4])           \n\t"              \
        "sb     %[p0_r],    -1(%[s4])           \n\t"              \
        "sb     %[p1_r],    -2(%[s4])           \n\t"              \
        "sb     %[p2_r],    -3(%[s4])           \n\t"              \
        "sb     %[p3_r],    -4(%[s4])           \n\t"              \
        "sb     %[p4_r],    -5(%[s4])           \n\t"              \
        "sb     %[p5_r],    -6(%[s4])           \n\t"              \
        "sb     %[p6_r],    -7(%[s4])           \n\t"              \
                                                                   \
        :                                                          \
        : [q6_r] "r"(q6_r), [q5_r] "r"(q5_r), [q4_r] "r"(q4_r),    \
          [q3_r] "r"(q3_r), [q2_r] "r"(q2_r), [q1_r] "r"(q1_r),    \
          [q0_r] "r"(q0_r), [p0_r] "r"(p0_r), [p1_r] "r"(p1_r),    \
          [p2_r] "r"(p2_r), [p3_r] "r"(p3_r), [p4_r] "r"(p4_r),    \
          [p5_r] "r"(p5_r), [p6_r] "r"(p6_r), [s4] "r"(s4));       \
                                                                   \
    __asm__ __volatile__(                                          \
        "srl    %[q6_r],    %[q6_r],    16      \n\t"              \
        "srl    %[q5_r],    %[q5_r],    16      \n\t"              \
        "srl    %[q4_r],    %[q4_r],    16      \n\t"              \
        "srl    %[q3_r],    %[q3_r],    16      \n\t"              \
        "srl    %[q2_r],    %[q2_r],    16      \n\t"              \
        "srl    %[q1_r],    %[q1_r],    16      \n\t"              \
        "srl    %[q0_r],    %[q0_r],    16      \n\t"              \
        "srl    %[p0_r],    %[p0_r],    16      \n\t"              \
        "srl    %[p1_r],    %[p1_r],    16      \n\t"              \
        "srl    %[p2_r],    %[p2_r],    16      \n\t"              \
        "srl    %[p3_r],    %[p3_r],    16      \n\t"              \
        "srl    %[p4_r],    %[p4_r],    16      \n\t"              \
        "srl    %[p5_r],    %[p5_r],    16      \n\t"              \
        "srl    %[p6_r],    %[p6_r],    16      \n\t"              \
                                                                   \
        : [q6_r] "+r"(q6_r), [q5_r] "+r"(q5_r), [q4_r] "+r"(q4_r), \
          [q3_r] "+r"(q3_r), [q2_r] "+r"(q2_r), [q1_r] "+r"(q1_r), \
          [q0_r] "+r"(q0_r), [p0_r] "+r"(p0_r), [p1_r] "+r"(p1_r), \
          [p2_r] "+r"(p2_r), [p3_r] "+r"(p3_r), [p4_r] "+r"(p4_r), \
          [p5_r] "+r"(p5_r), [p6_r] "+r"(p6_r)                     \
        :);                                                        \
                                                                   \
    __asm__ __volatile__(                                          \
        "sb     %[q6_r],     6(%[s3])           \n\t"              \
        "sb     %[q5_r],     5(%[s3])           \n\t"              \
        "sb     %[q4_r],     4(%[s3])           \n\t"              \
        "sb     %[q3_r],     3(%[s3])           \n\t"              \
        "sb     %[q2_r],     2(%[s3])           \n\t"              \
        "sb     %[q1_r],     1(%[s3])           \n\t"              \
        "sb     %[q0_r],     0(%[s3])           \n\t"              \
        "sb     %[p0_r],    -1(%[s3])           \n\t"              \
        "sb     %[p1_r],    -2(%[s3])           \n\t"              \
        "sb     %[p2_r],    -3(%[s3])           \n\t"              \
        "sb     %[p3_r],    -4(%[s3])           \n\t"              \
        "sb     %[p4_r],    -5(%[s3])           \n\t"              \
        "sb     %[p5_r],    -6(%[s3])           \n\t"              \
        "sb     %[p6_r],    -7(%[s3])           \n\t"              \
                                                                   \
        :                                                          \
        : [q6_r] "r"(q6_r), [q5_r] "r"(q5_r), [q4_r] "r"(q4_r),    \
          [q3_r] "r"(q3_r), [q2_r] "r"(q2_r), [q1_r] "r"(q1_r),    \
          [q0_r] "r"(q0_r), [p0_r] "r"(p0_r), [p1_r] "r"(p1_r),    \
          [p2_r] "r"(p2_r), [p3_r] "r"(p3_r), [p4_r] "r"(p4_r),    \
          [p5_r] "r"(p5_r), [p6_r] "r"(p6_r), [s3] "r"(s3));       \
                                                                   \
    __asm__ __volatile__(                                          \
        "sb     %[q6_l],     6(%[s2])           \n\t"              \
        "sb     %[q5_l],     5(%[s2])           \n\t"              \
        "sb     %[q4_l],     4(%[s2])           \n\t"              \
        "sb     %[q3_l],     3(%[s2])           \n\t"              \
        "sb     %[q2_l],     2(%[s2])           \n\t"              \
        "sb     %[q1_l],     1(%[s2])           \n\t"              \
        "sb     %[q0_l],     0(%[s2])           \n\t"              \
        "sb     %[p0_l],    -1(%[s2])           \n\t"              \
        "sb     %[p1_l],    -2(%[s2])           \n\t"              \
        "sb     %[p2_l],    -3(%[s2])           \n\t"              \
        "sb     %[p3_l],    -4(%[s2])           \n\t"              \
        "sb     %[p4_l],    -5(%[s2])           \n\t"              \
        "sb     %[p5_l],    -6(%[s2])           \n\t"              \
        "sb     %[p6_l],    -7(%[s2])           \n\t"              \
                                                                   \
        :                                                          \
        : [q6_l] "r"(q6_l), [q5_l] "r"(q5_l), [q4_l] "r"(q4_l),    \
          [q3_l] "r"(q3_l), [q2_l] "r"(q2_l), [q1_l] "r"(q1_l),    \
          [q0_l] "r"(q0_l), [p0_l] "r"(p0_l), [p1_l] "r"(p1_l),    \
          [p2_l] "r"(p2_l), [p3_l] "r"(p3_l), [p4_l] "r"(p4_l),    \
          [p5_l] "r"(p5_l), [p6_l] "r"(p6_l), [s2] "r"(s2));       \
                                                                   \
    __asm__ __volatile__(                                          \
        "srl    %[q6_l],    %[q6_l],    16     \n\t"               \
        "srl    %[q5_l],    %[q5_l],    16     \n\t"               \
        "srl    %[q4_l],    %[q4_l],    16     \n\t"               \
        "srl    %[q3_l],    %[q3_l],    16     \n\t"               \
        "srl    %[q2_l],    %[q2_l],    16     \n\t"               \
        "srl    %[q1_l],    %[q1_l],    16     \n\t"               \
        "srl    %[q0_l],    %[q0_l],    16     \n\t"               \
        "srl    %[p0_l],    %[p0_l],    16     \n\t"               \
        "srl    %[p1_l],    %[p1_l],    16     \n\t"               \
        "srl    %[p2_l],    %[p2_l],    16     \n\t"               \
        "srl    %[p3_l],    %[p3_l],    16     \n\t"               \
        "srl    %[p4_l],    %[p4_l],    16     \n\t"               \
        "srl    %[p5_l],    %[p5_l],    16     \n\t"               \
        "srl    %[p6_l],    %[p6_l],    16     \n\t"               \
                                                                   \
        : [q6_l] "+r"(q6_l), [q5_l] "+r"(q5_l), [q4_l] "+r"(q4_l), \
          [q3_l] "+r"(q3_l), [q2_l] "+r"(q2_l), [q1_l] "+r"(q1_l), \
          [q0_l] "+r"(q0_l), [p0_l] "+r"(p0_l), [p1_l] "+r"(p1_l), \
          [p2_l] "+r"(p2_l), [p3_l] "+r"(p3_l), [p4_l] "+r"(p4_l), \
          [p5_l] "+r"(p5_l), [p6_l] "+r"(p6_l)                     \
        :);                                                        \
                                                                   \
    __asm__ __volatile__(                                          \
        "sb     %[q6_l],     6(%[s1])           \n\t"              \
        "sb     %[q5_l],     5(%[s1])           \n\t"              \
        "sb     %[q4_l],     4(%[s1])           \n\t"              \
        "sb     %[q3_l],     3(%[s1])           \n\t"              \
        "sb     %[q2_l],     2(%[s1])           \n\t"              \
        "sb     %[q1_l],     1(%[s1])           \n\t"              \
        "sb     %[q0_l],     0(%[s1])           \n\t"              \
        "sb     %[p0_l],    -1(%[s1])           \n\t"              \
        "sb     %[p1_l],    -2(%[s1])           \n\t"              \
        "sb     %[p2_l],    -3(%[s1])           \n\t"              \
        "sb     %[p3_l],    -4(%[s1])           \n\t"              \
        "sb     %[p4_l],    -5(%[s1])           \n\t"              \
        "sb     %[p5_l],    -6(%[s1])           \n\t"              \
        "sb     %[p6_l],    -7(%[s1])           \n\t"              \
                                                                   \
        :                                                          \
        : [q6_l] "r"(q6_l), [q5_l] "r"(q5_l), [q4_l] "r"(q4_l),    \
          [q3_l] "r"(q3_l), [q2_l] "r"(q2_l), [q1_l] "r"(q1_l),    \
          [q0_l] "r"(q0_l), [p0_l] "r"(p0_l), [p1_l] "r"(p1_l),    \
          [p2_l] "r"(p2_l), [p3_l] "r"(p3_l), [p4_l] "r"(p4_l),    \
          [p5_l] "r"(p5_l), [p6_l] "r"(p6_l), [s1] "r"(s1));       \
  }

#define PACK_LEFT_0TO3()                                              \
  {                                                                   \
    __asm__ __volatile__(                                             \
        "preceu.ph.qbl   %[p3_l],   %[p3]   \n\t"                     \
        "preceu.ph.qbl   %[p2_l],   %[p2]   \n\t"                     \
        "preceu.ph.qbl   %[p1_l],   %[p1]   \n\t"                     \
        "preceu.ph.qbl   %[p0_l],   %[p0]   \n\t"                     \
        "preceu.ph.qbl   %[q0_l],   %[q0]   \n\t"                     \
        "preceu.ph.qbl   %[q1_l],   %[q1]   \n\t"                     \
        "preceu.ph.qbl   %[q2_l],   %[q2]   \n\t"                     \
        "preceu.ph.qbl   %[q3_l],   %[q3]   \n\t"                     \
                                                                      \
        : [p3_l] "=&r"(p3_l), [p2_l] "=&r"(p2_l), [p1_l] "=&r"(p1_l), \
          [p0_l] "=&r"(p0_l), [q0_l] "=&r"(q0_l), [q1_l] "=&r"(q1_l), \
          [q2_l] "=&r"(q2_l), [q3_l] "=&r"(q3_l)                      \
        : [p3] "r"(p3), [p2] "r"(p2), [p1] "r"(p1), [p0] "r"(p0),     \
          [q0] "r"(q0), [q1] "r"(q1), [q2] "r"(q2), [q3] "r"(q3));    \
  }

#define PACK_LEFT_4TO7()                                              \
  {                                                                   \
    __asm__ __volatile__(                                             \
        "preceu.ph.qbl   %[p7_l],   %[p7]   \n\t"                     \
        "preceu.ph.qbl   %[p6_l],   %[p6]   \n\t"                     \
        "preceu.ph.qbl   %[p5_l],   %[p5]   \n\t"                     \
        "preceu.ph.qbl   %[p4_l],   %[p4]   \n\t"                     \
        "preceu.ph.qbl   %[q4_l],   %[q4]   \n\t"                     \
        "preceu.ph.qbl   %[q5_l],   %[q5]   \n\t"                     \
        "preceu.ph.qbl   %[q6_l],   %[q6]   \n\t"                     \
        "preceu.ph.qbl   %[q7_l],   %[q7]   \n\t"                     \
                                                                      \
        : [p7_l] "=&r"(p7_l), [p6_l] "=&r"(p6_l), [p5_l] "=&r"(p5_l), \
          [p4_l] "=&r"(p4_l), [q4_l] "=&r"(q4_l), [q5_l] "=&r"(q5_l), \
          [q6_l] "=&r"(q6_l), [q7_l] "=&r"(q7_l)                      \
        : [p7] "r"(p7), [p6] "r"(p6), [p5] "r"(p5), [p4] "r"(p4),     \
          [q4] "r"(q4), [q5] "r"(q5), [q6] "r"(q6), [q7] "r"(q7));    \
  }

#define PACK_RIGHT_0TO3()                                             \
  {                                                                   \
    __asm__ __volatile__(                                             \
        "preceu.ph.qbr   %[p3_r],   %[p3]  \n\t"                      \
        "preceu.ph.qbr   %[p2_r],   %[p2]   \n\t"                     \
        "preceu.ph.qbr   %[p1_r],   %[p1]   \n\t"                     \
        "preceu.ph.qbr   %[p0_r],   %[p0]   \n\t"                     \
        "preceu.ph.qbr   %[q0_r],   %[q0]   \n\t"                     \
        "preceu.ph.qbr   %[q1_r],   %[q1]   \n\t"                     \
        "preceu.ph.qbr   %[q2_r],   %[q2]   \n\t"                     \
        "preceu.ph.qbr   %[q3_r],   %[q3]   \n\t"                     \
                                                                      \
        : [p3_r] "=&r"(p3_r), [p2_r] "=&r"(p2_r), [p1_r] "=&r"(p1_r), \
          [p0_r] "=&r"(p0_r), [q0_r] "=&r"(q0_r), [q1_r] "=&r"(q1_r), \
          [q2_r] "=&r"(q2_r), [q3_r] "=&r"(q3_r)                      \
        : [p3] "r"(p3), [p2] "r"(p2), [p1] "r"(p1), [p0] "r"(p0),     \
          [q0] "r"(q0), [q1] "r"(q1), [q2] "r"(q2), [q3] "r"(q3));    \
  }

#define PACK_RIGHT_4TO7()                                             \
  {                                                                   \
    __asm__ __volatile__(                                             \
        "preceu.ph.qbr   %[p7_r],   %[p7]   \n\t"                     \
        "preceu.ph.qbr   %[p6_r],   %[p6]   \n\t"                     \
        "preceu.ph.qbr   %[p5_r],   %[p5]   \n\t"                     \
        "preceu.ph.qbr   %[p4_r],   %[p4]   \n\t"                     \
        "preceu.ph.qbr   %[q4_r],   %[q4]   \n\t"                     \
        "preceu.ph.qbr   %[q5_r],   %[q5]   \n\t"                     \
        "preceu.ph.qbr   %[q6_r],   %[q6]   \n\t"                     \
        "preceu.ph.qbr   %[q7_r],   %[q7]   \n\t"                     \
                                                                      \
        : [p7_r] "=&r"(p7_r), [p6_r] "=&r"(p6_r), [p5_r] "=&r"(p5_r), \
          [p4_r] "=&r"(p4_r), [q4_r] "=&r"(q4_r), [q5_r] "=&r"(q5_r), \
          [q6_r] "=&r"(q6_r), [q7_r] "=&r"(q7_r)                      \
        : [p7] "r"(p7), [p6] "r"(p6), [p5] "r"(p5), [p4] "r"(p4),     \
          [q4] "r"(q4), [q5] "r"(q5), [q6] "r"(q6), [q7] "r"(q7));    \
  }

#define COMBINE_LEFT_RIGHT_0TO2()                                         \
  {                                                                       \
    __asm__ __volatile__(                                                 \
        "precr.qb.ph    %[p2],  %[p2_l],    %[p2_r]    \n\t"              \
        "precr.qb.ph    %[p1],  %[p1_l],    %[p1_r]    \n\t"              \
        "precr.qb.ph    %[p0],  %[p0_l],    %[p0_r]    \n\t"              \
        "precr.qb.ph    %[q0],  %[q0_l],    %[q0_r]    \n\t"              \
        "precr.qb.ph    %[q1],  %[q1_l],    %[q1_r]    \n\t"              \
        "precr.qb.ph    %[q2],  %[q2_l],    %[q2_r]    \n\t"              \
                                                                          \
        : [p2] "=&r"(p2), [p1] "=&r"(p1), [p0] "=&r"(p0), [q0] "=&r"(q0), \
          [q1] "=&r"(q1), [q2] "=&r"(q2)                                  \
        : [p2_l] "r"(p2_l), [p2_r] "r"(p2_r), [p1_l] "r"(p1_l),           \
          [p1_r] "r"(p1_r), [p0_l] "r"(p0_l), [p0_r] "r"(p0_r),           \
          [q0_l] "r"(q0_l), [q0_r] "r"(q0_r), [q1_l] "r"(q1_l),           \
          [q1_r] "r"(q1_r), [q2_l] "r"(q2_l), [q2_r] "r"(q2_r));          \
  }

#define COMBINE_LEFT_RIGHT_3TO6()                                         \
  {                                                                       \
    __asm__ __volatile__(                                                 \
        "precr.qb.ph    %[p6],  %[p6_l],    %[p6_r]    \n\t"              \
        "precr.qb.ph    %[p5],  %[p5_l],    %[p5_r]    \n\t"              \
        "precr.qb.ph    %[p4],  %[p4_l],    %[p4_r]    \n\t"              \
        "precr.qb.ph    %[p3],  %[p3_l],    %[p3_r]    \n\t"              \
        "precr.qb.ph    %[q3],  %[q3_l],    %[q3_r]    \n\t"              \
        "precr.qb.ph    %[q4],  %[q4_l],    %[q4_r]    \n\t"              \
        "precr.qb.ph    %[q5],  %[q5_l],    %[q5_r]    \n\t"              \
        "precr.qb.ph    %[q6],  %[q6_l],    %[q6_r]    \n\t"              \
                                                                          \
        : [p6] "=&r"(p6), [p5] "=&r"(p5), [p4] "=&r"(p4), [p3] "=&r"(p3), \
          [q3] "=&r"(q3), [q4] "=&r"(q4), [q5] "=&r"(q5), [q6] "=&r"(q6)  \
        : [p6_l] "r"(p6_l), [p5_l] "r"(p5_l), [p4_l] "r"(p4_l),           \
          [p3_l] "r"(p3_l), [p6_r] "r"(p6_r), [p5_r] "r"(p5_r),           \
          [p4_r] "r"(p4_r), [p3_r] "r"(p3_r), [q3_l] "r"(q3_l),           \
          [q4_l] "r"(q4_l), [q5_l] "r"(q5_l), [q6_l] "r"(q6_l),           \
          [q3_r] "r"(q3_r), [q4_r] "r"(q4_r), [q5_r] "r"(q5_r),           \
          [q6_r] "r"(q6_r));                                              \
  }

#endif  // #if HAVE_DSPR2
#ifdef __cplusplus
}  // extern "C"
#endif

#endif  // VPX_VPX_DSP_MIPS_LOOPFILTER_MACROS_DSPR2_H_