Move mm_support() from libavcodec to libavutil, make it a public
[libav.git] / libavutil / cpu.c
CommitLineData
c6c98d08
SS
1/*
2 * This file is part of FFmpeg.
3 *
4 * FFmpeg is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * FFmpeg is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with FFmpeg; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19#include "cpu.h"
20#include "config.h"
21
22#if ARCH_ARM
23# include "arm/cpu.h"
24#elif ARCH_PPC
25# include "ppc/cpu.h"
26#elif ARCH_X86
27# include "x86/cpu.h"
28#else
29int av_get_cpu_flags(void)
30{
31 return 0;
32}
33#endif
34
35#ifdef TEST
36
37#undef printf
38
39int main(void)
40{
41 int cpu_flags = av_get_cpu_flags();
42
43 printf("cpu_flags = 0x%08X\n", cpu_flags);
44 printf("cpu_flags = %s%s%s%s%s%s%s%s%s%s%s%s\n",
45#if ARCH_ARM
46 cpu_flags & AV_CPU_FLAG_IWMMXT ? "IWMMXT " : "",
47#elif ARCH_PPC
48 cpu_flags & AV_CPU_FLAG_ALTIVEC ? "ALTIVEC " : "",
49#elif ARCH_X86
50 cpu_flags & AV_CPU_FLAG_MMX ? "MMX " : "",
51 cpu_flags & AV_CPU_FLAG_MMX2 ? "MMX2 " : "",
52 cpu_flags & AV_CPU_FLAG_SSE ? "SSE " : "",
53 cpu_flags & AV_CPU_FLAG_SSE2 ? "SSE2 " : "",
54 cpu_flags & AV_CPU_FLAG_SSE2SLOW ? "SSE2(slow) " : "",
55 cpu_flags & AV_CPU_FLAG_SSE3 ? "SSE3 " : "",
56 cpu_flags & AV_CPU_FLAG_SSE3SLOW ? "SSE3(slow) " : "",
57 cpu_flags & AV_CPU_FLAG_SSSE3 ? "SSSE3 " : "",
58 cpu_flags & AV_CPU_FLAG_SSE4 ? "SSE4.1 " : "",
59 cpu_flags & AV_CPU_FLAG_SSE42 ? "SSE4.2 " : "",
60 cpu_flags & AV_CPU_FLAG_3DNOW ? "3DNow " : "",
61 cpu_flags & AV_CPU_FLAG_3DNOWEXT ? "3DNowExt " : "");
62#endif
63 return 0;
64}
65
66#endif