Skip to content

Commit

Permalink
build: Generalize yasm/nasm-related variable names
Browse files Browse the repository at this point in the history
None of them are specific to the YASM assembler.

(Cherry-picked from libav commit 39e208f)

Signed-off-by: James Almer <[email protected]>
  • Loading branch information
DonDiego authored and jamrial committed Jun 21, 2017
1 parent 664ac7c commit fd502f4
Show file tree
Hide file tree
Showing 49 changed files with 246 additions and 236 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ ffbuild/.config: $(CONFIGURABLE_COMPONENTS)
SUBDIR_VARS := CLEANFILES EXAMPLES FFLIBS HOSTPROGS TESTPROGS TOOLS \
HEADERS ARCH_HEADERS BUILT_HEADERS SKIPHEADERS \
ARMV5TE-OBJS ARMV6-OBJS ARMV8-OBJS VFP-OBJS NEON-OBJS \
ALTIVEC-OBJS VSX-OBJS MMX-OBJS YASM-OBJS \
ALTIVEC-OBJS VSX-OBJS MMX-OBJS X86ASM-OBJS \
MIPSFPU-OBJS MIPSDSPR2-OBJS MIPSDSP-OBJS MSA-OBJS \
MMI-OBJS OBJS SLIBOBJS HOSTOBJS TESTOBJS

Expand Down
74 changes: 42 additions & 32 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ Toolchain options:
--ln_s=LN_S use symbolic link tool LN_S [$ln_s_default]
--strip=STRIP use strip tool STRIP [$strip_default]
--windres=WINDRES use windows resource compiler WINDRES [$windres_default]
--yasmexe=EXE use yasm-compatible assembler EXE [$yasmexe_default]
--x86asmexe=EXE use nasm-compatible assembler EXE [$x86asmexe_default]
--cc=CC use C compiler CC [$cc_default]
--cxx=CXX use C compiler CXX [$cxx_default]
--objcc=OCC use ObjC compiler OCC [$cc_default]
Expand Down Expand Up @@ -401,7 +401,7 @@ Optimization options (experts only):
--disable-vfp disable VFP optimizations
--disable-neon disable NEON optimizations
--disable-inline-asm disable use of inline assembly
--disable-yasm disable use of nasm/yasm assembly
--disable-x86asm disable use of standalone x86 assembly
--disable-mipsdsp disable MIPS DSP ASE R1 optimizations
--disable-mipsdspr2 disable MIPS DSP ASE R2 optimizations
--disable-msa disable MSA optimizations
Expand Down Expand Up @@ -979,12 +979,12 @@ check_insn(){
echo "$2" | check_as && enable ${1}_external || disable ${1}_external
}

check_yasm(){
log check_yasm "$@"
check_x86asm(){
log check_x86asm "$@"
echo "$1" > $TMPS
log_file $TMPS
shift 1
check_cmd $yasmexe $YASMFLAGS -Werror "$@" -o $TMPO $TMPS
check_cmd $x86asmexe $X86ASMFLAGS -Werror "$@" -o $TMPO $TMPS
}

ld_o(){
Expand Down Expand Up @@ -1833,7 +1833,7 @@ BUILTIN_LIST="
HAVE_LIST_CMDLINE="
inline_asm
symver
yasm
x86asm
"

HAVE_LIST_PUB="
Expand Down Expand Up @@ -2237,7 +2237,7 @@ CMDLINE_SET="
tempprefix
toolchain
valgrind
yasmexe
x86asmexe
"

CMDLINE_APPEND="
Expand Down Expand Up @@ -2305,7 +2305,7 @@ fma3_deps="avx"
fma4_deps="avx"
avx2_deps="avx"

mmx_external_deps="yasm"
mmx_external_deps="x86asm"
mmx_inline_deps="inline_asm"
mmx_suggest="mmx_external mmx_inline"

Expand Down Expand Up @@ -3259,7 +3259,7 @@ pkg_config_default=pkg-config
ranlib_default="ranlib"
strip_default="strip"
version_script='--version-script'
yasmexe_default="yasm"
x86asmexe_default="yasm"
windres_default="windres"
nvcc_default="nvcc"
nvccflags_default="-gencode arch=compute_30,code=sm_30 -O2"
Expand Down Expand Up @@ -3508,6 +3508,16 @@ for opt do
[ "$list" = "" ] && warn "Option $opt did not match anything"
$action $list
;;
--enable-yasm|--disable-yasm)
warn "The ${opt} option is only provided for compatibility and will be\n"\
"removed in the future. Use --enable-x86asm / --disable-x86asm instead."
test $opt = --enable-yasm && x86asm=yes || x86asm=no
;;
--yasmexe=*)
warn "The --yasmexe option is only provided for compatibility and will be\n"\
"removed in the future. Use --x86asmexe instead."
x86asmexe="$optval"
;;
--enable-?*|--disable-?*)
eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
if is_in $option $COMPONENT_LIST; then
Expand Down Expand Up @@ -3726,7 +3736,7 @@ windres_default="${cross_prefix}${windres_default}"
sysinclude_default="${sysroot}/usr/include"

