[libav-devel] [PATCH] configure: Force mingw's ld to keep the reloc section

2014-10-11 Thread Alex Smith
Binutils will always strip the relocation information from executable
files even if it needs it (dynamicbase/ASLR).  We can work around this
by using the pic-executable flag combined with setting the correct entry
point since apparently ld forgets what that should be.  This problem
affects both 32 and 64-bit mingw-w64.

We can combine the nxcompat/dynamicbase check because they were added to
binutils at the same time.
---
 configure | 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index a82bef7..60b31ec 100755
--- a/configure
+++ b/configure
@@ -3475,8 +3475,6 @@ case $target_os in
 elif enabled arm; then
 LIBTARGET=arm-wince
 fi
-check_ldflags -Wl,--nxcompat
-check_ldflags -Wl,--dynamicbase
 shlibdir_default=$bindir_default
 SLIBPREF=
 SLIBSUF=.dll
@@ -3492,6 +3490,18 @@ case $target_os in
 dlltool=${cross_prefix}dlltool
 ranlib=:
 enable dos_paths
+check_ldflags -Wl,--nxcompat,--dynamicbase
+# Lets work around some stupidity in binutils.
+# ld will strip relocations from executables even though we need them
+# for dynamicbase (ASLR).  Using -pie does retain the reloc section
+# however ld then forgets what the entry point should be (oops) so we
+# have to manually (re)set it.
+add_ldexeflags -Wl,--pic-executable
+if enabled x86_32; then
+add_ldexeflags -Wl,-e,_mainCRTStartup
+elif enabled x86_64; then
+add_ldexeflags -Wl,-e,mainCRTStartup
+fi
 ;;
 win32|win64)
 disable symver
-- 
1.9.4.msysgit.2

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] configure: Force mingw's ld to keep the reloc section

2014-10-11 Thread Alex Smith
On Sat, Oct 11, 2014 at 5:47 AM, Luca Barbato lu_z...@gentoo.org wrote:

 Looks fine or at least it is doing what expected, mingw-w64 is aware of
 the problem?

 lu


See
http://sourceforge.net/p/mingw-w64/mailman/mingw-w64-public/thread/cagfxeqkg0j%2bax0dj-cbxggrwwt15k-arswwabn6wwsdutrh...@mail.gmail.com/

I'm not holding my breath for a fix.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH v2] configure: Force mingw's ld to keep the reloc section

2014-10-11 Thread Alex Smith
Binutils will always strip the relocation information from executable
files even if it needs it (dynamicbase/ASLR).  We can work around this
by using the pic-executable flag combined with setting the correct entry
point since apparently ld forgets what that should be.  This problem
affects both 32 and 64-bit mingw-w64.

We can combine the nxcompat/dynamicbase check because they were added to
binutils at the same time.
---
 configure | 13 +++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index a82bef7..356778b 100755
--- a/configure
+++ b/configure
@@ -3475,8 +3475,6 @@ case $target_os in
 elif enabled arm; then
 LIBTARGET=arm-wince
 fi
-check_ldflags -Wl,--nxcompat
-check_ldflags -Wl,--dynamicbase
 shlibdir_default=$bindir_default
 SLIBPREF=
 SLIBSUF=.dll
@@ -3492,6 +3490,17 @@ case $target_os in
 dlltool=${cross_prefix}dlltool
 ranlib=:
 enable dos_paths
+check_ldflags -Wl,--nxcompat,--dynamicbase
+# Lets work around some stupidity in binutils.
+# ld will strip relocations from executables even though we need them
+# for dynamicbase (ASLR).  Using -pie does retain the reloc section
+# however ld then forgets what the entry point should be (oops) so we
+# have to manually (re)set it.
+if enabled x86_32; then
+add_ldexeflags -Wl,--pic-executable,-e,_mainCRTStartup
+elif enabled x86_64; then
+add_ldexeflags -Wl,--pic-executable,-e,mainCRTStartup
+fi
 ;;
 win32|win64)
 disable symver
--
1.9.4.msysgit.2

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH v3] configure: Force mingw's ld to keep the reloc section

2014-10-11 Thread Alex Smith
Binutils will always strip the relocation information from executable
files even if it needs it (dynamicbase/ASLR).  We can work around this
by using the pic-executable flag combined with setting the correct entry
point since apparently ld forgets what that should be.  This problem
affects both 32 and 64-bit mingw-w64.

We can combine the nxcompat/dynamicbase check because they were added to
binutils at the same time.

Signed-off-by: Alex Smith alex.sm...@warpsharp.info
---
 configure | 13 +++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index a82bef7..356778b 100755
--- a/configure
+++ b/configure
@@ -3475,8 +3475,6 @@ case $target_os in
 elif enabled arm; then
 LIBTARGET=arm-wince
 fi
-check_ldflags -Wl,--nxcompat
-check_ldflags -Wl,--dynamicbase
 shlibdir_default=$bindir_default
 SLIBPREF=
 SLIBSUF=.dll
@@ -3492,6 +3490,17 @@ case $target_os in
 dlltool=${cross_prefix}dlltool
 ranlib=:
 enable dos_paths
+check_ldflags -Wl,--nxcompat,--dynamicbase
+# Lets work around some stupidity in binutils.
+# ld will strip relocations from executables even though we need them
+# for dynamicbase (ASLR).  Using -pie does retain the reloc section
+# however ld then forgets what the entry point should be (oops) so we
+# have to manually (re)set it.
+if enabled x86_32; then
+add_ldexeflags -Wl,--pic-executable,-e,_mainCRTStartup
+elif enabled x86_64; then
+add_ldexeflags -Wl,--pic-executable,-e,mainCRTStartup
+fi
 ;;
 win32|win64)
 disable symver
--
1.9.4.msysgit.2

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 1/2] configure: Support for HEASLR on mingw targets

2014-10-11 Thread Alex Smith
The appropriate flag for HEASLR (--high-entropy-va) is scheduled for
inclusion in the next version of binutils (2.25), doesn't hurt to
include it a little early.

Also set the image base 4GB so higher entropy gets applied to image
base randomization when used with HEASLR (8 - 17 bits of
randomization).  Windows does this for compatibility because of latent
pointer truncation issues.

Signed-off-by: Alex Smith alex.sm...@warpsharp.info
---
 configure | 4 
 1 file changed, 4 insertions(+)

diff --git a/configure b/configure
index 356778b..56bce93 100755
--- a/configure
+++ b/configure
@@ -3500,6 +3500,10 @@ case $target_os in
 add_ldexeflags -Wl,--pic-executable,-e,_mainCRTStartup
 elif enabled x86_64; then
 add_ldexeflags -Wl,--pic-executable,-e,mainCRTStartup
+check_ldflags -Wl,--high-entropy-va # binutils 2.25
+# Set image base 4GB for extra entropy with HEASLR
+add_ldexeflags -Wl,--image-base,0x14000
+append SHFLAGS -Wl,--image-base,0x18000
 fi
 ;;
 win32|win64)
-- 
1.9.4.msysgit.2

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 2/2] configure: Disable automatic image base calculation

2014-10-11 Thread Alex Smith
There's no reason for it.  ASLR will rebase it regardless so preventing
collisions isn't really relevant.  This also brings it in line with
what a msvc produced dll will have (an image base of 0x1000).

Signed-off-by: Alex Smith alex.sm...@warpsharp.info
---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index 56bce93..7c3b91c 100755
--- a/configure
+++ b/configure
@@ -3485,7 +3485,7 @@ case $target_os in
 SLIB_INSTALL_LINKS=
 SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
 SLIB_INSTALL_EXTRA_LIB='lib$(SLIBNAME:$(SLIBSUF)=.dll.a) 
$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
-SHFLAGS='-shared -Wl,--output-def,$$(@:$(SLIBSUF)=.orig.def) 
-Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) 
-Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base'
+SHFLAGS='-shared -Wl,--output-def,$$(@:$(SLIBSUF)=.orig.def) 
-Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) 
-Wl,--enable-runtime-pseudo-reloc -Wl,--disable-auto-image-base'
 objformat=win32
 dlltool=${cross_prefix}dlltool
 ranlib=:
-- 
1.9.4.msysgit.2

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 4/5] configure: Check for a definition instead of a header for mingw libc

2013-12-03 Thread Alex Smith
On Tue, Dec 3, 2013 at 12:08 AM, Diego Biurrun di...@biurrun.de wrote:
 what MinGW version/variant was that?  MinGW64?  Did you also test MinGW32?

I tested both i686-w64-mingw32 and x86_64-w64-mingw32, both had the same result.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] configure: Separate MinGW32 and MinGW64 libc handling

2013-12-03 Thread Alex Smith
On Tue, Dec 3, 2013 at 9:25 AM, Diego Biurrun di...@biurrun.de wrote:
 ---

 Still needs testing on MinGW64.

This is on i686-w64-mingw32 (does anybody even use the old mingw32
anymore?), neither check appears to work.

