<div dir="ltr">nasm 2.13 was released in April 2017 and 2.13.01 is the latest stable version.<div>Is there is any problem updating to 2.13?<br></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr">Thanks<div>Vignesh</div><div><br></div></div></div></div></div></div></div></div></div>
<br><div class="gmail_quote">On Tue, Nov 21, 2017 at 5:55 PM, Sean McGovern <span dir="ltr"><<a href="mailto:gseanmcg@gmail.com" target="_blank">gseanmcg@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
Is this really necessary?<br>
<br>
Ubuntu 16.04 Xenial Xerus only ships with nasm 2.11.08.<br>
<br>
-- Sean McG.<br>
<br>
Original Message <br>
From: <a href="mailto:vignesh@multicorewareinc.com">vignesh@multicorewareinc.com</a><br>
Sent: November 21, 2017 12:07 AM<br>
To: <a href="mailto:x265-devel@videolan.org">x265-devel@videolan.org</a><br>
Reply-to: <a href="mailto:x265-devel@videolan.org">x265-devel@videolan.org</a><br>
Subject: [x265] [PATCH 2 of 2] x86: Change assembler from YASM to NASM<br>
<div><div class="h5"><br>
# HG changeset patch<br>
# User Vignesh Vijayakumar<<a href="mailto:vignesh@multicorewareinc.com">vignesh@<wbr>multicorewareinc.com</a>><br>
# Date 1509595841 -19800<br>
# Thu Nov 02 09:40:41 2017 +0530<br>
# Node ID 16ea92bf3627c6de43d583554df294<wbr>dbbfd8fa8a<br>
# Parent 182bfd0d5af929a801a08b35ee863d<wbr>79eadb2833<br>
x86: Change assembler from YASM to NASM<br>
<br>
Supports NASM versions 2.13 and greater<br>
<br>
diff -r 182bfd0d5af9 -r 16ea92bf3627 source/CMakeLists.txt<br>
--- a/source/CMakeLists.txt Thu Nov 02 09:39:58 2017 +0530<br>
+++ b/source/CMakeLists.txt Thu Nov 02 09:40:41 2017 +0530<br>
@@ -323,15 +323,15 @@<br>
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE CC_VERSION)<br>
endif(GCC)<br>
<br>
-find_package(Yasm)<br>
+find_package(Nasm)<br>
if(ARM OR CROSS_COMPILE_ARM)<br>
option(ENABLE_ASSEMBLY "Enable use of assembly coded primitives" ON)<br>
-elseif(YASM_FOUND AND X86)<br>
- if (YASM_VERSION_STRING VERSION_LESS "1.2.0")<br>
- message(STATUS "Yasm version ${YASM_VERSION_STRING} is too old. 1.2.0 or later required")<br>
+elseif(NASM_FOUND AND X86)<br>
+ if (NASM_VERSION_STRING VERSION_LESS "2.13.0")<br>
+ message(STATUS "Nasm version ${NASM_VERSION_STRING} is too old. 2.13.0 or later required")<br>
option(ENABLE_ASSEMBLY "Enable use of assembly coded primitives" OFF)<br>
else()<br>
- message(STATUS "Found Yasm ${YASM_VERSION_STRING} to build assembly primitives")<br>
+ message(STATUS "Found Nasm ${NASM_VERSION_STRING} to build assembly primitives")<br>
option(ENABLE_ASSEMBLY "Enable use of assembly coded primitives" ON)<br>
endif()<br>
else()<br>
@@ -517,18 +517,18 @@<br>
list(APPEND ASM_OBJS ${ASM}.${SUFFIX})<br>
add_custom_command(<br>
OUTPUT ${ASM}.${SUFFIX}<br>
- COMMAND ${YASM_EXECUTABLE} ARGS ${YASM_FLAGS} ${ASM_SRC} -o ${ASM}.${SUFFIX}<br>
+ COMMAND ${NASM_EXECUTABLE} ARGS ${NASM_FLAGS} ${ASM_SRC} -o ${ASM}.${SUFFIX}<br>
DEPENDS ${ASM_SRC})<br>
endforeach()<br>
endif()<br>
endif()<br>
source_group(ASM FILES ${ASM_SRCS})<br>
if(ENABLE_HDR10_PLUS)<br>
- add_library(x265-static STATIC $<TARGET_OBJECTS:encoder> $<TARGET_OBJECTS:common> $<TARGET_OBJECTS:dynamicHDR10> ${ASM_OBJS} ${ASM_SRCS})<br>
+ add_library(x265-static STATIC $<TARGET_OBJECTS:encoder> $<TARGET_OBJECTS:common> $<TARGET_OBJECTS:dynamicHDR10> ${ASM_OBJS})<br>
add_library(hdr10plus-static STATIC $<TARGET_OBJECTS:dynamicHDR10><wbr>)<br>
set_target_properties(<wbr>hdr10plus-static PROPERTIES OUTPUT_NAME hdr10plus)<br>
else()<br>
- add_library(x265-static STATIC $<TARGET_OBJECTS:encoder> $<TARGET_OBJECTS:common> ${ASM_OBJS} ${ASM_SRCS})<br>
+ add_library(x265-static STATIC $<TARGET_OBJECTS:encoder> $<TARGET_OBJECTS:common> ${ASM_OBJS})<br>
endif()<br>
if(NOT MSVC)<br>
set_target_properties(x265-<wbr>static PROPERTIES OUTPUT_NAME x265)<br>
@@ -686,11 +686,11 @@<br>
if(ENABLE_HDR10_PLUS)<br>
add_executable(cli ../COPYING ${InputFiles} ${OutputFiles} ${GETOPT}<br>
x265.cpp x265.h x265cli.h<br>
- $<TARGET_OBJECTS:encoder> $<TARGET_OBJECTS:common> $<TARGET_OBJECTS:dynamicHDR10> ${ASM_OBJS} ${ASM_SRCS})<br>
+ $<TARGET_OBJECTS:encoder> $<TARGET_OBJECTS:common> $<TARGET_OBJECTS:dynamicHDR10> ${ASM_OBJS})<br>
else()<br>
add_executable(cli ../COPYING ${InputFiles} ${OutputFiles} ${GETOPT}<br>
x265.cpp x265.h x265cli.h<br>
- $<TARGET_OBJECTS:encoder> $<TARGET_OBJECTS:common> ${ASM_OBJS} ${ASM_SRCS})<br>
+ $<TARGET_OBJECTS:encoder> $<TARGET_OBJECTS:common> ${ASM_OBJS})<br>
endif()<br>
else()<br>
add_executable(cli ../COPYING ${InputFiles} ${OutputFiles} ${GETOPT} ${X265_RC_FILE}<br>
diff -r 182bfd0d5af9 -r 16ea92bf3627 source/cmake/CMakeASM_<wbr>NASMInformation.cmake<br>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000<br>
+++ b/source/cmake/CMakeASM_<wbr>NASMInformation.cmake Thu Nov 02 09:40:41 2017 +0530<br>
@@ -0,0 +1,68 @@<br>
+set(ASM_DIALECT "_NASM")<br>
+set(CMAKE_ASM${ASM_DIALECT}_<wbr>SOURCE_FILE_EXTENSIONS asm)<br>
+<br>
+if(X64)<br>
+ list(APPEND ASM_FLAGS -DARCH_X86_64=1 -I ${CMAKE_CURRENT_SOURCE_DIR}/..<wbr>/common/x86/)<br>
+ if(ENABLE_PIC)<br>
+ list(APPEND ASM_FLAGS -DPIC)<br>
+ endif()<br>
+ if(APPLE)<br>
+ set(ARGS -f macho64 -DPREFIX)<br>
+ elseif(UNIX AND NOT CYGWIN)<br>
+ set(ARGS -f elf64)<br>
+ else()<br>
+ set(ARGS -f win64)<br>
+ endif()<br>
+else()<br>
+ list(APPEND ASM_FLAGS -DARCH_X86_64=0 -I ${CMAKE_CURRENT_SOURCE_DIR}/..<wbr>/common/x86/)<br>
+ if(APPLE)<br>
+ set(ARGS -f macho32 -DPREFIX)<br>
+ elseif(UNIX AND NOT CYGWIN)<br>
+ set(ARGS -f elf32)<br>
+ else()<br>
+ set(ARGS -f win32 -DPREFIX)<br>
+ endif()<br>
+endif()<br>
+<br>
+if(GCC)<br>
+ list(APPEND ASM_FLAGS -DHAVE_ALIGNED_STACK=1)<br>
+else()<br>
+ list(APPEND ASM_FLAGS -DHAVE_ALIGNED_STACK=0)<br>
+endif()<br>
+<br>
+if(HIGH_BIT_DEPTH)<br>
+ if(MAIN12)<br>
+ list(APPEND ASM_FLAGS -DHIGH_BIT_DEPTH=1 -DBIT_DEPTH=12 -DX265_NS=${X265_NS})<br>
+ else()<br>
+ list(APPEND ASM_FLAGS -DHIGH_BIT_DEPTH=1 -DBIT_DEPTH=10 -DX265_NS=${X265_NS})<br>
+ endif()<br>
+else()<br>
+ list(APPEND ASM_FLAGS -DHIGH_BIT_DEPTH=0 -DBIT_DEPTH=8 -DX265_NS=${X265_NS})<br>
+endif()<br>
+<br>
+list(APPEND ASM_FLAGS "${CMAKE_ASM_NASM_FLAGS}")<br>
+<br>
+if(CMAKE_BUILD_TYPE MATCHES Release)<br>
+ list(APPEND ASM_FLAGS "${CMAKE_ASM_NASM_FLAGS_<wbr>RELEASE}")<br>
+elseif(CMAKE_BUILD_TYPE MATCHES Debug)<br>
+ list(APPEND ASM_FLAGS "${CMAKE_ASM_NASM_FLAGS_DEBUG}<wbr>")<br>
+elseif(CMAKE_BUILD_TYPE MATCHES MinSizeRel)<br>
+ list(APPEND ASM_FLAGS "${CMAKE_ASM_NASM_FLAGS_<wbr>MINSIZEREL}")<br>
+elseif(CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)<br>
+ list(APPEND ASM_FLAGS "${CMAKE_ASM_NASM_FLAGS_<wbr>RELWITHDEBINFO}")<br>
+endif()<br>
+<br>
+set(NASM_FLAGS ${ARGS} ${ASM_FLAGS} PARENT_SCOPE)<br>
+string(REPLACE ";" " " CMAKE_ASM_NASM_COMPILER_ARG1 "${ARGS}")<br>
+<br>
+# This section exists to override the one in CMakeASMInformation.cmake<br>
+# (the default Information file). This removes the <FLAGS><br>
+# thing so that your C compiler flags that have been set via<br>
+# set_target_properties don't get passed to nasm and confuse it.<br>
+if(NOT CMAKE_ASM${ASM_DIALECT}_<wbr>COMPILE_OBJECT)<br>
+ string(REPLACE ";" " " STR_ASM_FLAGS "${ASM_FLAGS}")<br>
+ set(CMAKE_ASM${ASM_DIALECT}_<wbr>COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_<wbr>COMPILER> ${STR_ASM_FLAGS} -o <OBJECT> <SOURCE>")<br>
+endif()<br>
+<br>
+include(CMakeASMInformation)<br>
+set(ASM_DIALECT)<br>
diff -r 182bfd0d5af9 -r 16ea92bf3627 source/cmake/CMakeASM_<wbr>YASMInformation.cmake<br>
--- a/source/cmake/CMakeASM_<wbr>YASMInformation.cmake Thu Nov 02 09:39:58 2017 +0530<br>
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000<br>
@@ -1,68 +0,0 @@<br>
-set(ASM_DIALECT "_YASM")<br>
-set(CMAKE_ASM${ASM_DIALECT}_<wbr>SOURCE_FILE_EXTENSIONS asm)<br>
-<br>
-if(X64)<br>
- list(APPEND ASM_FLAGS -DARCH_X86_64=1)<br>
- if(ENABLE_PIC)<br>
- list(APPEND ASM_FLAGS -DPIC)<br>
- endif()<br>
- if(APPLE)<br>
- set(ARGS -f macho64 -m amd64 -DPREFIX)<br>
- elseif(UNIX AND NOT CYGWIN)<br>
- set(ARGS -f elf64 -m amd64)<br>
- else()<br>
- set(ARGS -f win64 -m amd64)<br>
- endif()<br>
-else()<br>
- list(APPEND ASM_FLAGS -DARCH_X86_64=0)<br>
- if(APPLE)<br>
- set(ARGS -f macho -DPREFIX)<br>
- elseif(UNIX AND NOT CYGWIN)<br>
- set(ARGS -f elf32)<br>
- else()<br>
- set(ARGS -f win32 -DPREFIX)<br>
- endif()<br>
-endif()<br>
-<br>
-if(GCC)<br>
- list(APPEND ASM_FLAGS -DHAVE_ALIGNED_STACK=1)<br>
-else()<br>
- list(APPEND ASM_FLAGS -DHAVE_ALIGNED_STACK=0)<br>
-endif()<br>
-<br>
-if(HIGH_BIT_DEPTH)<br>
- if(MAIN12)<br>
- list(APPEND ASM_FLAGS -DHIGH_BIT_DEPTH=1 -DBIT_DEPTH=12 -DX265_NS=${X265_NS})<br>
- else()<br>
- list(APPEND ASM_FLAGS -DHIGH_BIT_DEPTH=1 -DBIT_DEPTH=10 -DX265_NS=${X265_NS})<br>
- endif()<br>
-else()<br>
- list(APPEND ASM_FLAGS -DHIGH_BIT_DEPTH=0 -DBIT_DEPTH=8 -DX265_NS=${X265_NS})<br>
-endif()<br>
-<br>
-list(APPEND ASM_FLAGS "${CMAKE_ASM_YASM_FLAGS}")<br>
-<br>
-if(CMAKE_BUILD_TYPE MATCHES Release)<br>
- list(APPEND ASM_FLAGS "${CMAKE_ASM_YASM_FLAGS_<wbr>RELEASE}")<br>
-elseif(CMAKE_BUILD_TYPE MATCHES Debug)<br>
- list(APPEND ASM_FLAGS "${CMAKE_ASM_YASM_FLAGS_DEBUG}<wbr>")<br>
-elseif(CMAKE_BUILD_TYPE MATCHES MinSizeRel)<br>
- list(APPEND ASM_FLAGS "${CMAKE_ASM_YASM_FLAGS_<wbr>MINSIZEREL}")<br>
-elseif(CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)<br>
- list(APPEND ASM_FLAGS "${CMAKE_ASM_YASM_FLAGS_<wbr>RELWITHDEBINFO}")<br>
-endif()<br>
-<br>
-set(YASM_FLAGS ${ARGS} ${ASM_FLAGS} PARENT_SCOPE)<br>
-string(REPLACE ";" " " CMAKE_ASM_YASM_COMPILER_ARG1 "${ARGS}")<br>
-<br>
-# This section exists to override the one in CMakeASMInformation.cmake<br>
-# (the default Information file). This removes the <FLAGS><br>
-# thing so that your C compiler flags that have been set via<br>
-# set_target_properties don't get passed to yasm and confuse it.<br>
-if(NOT CMAKE_ASM${ASM_DIALECT}_<wbr>COMPILE_OBJECT)<br>
- string(REPLACE ";" " " STR_ASM_FLAGS "${ASM_FLAGS}")<br>
- set(CMAKE_ASM${ASM_DIALECT}_<wbr>COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_<wbr>COMPILER> ${STR_ASM_FLAGS} -o <OBJECT> <SOURCE>")<br>
-endif()<br>
-<br>
-include(CMakeASMInformation)<br>
-set(ASM_DIALECT)<br>
diff -r 182bfd0d5af9 -r 16ea92bf3627 source/cmake/<wbr>CMakeDetermineASM_<wbr>NASMCompiler.cmake<br>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000<br>
+++ b/source/cmake/<wbr>CMakeDetermineASM_<wbr>NASMCompiler.cmake Thu Nov 02 09:40:41 2017 +0530<br>
@@ -0,0 +1,5 @@<br>
+set(ASM_DIALECT "_NASM")<br>
+set(CMAKE_ASM${ASM_DIALECT}_<wbr>COMPILER ${NASM_EXECUTABLE})<br>
+set(CMAKE_ASM${ASM_DIALECT}_<wbr>COMPILER_INIT ${_CMAKE_TOOLCHAIN_PREFIX}<wbr>nasm)<br>
+include(<wbr>CMakeDetermineASMCompiler)<br>
+set(ASM_DIALECT)<br>
diff -r 182bfd0d5af9 -r 16ea92bf3627 source/cmake/<wbr>CMakeDetermineASM_<wbr>YASMCompiler.cmake<br>
--- a/source/cmake/<wbr>CMakeDetermineASM_<wbr>YASMCompiler.cmake Thu Nov 02 09:39:58 2017 +0530<br>
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000<br>
@@ -1,5 +0,0 @@<br>
-set(ASM_DIALECT "_YASM")<br>
-set(CMAKE_ASM${ASM_DIALECT}_<wbr>COMPILER ${YASM_EXECUTABLE})<br>
-set(CMAKE_ASM${ASM_DIALECT}_<wbr>COMPILER_INIT ${_CMAKE_TOOLCHAIN_PREFIX}<wbr>yasm)<br>
-include(<wbr>CMakeDetermineASMCompiler)<br>
-set(ASM_DIALECT)<br>
diff -r 182bfd0d5af9 -r 16ea92bf3627 source/cmake/CMakeTestASM_<wbr>NASMCompiler.cmake<br>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000<br>
+++ b/source/cmake/CMakeTestASM_<wbr>NASMCompiler.cmake Thu Nov 02 09:40:41 2017 +0530<br>
@@ -0,0 +1,3 @@<br>
+set(ASM_DIALECT "_NASM")<br>
+include(CMakeTestASMCompiler)<br>
+set(ASM_DIALECT)<br>
diff -r 182bfd0d5af9 -r 16ea92bf3627 source/cmake/CMakeTestASM_<wbr>YASMCompiler.cmake<br>
--- a/source/cmake/CMakeTestASM_<wbr>YASMCompiler.cmake Thu Nov 02 09:39:58 2017 +0530<br>
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000<br>
@@ -1,3 +0,0 @@<br>
-set(ASM_DIALECT "_YASM")<br>
-include(CMakeTestASMCompiler)<br>
-set(ASM_DIALECT)<br>
diff -r 182bfd0d5af9 -r 16ea92bf3627 source/cmake/FindNasm.cmake<br>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000<br>
+++ b/source/cmake/FindNasm.cmake Thu Nov 02 09:40:41 2017 +0530<br>
@@ -0,0 +1,25 @@<br>
+include(<wbr>FindPackageHandleStandardArgs)<br>
+<br>
+# Simple path search with YASM_ROOT environment variable override<br>
+find_program(NASM_EXECUTABLE<br>
+ NAMES nasm nasm-2.13.0-win32 nasm-2.13.0-win64 nasm nasm-2.13.0-win32 nasm-2.13.0-win64<br>
+ HINTS $ENV{NASM_ROOT} ${NASM_ROOT}<br>
+ PATH_SUFFIXES bin<br>
+)<br>
+<br>
+if(NASM_EXECUTABLE)<br>
+ execute_process(COMMAND ${NASM_EXECUTABLE} -version<br>
+ OUTPUT_VARIABLE nasm_version<br>
+ ERROR_QUIET<br>
+ OUTPUT_STRIP_TRAILING_<wbr>WHITESPACE<br>
+ )<br>
+ if(nasm_version MATCHES "^NASM version ([0-9\\.]*)")<br>
+ set(NASM_VERSION_STRING "${CMAKE_MATCH_1}")<br>
+ endif()<br>
+ unset(nasm_version)<br>
+endif()<br>
+<br>
+# Provide standardized success/failure messages<br>
+find_package_handle_standard_<wbr>args(nasm<br>
+ REQUIRED_VARS NASM_EXECUTABLE<br>
+ VERSION_VAR NASM_VERSION_STRING)<br>
diff -r 182bfd0d5af9 -r 16ea92bf3627 source/cmake/FindYasm.cmake<br>
--- a/source/cmake/FindYasm.cmake Thu Nov 02 09:39:58 2017 +0530<br>
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000<br>
@@ -1,25 +0,0 @@<br>
-include(<wbr>FindPackageHandleStandardArgs)<br>
-<br>
-# Simple path search with YASM_ROOT environment variable override<br>
-find_program(YASM_EXECUTABLE<br>
- NAMES yasm yasm-1.2.0-win32 yasm-1.2.0-win64 yasm yasm-1.3.0-win32 yasm-1.3.0-win64<br>
- HINTS $ENV{YASM_ROOT} ${YASM_ROOT}<br>
- PATH_SUFFIXES bin<br>
-)<br>
-<br>
-if(YASM_EXECUTABLE)<br>
- execute_process(COMMAND ${YASM_EXECUTABLE} --version<br>
- OUTPUT_VARIABLE yasm_version<br>
- ERROR_QUIET<br>
- OUTPUT_STRIP_TRAILING_<wbr>WHITESPACE<br>
- )<br>
- if(yasm_version MATCHES "^yasm ([0-9\\.]*)")<br>
- set(YASM_VERSION_STRING "${CMAKE_MATCH_1}")<br>
- endif()<br>
- unset(yasm_version)<br>
-endif()<br>
-<br>
-# Provide standardized success/failure messages<br>
-find_package_handle_standard_<wbr>args(yasm<br>
- REQUIRED_VARS YASM_EXECUTABLE<br>
- VERSION_VAR YASM_VERSION_STRING)<br>
diff -r 182bfd0d5af9 -r 16ea92bf3627 source/common/CMakeLists.txt<br>
--- a/source/common/CMakeLists.txt Thu Nov 02 09:39:58 2017 +0530<br>
+++ b/source/common/CMakeLists.txt Thu Nov 02 09:40:41 2017 +0530<br>
@@ -72,12 +72,12 @@<br>
endif()<br>
<br>
if(MSVC_IDE OR XCODE)<br>
- # MSVC requires custom build rules in the main cmake script for yasm<br>
- set(MSVC_ASMS "${A_SRCS}" CACHE INTERNAL "yasm sources")<br>
+ # MSVC requires custom build rules in the main cmake script for nasm<br>
+ set(MSVC_ASMS "${A_SRCS}" CACHE INTERNAL "nasm sources")<br>
set(A_SRCS)<br>
endif()<br>
<br>
- enable_language(ASM_YASM)<br>
+ enable_language(ASM_NASM)<br>
<br>
foreach(SRC ${A_SRCS} ${C_SRCS})<br>
set(ASM_PRIMITIVES ${ASM_PRIMITIVES} x86/${SRC})<br>
diff -r 182bfd0d5af9 -r 16ea92bf3627 source/common/x86/x86inc.asm<br>
--- a/source/common/x86/x86inc.asm Thu Nov 02 09:39:58 2017 +0530<br>
+++ b/source/common/x86/x86inc.asm Thu Nov 02 09:40:41 2017 +0530<br>
@@ -66,6 +66,15 @@<br>
%endif<br>
%endif<br>
<br>
+%define FORMAT_ELF 0<br>
+%ifidn __OUTPUT_FORMAT__,elf<br>
+ %define FORMAT_ELF 1<br>
+%elifidn __OUTPUT_FORMAT__,elf32<br>
+ %define FORMAT_ELF 1<br>
+%elifidn __OUTPUT_FORMAT__,elf64<br>
+ %define FORMAT_ELF 1<br>
+%endif<br>
+<br>
%ifdef PREFIX<br>
%define mangle(x) _ %+ x<br>
%else<br>
@@ -88,6 +97,10 @@<br>
default rel<br>
%endif<br>
<br>
+%ifdef __NASM_VER__<br>
+ %use smartalign<br>
+%endif<br>
+<br>
; Macros to eliminate most code duplication between x86_32 and x86_64:<br>
; Currently this works only for leaf functions which load all their arguments<br>
; into registers at the start, and make no other use of the stack. Luckily that<br>
@@ -685,7 +698,7 @@<br>
CAT_XDEFINE cglobaled_, %2, 1<br>
%endif<br>
%xdefine current_function %2<br>
- %ifidn __OUTPUT_FORMAT__,elf<br>
+ %if FORMAT_ELF<br>
global %2:function %%VISIBILITY<br>
%else<br>
global %2<br>
@@ -711,14 +724,16 @@<br>
<br>
; like cextern, but without the prefix<br>
%macro cextern_naked 1<br>
- %xdefine %1 mangle(%1)<br>
+ %ifdef PREFIX<br>
+ %xdefine %1 mangle(%1)<br>
+ %endif<br>
CAT_XDEFINE cglobaled_, %1, 1<br>
extern %1<br>
%endmacro<br>
<br>
%macro const 1-2+<br>
%xdefine %1 mangle(private_prefix %+ _ %+ %1)<br>
- %ifidn __OUTPUT_FORMAT__,elf<br>
+ %if FORMAT_ELF<br>
global %1:data hidden<br>
%else<br>
global %1<br>
@@ -727,9 +742,8 @@<br>
%1: %2<br>
%endmacro<br>
<br>
-; This is needed for ELF, otherwise the GNU linker assumes the stack is<br>
-; executable by default.<br>
-%ifidn __OUTPUT_FORMAT__,elf<br>
+; This is needed for ELF, otherwise the GNU linker assumes the stack is executable by default.<br>
+%if FORMAT_ELF<br>
[SECTION .note.GNU-stack noalloc noexec nowrite progbits]<br>
%endif<br>
<br>
@@ -801,9 +815,17 @@<br>
%endif<br>
<br>
%if ARCH_X86_64 || cpuflag(sse2)<br>
- CPU amdnop<br>
+ %ifdef __NASM_VER__<br>
+ ALIGNMODE p6<br>
+ %else<br>
+ CPU amdnop<br>
+ %endif<br>
%else<br>
- CPU basicnop<br>
+ %ifdef __NASM_VER__<br>
+ ALIGNMODE nop<br>
+ %else<br>
+ CPU basicnop<br>
+ %endif<br>
%endif<br>
%endmacro<br>
<br>
@@ -1467,7 +1489,7 @@<br>
v%5%6 %1, %2, %3, %4<br>
%elifidn %1, %2<br>
; If %3 or %4 is a memory operand it needs to be encoded as the last operand.<br>
- %ifid %3<br>
+ %ifnum sizeof%3<br>
v%{5}213%6 %2, %3, %4<br>
%else<br>
v%{5}132%6 %2, %4, %3<br>
@@ -1491,14 +1513,3 @@<br>
FMA4_INSTR fmsubadd, pd, ps<br>
FMA4_INSTR fnmadd, pd, ps, sd, ss<br>
FMA4_INSTR fnmsub, pd, ps, sd, ss<br>
-<br>
-; workaround: vpbroadcastq is broken in x86_32 due to a yasm bug (fixed in 1.3.0)<br>
-%if __YASM_VERSION_ID__ < 0x01030000 && ARCH_X86_64 == 0<br>
- %macro vpbroadcastq 2<br>
- %if sizeof%1 == 16<br>
- movddup %1, %2<br>
- %else<br>
- vbroadcastsd %1, %2<br>
- %endif<br>
- %endmacro<br>
-%endif<br>
diff -r 182bfd0d5af9 -r 16ea92bf3627 source/test/CMakeLists.txt<br>
--- a/source/test/CMakeLists.txt Thu Nov 02 09:39:58 2017 +0530<br>
+++ b/source/test/CMakeLists.txt Thu Nov 02 09:40:41 2017 +0530<br>
@@ -7,37 +7,37 @@<br>
<br>
# add X86 assembly files<br>
if(X86)<br>
-enable_language(ASM_YASM)<br>
+enable_language(ASM_NASM)<br>
<br>
if(MSVC_IDE)<br>
- set(YASM_SRC checkasm-a.obj)<br>
+ set(NASM_SRC checkasm-a.obj)<br>
add_custom_command(<br>
OUTPUT checkasm-a.obj<br>
- COMMAND ${YASM_EXECUTABLE}<br>
- ARGS ${YASM_FLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/<wbr>checkasm-a.asm -o checkasm-a.obj<br>
+ COMMAND ${NASM_EXECUTABLE}<br>
+ ARGS ${NASM_FLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/<wbr>checkasm-a.asm -o checkasm-a.obj<br>
DEPENDS checkasm-a.asm)<br>
else()<br>
- set(YASM_SRC checkasm-a.asm)<br>
+ set(NASM_SRC checkasm-a.asm)<br>
endif()<br>
endif(X86)<br>
<br>
# add ARM assembly files<br>
if(ARM OR CROSS_COMPILE_ARM)<br>
enable_language(ASM)<br>
- set(YASM_SRC checkasm-arm.S)<br>
+ set(NASM_SRC checkasm-arm.S)<br>
add_custom_command(<br>
OUTPUT checkasm-arm.obj<br>
COMMAND ${CMAKE_CXX_COMPILER}<br>
- ARGS ${YASM_FLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/<wbr>checkasm-arm.S -o checkasm-arm.obj<br>
+ ARGS ${NASM_FLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/<wbr>checkasm-arm.S -o checkasm-arm.obj<br>
DEPENDS checkasm-arm.S)<br>
endif(ARM OR CROSS_COMPILE_ARM)<br>
<br>
# add PowerPC assembly files<br>
if(POWER)<br>
- set(YASM_SRC)<br>
+ set(NASM_SRC)<br>
endif(POWER)<br>
<br>
-add_executable(TestBench ${YASM_SRC}<br>
+add_executable(TestBench ${NASM_SRC}<br>
testbench.cpp testharness.h<br>
pixelharness.cpp pixelharness.h<br>
mbdstharness.cpp mbdstharness.h<br>
diff -r 182bfd0d5af9 -r 16ea92bf3627 source/test/checkasm-a.asm<br>
--- a/source/test/checkasm-a.asm Thu Nov 02 09:39:58 2017 +0530<br>
+++ b/source/test/checkasm-a.asm Thu Nov 02 09:40:41 2017 +0530<br>
@@ -26,7 +26,7 @@<br>
;* For more information, contact us at license @ <a href="http://x265.com" rel="noreferrer" target="_blank">x265.com</a>.<br>
;*****************************<wbr>******************************<wbr>******************<br>
<br>
-%include "../common/x86/x86inc.asm"<br>
+%include "x86inc.asm"<br>
<br>
SECTION_RODATA<br>
<br>
@@ -35,24 +35,24 @@<br>
%if ARCH_X86_64<br>
; just random numbers to reduce the chance of incidental match<br>
ALIGN 16<br>
-x6: ddq 0x79445c159ce790641a1b2550a612<wbr>b48c<br>
-x7: ddq 0x86b2536fcd8cf6362eed899d5a28<wbr>ddcd<br>
-x8: ddq 0x3f2bf84fc0fcca4eb0856806085e<wbr>7943<br>
-x9: ddq 0xd229e1f5b281303facbd382dcf5b<wbr>8de2<br>
-x10: ddq 0xab63e2e11fa38ed971aeaff20b09<wbr>5fd9<br>
-x11: ddq 0x77d410d5c42c882d89b0c0765892<wbr>729a<br>
-x12: ddq 0x24b3c1d2a024048bc45ea11a955d<wbr>8dd5<br>
-x13: ddq 0xdd7b8919edd427862e8ec680de14<wbr>b47c<br>
-x14: ddq 0x11e53e2b2ac655ef135ce6888fa0<wbr>2cbf<br>
-x15: ddq 0x6de8f4c914c334d5011ff554472a<wbr>7a10<br>
-n7: dq 0x21f86d66c8ca00ce<br>
-n8: dq 0x75b6ba21077c48ad<br>
-n9: dq 0xed56bb2dcb3c7736<br>
-n10: dq 0x8bda43d3fd1a7e06<br>
-n11: dq 0xb64a9c9e5d318408<br>
-n12: dq 0xdf9a54b303f1d3a3<br>
-n13: dq 0x4a75479abd64e097<br>
-n14: dq 0x249214109d5d1c88<br>
+x6: dq 0x1a1b2550a612b48c,<wbr>0x79445c159ce79064<br>
+x7: dq 0x2eed899d5a28ddcd,<wbr>0x86b2536fcd8cf636<br>
+x8: dq 0xb0856806085e7943,<wbr>0x3f2bf84fc0fcca4e<br>
+x9: dq 0xacbd382dcf5b8de2,<wbr>0xd229e1f5b281303f<br>
+x10: dq 0x71aeaff20b095fd9,<wbr>0xab63e2e11fa38ed9<br>
+x11: dq 0x89b0c0765892729a,<wbr>0x77d410d5c42c882d<br>
+x12: dq 0xc45ea11a955d8dd5,<wbr>0x24b3c1d2a024048b<br>
+x13: dq 0x2e8ec680de14b47c,<wbr>0xdd7b8919edd42786<br>
+x14: dq 0x135ce6888fa02cbf,<wbr>0x11e53e2b2ac655ef<br>
+x15: dq 0x011ff554472a7a10,<wbr>0x6de8f4c914c334d5<br>
+n7: dq 0x21f86d66c8ca00ce<br>
+n8: dq 0x75b6ba21077c48ad<br>
+n9: dq 0xed56bb2dcb3c7736<br>
+n10: dq 0x8bda43d3fd1a7e06<br>
+n11: dq 0xb64a9c9e5d318408<br>
+n12: dq 0xdf9a54b303f1d3a3<br>
+n13: dq 0x4a75479abd64e097<br>
+n14: dq 0x249214109d5d1c88<br>
%endif<br>
<br>
SECTION .text<br>
@@ -70,14 +70,14 @@<br>
;-----------------------------<wbr>------------------------------<wbr>------------------<br>
cglobal checkasm_stack_clobber, 1,2<br>
; Clobber the stack with junk below the stack pointer<br>
- %define size (max_args+6)*8<br>
- SUB rsp, size<br>
- mov r1, size-8<br>
+ %define argsize (max_args+6)*8<br>
+ SUB rsp, argsize<br>
+ mov r1, argsize-8<br>
.loop:<br>
mov [rsp+r1], r0<br>
sub r1, 8<br>
jge .loop<br>
- ADD rsp, size<br>
+ ADD rsp, argsize<br>
RET<br>
<br>
%if WIN64<br>
@@ -156,7 +156,11 @@<br>
mov r9, rax<br>
mov r10, rdx<br>
lea r0, [error_message]<br>
+%if FORMAT_ELF<br>
+ call puts wrt ..plt<br>
+%else<br>
call puts<br>
+%endif<br>
mov r1, [rsp+max_args*8]<br>
mov dword [r1], 0<br>
mov rdx, r10<br>
</div></div>______________________________<wbr>_________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org">x265-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/x265-devel" rel="noreferrer" target="_blank">https://mailman.videolan.org/<wbr>listinfo/x265-devel</a><br>
______________________________<wbr>_________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org">x265-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/x265-devel" rel="noreferrer" target="_blank">https://mailman.videolan.org/<wbr>listinfo/x265-devel</a><br>
</blockquote></div><br></div>