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 *****************************************************************************/
59 .macro require8, val=1
60 ELF .eabi_attribute 24, \val
63 .macro preserve8, val=1
64 ELF .eabi_attribute 25, \val
67 .macro function name, export=1
69 ELF .size \name, . - \name
75 .global EXTERN_ASM\name
76 ELF .hidden EXTERN_ASM\name
77 ELF .type EXTERN_ASM\name, %function
78 FUNC .func EXTERN_ASM\name
82 ELF .type \name, %function
89 #if HAVE_ARMV6T2 && !defined(PIC)
90 movw \rd, #:lower16:\val
91 movt \rd, #:upper16:\val
97 .macro movconst rd, val
99 movw \rd, #:lower16:\val
101 movt \rd, #:upper16:\val
108 #define GLUE(a, b) a ## b
109 #define JOIN(a, b) GLUE(a, b)
110 #define X(s) JOIN(EXTERN_ASM, s)
112 #define FENC_STRIDE 16
113 #define FDEC_STRIDE 32
115 .macro HORIZ_ADD dest, a, b
123 .macro SUMSUB_AB sum, diff, a, b
124 vadd.s16 \sum, \a, \b
125 vsub.s16 \diff, \a, \b
128 .macro SUMSUB_ABCD s1, d1, s2, d2, a, b, c, d
129 SUMSUB_AB \s1, \d1, \a, \b
130 SUMSUB_AB \s2, \d2, \c, \d
138 // dist = distance in elements (0 for vertical pass, 1/2 for horizontal passes)
139 // op = sumsub/amax (sum and diff / maximum of absolutes)
140 // d1/2 = destination registers
141 // s1/2 = source registers
142 .macro HADAMARD dist, op, d1, d2, s1, s2
149 SUMSUB_AB \d1, \d2, \s1, \s2
153 vmax.s16 \d1, \s1, \s2
157 .macro TRANSPOSE8x8 r0 r1 r2 r3 r4 r5 r6 r7
172 .macro TRANSPOSE4x4 r0 r1 r2 r3
179 .macro TRANSPOSE4x4_16 d0 d1 d2 d3