From configure.log:
check_cpp_condition _mingw.h defined __MINGW64_VERSION
check_cpp
BEGIN /msystmp/ffconf.SxkOubmZ.c
1 #include _mingw.h
2 #if !(defined __MINGW64_VERSION)
3 #error unsatisfied condition: defined __MINGW64_VERSION
4 #endif
END /msystmp/ffconf.SxkOubmZ.c
gcc -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
-march=i686 -std=c99 -E -o /msystmp/ffconf.WuzktIcl.o
/msystmp/ffconf.SxkOubmZ.c
f:/msys/tmp/ffconf.SxkOubmZ.c:3:2: error: #error unsatisfied
condition: defined __MINGW64_VERSION
 #error unsatisfied condition: defined __MINGW64_VERSION
  ^
check_cpp_condition _mingw.h defined __MINGW32_VERSION
check_cpp
BEGIN /msystmp/ffconf.SxkOubmZ.c
1 #include _mingw.h
2 #if !(defined __MINGW32_VERSION)
3 #error unsatisfied condition: defined __MINGW32_VERSION
4 #endif
END /msystmp/ffconf.SxkOubmZ.c
gcc -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
-march=i686 -std=c99 -E -o /msystmp/ffconf.WuzktIcl.o
/msystmp/ffconf.SxkOubmZ.c
f:/msys/tmp/ffconf.SxkOubmZ.c:3:2: error: #error unsatisfied
condition: defined __MINGW32_VERSION
 #error unsatisfied condition: defined __MINGW32_VERSION
  ^
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 4/5] configure: Check for a definition instead of a header for mingw libc

2013-12-02 Thread Alex Smith
On Mon, Dec 2, 2013 at 4:19 PM, Diego Biurrun di...@biurrun.de wrote:
 +elif check_cpp_condition _mingw.h defined __MINGW32_VERSION; then
  libc_type=mingw
  check_cpp_condition _mingw.h \
  defined (__MINGW64_VERSION_MAJOR) || (__MINGW32_MAJOR_VERSION  3) 
 || \

From config.log:

check_cpp_condition _mingw.h defined __MINGW32_VERSION
check_cpp
BEGIN /msystmp/ffconf.cOtycERm.c
1 #include _mingw.h
2 #if !(defined __MINGW32_VERSION)
3 #error unsatisfied condition: defined __MINGW32_VERSION
4 #endif
END /msystmp/ffconf.cOtycERm.c
gcc -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
-march=i686 -std=c99 -E -o /msystmp/ffconf.PlYxyFKS.o
/msystmp/ffconf.cOtycERm.c
f:/msys/tmp/ffconf.cOtycERm.c:3:2: error: #error unsatisfied
condition: defined __MINGW32_VERSION
 #error unsatisfied condition: defined __MINGW32_VERSION
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] configure: Add a generic catch for all -W options with msvc/icl

2013-09-25 Thread Alex Smith
On Wed, Sep 25, 2013 at 7:00 AM, Diego Biurrun di...@biurrun.de wrote:
 On Tue, Sep 24, 2013 at 11:18:10AM -0400, Alex Smith wrote:
 The latest icl silently ignores certain -W* options.  This is
 effectively a nop on older icl/msvc versions.
 --- a/configure
 +++ b/configure
 @@ -2390,9 +2390,9 @@ msvc_common_flags(){
  # In addition to specifying certain flags under the compiler
  # specific filters, they must be specified here as well or else 
 the
  # generic catch all at the bottom will print the original flag.
 --Wall);;
  -std=c99) ;;
  # Common flags
 +-W*)  ;;
  -fomit-frame-pointer) ;;
  -g)   echo -Z7 ;;
  -fno-math-errno)  ;;

 I don't really understand what you are trying to achieve here and
 the log message does not enlighten me.

 Diego

Instead of issuing a warning (which we then turn into an error) to
detect unknown command line options, the latest icl just treats them
as valid but they don't do anything.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH v5] configure: Enable -Qansi-alias for icl 14+

2013-09-24 Thread Alex Smith
Qansi-alias worked on 12.x, then caused miscompilation on 13.x, but now
works again passing all FATE tests for icl version 14.
---
 configure | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 928e5f4..e215f71 100755
--- a/configure
+++ b/configure
@@ -4021,8 +4021,9 @@ elif enabled_any msvc icl; then
 enabled debug  add_ldflags -debug
 enable pragma_deprecated
 if enabled icl; then
-# basically -fstrict-aliasing that does not work (correctly) on icl 
13.x
-check_cpp_condition windows.h __ICL  1300  add_cflags 
-Qansi-alias
+# -Qansi-alias is basically -fstrict-aliasing that does not work
+# (correctly) on icl 13.x
+check_cpp_condition windows.h __ICL  1300 || __ICL = 1400  
add_cflags -Qansi-alias
 # icl will pass the inline asm tests but inline asm is currently
 # not supported (build will fail)
 disable inline_asm
--
1.8.4.msysgit.0

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH] configure: Add a generic catch for all -W options with msvc/icl

2013-09-24 Thread Alex Smith
The latest icl silently ignores certain -W* options.  This is
effectively a nop on older icl/msvc versions.
---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index 2e2a151..911176a 100755
--- a/configure
+++ b/configure
@@ -2390,9 +2390,9 @@ msvc_common_flags(){
 # In addition to specifying certain flags under the compiler
 # specific filters, they must be specified here as well or else the
 # generic catch all at the bottom will print the original flag.
--Wall);;
 -std=c99) ;;
 # Common flags
+-W*)  ;;
 -fomit-frame-pointer) ;;
 -g)   echo -Z7 ;;
 -fno-math-errno)  ;;
-- 
1.8.4.msysgit.0

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH] configure: Add additional optimization for icl 14.x

2013-09-23 Thread Alex Smith
Qansi-alias worked on 12.x, then caused miscompilation on 13.x, but now
works again passing all fate tests for version icl version 14.

Qansi-alias is the icl equivalent of -fstrict-aliasing.
---
 configure | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 928e5f4..3bed617 100755
--- a/configure
+++ b/configure
@@ -4021,8 +4021,9 @@ elif enabled_any msvc icl; then
 enabled debug  add_ldflags -debug
 enable pragma_deprecated
 if enabled icl; then
-# basically -fstrict-aliasing that does not work (correctly) on icl 
13.x
-check_cpp_condition windows.h __ICL  1300  add_cflags 
-Qansi-alias
+# -Qansi-alias is basically -fstrict-aliasing that does not work 
(correctly) on icl 13.x
+check_cpp_condition windows.h __ICL   1300  add_cflags 
-Qansi-alias
+check_cpp_condition windows.h __ICL = 1400  add_cflags 
-Qansi-alias
 # icl will pass the inline asm tests but inline asm is currently
 # not supported (build will fail)
 disable inline_asm
-- 
1.8.4.msysgit.0

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] configure: Add additional optimization for icl 14.x

2013-09-23 Thread Alex Smith
On Mon, Sep 23, 2013 at 4:34 AM, Alex Smith alex.sm...@warpsharp.info wrote:
 Qansi-alias worked on 12.x, then caused miscompilation on 13.x, but now
 works again passing all fate tests for version icl version 14.

 Qansi-alias is the icl equivalent of -fstrict-aliasing.
 ---
  configure | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)

 diff --git a/configure b/configure
 index 928e5f4..3bed617 100755
 --- a/configure
 +++ b/configure
 @@ -4021,8 +4021,9 @@ elif enabled_any msvc icl; then
  enabled debug  add_ldflags -debug
  enable pragma_deprecated
  if enabled icl; then
 -# basically -fstrict-aliasing that does not work (correctly) on icl 
 13.x
 -check_cpp_condition windows.h __ICL  1300  add_cflags 
 -Qansi-alias
 +# -Qansi-alias is basically -fstrict-aliasing that does not work 
 (correctly) on icl 13.x
 +check_cpp_condition windows.h __ICL   1300  add_cflags 
 -Qansi-alias
 +check_cpp_condition windows.h __ICL = 1400  add_cflags 
 -Qansi-alias
  # icl will pass the inline asm tests but inline asm is currently
  # not supported (build will fail)
  disable inline_asm
 --
 1.8.4.msysgit.0


Forgot to mark it as v3 before I sent it.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] configure: Add additional optimization for icl 14.x

2013-09-23 Thread Alex Smith
On Mon, Sep 23, 2013 at 4:44 AM, Diego Biurrun di...@biurrun.de wrote:
 On Mon, Sep 23, 2013 at 04:34:25AM -0400, Alex Smith wrote:
 Qansi-alias worked on 12.x, then caused miscompilation on 13.x, but now
 works again passing all fate tests for version icl version 14.

 s/version//

 Qansi-alias is the icl equivalent of -fstrict-aliasing.

 IMO redundant.

Well you asked as if it wasn't clear from the context.


 --- a/configure
 +++ b/configure
 @@ -4021,8 +4021,9 @@ elif enabled_any msvc icl; then
  if enabled icl; then
 -# basically -fstrict-aliasing that does not work (correctly) on icl 
 13.x
 -check_cpp_condition windows.h __ICL  1300  add_cflags 
 -Qansi-alias
 +# -Qansi-alias is basically -fstrict-aliasing that does not work 
 (correctly) on icl 13.x

 Break this line.

