3 // Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
5 // Use of this source code is governed by a BSD-style license
6 // that can be found in the LICENSE file in the root of the source
7 // tree. An additional intellectual property rights grant can be found
8 // in the file PATENTS. All contributing project authors may
9 // be found in the AUTHORS file in the root of the source tree.
11 // This file was originally licensed as follows. It has been
12 // relicensed with permission from the copyright holders.
16 // File Name: armCOMM_s.h
18 // Last Modified Revision: 13871
19 // Last Modified Date: Fri, 09 May 2008
21 // (c) Copyright 2007-2008 ARM Limited. All Rights Reserved.
25 // ARM optimized OpenMAX common header file
28 .set _SBytes, 0 // Number of scratch bytes on stack
29 .set _Workspace, 0 // Stack offset of scratch workspace
31 .set _RRegList, 0 // R saved register list (last register number)
32 .set _DRegList, 0 // D saved register list (last register number)
34 // Work out list of D saved registers, like for R registers.
35 .macro _M_GETDREGLIST dreg
81 .warning "Unrecognized saved d register limit: \rreg"
84 //////////////////////////////////////////////////////////
85 // Function header and footer macros
86 //////////////////////////////////////////////////////////
88 // Function Header Macro
89 // Generates the function prologue
90 // Note that functions should all be "stack-moves-once"
91 // The FNSTART and FNEND macros should be the only places
92 // where the stack moves.
94 // name = function name
95 // rreg = "" don't stack any registers
96 // "lr" stack "lr" only
97 // "rN" stack registers "r4-rN,lr"
98 // dreg = "" don't stack any D registers
99 // "dN" stack registers "d8-dN"
101 // Note: ARM Archicture procedure call standard AAPCS
102 // states that r4-r11, sp, d8-d15 must be preserved by
103 // a compliant function.
104 .macro M_START name, rreg, dreg
107 // Define the function and make it external.
109 .section .text.\name,"ax",%progbits
113 // Save specified R registers
116 // Save specified D registers
120 // Ensure size claimed on stack is 16-byte aligned for ARM64
121 .if (_SBytes & 15) != 0
122 .set _SBytes, _SBytes + (16 - (_SBytes & 15))
129 // Function Footer Macro
130 // Generates the function epilogue
132 // Restore the stack pointer to its original value on function entry
136 // Restore any saved R or D registers.
139 // Reset the global stack tracking variables back to their
144 // Based on the value of _DRegList, push the specified set of registers
146 // The ARM64 ABI says only v8-v15 needs to be saved across calls and only
147 // the lower 64 bits need to be saved.
150 sub sp, sp, (_DRegList - 7) * 16 // 16-byte alignment
185 // Based on the value of _RRegList, push the specified set of registers
187 // The ARM64 ABI says registers r19-r29 needs to be saved across calls.
188 // But for the FFT routines, we don't need to save anything, so just
189 // preserve the SP and LR.
197 // The opposite of _M_PUSH_DREG
232 add sp, sp, (_DRegList - 7) * 16 // 16-byte alignment
237 // The opposite of _M_PUSH_RREG
238 .macro _M_POP_RREG cc
245 // Produce function return instructions
251 // rsb - reverse subtract
252 // compute dst = src2 - src1, useful when src2 is an immediate value
253 .macro rsb dst, src1, src2
254 sub \dst, \src1, \src2