Skip to content

Commit

Permalink
x86: Change assembler from yasm to nasm
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Gramner committed May 21, 2017
1 parent 8c29742 commit d2b5f48
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 19 deletions.
15 changes: 1 addition & 14 deletions common/x86/x86inc.asm
Expand Up @@ -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
Expand Down Expand Up @@ -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
9 changes: 4 additions & 5 deletions configure
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit d2b5f48

Please sign in to comment.