What do you mean by that?


 +check_cpp_condition windows.h __ICL   1300  add_cflags 
 -Qansi-alias
 +check_cpp_condition windows.h __ICL = 1400  add_cflags 
 -Qansi-alias

 Can't you check for == 13 in just one line?

 Diego

No, __ICL is the compiler version which is defined as VRP (version,
revision, patch) so as updates roll out it won't stay the same.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH v4] configure: Add additional optimization for icl 14.x

2013-09-23 Thread Alex Smith
Qansi-alias worked on 12.x, then caused miscompilation on 13.x, but now
works again passing all fate tests for icl version 14.
---
 configure | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 928e5f4..682347e 100755
--- a/configure
+++ b/configure
@@ -4021,8 +4021,10 @@ elif enabled_any msvc icl; then
 enabled debug  add_ldflags -debug
 enable pragma_deprecated
 if enabled icl; then
-# basically -fstrict-aliasing that does not work (correctly) on icl 
13.x
-check_cpp_condition windows.h __ICL  1300  add_cflags 
-Qansi-alias
+# -Qansi-alias is basically -fstrict-aliasing that does not work
+# (correctly) on icl 13.x.
+check_cpp_condition windows.h __ICL   1300  add_cflags 
-Qansi-alias
+check_cpp_condition windows.h __ICL = 1400  add_cflags 
-Qansi-alias
 # icl will pass the inline asm tests but inline asm is currently
 # not supported (build will fail)
 disable inline_asm
--
1.8.4.msysgit.0

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] configure: Add additional optimization for icl 14.x

2013-09-23 Thread Alex Smith
On Mon, Sep 23, 2013 at 5:19 AM, Diego Biurrun di...@biurrun.de wrote:

 You mean that it won't stay as 1300 but could increase to 1323 or whatever?

 What about just checking the version alone w/o revision and patch level?

 Diego

That's the only macro definition we have to work with if you have any
suggestions.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH] lavu/timer: Use Intel's intrinsic header for rdtsc

2013-09-22 Thread Alex Smith
Maybe it has some Intel (ricer) magic?
---
 libavutil/x86/timer.h | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/libavutil/x86/timer.h b/libavutil/x86/timer.h
index cdd67dd..4e744ca 100644
--- a/libavutil/x86/timer.h
+++ b/libavutil/x86/timer.h
@@ -36,8 +36,13 @@ static inline uint64_t read_time(void)
 
 #elif HAVE_RDTSC
 
-#include intrin.h
-#define AV_READ_TIME __rdtsc
+#if defined(__INTEL_COMPILER)
+#   include immintrin.h
+#   define AV_READ_TIME _rdtsc
+#else
+#   include intrin.h
+#   define AV_READ_TIME __rdtsc
+#endif
 
 #endif /* HAVE_INLINE_ASM */
 
-- 
1.8.4.msysgit.0

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH] icl/configure: Add additional optimization for icl 14.x

2013-09-22 Thread Alex Smith
It worked on 12.x, was broken on 13.x, and now it works again on 14.x.
It is the icl equivalent of -fstrict-aliasing.
---
 configure | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index 928e5f4..8a25a8d 100755
--- a/configure
+++ b/configure
@@ -4022,7 +4022,9 @@ elif enabled_any msvc icl; then
 enable pragma_deprecated
 if enabled icl; then
 # basically -fstrict-aliasing that does not work (correctly) on icl 
13.x
-check_cpp_condition windows.h __ICL  1300  add_cflags 
-Qansi-alias
+check_cpp_condition windows.h __ICL  1300   add_cflags 
-Qansi-alias
+# oh icl, you so cray
+check_cpp_condition windows.h __ICL = 1400  add_cflags 
-Qansi-alias
 # icl will pass the inline asm tests but inline asm is currently
 # not supported (build will fail)
 disable inline_asm
-- 
1.8.4.msysgit.0

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH v2] configure: Add additional optimization for icl 14.x

2013-09-22 Thread Alex Smith
It worked on 12.x, was broken on 13.x, and now it works again on 14.x.
It is the icl equivalent of -fstrict-aliasing.
---
 configure | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index 928e5f4..0fc9192 100755
--- a/configure
+++ b/configure
@@ -4022,7 +4022,8 @@ elif enabled_any msvc icl; then
 enable pragma_deprecated
 if enabled icl; then
 # basically -fstrict-aliasing that does not work (correctly) on icl 
13.x
-check_cpp_condition windows.h __ICL  1300  add_cflags 
-Qansi-alias
+check_cpp_condition windows.h __ICL  1300   add_cflags 
-Qansi-alias
+check_cpp_condition windows.h __ICL = 1400  add_cflags 
-Qansi-alias
 # icl will pass the inline asm tests but inline asm is currently
 # not supported (build will fail)
 disable inline_asm
--
1.8.4.msysgit.0

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] lavu/timer: Use Intel's intrinsic header for rdtsc

2013-09-22 Thread Alex Smith
On Sun, Sep 22, 2013 at 9:40 AM, Luca Barbato lu_z...@gentoo.org wrote:
 On 22/09/13 15:35, Alex Smith wrote:
 Maybe it has some Intel (ricer) magic?

 Is it needed or just nice to have?

 (the tag: should be either lavu: or timer:)

 lu

Well you can use either, one is simply the way provided by Intel's own headers,
the other is msvc/mingw (in this case).  It's probably a stupid idea, perhaps
more proper(?) but likely stupid.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH v2] configure: Add additional optimization for icl 14.x

2013-09-22 Thread Alex Smith
On Sun, Sep 22, 2013 at 11:31 AM, Johan Andersson j...@i19.se wrote:
 On Sun, Sep 22, 2013 at 09:47:44AM -0400, Alex Smith wrote:

 Why the extra space between 1300?

 --
 Johan Andersson

Cosmetic.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH v2] configure: Add additional optimization for icl 14.x

2013-09-22 Thread Alex Smith
On Sun, Sep 22, 2013 at 6:40 PM, Alex Smith alex.sm...@warpsharp.info wrote:
 On Sun, Sep 22, 2013 at 11:31 AM, Johan Andersson j...@i19.se wrote:
 On Sun, Sep 22, 2013 at 09:47:44AM -0400, Alex Smith wrote:

 Why the extra space between 1300?

 --
 Johan Andersson

 Cosmetic.

Although tbh it probably makes more sense to put the extra space
before  and not where it currently is.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH] avutil: Fix compilation with inline asm disabled on mingw

2013-09-21 Thread Alex Smith
Because of -Werror=implicit-function-declaration the build will fail.
---
 libavutil/x86/timer.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavutil/x86/timer.h b/libavutil/x86/timer.h
index 35e614d..cdd67dd 100644
--- a/libavutil/x86/timer.h
+++ b/libavutil/x86/timer.h
@@ -36,6 +36,7 @@ static inline uint64_t read_time(void)
 
 #elif HAVE_RDTSC
 
+#include intrin.h
 #define AV_READ_TIME __rdtsc
 
 #endif /* HAVE_INLINE_ASM */
-- 
1.8.4.msysgit.0

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] msvc/icl: Use __declspec(deprecated)

2013-09-19 Thread Alex Smith
What?

The pragma test fails on msvc.

On Thu, Sep 19, 2013 at 4:39 PM, Diego Biurrun di...@biurrun.de wrote:
 On Thu, Sep 19, 2013 at 04:22:48PM -0400, Alex Smith wrote:
 This is a nop.

 Diego
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH] msvc/icl: Use __declspec(deprecated)

2013-09-19 Thread Alex Smith
Prior to this on msvc/icl there was no handling of deprecated functions
and the deprecated warning was disabled.

After enabling there are a number of warnings relating to the CRT and
the use of the non-secure versions of several functions.  Defining
_CRT_SECURE_NO_WARNINGS silences these warnings.
---
 configure  |  5 +++--
 libavutil/attributes.h |  2 ++
 libavutil/internal.h   | 12 ++--
 3 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/configure b/configure
index 1e195d5..bb18877 100755
--- a/configure
+++ b/configure
@@ -2405,7 +2405,7 @@ msvc_flags(){
 -Wall)echo -W4 -wd4244 -wd4127 -wd4018 -wd4389 
\
-wd4146 -wd4057 -wd4204 -wd4706 -wd4305 
\
-wd4152 -wd4324 -we4013 -wd4100 -wd4214 
\
-   -wd4996 -wd4273 ;;
+   -wd4273 ;;
 esac
 done
 }
@@ -2629,7 +2629,7 @@ probe_cc(){
 _ld_lib='lib%.a'
 _ld_path='-libpath:'
 _flags='-nologo'
-_cflags='-D_USE_MATH_DEFINES -Dinline=__inline -FIstdlib.h 
-Dstrtoll=_strtoi64'
+_cflags='-D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS 
-Dinline=__inline -FIstdlib.h -Dstrtoll=_strtoi64'
 if [ $pfx = hostcc ]; then
 append _cflags -Dsnprintf=_snprintf
 fi
@@ -3997,6 +3997,7 @@ elif enabled_any msvc icl; then
 enabled x86_32  disable aligned_stack
 enabled_all x86_32 debug  add_cflags -Oy-
 enabled debug  add_ldflags -debug
+enabled pragma_deprecated
 if enabled icl; then
 # basically -fstrict-aliasing that does not work (correctly) on icl 
13.x
 check_cpp_condition windows.h __ICL  1300  add_cflags 
-Qansi-alias
diff --git a/libavutil/attributes.h b/libavutil/attributes.h
index 292a0a1..850a73f 100644
--- a/libavutil/attributes.h
+++ b/libavutil/attributes.h
@@ -72,6 +72,8 @@
 
 #if AV_GCC_VERSION_AT_LEAST(3,1)
 #define attribute_deprecated __attribute__((deprecated))
+#elif defined(_MSC_VER)
+#define attribute_deprecated __declspec(deprecated)
 #else
 #define attribute_deprecated
 #endif
diff --git a/libavutil/internal.h b/libavutil/internal.h
index b18860f..7b178c2 100644
--- a/libavutil/internal.h
+++ b/libavutil/internal.h
@@ -62,8 +62,16 @@
 #endif
 
 #if HAVE_PRAGMA_DEPRECATED
-#define FF_DISABLE_DEPRECATION_WARNINGS _Pragma(GCC diagnostic ignored 
\-Wdeprecated-declarations\)
-#define FF_ENABLE_DEPRECATION_WARNINGS  _Pragma(GCC diagnostic warning 
\-Wdeprecated-declarations\)
+#if defined(__ICL)
+#define FF_DISABLE_DEPRECATION_WARNINGS __pragma(warning(push)) 
__pragma(warning(disable:1478))
+#define FF_ENABLE_DEPRECATION_WARNINGS  __pragma(warning(pop))
+#elif defined(_MSC_VER)
+#define FF_DISABLE_DEPRECATION_WARNINGS __pragma(warning(push)) 
__pragma(warning(disable:4996))
+#define FF_ENABLE_DEPRECATION_WARNINGS  __pragma(warning(pop))
+#else
+#define FF_DISABLE_DEPRECATION_WARNINGS _Pragma(GCC diagnostic 
ignored \-Wdeprecated-declarations\)
+#define FF_ENABLE_DEPRECATION_WARNINGS  _Pragma(GCC diagnostic 
warning \-Wdeprecated-declarations\)
+#endif
 #else
 #define FF_DISABLE_DEPRECATION_WARNINGS
 #define FF_ENABLE_DEPRECATION_WARNINGS
-- 
1.8.1.msysgit.1

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH] msvc/icl: Use __declspec(noinline)

2013-09-19 Thread Alex Smith
---
 libavutil/attributes.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavutil/attributes.h b/libavutil/attributes.h
index 850a73f..9f476c9 100644
--- a/libavutil/attributes.h
+++ b/libavutil/attributes.h
@@ -42,6 +42,8 @@
 
 #if AV_GCC_VERSION_AT_LEAST(3,1)
 #define av_noinline __attribute__((noinline))
+#elif defined(_MSC_VER)
+#define av_noinline __declspec(noinline)
 #else
 #define av_noinline
 #endif
-- 
1.8.1.msysgit.1

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH v2] msvc/icl: Use __declspec(deprecated)

2013-09-19 Thread Alex Smith
Prior to this on msvc/icl there was no handling of deprecated functions
and the deprecated warning was disabled.

After enabling there are a number of warnings relating to the CRT and
the use of the non-secure versions of several functions.  Defining
_CRT_SECURE_NO_WARNINGS silences these warnings.
---
 configure  |  5 +++--
 libavutil/attributes.h |  2 ++
 libavutil/internal.h   | 12 ++--
 3 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/configure b/configure
index 1e195d5..8a7c6ce 100755
--- a/configure
+++ b/configure
@@ -2405,7 +2405,7 @@ msvc_flags(){
 -Wall)echo -W4 -wd4244 -wd4127 -wd4018 -wd4389 
\
-wd4146 -wd4057 -wd4204 -wd4706 -wd4305 
\
-wd4152 -wd4324 -we4013 -wd4100 -wd4214 
\
-   -wd4996 -wd4273 ;;
+   -wd4273 ;;
 esac
 done
 }
@@ -2629,7 +2629,7 @@ probe_cc(){
 _ld_lib='lib%.a'
 _ld_path='-libpath:'
 _flags='-nologo'
-_cflags='-D_USE_MATH_DEFINES -Dinline=__inline -FIstdlib.h 
-Dstrtoll=_strtoi64'
+_cflags='-D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS 
-Dinline=__inline -FIstdlib.h -Dstrtoll=_strtoi64'
 if [ $pfx = hostcc ]; then
 append _cflags -Dsnprintf=_snprintf
 fi
@@ -3997,6 +3997,7 @@ elif enabled_any msvc icl; then
 enabled x86_32  disable aligned_stack
 enabled_all x86_32 debug  add_cflags -Oy-
 enabled debug  add_ldflags -debug
+enable pragma_deprecated
 if enabled icl; then
 # basically -fstrict-aliasing that does not work (correctly) on icl 
13.x
 check_cpp_condition windows.h __ICL  1300  add_cflags 
-Qansi-alias
diff --git a/libavutil/attributes.h b/libavutil/attributes.h
index 292a0a1..850a73f 100644
--- a/libavutil/attributes.h
+++ b/libavutil/attributes.h
@@ -72,6 +72,8 @@

 #if AV_GCC_VERSION_AT_LEAST(3,1)
 #define attribute_deprecated __attribute__((deprecated))
+#elif defined(_MSC_VER)
+#define attribute_deprecated __declspec(deprecated)
 #else
 #define attribute_deprecated
 #endif
diff --git a/libavutil/internal.h b/libavutil/internal.h
index b18860f..7b178c2 100644
--- a/libavutil/internal.h
+++ b/libavutil/internal.h
@@ -62,8 +62,16 @@
 #endif

 #if HAVE_PRAGMA_DEPRECATED
-#define FF_DISABLE_DEPRECATION_WARNINGS _Pragma(GCC diagnostic ignored 
\-Wdeprecated-declarations\)
-#define FF_ENABLE_DEPRECATION_WARNINGS  _Pragma(GCC diagnostic warning 
\-Wdeprecated-declarations\)
+#if defined(__ICL)
+#define FF_DISABLE_DEPRECATION_WARNINGS __pragma(warning(push)) 
__pragma(warning(disable:1478))
+#define FF_ENABLE_DEPRECATION_WARNINGS  __pragma(warning(pop))
+#elif defined(_MSC_VER)
+#define FF_DISABLE_DEPRECATION_WARNINGS __pragma(warning(push)) 
__pragma(warning(disable:4996))
+#define FF_ENABLE_DEPRECATION_WARNINGS  __pragma(warning(pop))
+#else
+#define FF_DISABLE_DEPRECATION_WARNINGS _Pragma(GCC diagnostic 
ignored \-Wdeprecated-declarations\)
+#define FF_ENABLE_DEPRECATION_WARNINGS  _Pragma(GCC diagnostic 
warning \-Wdeprecated-declarations\)
+#endif
 #else
 #define FF_DISABLE_DEPRECATION_WARNINGS
 #define FF_ENABLE_DEPRECATION_WARNINGS
--
1.8.1.msysgit.1

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] msvc/icl: Use __declspec(deprecated)

2013-09-19 Thread Alex Smith
On Thu, Sep 19, 2013 at 4:40 PM, Alex Smith alex.sm...@warpsharp.info wrote:
 What?

 The pragma test fails on msvc.

 On Thu, Sep 19, 2013 at 4:39 PM, Diego Biurrun di...@biurrun.de wrote:
 On Thu, Sep 19, 2013 at 04:22:48PM -0400, Alex Smith wrote:
 This is a nop.

 Diego

j/k, I'm stupid.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 1/3] configure: Mention that icl does not build both static and shared libs

2013-09-11 Thread Alex Smith
On Wed, Sep 11, 2013 at 5:51 AM, Diego Biurrun di...@biurrun.de wrote:
 ---

 Confirmation for this would be good, I believe it is the case.

I'm going to assume you mean this one when you poked me on IRC.

Yes, the behavior is the same.  They're designed to basically be interchangeable
with no/minimal effort so you can assume in most cases it's going to behave the
same (except you're now ricing).
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH v2] icc/icl: Override Intel's CPU dispatcher

2013-06-26 Thread Alex Smith
On Wed, Jun 26, 2013 at 2:32 PM, Luca Barbato lu_z...@gentoo.org wrote:
 We have to disable it for static builds and/or make it optional (as in
 opt-in)

 lu

Then it's in the wrong place I think.

Perhaps compat really is the better place for it if we only want to
link it into avconv.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 2/2] configure: Do not omit frame pointers for msvc/icl debug builds

2013-06-24 Thread Alex Smith
Because O1 or O2 are required to build libav with msvc/icl, this must be
explicitly set instead of just omitting Oy.
---
 configure | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configure b/configure
