1 /*****************************************************************************
2 * asm.S: arm utility macros
3 *****************************************************************************
4 * Copyright (C) 2008-2016 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 *****************************************************************************/
60 #define HAVE_SECTION_DATA_REL_RO 1
62 #define HAVE_SECTION_DATA_REL_RO 0
65 .macro require8, val=1
66 ELF .eabi_attribute 24, \val
69 .macro preserve8, val=1
70 ELF .eabi_attribute 25, \val
73 .macro function name, export=1
75 ELF .size \name, . - \name
81 .global EXTERN_ASM\name
82 ELF .hidden EXTERN_ASM\name
83 ELF .type EXTERN_ASM\name, %function
84 FUNC .func EXTERN_ASM\name
88 ELF .type \name, %function
94 .macro const name, align=2, relocate=0
96 ELF .size \name, . - \name
99 .if HAVE_SECTION_DATA_REL_RO && \relocate
100 .section .data.rel.ro
108 .macro movrel rd, val
114 .word \val - (2f + 8)
118 movw \rd, #:lower16:\val
119 movt \rd, #:upper16:\val
125 .macro movrelx rd, val, got
126 #if defined(PIC) && defined(__ELF__)
134 .word _GLOBAL_OFFSET_TABLE_ - (3f + 8)
138 #elif defined(PIC) && defined(__APPLE__)
146 .non_lazy_symbol_pointer
148 .indirect_symbol \val
156 .macro movconst rd, val
158 movw \rd, #:lower16:\val
160 movt \rd, #:upper16:\val
167 #define GLUE(a, b) a ## b
168 #define JOIN(a, b) GLUE(a, b)
169 #define X(s) JOIN(EXTERN_ASM, s)
171 #define FENC_STRIDE 16
172 #define FDEC_STRIDE 32
174 .macro HORIZ_ADD dest, a, b
182 .macro SUMSUB_AB sum, diff, a, b
183 vadd.s16 \sum, \a, \b
184 vsub.s16 \diff, \a, \b
187 .macro SUMSUB_ABCD s1, d1, s2, d2, a, b, c, d
188 SUMSUB_AB \s1, \d1, \a, \b
189 SUMSUB_AB \s2, \d2, \c, \d
197 // dist = distance in elements (0 for vertical pass, 1/2 for horizontal passes)
198 // op = sumsub/amax (sum and diff / maximum of absolutes)
199 // d1/2 = destination registers
200 // s1/2 = source registers
201 .macro HADAMARD dist, op, d1, d2, s1, s2
208 SUMSUB_AB \d1, \d2, \s1, \s2
212 vmax.s16 \d1, \s1, \s2
216 .macro TRANSPOSE8x8 r0 r1 r2 r3 r4 r5 r6 r7
231 .macro TRANSPOSE4x4 r0 r1 r2 r3
238 .macro TRANSPOSE4x4_16 d0 d1 d2 d3