/*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_ARM_NEONTEST_H23#define AVUTIL_ARM_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"vstm %0, {d8-d15}\n\t" \36:: "r"(mem) : "memory")3738#define testneonclobbers(func, ctx, ...) \39uint64_t neon[2][8]; \40int ret; \41storeneonregs(neon[0]); \42ret = __real_ ## func(ctx, __VA_ARGS__); \43storeneonregs(neon[1]); \44if (memcmp(neon[0], neon[1], sizeof(neon[0]))) { \45int i; \46av_log(ctx, AV_LOG_ERROR, \47"NEON REGS CLOBBERED IN %s!\n", #func); \48for (i = 0; i < 8; i ++) \49if (neon[0][i] != neon[1][i]) { \50av_log(ctx, AV_LOG_ERROR, \51"d%-2d = %016"PRIx64"\n", \528 + i, av_bswap64(neon[0][i])); \53av_log(ctx, AV_LOG_ERROR, \54" -> %016"PRIx64"\n", \55av_bswap64(neon[1][i])); \56} \57abort(); \58} \59return ret6061#define wrap(func) \62int __real_ ## func; \63int __wrap_ ## func; \64int __wrap_ ## func6566#endif /* AVUTIL_ARM_NEONTEST_H */676869