index fdbea76..db591e8 100755
--- a/configure
+++ b/configure
@@ -3956,6 +3956,7 @@ elif enabled pathscale; then
 add_cflags -fstrict-overflow -OPT:wrap_around_unsafe_opt=OFF
 elif enabled_any msvc icl; then
 enabled x86_32  disable aligned_stack
+enabled_all x86_32 debug  add_cflags -Oy-
 if enabled icl; then
 # basically -fstrict-aliasing that does not work (correctly) on icl 
13.x
 check_cpp_condition windows.h __ICL  1300  add_cflags 
-Qansi-alias
-- 
1.8.1.msysgit.1

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 1/2] configure: Do not explicitly set Oy for msvc/icl

2013-06-24 Thread Alex Smith
It is implied by O1 or O2, both of which are required to build libav
with msvc/icl.  Silences warnings when targeting x64 with icl.
---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index da62095..fdbea76 100755
--- a/configure
+++ b/configure
@@ -2353,7 +2353,7 @@ msvc_common_flags(){
 -Wall);;
 -std=c99) ;;
 # Common flags
--fomit-frame-pointer) echo -Oy ;;
+-fomit-frame-pointer) ;;
 -g)   echo -Z7 ;;
 -fno-math-errno)  ;;
 -fno-common)  ;;
-- 
1.8.1.msysgit.1

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 2/2] configure: Do not explicitly set Oy for msvc/icl

2013-06-23 Thread Alex Smith
On Wed, Jun 19, 2013 at 6:07 PM, Alex Smith alex.sm...@warpsharp.info wrote:
 Instead, since it is implied by O1 or O2, selectively disable frame
 pointer omission for x86 debug builds.  Oy is ignored for x64 targets.
 This also silences warnings with icl targeting x64.
 ---
  configure | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

 diff --git a/configure b/configure
 index f6c89ac..01251ca 100755
 --- a/configure
 +++ b/configure
 @@ -2353,7 +2353,7 @@ msvc_common_flags(){
  -Wall);;
  -std=c99) ;;
  # Common flags
 --fomit-frame-pointer) echo -Oy ;;
 +-fomit-frame-pointer) ;;
  -g)   echo -Z7 ;;
  -fno-math-errno)  ;;
  -fno-common)  ;;
 @@ -3947,6 +3947,7 @@ elif enabled pathscale; then
  add_cflags -fstrict-overflow -OPT:wrap_around_unsafe_opt=OFF
  elif enabled_any msvc icl; then
  enabled x86_32  disable aligned_stack
 +enabled_all x86_32 debug  add_cflags -Oy-
  if enabled icl; then
  # basically -fstrict-aliasing for icl that doesn't work (correctly) 
 on 13.x+
  check_cpp_condition windows.h __ICL  1300  add_cflags 
 -Qansi-alias
 --
 1.8.1.msysgit.1


Bump
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 1/2] configure: More msvc/icl combining

2013-06-20 Thread Alex Smith
On Wed, Jun 19, 2013 at 8:10 PM, Diego Biurrun di...@biurrun.de wrote:
 On 2013-06-20 00:07, Alex Smith wrote:

 ---
   configure | 14 +++---
   1 file changed, 7 insertions(+), 7 deletions(-)


 If you prefer ..

 Diego

It was my understanding that you wanted this change in a separate patch.

It can make adding stuff like the second patch 'easier' since we don't
have to just put it in two places.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH] icl: Override Intel's CPU dispatcher

2013-06-20 Thread Alex Smith
Prevents the selection of the slowest code path on non-Intel CPU's.
Taken from x264 and adapted for use with libav.
---
 libavutil/x86/cpu.c | 46 +
 libavutil/x86/cpu.h |  1 +
 libavutil/x86/cpuid.asm | 50 +
 3 files changed, 97 insertions(+)

diff --git a/libavutil/x86/cpu.c b/libavutil/x86/cpu.c
index 3b36fd0..718301e 100644
--- a/libavutil/x86/cpu.c
+++ b/libavutil/x86/cpu.c
@@ -199,3 +199,49 @@ int ff_get_cpu_flags_x86(void)
 
 return rval;
 }
+
+#if HAVE_MMX
+#ifdef __INTEL_COMPILER
+/* Agner's patch to Intel's CPU dispatcher from pages 131-132 of
+ * http://agner.org/optimize/optimizing_cpp.pdf (2011-01-30)
+ * adapted to libav's cpu schema. Copied from x264 and adapted for libav. */
+
+/* Global variable indicating cpu */
+int __intel_cpu_indicator = 0;
+
+/* CPU dispatcher function */
+void ff_intel_cpu_indicator_init(void)
+{
+unsigned int cpu = ff_get_cpu_flags_x86();
+if (cpu  AV_CPU_FLAG_AVX)
+__intel_cpu_indicator = 0x2;
+else if (cpu  AV_CPU_FLAG_SSE42)
+__intel_cpu_indicator = 0x8000;
+else if (cpu  AV_CPU_FLAG_SSE4)
+__intel_cpu_indicator = 0x2000;
+else if (cpu  AV_CPU_FLAG_SSSE3)
+__intel_cpu_indicator = 0x1000;
+else if (cpu  AV_CPU_FLAG_SSE3)
+__intel_cpu_indicator = 0x800;
+else if (cpu  AV_CPU_FLAG_SSE2  !(cpu  AV_CPU_FLAG_SSE2SLOW))
+__intel_cpu_indicator = 0x200;
+else if (cpu  AV_CPU_FLAG_SSE)
+__intel_cpu_indicator = 0x80;
+else if (cpu  AV_CPU_FLAG_MMXEXT)
+__intel_cpu_indicator = 8;
+else
+__intel_cpu_indicator = 1;
+}
+
+/* __intel_cpu_indicator_init appears to have a non-standard calling 
convention that
+ * assumes certain registers aren't preserved, so we'll route it through a 
function
+ * that backs up all the registers. */
+void __intel_cpu_indicator_init(void)
+{
+ff_safe_intel_cpu_indicator_init();
+}
+#else
+void ff_intel_cpu_indicator_init(void)
+{}
+#endif
+#endif
diff --git a/libavutil/x86/cpu.h b/libavutil/x86/cpu.h
index e4f6f0b..62122f4 100644
--- a/libavutil/x86/cpu.h
+++ b/libavutil/x86/cpu.h
@@ -57,5 +57,6 @@
 void ff_cpu_cpuid(int index, int *eax, int *ebx, int *ecx, int *edx);
 void ff_cpu_xgetbv(int op, int *eax, int *edx);
 int  ff_cpu_cpuid_test(void);
+void ff_safe_intel_cpu_indicator_init(void);
 
 #endif /* AVUTIL_X86_CPU_H */
diff --git a/libavutil/x86/cpuid.asm b/libavutil/x86/cpuid.asm
index e739ebe..0f84a92 100644
--- a/libavutil/x86/cpuid.asm
+++ b/libavutil/x86/cpuid.asm
@@ -89,3 +89,53 @@ cglobal cpu_cpuid_test
 popfd
 ret
 %endif
+
+cextern intel_cpu_indicator_init
+
+;-
+; void ff_safe_intel_cpu_indicator_init(void)
+;-
+cglobal safe_intel_cpu_indicator_init
+push r0
+push r1
+push r2
+push r3
+push r4
+push r5
+push r6
+%if ARCH_X86_64
+push r7
+push r8
+push r9
+push r10
+push r11
+push r12
+push r13
+push r14
+%endif
+push rbp
+mov  rbp, rsp
+%if WIN64
+sub  rsp, 32 ; shadow space
+%endif
+and  rsp, ~31
+call intel_cpu_indicator_init
+leave
+%if ARCH_X86_64
+pop r14
+pop r13
+pop r12
+pop r11
+pop r10
+pop r9
+pop r8
+pop r7
+%endif
+pop r6
+pop r5
+pop r4
+pop r3
+pop r2
+pop r1
+pop r0
+ret
-- 
1.8.1.msysgit.1

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] icl: Override Intel's CPU dispatcher

2013-06-20 Thread Alex Smith
Sorry but I probably should have flagged that as WIP(?) since I'm more looking
for comments on it than anything else (IRC was dead).  I'm not sure if that's
the proper place to add the dispatch code or if we even want to
include it in libav.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] icl: Override Intel's CPU dispatcher

2013-06-20 Thread Alex Smith
On Thu, Jun 20, 2013 at 7:20 AM, Alex Smith alex.sm...@warpsharp.info wrote:
 Sorry but I probably should have flagged that as WIP(?) since I'm more looking
 for comments on it than anything else (IRC was dead).  I'm not sure if that's
 the proper place to add the dispatch code or if we even want to
 include it in libav.

Oh, and this isn't strictly for ICL on Windows either.  I believe it
overrides the dispatch code on *nix with icc as well.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 2/2] configure: Do not explicitly set Oy for msvc/icl

2013-06-20 Thread Alex Smith
On Thu, Jun 20, 2013 at 8:02 AM, Hendrik Leppkes h.lepp...@gmail.com wrote:
 I can't be sure about ICL, it may have a separate option to enable DCE
 without all the optimizations, but MSVC folds DCE into the general
 optimization, so you need at least O1 or O2

