Re: [FFmpeg-devel] Don't use _tzcnt instrinics with clang for windows w/o BMI.

2017-10-25 Thread Michael Niedermayer
On Thu, Oct 26, 2017 at 03:39:57AM +1100, Matt Oliver wrote:
> On 25 October 2017 at 07:15, Dale Curtis  wrote:
> 
> > Technically _tzcnt* intrinsics are only available when the BMI
> > instruction set is present. However the instruction encoding
> > degrades to "rep bsf" on older processors.
> >
> > Clang for Windows debatably restricts the _tzcnt* instrinics behind
> > the __BMI__ architecture define, so check for its presence or
> > exclude the usage of these intrinics when clang is present.
> >
> > See also:
> > https://ffmpeg.org/pipermail/ffmpeg-devel/2015-November/183404.html
> > https://bugs.llvm.org/show_bug.cgi?id=30506
> > http://lists.llvm.org/pipermail/cfe-dev/2016-October/051034.html
> >
> > Signed-off-by: Dale Curtis  
> 
> LGTM

will apply

thanks

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

When you are offended at any man's fault, turn to yourself and study your
own failings. Then you will forget your anger. -- Epictetus


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


Re: [FFmpeg-devel] Don't use _tzcnt instrinics with clang for windows w/o BMI.

2017-10-25 Thread Matt Oliver
On 25 October 2017 at 07:15, Dale Curtis  wrote:

> Technically _tzcnt* intrinsics are only available when the BMI
> instruction set is present. However the instruction encoding
> degrades to "rep bsf" on older processors.
>
> Clang for Windows debatably restricts the _tzcnt* instrinics behind
> the __BMI__ architecture define, so check for its presence or
> exclude the usage of these intrinics when clang is present.
>
> See also:
> https://ffmpeg.org/pipermail/ffmpeg-devel/2015-November/183404.html
> https://bugs.llvm.org/show_bug.cgi?id=30506
> http://lists.llvm.org/pipermail/cfe-dev/2016-October/051034.html
>
> Signed-off-by: Dale Curtis 

[FFmpeg-devel] Don't use _tzcnt instrinics with clang for windows w/o BMI.

2017-10-24 Thread Dale Curtis
Technically _tzcnt* intrinsics are only available when the BMI
instruction set is present. However the instruction encoding
degrades to "rep bsf" on older processors.

Clang for Windows debatably restricts the _tzcnt* instrinics behind
the __BMI__ architecture define, so check for its presence or
exclude the usage of these intrinics when clang is present.

See also:
https://ffmpeg.org/pipermail/ffmpeg-devel/2015-November/183404.html
https://bugs.llvm.org/show_bug.cgi?id=30506
http://lists.llvm.org/pipermail/cfe-dev/2016-October/051034.html

Signed-off-by: Dale Curtis 
From 123a60bdcf99cab6b6e6bd31a463a29bc49598f0 Mon Sep 17 00:00:00 2001
From: Dale Curtis 
Date: Tue, 24 Oct 2017 13:03:59 -0700
Subject: [PATCH] Don't use _tzcnt instrinics with clang for windows w/o BMI.

Technically _tzcnt* intrinsics are only available when the BMI
instruction set is present. However the instruction encoding
degrades to "rep bsf" on older processors.

Clang for Windows debatably restricts the _tzcnt* instrinics behind
the __BMI__ architecture define, so check for its presence or
exclude the usage of these intrinics when clang is present.

See also:
https://ffmpeg.org/pipermail/ffmpeg-devel/2015-November/183404.html
https://bugs.llvm.org/show_bug.cgi?id=30506
http://lists.llvm.org/pipermail/cfe-dev/2016-October/051034.html

Signed-off-by: Dale Curtis 
---
 libavutil/x86/intmath.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavutil/x86/intmath.h b/libavutil/x86/intmath.h
index e83971c084..40743fd13e 100644
--- a/libavutil/x86/intmath.h
+++ b/libavutil/x86/intmath.h
@@ -47,7 +47,8 @@ static av_always_inline av_const int ff_log2_x86(unsigned int v)
 #   endif
 #   define ff_log2_16bit av_log2
 
-#if defined(__INTEL_COMPILER) || (defined(_MSC_VER) && (_MSC_VER >= 1700))
+#if defined(__INTEL_COMPILER) || (defined(_MSC_VER) && (_MSC_VER >= 1700) && \
+  (defined(__BMI__) || !defined(__clang__)))
 #   define ff_ctz(v) _tzcnt_u32(v)
 
 #   if ARCH_X86_64
-- 
2.15.0.rc0.271.g36b669edcc-goog

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