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 *****************************************************************************/
43 .macro require8, val=1
44 ELF .eabi_attribute 24, \val
47 .macro preserve8, val=1
48 ELF .eabi_attribute 25, \val
52 .global EXTERN_ASM\name
56 ELF .type \name, %function
62 #if HAVE_ARMV6T2 && !defined(PIC)
63 movw \rd, #:lower16:\val
64 movt \rd, #:upper16:\val
70 .macro movconst rd, val
72 movw \rd, #:lower16:\val
74 movt \rd, #:upper16:\val
81 #define FENC_STRIDE 16
82 #define FDEC_STRIDE 32
84 .macro HORIZ_ADD dest, a, b
92 .macro SUMSUB_AB sum, diff, a, b
94 vsub.s16 \diff, \a, \b
97 .macro SUMSUB_ABCD s1, d1, s2, d2, a, b, c, d
98 SUMSUB_AB \s1, \d1, \a, \b
99 SUMSUB_AB \s2, \d2, \c, \d
107 // dist = distance in elements (0 for vertical pass, 1/2 for horizontal passes)
108 // op = sumsub/amax (sum and diff / maximum of absolutes)
109 // d1/2 = destination registers
110 // s1/2 = source registers
111 .macro HADAMARD dist, op, d1, d2, s1, s2
118 SUMSUB_AB \d1, \d2, \s1, \s2
122 vmax.s16 \d1, \s1, \s2
126 .macro TRANSPOSE8x8 r0 r1 r2 r3 r4 r5 r6 r7
141 .macro TRANSPOSE4x4 r0 r1 r2 r3
148 .macro TRANSPOSE4x4_16 d0 d1 d2 d3