Re: [FFmpeg-devel] [PATCH] x86/emms: run the instruction unconditionally on supported targets

2016-02-03 Thread James Almer
On 2/3/2016 2:21 AM, James Almer wrote:
> Inlined functions like AV_ZERO* and AV_COPY* may use mmx instructions
> regardless of runtime cpuflags.
> 
> Signed-off-by: James Almer 
> ---
> On targets where __MMX__ is not defined (like default x86_32 builds) the
> runtime check is a must, and neither of the above functions will use mmx
> instructions anyway.
> 
>  libavutil/x86/emms.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/libavutil/x86/emms.h b/libavutil/x86/emms.h
> index a529b6b..0deeb8c 100644
> --- a/libavutil/x86/emms.h
> +++ b/libavutil/x86/emms.h
> @@ -34,7 +34,9 @@ void avpriv_emms_yasm(void);
>   */
>  static av_always_inline void emms_c(void)
>  {
> +#if !defined(__MMX__)
>  if(av_get_cpu_flags() & AV_CPU_FLAG_MMX)
> +#endif
>  __asm__ volatile ("emms" ::: "memory");
>  }
>  #elif HAVE_MMX && HAVE_MM_EMPTY
> 

If you want a simple test case, on x86_32 do:

configure --cpu=pentium-mmx && make fate-dca CPUFLAGS=0

And watch it crash.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] x86/emms: run the instruction unconditionally on supported targets

2016-02-03 Thread Michael Niedermayer
On Wed, Feb 03, 2016 at 02:21:28AM -0300, James Almer wrote:
> Inlined functions like AV_ZERO* and AV_COPY* may use mmx instructions
> regardless of runtime cpuflags.
> 
> Signed-off-by: James Almer 
> ---
> On targets where __MMX__ is not defined (like default x86_32 builds) the
> runtime check is a must, and neither of the above functions will use mmx
> instructions anyway.
> 
>  libavutil/x86/emms.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/libavutil/x86/emms.h b/libavutil/x86/emms.h
> index a529b6b..0deeb8c 100644
> --- a/libavutil/x86/emms.h
> +++ b/libavutil/x86/emms.h
> @@ -34,7 +34,9 @@ void avpriv_emms_yasm(void);
>   */
>  static av_always_inline void emms_c(void)
>  {
> +#if !defined(__MMX__)
>  if(av_get_cpu_flags() & AV_CPU_FLAG_MMX)
> +#endif

should be ok, but please add a comment to the code explaining why
this is done

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

It is what and why we do it that matters, not just one of them.


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] x86/emms: run the instruction unconditionally on supported targets

2016-02-03 Thread James Almer
On 2/3/2016 11:57 PM, Michael Niedermayer wrote:
> On Wed, Feb 03, 2016 at 02:21:28AM -0300, James Almer wrote:
>> Inlined functions like AV_ZERO* and AV_COPY* may use mmx instructions
>> regardless of runtime cpuflags.
>>
>> Signed-off-by: James Almer 
>> ---
>> On targets where __MMX__ is not defined (like default x86_32 builds) the
>> runtime check is a must, and neither of the above functions will use mmx
>> instructions anyway.
>>
>>  libavutil/x86/emms.h | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/libavutil/x86/emms.h b/libavutil/x86/emms.h
>> index a529b6b..0deeb8c 100644
>> --- a/libavutil/x86/emms.h
>> +++ b/libavutil/x86/emms.h
>> @@ -34,7 +34,9 @@ void avpriv_emms_yasm(void);
>>   */
>>  static av_always_inline void emms_c(void)
>>  {
>> +#if !defined(__MMX__)
>>  if(av_get_cpu_flags() & AV_CPU_FLAG_MMX)
>> +#endif
> 
> should be ok, but please add a comment to the code explaining why
> this is done

Done and pushed. Thanks.

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] x86/emms: run the instruction unconditionally on supported targets

2016-02-02 Thread James Almer
Inlined functions like AV_ZERO* and AV_COPY* may use mmx instructions
regardless of runtime cpuflags.

Signed-off-by: James Almer 
---
On targets where __MMX__ is not defined (like default x86_32 builds) the
runtime check is a must, and neither of the above functions will use mmx
instructions anyway.

 libavutil/x86/emms.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavutil/x86/emms.h b/libavutil/x86/emms.h
index a529b6b..0deeb8c 100644
--- a/libavutil/x86/emms.h
+++ b/libavutil/x86/emms.h
@@ -34,7 +34,9 @@ void avpriv_emms_yasm(void);
  */
 static av_always_inline void emms_c(void)
 {
+#if !defined(__MMX__)
 if(av_get_cpu_flags() & AV_CPU_FLAG_MMX)
+#endif
 __asm__ volatile ("emms" ::: "memory");
 }
 #elif HAVE_MMX && HAVE_MM_EMPTY
-- 
2.7.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel