/*1* check NEON registers for clobbering2* Copyright (c) 2008 Ramiro Polla <[email protected]>3* Copyright (c) 2013 Martin Storsjo4*5* This file is part of FFmpeg.6*7* FFmpeg is free software; you can redistribute it and/or8* modify it under the terms of the GNU Lesser General Public9* License as published by the Free Software Foundation; either10* version 2.1 of the License, or (at your option) any later version.11*12* FFmpeg is distributed in the hope that it will be useful,13* but WITHOUT ANY WARRANTY; without even the implied warranty of14* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU15* Lesser General Public License for more details.16*17* You should have received a copy of the GNU Lesser General Public18* License along with FFmpeg; if not, write to the Free Software19* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA20*/2122#ifndef AVUTIL_AARCH64_NEONTEST_H23#define AVUTIL_AARCH64_NEONTEST_H2425#include <inttypes.h>26#include <stdint.h>27#include <stdlib.h>28#include <stdarg.h>29#include <string.h>3031#include "libavutil/bswap.h"3233#define storeneonregs(mem) \34__asm__ volatile( \35"stp d8, d9, [%0]\n\t" \36"stp d10, d11, [%0, #16]\n\t" \37"stp d12, d13, [%0, #32]\n\t" \38"stp d14, d15, [%0, #48]\n\t" \39:: "r"(mem) : "memory")4041#define testneonclobbers(func, ctx, ...) \42uint64_t neon[2][8]; \43int ret; \44storeneonregs(neon[0]); \45ret = __real_ ## func(ctx, __VA_ARGS__); \46storeneonregs(neon[1]); \47if (memcmp(neon[0], neon[1], sizeof(neon[0]))) { \48int i; \49av_log(ctx, AV_LOG_ERROR, \50"NEON REGS CLOBBERED IN %s!\n", #func); \51for (i = 0; i < 8; i ++) \52if (neon[0][i] != neon[1][i]) { \53av_log(ctx, AV_LOG_ERROR, \54"d%-2d = %016"PRIx64"\n", \558 + i, av_bswap64(neon[0][i])); \56av_log(ctx, AV_LOG_ERROR, \57" -> %016"PRIx64"\n", \58av_bswap64(neon[1][i])); \59} \60abort(); \61} \62return ret6364#define wrap(func) \65int __real_ ## func; \66int __wrap_ ## func; \67int __wrap_ ## func6869#endif /* AVUTIL_AARCH64_NEONTEST_H */707172