1 /*****************************************************************************
2 * asm.S: arm utility macros
3 *****************************************************************************
4 * Copyright (C) 2008-2014 x264 project
6 * Authors: Mans Rullgard <mans@mansr.com>
7 * David Conrad <lessen42@gmail.com>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
23 * This program is also available under a commercial proprietary license.
24 * For more information, contact us at licensing@x264.com.
25 *****************************************************************************/
53 .macro require8, val=1
54 ELF .eabi_attribute 24, \val
57 .macro preserve8, val=1
58 ELF .eabi_attribute 25, \val
61 .macro function name, export=1
64 .global EXTERN_ASM\name
65 ELF .hidden EXTERN_ASM\name
66 ELF .type EXTERN_ASM\name, %function
71 ELF .type \name, %function
78 #if HAVE_ARMV6T2 && !defined(PIC)
79 movw \rd, #:lower16:\val
80 movt \rd, #:upper16:\val
86 .macro movconst rd, val
88 movw \rd, #:lower16:\val
90 movt \rd, #:upper16:\val
97 #define GLUE(a, b) a ## b
98 #define JOIN(a, b) GLUE(a, b)
99 #define X(s) JOIN(EXTERN_ASM, s)
101 #define FENC_STRIDE 16
102 #define FDEC_STRIDE 32
104 .macro HORIZ_ADD dest, a, b
112 .macro SUMSUB_AB sum, diff, a, b
113 vadd.s16 \sum, \a, \b
114 vsub.s16 \diff, \a, \b
117 .macro SUMSUB_ABCD s1, d1, s2, d2, a, b, c, d
118 SUMSUB_AB \s1, \d1, \a, \b
119 SUMSUB_AB \s2, \d2, \c, \d
127 // dist = distance in elements (0 for vertical pass, 1/2 for horizontal passes)
128 // op = sumsub/amax (sum and diff / maximum of absolutes)
129 // d1/2 = destination registers
130 // s1/2 = source registers
131 .macro HADAMARD dist, op, d1, d2, s1, s2
138 SUMSUB_AB \d1, \d2, \s1, \s2
142 vmax.s16 \d1, \s1, \s2
146 .macro TRANSPOSE8x8 r0 r1 r2 r3 r4 r5 r6 r7
161 .macro TRANSPOSE4x4 r0 r1 r2 r3
168 .macro TRANSPOSE4x4_16 d0 d1 d2 d3