It's exactly the same as msvc in that regard AFAIK.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 1/2] configure: More msvc/icl combining

2013-06-19 Thread Alex Smith
---
 configure | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/configure b/configure
index 543763f..f6c89ac 100755
--- a/configure
+++ b/configure
@@ -3945,14 +3945,14 @@ elif enabled tms470; then
 add_cflags -pds=824 -pds=837
 elif enabled pathscale; then
 add_cflags -fstrict-overflow -OPT:wrap_around_unsafe_opt=OFF
-elif enabled msvc; then
+elif enabled_any msvc icl; then
 enabled x86_32  disable aligned_stack
-elif enabled icl; then
-enabled x86_32  disable aligned_stack
-# basically -fstrict-aliasing for icl that doesn't work (correctly) on 
13.x+
-check_cpp_condition windows.h __ICL  1300  add_cflags -Qansi-alias
-# icl will pass the inline asm tests but inline asm is currently not 
supported (build will fail)
-disable inline_asm
+if enabled icl; then
+# basically -fstrict-aliasing for icl that doesn't work (correctly) on 
13.x+
+check_cpp_condition windows.h __ICL  1300  add_cflags 
-Qansi-alias
+# icl will pass the inline asm tests but inline asm is currently not 
supported (build will fail)
+disable inline_asm
+fi
 fi
 
 case $target_os in
-- 
1.8.1.msysgit.1

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 2/2] configure: Do not explicitly set Oy for msvc/icl

2013-06-19 Thread Alex Smith
Instead, since it is implied by O1 or O2, selectively disable frame
pointer omission for x86 debug builds.  Oy is ignored for x64 targets.
This also silences warnings with icl targeting x64.
---
 configure | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index f6c89ac..01251ca 100755
--- a/configure
+++ b/configure
@@ -2353,7 +2353,7 @@ msvc_common_flags(){
 -Wall);;
 -std=c99) ;;
 # Common flags
--fomit-frame-pointer) echo -Oy ;;
+-fomit-frame-pointer) ;;
 -g)   echo -Z7 ;;
 -fno-math-errno)  ;;
 -fno-common)  ;;
@@ -3947,6 +3947,7 @@ elif enabled pathscale; then
 add_cflags -fstrict-overflow -OPT:wrap_around_unsafe_opt=OFF
 elif enabled_any msvc icl; then
 enabled x86_32  disable aligned_stack
+enabled_all x86_32 debug  add_cflags -Oy-
 if enabled icl; then
 # basically -fstrict-aliasing for icl that doesn't work (correctly) on 
13.x+
 check_cpp_condition windows.h __ICL  1300  add_cflags 
-Qansi-alias
-- 
1.8.1.msysgit.1

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH] configure: Remove unneeded icl inline compatibility definition

2013-06-18 Thread Alex Smith
---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index 93a9b30..543763f 100755
--- a/configure
+++ b/configure
@@ -2625,7 +2625,7 @@ probe_cc(){
 # -Qdiag-error to make icl error when presented with certain unknown 
arguments
 _flags='-nologo -Qdiag-error:4044,10157'
 # -Qvec- -Qsimd- to prevent miscompilation, -GS for consistency with 
msvc which enables it by default
-_cflags='-D_USE_MATH_DEFINES -Dinline=__inline -FIstdlib.h 
-Dstrtoll=_strtoi64 -Qms0 -Qvec- -Qsimd- -GS'
+_cflags='-D_USE_MATH_DEFINES -FIstdlib.h -Dstrtoll=_strtoi64 -Qms0 
-Qvec- -Qsimd- -GS'
 if [ $pfx = hostcc ]; then
 append _cflags -Dsnprintf=_snprintf
 fi
-- 
1.8.1.msysgit.1

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 3/3] msvc: Omit frame pointers only on x86_32

2013-05-30 Thread Alex Smith
Oy is only supported on x86 compilers and will be ignored for x64.  Also
silences a warning about said unsupport when using ICL.
---
 configure | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index 73f4cd8..d9f15c8 100755
--- a/configure
+++ b/configure
@@ -2346,10 +2346,11 @@ msvc_common_flags(){
 # In addition to specifying certain flags under the compiler
 # specific filters, they must be specified here as well or else the
 # generic catch all at the bottom will print the original flag.
+# Oy is available only on x86 compilers
+-fomit-frame-pointer) enabled x86_32  echo -Oy ;;
 -Wall);;
 -std=c99) ;;
 # Common flags
--fomit-frame-pointer) echo -Oy ;;
 -g)   echo -Z7 ;;
 -fno-math-errno)  ;;
 -fno-common)  ;;
-- 
1.8.1.msysgit.1

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 2/3] configure: icl cosmetics

2013-05-30 Thread Alex Smith
---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index 897e1ed..73f4cd8 100755
--- a/configure
+++ b/configure
@@ -2619,7 +2619,7 @@ probe_cc(){
 _ld_lib='lib%.a'
 _ld_path='-libpath:'
 # -Qdiag-error to make icl error when presented with certain unknown 
arguments
-_flags='-nologo -Qdiag-error:10157 -Qdiag-error:4044'
+_flags='-nologo -Qdiag-error:4044,10157'
 # -Qvec- -Qsimd- to prevent miscompilation, -GS for consistency with 
msvc which enables it by default
 _cflags='-D_USE_MATH_DEFINES -Dinline=__inline -FIstdlib.h 
-Dstrtoll=_strtoi64 -Qms0 -Qvec- -Qsimd- -GS'
 if [ $pfx = hostcc ]; then
-- 
1.8.1.msysgit.1

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 1/3 v2] configure: Separate commonalities in msvc and icl flags

2013-05-30 Thread Alex Smith
Allows for easier handling of flags that may be specific to icl or msvc.
Furthermore, simplify the handling of warnings and remarks thanks to
icl's support of -Wall on Windows.
---
 configure | 42 +-
 1 file changed, 33 insertions(+), 9 deletions(-)

diff --git a/configure b/configure
index 48b405f..897e1ed 100755
--- a/configure
+++ b/configure
@@ -2340,16 +2340,17 @@ ccc_flags(){
done
 }

-msvc_flags(){
+msvc_common_flags(){
 for flag; do
 case $flag in
+# In addition to specifying certain flags under the compiler
+# specific filters, they must be specified here as well or else the
+# generic catch all at the bottom will print the original flag.
+-Wall);;
+-std=c99) ;;
+# Common flags
 -fomit-frame-pointer) echo -Oy ;;
 -g)   echo -Z7 ;;
--Wall)echo -W4 -wd4244 -wd4127 -wd4018 -wd4389 \
-   -wd4146 -wd4057 -wd4204 -wd4706 -wd4305 
\
-   -wd4152 -wd4324 -we4013 -wd4100 -wd4214 
\
-   -wd4996 -wd4273 ;;
--std=c99) ;;
 -fno-math-errno)  ;;
 -fno-common)  ;;
 -fno-signed-zeros);;
@@ -2365,6 +2366,30 @@ msvc_flags(){
 done
 }

+msvc_flags(){
+msvc_common_flags $@
+for flag; do
+case $flag in
+-Wall)echo -W4 -wd4244 -wd4127 -wd4018 -wd4389 \
+   -wd4146 -wd4057 -wd4204 -wd4706 -wd4305 
\
+   -wd4152 -wd4324 -we4013 -wd4100 -wd4214 
\
+   -wd4996 -wd4273 ;;
+esac
+done
+}
+
+icl_flags(){
+msvc_common_flags $@
+for flag; do
+case $flag in
+# Despite what Intel's documentation says -Wall, which is supported
+# on Windows, does enable remarks so disable them here.
+-Wall)echo $flag -Qdiag-disable:remark ;;
+-std=c99) echo -Qstd=c99 ;;
+esac
+done
+}
+
 pgi_flags(){
 for flag; do
 case $flag in
@@ -2590,13 +2615,13 @@ probe_cc(){
 fi
 _cc_o='-Fo $@'
 _cc_e='-P'
-_flags_filter=msvc_flags
+_flags_filter=icl_flags
 _ld_lib='lib%.a'
 _ld_path='-libpath:'
 # -Qdiag-error to make icl error when presented with certain unknown 
arguments
 _flags='-nologo -Qdiag-error:10157 -Qdiag-error:4044'
 # -Qvec- -Qsimd- to prevent miscompilation, -GS for consistency with 
msvc which enables it by default
-_cflags='-D_USE_MATH_DEFINES -Dinline=__inline -FIstdlib.h 
-Dstrtoll=_strtoi64 -Qstd=c99 -Qms0 -Qvec- -Qsimd- -GS'
+_cflags='-D_USE_MATH_DEFINES -Dinline=__inline -FIstdlib.h 
-Dstrtoll=_strtoi64 -Qms0 -Qvec- -Qsimd- -GS'
 if [ $pfx = hostcc ]; then
 append _cflags -Dsnprintf=_snprintf
 fi
@@ -3916,7 +3941,6 @@ elif enabled msvc; then
 enabled x86_32  disable aligned_stack
 elif enabled icl; then
 enabled x86_32  disable aligned_stack
-check_cflags -W1 # Just warnings, no remark spam
 # basically -fstrict-aliasing for icl that doesn't work (correctly) on 
13.x+
 check_cpp_condition windows.h __ICL  1300  add_cflags -Qansi-alias
 # icl will pass the inline asm tests but inline asm is currently not 
supported (build will fail)
--
1.8.1.msysgit.1

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH] configure: Separate commonalities in msvc and icl flags

2013-05-29 Thread Alex Smith
Allows for easier handling of flags that may be specific to icl or msvc.
Furthermore, simplify the handling of warnings and remarks thanks to
icl's support of -Wall on Windows.
---
 configure | 47 ---
 1 file changed, 36 insertions(+), 11 deletions(-)

diff --git a/configure b/configure
index 48b405f..d9f15c8 100755
--- a/configure
+++ b/configure
@@ -2340,16 +2340,18 @@ ccc_flags(){
done
 }
 
-msvc_flags(){
+msvc_common_flags(){
 for flag; do
 case $flag in
--fomit-frame-pointer) echo -Oy ;;
--g)   echo -Z7 ;;
--Wall)echo -W4 -wd4244 -wd4127 -wd4018 -wd4389 \
-   -wd4146 -wd4057 -wd4204 -wd4706 -wd4305 
\
-   -wd4152 -wd4324 -we4013 -wd4100 -wd4214 
\
-   -wd4996 -wd4273 ;;
+# In addition to specifying certain flags under the compiler
+# specific filters, they must be specified here as well or else the
+# generic catch all at the bottom will print the original flag.
+# Oy is available only on x86 compilers
+-fomit-frame-pointer) enabled x86_32  echo -Oy ;;
+-Wall);;
 -std=c99) ;;