set_default arch cc cxx doxygen pkg_config ranlib strip sysinclude \
target_exec target_os yasmexe nvcc
target_exec target_os x86asmexe nvcc
enabled cross_compile || host_cc_default=$cc
set_default host_cc

Expand Down Expand Up @@ -5477,13 +5487,13 @@ EOF
enabled ssse3 && check_inline_asm ssse3_inline '"pabsw %xmm0, %xmm0"'
enabled mmxext && check_inline_asm mmxext_inline '"pmaxub %mm0, %mm1"'

if ! disabled_any asm mmx yasm; then
if check_cmd $yasmexe --version; then
enabled x86_64 && yasm_extra="-m amd64"
yasm_debug="-g dwarf2"
if ! disabled_any asm mmx x86asm; then
if check_cmd $x86asmexe --version; then
enabled x86_64 && x86asm_extra="-m amd64"
x86asm_debug="-g dwarf2"
elif check_cmd nasm -v; then
yasmexe=nasm
yasm_debug="-g -F dwarf"
x86asmexe=nasm
x86asm_debug="-g -F dwarf"
if enabled x86_64; then
case "$objformat" in
elf) objformat=elf64 ;;
Expand All @@ -5492,19 +5502,19 @@ EOF
fi
fi

YASMFLAGS="-f $objformat $yasm_extra"
enabled pic && append YASMFLAGS "-DPIC"
test -n "$extern_prefix" && append YASMFLAGS "-DPREFIX"
X86ASMFLAGS="-f $objformat $x86asm_extra"
enabled pic && append X86ASMFLAGS "-DPIC"
test -n "$extern_prefix" && append X86ASMFLAGS "-DPREFIX"
case "$objformat" in
elf*) enabled debug && append YASMFLAGS $yasm_debug ;;
elf*) enabled debug && append X86ASMFLAGS $x86asm_debug ;;
esac

check_yasm "movbe ecx, [5]" && enable yasm ||
die "yasm/nasm not found or too old. Use --disable-yasm for a crippled build."
check_yasm "vextracti128 xmm0, ymm0, 0" || disable avx2_external
check_yasm "vpmacsdd xmm0, xmm1, xmm2, xmm3" || disable xop_external
check_yasm "vfmaddps ymm0, ymm1, ymm2, ymm3" || disable fma4_external
check_yasm "CPU amdnop" || disable cpunop
check_x86asm "movbe ecx, [5]" && enable x86asm ||
die "yasm/nasm not found or too old. Use --disable-x86asm for a crippled build."
check_x86asm "vextracti128 xmm0, ymm0, 0" || disable avx2_external
check_x86asm "vpmacsdd xmm0, xmm1, xmm2, xmm3" || disable xop_external
check_x86asm "vfmaddps ymm0, ymm1, ymm2, ymm3" || disable fma4_external
check_x86asm "CPU amdnop" || disable cpunop
fi

case "$cpu" in
Expand Down Expand Up @@ -6591,7 +6601,7 @@ fi
echo "big-endian ${bigendian-no}"
echo "runtime cpu detection ${runtime_cpudetect-no}"
if enabled x86; then
echo "${yasmexe} ${yasm-no}"
echo "standalone assembly ${x86asm-no}"
echo "MMX enabled ${mmx-no}"
echo "MMXEXT enabled ${mmxext-no}"
echo "3DNow! enabled ${amd3dnow-no}"
Expand Down Expand Up @@ -6727,8 +6737,8 @@ DEPCC=$dep_cc
DEPCCFLAGS=$DEPCCFLAGS \$(CPPFLAGS)
DEPAS=$as
DEPASFLAGS=$DEPASFLAGS \$(CPPFLAGS)
YASM=$yasmexe
DEPYASM=$yasmexe
X86ASM=$x86asmexe
DEPX86ASM=$x86asmexe
AR=$ar
ARFLAGS=$arflags
AR_O=$ar_o
Expand Down Expand Up @@ -6767,7 +6777,7 @@ LDEXEFLAGS=$LDEXEFLAGS
LDLIBFLAGS=$LDLIBFLAGS
SHFLAGS=$(echo $($ldflags_filter $SHFLAGS))
ASMSTRIPFLAGS=$ASMSTRIPFLAGS
YASMFLAGS=$YASMFLAGS
X86ASMFLAGS=$X86ASMFLAGS
BUILDSUF=$build_suffix
PROGSSUF=$progs_suffix
FULLNAME=$FULLNAME
Expand Down Expand Up @@ -6861,7 +6871,7 @@ test -n "$assert_level" &&
test -n "$malloc_prefix" &&
echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH

if enabled yasm; then
if enabled x86asm; then
append config_files $TMPASM
printf '' >$TMPASM
fi
Expand All @@ -6887,7 +6897,7 @@ echo "endif # FFMPEG_CONFIG_MAK" >> ffbuild/config.mak
cp_if_changed $TMPH config.h
touch ffbuild/.config

enabled yasm && cp_if_changed $TMPASM config.asm
enabled x86asm && cp_if_changed $TMPASM config.asm

cat > $TMPH <<EOF
/* Generated by ffconf */
Expand Down
2 changes: 1 addition & 1 deletion ffbuild/arch.mak
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ OBJS-$(HAVE_ALTIVEC) += $(ALTIVEC-OBJS) $(ALTIVEC-OBJS-yes)
OBJS-$(HAVE_VSX) += $(VSX-OBJS) $(VSX-OBJS-yes)

OBJS-$(HAVE_MMX) += $(MMX-OBJS) $(MMX-OBJS-yes)
OBJS-$(HAVE_YASM) += $(YASM-OBJS) $(YASM-OBJS-yes)
OBJS-$(HAVE_X86ASM) += $(X86ASM-OBJS) $(X86ASM-OBJS-yes)
26 changes: 13 additions & 13 deletions ffbuild/common.mak
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@
# common bits used by all libraries
#

DEFAULT_YASMD=.dbg
DEFAULT_X86ASMD=.dbg

ifeq ($(DBG),1)
YASMD=$(DEFAULT_YASMD)
X86ASMD=$(DEFAULT_X86ASMD)
else
YASMD=
X86ASMD=
endif

ifndef SUBDIR

ifndef V
Q = @
ECHO = printf "$(1)\t%s\n" $(2)
BRIEF = CC CXX OBJCC HOSTCC HOSTLD AS YASM AR LD STRIP CP WINDRES NVCC
SILENT = DEPCC DEPHOSTCC DEPAS DEPYASM RANLIB RM
BRIEF = CC CXX OBJCC HOSTCC HOSTLD AS X86ASM AR LD STRIP CP WINDRES NVCC
SILENT = DEPCC DEPHOSTCC DEPAS DEPX86ASM RANLIB RM

MSG = $@
M = @$(call ECHO,$(TAG),$@);
Expand All @@ -37,7 +37,7 @@ OBJCFLAGS += $(EOBJCFLAGS)
OBJCCFLAGS = $(CPPFLAGS) $(CFLAGS) $(OBJCFLAGS)
ASFLAGS := $(CPPFLAGS) $(ASFLAGS)
CXXFLAGS := $(CPPFLAGS) $(CFLAGS) $(CXXFLAGS)
YASMFLAGS += $(IFLAGS:%=%/) -Pconfig.asm
X86ASMFLAGS += $(IFLAGS:%=%/) -Pconfig.asm
NVCCFLAGS += -ptx

HOSTCCFLAGS = $(IFLAGS) $(HOSTCPPFLAGS) $(HOSTCFLAGS)
Expand Down Expand Up @@ -73,13 +73,13 @@ COMPILE_NVCC = $(call COMPILE,NVCC)
%_host.o: %.c
$(COMPILE_HOSTC)

%$(DEFAULT_YASMD).asm: %.asm
$(DEPYASM) $(YASMFLAGS) -I $(<D)/ -M -o $@ $< > $(@:.asm=.d)
$(YASM) $(YASMFLAGS) -I $(<D)/ -e $< | sed '/^%/d;/^$$/d;' > $@
%$(DEFAULT_X86ASMD).asm: %.asm
$(DEPX86ASM) $(X86ASMFLAGS) -I $(<D)/ -M -o $@ $< > $(@:.asm=.d)
$(X86ASM) $(X86ASMFLAGS) -I $(<D)/ -e $< | sed '/^%/d;/^$$/d;' > $@

%.o: %.asm
$(DEPYASM) $(YASMFLAGS) -I $(<D)/ -M -o $@ $< > $(@:.o=.d)
$(YASM) $(YASMFLAGS) -I $(<D)/ -o $@ $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<)
$(DEPX86ASM) $(X86ASMFLAGS) -I $(<D)/ -M -o $@ $< > $(@:.o=.d)
$(X86ASM) $(X86ASMFLAGS) -I $(<D)/ -o $@ $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<)
-$(if $(ASMSTRIPFLAGS), $(STRIP) $(ASMSTRIPFLAGS) $@)

%.o: %.rc
Expand Down Expand Up @@ -163,7 +163,7 @@ $(TOOLOBJS): | tools

OBJDIRS := $(OBJDIRS) $(dir $(OBJS) $(HOBJS) $(HOSTOBJS) $(SLIBOBJS) $(TESTOBJS))

CLEANSUFFIXES = *.d *.o *~ *.h.c *.gcda *.gcno *.map *.ver *.version *.ho *$(DEFAULT_YASMD).asm *.ptx *.ptx.c
CLEANSUFFIXES = *.d *.o *~ *.h.c *.gcda *.gcno *.map *.ver *.version *.ho *$(DEFAULT_X86ASMD).asm *.ptx *.ptx.c
DISTCLEANSUFFIXES = *.pc
LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a

Expand All @@ -174,4 +174,4 @@ endef

$(eval $(RULES))

-include $(wildcard $(OBJS:.o=.d) $(HOSTOBJS:.o=.d) $(TESTOBJS:.o=.d) $(HOBJS:.o=.d) $(SLIBOBJS:.o=.d)) $(OBJS:.o=$(DEFAULT_YASMD).d)
-include $(wildcard $(OBJS:.o=.d) $(HOSTOBJS:.o=.d) $(TESTOBJS:.o=.d) $(HOBJS:.o=.d) $(SLIBOBJS:.o=.d)) $(OBJS:.o=$(DEFAULT_X86ASMD).d)
10 changes: 5 additions & 5 deletions libavcodec/tests/x86/dct.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "libavcodec/x86/xvididct.h"
#include "libavcodec/x86/simple_idct.h"

#if (CONFIG_PRORES_DECODER || CONFIG_PRORES_LGPL_DECODER) && ARCH_X86_64 && HAVE_YASM
#if (CONFIG_PRORES_DECODER || CONFIG_PRORES_LGPL_DECODER) && ARCH_X86_64 && HAVE_X86ASM
void ff_prores_idct_put_10_sse2(uint16_t *dst, int linesize,
int16_t *block, int16_t *qmat);

Expand Down Expand Up @@ -70,22 +70,22 @@ static const struct algo idct_tab_arch[] = {
#if HAVE_MMX_EXTERNAL
{ "SIMPLE-MMX", ff_simple_idct_mmx, FF_IDCT_PERM_SIMPLE, AV_CPU_FLAG_MMX },
#endif
#if CONFIG_MPEG4_DECODER && HAVE_YASM
#if CONFIG_MPEG4_DECODER && HAVE_X86ASM
#if ARCH_X86_32
{ "XVID-MMX", ff_xvid_idct_mmx, FF_IDCT_PERM_NONE, AV_CPU_FLAG_MMX, 1 },
{ "XVID-MMXEXT", ff_xvid_idct_mmxext, FF_IDCT_PERM_NONE, AV_CPU_FLAG_MMXEXT, 1 },
#endif
#if HAVE_SSE2_EXTERNAL
{ "XVID-SSE2", ff_xvid_idct_sse2, FF_IDCT_PERM_SSE2, AV_CPU_FLAG_SSE2, 1 },
#endif
#endif /* CONFIG_MPEG4_DECODER && HAVE_YASM */
#if (CONFIG_PRORES_DECODER || CONFIG_PRORES_LGPL_DECODER) && ARCH_X86_64 && HAVE_YASM
#endif /* CONFIG_MPEG4_DECODER && HAVE_X86ASM */
#if (CONFIG_PRORES_DECODER || CONFIG_PRORES_LGPL_DECODER) && ARCH_X86_64 && HAVE_X86ASM
{ "PR-SSE2", ff_prores_idct_put_10_sse2_wrap, FF_IDCT_PERM_TRANSPOSE, AV_CPU_FLAG_SSE2, 1 },
# if HAVE_AVX_EXTERNAL
{ "PR-AVX", ff_prores_idct_put_10_avx_wrap, FF_IDCT_PERM_TRANSPOSE, AV_CPU_FLAG_AVX, 1 },
# endif
#endif
#if HAVE_YASM
#if HAVE_X86ASM
#if ARCH_X86_64
#if HAVE_SSE2_EXTERNAL
{ "SIMPLE10-SSE2", ff_simple_idct10_sse2, FF_IDCT_PERM_TRANSPOSE, AV_CPU_FLAG_SSE2},
Expand Down
Loading

0 comments on commit fd502f4

Please sign in to comment.