[x264-devel] x86: Change assembler from yasm to nasm

Henrik Gramner git at videolan.org
Mon May 22 00:02:47 CEST 2017


x264 | branch: master | Henrik Gramner <henrik at gramner.com> | Sat Mar 18 18:50:36 2017 +0100| [d2b5f4873e2147452a723b61b14f030b2ee760a5] | committer: Henrik Gramner

x86: Change assembler from yasm to nasm

This is required to support AVX-512.

Drop `-Worphan-labels` from ASFLAGS since it's enabled by default in nasm.

Also change alignmode from `k8` to `p6` since it's more similar to `amdnop`
in yasm, e.g. use long nops without excessive prefixes.

> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=d2b5f4873e2147452a723b61b14f030b2ee760a5
---

 common/x86/x86inc.asm | 15 +--------------
 configure             |  9 ++++-----
 2 files changed, 5 insertions(+), 19 deletions(-)

diff --git a/common/x86/x86inc.asm b/common/x86/x86inc.asm
index e7168b18..f7ab7938 100644
--- a/common/x86/x86inc.asm
+++ b/common/x86/x86inc.asm
@@ -836,7 +836,7 @@ BRANCH_INSTR jz, je, jnz, jne, jl, jle, jnl, jnle, jg, jge, jng, jnge, ja, jae,
 
     %if ARCH_X86_64 || cpuflag(sse2)
         %ifdef __NASM_VER__
-            ALIGNMODE k8
+            ALIGNMODE p6
         %else
             CPU amdnop
         %endif
@@ -1533,16 +1533,3 @@ FMA4_INSTR fmsub,    pd, ps, sd, ss
 FMA4_INSTR fmsubadd, pd, ps
 FMA4_INSTR fnmadd,   pd, ps, sd, ss
 FMA4_INSTR fnmsub,   pd, ps, sd, ss
-
-; workaround: vpbroadcastq is broken in x86_32 due to a yasm bug (fixed in 1.3.0)
-%ifdef __YASM_VER__
-    %if __YASM_VERSION_ID__ < 0x01030000 && ARCH_X86_64 == 0
-        %macro vpbroadcastq 2
-            %if sizeof%1 == 16
-                movddup %1, %2
-            %else
-                vbroadcastsd %1, %2
-            %endif
-        %endmacro
-    %endif
-%endif
diff --git a/configure b/configure
index ec9389d8..4ebaf572 100755
--- a/configure
+++ b/configure
@@ -688,7 +688,7 @@ stack_alignment=4
 case $host_cpu in
     i*86)
         ARCH="X86"
-        AS="${AS-yasm}"
+        AS="${AS-nasm}"
         AS_EXT=".asm"
         ASFLAGS="$ASFLAGS -DARCH_X86_64=0 -I\$(SRCPATH)/common/x86/"
         if [ $compiler = GNU ]; then
@@ -714,7 +714,7 @@ case $host_cpu in
         ;;
     x86_64)
         ARCH="X86_64"
-        AS="${AS-yasm}"
+        AS="${AS-nasm}"
         AS_EXT=".asm"
         ASFLAGS="$ASFLAGS -DARCH_X86_64=1 -I\$(SRCPATH)/common/x86/"
         stack_alignment=16
@@ -886,15 +886,14 @@ elif [ $compiler = ICC -a $ARCH = X86 ]; then
 fi
 
 if [ $asm = auto -a \( $ARCH = X86 -o $ARCH = X86_64 \) ] ; then
-    if ! as_check "vpmovzxwd ymm0, xmm0" ; then
+    if ! as_check "vmovdqa32 [eax]{k1}{z}, zmm0" ; then
         VER=`($AS --version || echo no assembler) 2>/dev/null | head -n 1`
         echo "Found $VER"
-        echo "Minimum version is yasm-1.2.0"
+        echo "Minimum version is nasm-2.13"
         echo "If you really want to compile without asm, configure with --disable-asm."
         exit 1
     fi
     cc_check '' '' '__asm__("pabsw %xmm0, %xmm0");' && define HAVE_X86_INLINE_ASM
-    ASFLAGS="$ASFLAGS -Worphan-labels"
     define HAVE_MMX
 fi
 



More information about the x264-devel mailing list