Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
52868 views
1
/*
2
* check NEON registers for clobbering
3
* Copyright (c) 2008 Ramiro Polla <[email protected]>
4
* Copyright (c) 2013 Martin Storsjo
5
*
6
* This file is part of FFmpeg.
7
*
8
* FFmpeg is free software; you can redistribute it and/or
9
* modify it under the terms of the GNU Lesser General Public
10
* License as published by the Free Software Foundation; either
11
* version 2.1 of the License, or (at your option) any later version.
12
*
13
* FFmpeg is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
* Lesser General Public License for more details.
17
*
18
* You should have received a copy of the GNU Lesser General Public
19
* License along with FFmpeg; if not, write to the Free Software
20
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
*/
22
23
#ifndef AVUTIL_ARM_NEONTEST_H
24
#define AVUTIL_ARM_NEONTEST_H
25
26
#include <inttypes.h>
27
#include <stdint.h>
28
#include <stdlib.h>
29
#include <stdarg.h>
30
#include <string.h>
31
32
#include "libavutil/bswap.h"
33
34
#define storeneonregs(mem) \
35
__asm__ volatile( \
36
"vstm %0, {d8-d15}\n\t" \
37
:: "r"(mem) : "memory")
38
39
#define testneonclobbers(func, ctx, ...) \
40
uint64_t neon[2][8]; \
41
int ret; \
42
storeneonregs(neon[0]); \
43
ret = __real_ ## func(ctx, __VA_ARGS__); \
44
storeneonregs(neon[1]); \
45
if (memcmp(neon[0], neon[1], sizeof(neon[0]))) { \
46
int i; \
47
av_log(ctx, AV_LOG_ERROR, \
48
"NEON REGS CLOBBERED IN %s!\n", #func); \
49
for (i = 0; i < 8; i ++) \
50
if (neon[0][i] != neon[1][i]) { \
51
av_log(ctx, AV_LOG_ERROR, \
52
"d%-2d = %016"PRIx64"\n", \
53
8 + i, av_bswap64(neon[0][i])); \
54
av_log(ctx, AV_LOG_ERROR, \
55
" -> %016"PRIx64"\n", \
56
av_bswap64(neon[1][i])); \
57
} \
58
abort(); \
59
} \
60
return ret
61
62
#define wrap(func) \
63
int __real_ ## func; \
64
int __wrap_ ## func; \
65
int __wrap_ ## func
66
67
#endif /* AVUTIL_ARM_NEONTEST_H */
68
69