+# Common flags
+-g)   echo -Z7 ;;
 -fno-math-errno)  ;;
 -fno-common)  ;;
 -fno-signed-zeros);;
@@ -2365,6 +2367,30 @@ msvc_flags(){
 done
 }
 
+msvc_flags(){
+msvc_common_flags $@
+for flag; do
+case $flag in
+-Wall)echo -W4 -wd4244 -wd4127 -wd4018 -wd4389 \
+   -wd4146 -wd4057 -wd4204 -wd4706 -wd4305 
\
+   -wd4152 -wd4324 -we4013 -wd4100 -wd4214 
\
+   -wd4996 -wd4273 ;;
+esac
+done
+}
+
+icl_flags(){
+msvc_common_flags $@
+for flag; do
+case $flag in
+# Despite what Intel's documentation says -Wall, which is supported
+# on Windows, does enable remarks so disable them here.
+-Wall)echo $flag -Qdiag-disable:remark ;;
+-std=c99) echo -Qstd=c99 ;;
+esac
+done
+}
+
 pgi_flags(){
 for flag; do
 case $flag in
@@ -2590,13 +2616,13 @@ probe_cc(){
 fi
 _cc_o='-Fo $@'
 _cc_e='-P'
-_flags_filter=msvc_flags
+_flags_filter=icl_flags
 _ld_lib='lib%.a'
 _ld_path='-libpath:'
 # -Qdiag-error to make icl error when presented with certain unknown 
arguments
-_flags='-nologo -Qdiag-error:10157 -Qdiag-error:4044'
+_flags='-nologo -Qdiag-error:4044,10157'
 # -Qvec- -Qsimd- to prevent miscompilation, -GS for consistency with 
msvc which enables it by default
-_cflags='-D_USE_MATH_DEFINES -Dinline=__inline -FIstdlib.h 
-Dstrtoll=_strtoi64 -Qstd=c99 -Qms0 -Qvec- -Qsimd- -GS'
+_cflags='-D_USE_MATH_DEFINES -Dinline=__inline -FIstdlib.h 
-Dstrtoll=_strtoi64 -Qms0 -Qvec- -Qsimd- -GS'
 if [ $pfx = hostcc ]; then
 append _cflags -Dsnprintf=_snprintf
 fi
@@ -3916,7 +3942,6 @@ elif enabled msvc; then
 enabled x86_32  disable aligned_stack
 elif enabled icl; then
 enabled x86_32  disable aligned_stack
-check_cflags -W1 # Just warnings, no remark spam
 # basically -fstrict-aliasing for icl that doesn't work (correctly) on 
13.x+
 check_cpp_condition windows.h __ICL  1300  add_cflags -Qansi-alias
 # icl will pass the inline asm tests but inline asm is currently not 
supported (build will fail)
-- 
1.8.1.msysgit.1

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 1/3] configure: Less generic msvc identification test

2013-05-25 Thread Alex Smith
I'm tempted to want to just drop this patch.  Nothing I've tried or that has
been suggested works for all versions involved.  This change or a more
complicated regex in the ICL patch isn't strictly nessasary as both work just
fine without them.

Feel free to make more suggestions if you've got them and I'll give it a shot.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 1/2 v2] configure: Fix check_exec_crash for ICL support

2013-05-25 Thread Alex Smith
From: Laurent laurent@gmail.com

Change the check_exec_crash test to use a function pointer instead of
simply calling the function.  The EBP availability test will crash when
compiled with ICL likely due to compiler optimization shenanigans.

Originally the check_exec_crash code was moved out of main to fix a
problem with gcc's treatment of non-leaf main on x86_32.  libav already
moved the code out of main but the addition of the function pointer will
prevent any inlining which fixes the remaining problem.

A function pointer is used since it is compiler agnostic (as opposed to
say __attribute__ ((noinline)) which would only work with gcc compatible
compilers).

Conflicts:
configure
---
 configure | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index e3cf0b9..819f9e6 100755
--- a/configure
+++ b/configure
@@ -908,9 +908,10 @@ check_exec_crash(){
 static void sighandler(int sig){
 raise(SIGTERM);
 }
-int foo(void){
+int func(void){
 $code
 }
+int (*func_ptr)(void) = func;
 int main(void){
 signal(SIGILL, sighandler);
 signal(SIGFPE, sighandler);
@@ -918,7 +919,7 @@ int main(void){
 #ifdef SIGBUS
 signal(SIGBUS, sighandler);
 #endif
-foo();
+return func_ptr();
 }
 EOF
 }
--
1.8.1.msysgit.1

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 2/2 v2] msvc/icl: Intel Compiler support on Windows

2013-05-25 Thread Alex Smith
Initial support for the ICL compiler on windows.  Requires a new c99wrap
with ICL support (1.0.2+).

Currently not much different speed wise compared to msvc.  In the future
with a few changes it can be made to support the inline asm.  This would
be the primary reason for using it.

Passed all fate tests, versions tested:
13.1.1.171 (2013 Update 3) x86 and x64
12.1.5.344 (2011 Update 11) x86 and x64
---
 configure | 39 +++
 1 file changed, 39 insertions(+)

diff --git a/configure b/configure
index 819f9e6..b956645 100755
--- a/configure
+++ b/configure
@@ -2227,6 +2227,13 @@ case $toolchain in
 ar_default=lib
 target_os_default=win32
 ;;
+icl)
+cc_default=c99wrap -noconv icl
+ld_default=c99wrap xilink
+nm_default=dumpbin -symbols
+ar_default=xilib
+target_os_default=win32
+;;
 gcov)
 add_cflags  -fprofile-arcs -ftest-coverage
 add_ldflags -fprofile-arcs -ftest-coverage
@@ -2554,6 +2561,31 @@ probe_cc(){
 if [ $pfx = hostcc ]; then
 append _cflags -Dsnprintf=_snprintf
 fi
+elif $_cc 21 | grep -q Intel; then
+_type=icl
+_ident=$($cc 21 | head -n1)
+_depflags='-QMMD -QMF$(@:.o=.d) -QMT$@'
+# Not only is O3 broken on 13.x+ but it's slower on all previous 
versions (tested) as well
+_cflags_speed=-O2
+_cflags_size=-O1 -Oi # -O1 without -Oi miscompiles stuff
+# Nonstandard output options, to avoid msys path conversion issues, 
relies on wrapper to remap it
+if $_cc 21 | grep -q Linker; then
+_ld_o='-out $@'
+else
+_ld_o='-Fe$@'
+fi
+_cc_o='-Fo $@'
+_cc_e='-P'
+_flags_filter=msvc_flags
+_ld_lib='lib%.a'
+_ld_path='-libpath:'
+# -Qdiag-error to make icl error when presented with certain unknown 
arguments
+_flags='-nologo -Qdiag-error:10157 -Qdiag-error:4044'
+# -Qvec- -Qsimd- to prevent miscompilation, -GS for consistency with 
msvc which enables it by default
+_cflags='-D_USE_MATH_DEFINES -Dinline=__inline -FIstdlib.h 
-Dstrtoll=_strtoi64 -Qstd=c99 -Qms0 -Qvec- -Qsimd- -GS'
+if [ $pfx = hostcc ]; then
+append _cflags -Dsnprintf=_snprintf
+fi
 fi

 eval ${pfx}_type=\$_type
@@ -3868,6 +3900,13 @@ elif enabled pathscale; then
 add_cflags -fstrict-overflow -OPT:wrap_around_unsafe_opt=OFF
 elif enabled msvc; then
 enabled x86_32  disable aligned_stack
+elif enabled icl; then
+enabled x86_32  disable aligned_stack
+check_cflags -W1 # Just warnings, no remark spam
+# basically -fstrict-aliasing for icl that doesn't work (correctly) on 
13.x+
+check_cpp_condition windows.h __ICL  1300  add_cflags -Qansi-alias
+# icl will pass the inline asm tests but inline asm is currently not 
supported (build will fail)
+disable inline_asm
 fi

 case $target_os in
--
1.8.1.msysgit.1

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 1/3] configure: Less generic msvc identification test

