[FFmpeg-devel] [PATCH]Use pushfl/popfl in cpuid.c
Reimar Döffinger
Reimar.Doeffinger
Mon Nov 24 14:14:48 CET 2008
On Mon, Nov 24, 2008 at 12:20:35PM -0000, M?ns Rullg?rd wrote:
> >> > How about
> >> > #ifdef ARCH_X86_64
> >> > #define PUSHF "pushfq\n\t"
> >> > #define POPF "popfq\n\t"
> >> > #else
> >> > #define PUSHF "pushfl\n\t"
> >> > #define POPF "popfl\n\t"
> >> > #endif
> >> > ?
> >>
> >> Just make sure you test it on both.
> >
> > Attached patch seems to work fine on x86_64 (make test passes).
>
> Does it detect the cpuid/simd support correctly? make test would pass
> even if it didn't.
Oh well, let's just do this the easy way:
cpuid.o after patch:
0000000000000000 <mm_support>:
0: 9c pushfq
1: 58 pop %rax
2: 48 89 c1 mov %rax,%rcx
5: 48 35 00 00 20 00 xor $0x200000,%rax
b: 50 push %rax
c: 9d popfq
d: 9c pushfq
e: 58 pop %rax
f: 45 31 c0 xor %r8d,%r8d
12: 48 39 c8 cmp %rcx,%rax
15: 0f 84 b7 00 00 00 je d2 <mm_support+0xd2>
1b: 31 c0 xor %eax,%eax
1d: 48 89 de mov %rbx,%rsi
20: 0f a2 cpuid
cpuid.o before patch:
0000000000000000 <mm_support>:
0: 9c pushfq
1: 58 pop %rax
2: 48 89 c1 mov %rax,%rcx
5: 48 35 00 00 20 00 xor $0x200000,%rax
b: 50 push %rax
c: 9d popfq
d: 9c pushfq
e: 58 pop %rax
f: 45 31 c0 xor %r8d,%r8d
12: 48 39 c8 cmp %rcx,%rax
15: 0f 84 b7 00 00 00 je d2 <mm_support+0xd2>
1b: 31 c0 xor %eax,%eax
1d: 48 89 de mov %rbx,%rsi
20: 0f a2 cpuid
Both compiled with gcc (Gentoo 4.3.2 p1.0) 4.3.2
Output of cpuid.c compiled with -DTEST:
mm_support = 0x0000007F
(corresponding to
FF_MM_MMX | FF_MM_MMXEXT | FF_MM_3DNOW | FF_MM_SSE | FF_MM_SSE2 | FF_MM_3DNOWEXT | FF_MM_SSE3
)
Greetings,
Reimar D?ffinger
More information about the ffmpeg-devel
mailing list