2013-05-25 Thread Alex Smith
On Sat, May 25, 2013 at 6:03 AM, Luca Barbato lu_z...@gentoo.org wrote:
 Microsoft (R) [^C]*C/C++ Optimizing Compiler

 Can we use that or there is something wrong with this setup?

Yea, it doesn't work for all cases.  Just tested again and it didn't
work for this:
Microsoft (R) C/C++ Optimizing Compiler
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 1/3] configure: Less generic msvc identification test

2013-05-16 Thread Alex Smith
While the current one works and it's unlikely it would cause any trouble
it's probably a good idea to use a slightly less generic string to grep
against.
---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index 7bcaac3..cbde7c0 100755
--- a/configure
+++ b/configure
@@ -2525,7 +2525,7 @@ probe_cc(){
 _cflags_size=-O2 -Munroll=c:1 $opt_common
 _cflags_noopt=-O1
 _flags_filter=pgi_flags
-elif $_cc 21 | grep -q Microsoft; then
+elif $_cc 21 | grep -q 'Microsoft (R) \(32-bit \)\?C/C++ Optimizing 
Compiler'; then
 _type=msvc
 _ident=$($cc 21 | head -n1)
 _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $ 21 | awk 
'\''/including/ { sub(/^.*file: */, ); gsub(/\\/, /); if (!match($$0, / /)) 
print $@:, $$0 }'\''  $(@:.o=.d)'
-- 
1.8.1.msysgit.1

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 2/3] configure: Fix certain tests for ICL support

2013-05-16 Thread Alex Smith
Originally commit 71d6b46849ca1c04d5ec7b74c9e48bdce68d5ebe in ffmpeg.

Certain tests, specifically EBP availability when using ICL, would crash
prior to this change.
---
 configure | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index cbde7c0..c65e0e9 100755
--- a/configure
+++ b/configure
@@ -908,9 +908,10 @@ check_exec_crash(){
 static void sighandler(int sig){
 raise(SIGTERM);
 }
-int foo(void){
+int func(void){
 $code
 }
+int (*func_ptr)(void) = func;
 int main(void){
 signal(SIGILL, sighandler);
 signal(SIGFPE, sighandler);
@@ -918,7 +919,7 @@ int main(void){
 #ifdef SIGBUS
 signal(SIGBUS, sighandler);
 #endif
-foo();
+return func_ptr();
 }
 EOF
 }
-- 
1.8.1.msysgit.1

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 3/3] configure: Intel Compiler support on Windows

2013-05-16 Thread Alex Smith
Initial support for the ICL compiler on windows.  Requires a new c99wrap
with ICL support (1.0.2+).

Currently not much different speed wise compared to msvc.  In the future
with a few changes it can be made to support the inline asm.  This would
be the primary reason for using it.
---
 configure | 38 ++
 1 file changed, 38 insertions(+)

diff --git a/configure b/configure
index c65e0e9..9208c64 100755
--- a/configure
+++ b/configure
@@ -,6 +,13 @@ case $toolchain in
 ar_default=lib
 target_os_default=win32
 ;;
+icl)
+cc_default=c99wrap -noconv icl
+ld_default=c99wrap xilink
+nm_default=dumpbin -symbols
+ar_default=xilib
+target_os_default=win32
+;;
 gcov)
 add_cflags  -fprofile-arcs -ftest-coverage
 add_ldflags -fprofile-arcs -ftest-coverage
@@ -2549,6 +2556,31 @@ probe_cc(){
 if [ $pfx = hostcc ]; then
 append _cflags -Dsnprintf=_snprintf
 fi
+elif $_cc 21 | grep -q 'Intel(R) C++ \(Intel(R) 64 \)\?Compiler'; then
+_type=icl
+_ident=$($cc 21 | head -n1)
+_depflags='-QMMD -QMF$(@:.o=.d) -QMT$@'
+# Not only is O3 broken on 13.x+ but it's slower on all previous 
versions (tested) as well
+_cflags_speed=-O2
+_cflags_size=-O1 -Oi # -O1 without -Oi miscompiles stuff
+# Nonstandard output options, to avoid msys path conversion issues, 
relies on wrapper to remap it
+if $_cc 21 | grep -q Linker; then
+_ld_o='-out $@'
+else
+_ld_o='-Fe$@'
+fi
+_cc_o='-Fo $@'
+_cc_e='-P'
+_flags_filter=msvc_flags
+_ld_lib='lib%.a'
+_ld_path='-libpath:'
+# -Qdiag-error to make icl error when presented with certain unknown 
arguments
+_flags='-nologo -Qdiag-error:10157 -Qdiag-error:4044'
+# -Qvec- -Qsimd- to prevent miscompilation, -GS for consistency with 
msvc which enables it by default
+_cflags='-D_USE_MATH_DEFINES -Dinline=__inline -FIstdlib.h 
-Dstrtoll=_strtoi64 -Qstd=c99 -Qms0 -Qvec- -Qsimd- -GS'
+if [ $pfx = hostcc ]; then
+append _cflags -Dsnprintf=_snprintf
+fi
 fi
 
 eval ${pfx}_type=\$_type
@@ -3853,6 +3885,12 @@ elif enabled pathscale; then
 add_cflags -fstrict-overflow -OPT:wrap_around_unsafe_opt=OFF
 elif enabled msvc; then
 enabled x86_32  disable aligned_stack
+elif enabled icl; then
+enabled x86_32  disable aligned_stack
+# basically -fstrict-aliasing for icl that doesn't work (correctly) on 
13.x+
+check_cpp_condition windows.h __ICL  1300  add_cflags -Qansi-alias
+# icl will pass the inline asm tests but inline asm is currently not 
supported (build will fail)
+disable inline_asm
 fi
 
 case $target_os in
-- 
1.8.1.msysgit.1

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 1/3] configure: Less generic msvc identification test

2013-05-16 Thread Alex Smith
On Thu, May 16, 2013 at 5:10 PM, Luca Barbato lu_z...@gentoo.org wrote:
 On 05/16/2013 11:08 PM, Alex Smith wrote:
 While the current one works and it's unlikely it would cause any trouble
 it's probably a good idea to use a slightly less generic string to grep
 against.
 ---
  configure | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

 diff --git a/configure b/configure
 index 7bcaac3..cbde7c0 100755
 --- a/configure
 +++ b/configure
 @@ -2525,7 +2525,7 @@ probe_cc(){
  _cflags_size=-O2 -Munroll=c:1 $opt_common
  _cflags_noopt=-O1
  _flags_filter=pgi_flags
 -elif $_cc 21 | grep -q Microsoft; then
 +elif $_cc 21 | grep -q 'Microsoft (R) \(32-bit \)\?C/C++ Optimizing 
 Compiler'; then

 why 32bit there isn't a 64bit version ?

The 64-bit version has nothing there.

There are two options:
Microsoft (R) 32-bit C/C++ Optimizing Compiler
or
Microsoft (R) C/C++ Optimizing Compiler
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 2/3] configure: Fix certain tests for ICL support

2013-05-16 Thread Alex Smith
On Thu, May 16, 2013 at 6:09 PM, Luca Barbato lu_z...@gentoo.org wrote:
 On 05/16/2013 11:08 PM, Alex Smith wrote:

 Adding return foo(); isn't enough?

 lu

I assume it's like that for a reason.

The original ffmpeg commit can be found here:
http://git.videolan.org/?p=ffmpeg.git;a=commitdiff;h=71d6b46849ca1c04d5ec7b74c9e48bdce68d5ebe

They originally had it to what you're suggesting.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH] configure: Use linker hardening flags on mingw

2013-05-14 Thread Alex Smith
This makes it consistent with the msvc builds which automatically set
the DEP and ASLR flags by default.  There really is no good reason why
they shouldn't be set.

The fact that binutils does not set them on by default boggles the mind.
---
 configure | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configure b/configure
index c84050c..7bcaac3 100755
--- a/configure
+++ b/configure
@@ -3029,6 +3029,8 @@ case $target_os in
 elif enabled arm; then
 LIBTARGET=arm-wince
 fi
+check_ldflags -Wl,--nxcompat
+check_ldflags -Wl,--dynamicbase
 shlibdir_default=$bindir_default
 SLIBPREF=
 SLIBSUF=.dll
-- 
1.8.1.msysgit.1

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel