default rel
%endif
+%macro CPUNOP 1
+ %if HAVE_CPUNOP
+ CPU %1
+ %endif
+%endmacro
+
; Always use long nops (reduces 0x90 spam in disassembly on x86_32)
-; Not supported by NASM (except via smartalign package + ALIGNMODE k8,
-; however that fails when used together with the -M option)
-%ifdef __YASM_VER__
-CPU amdnop
-%endif
+CPUNOP amdnop
; Macros to eliminate most code duplication between x86_32 and x86_64:
; Currently this works only for leaf functions which load all their arguments
; Applies any symbol mangling needed for C linkage, and sets up a define such that
; subsequent uses of the function name automatically refer to the mangled version.
; Appends cpuflags to the function name if cpuflags has been specified.
-%macro cglobal 1-2+ ; name, [PROLOGUE args]
-%if %0 == 1
- ; HACK: work around %+ broken with empty SUFFIX for nasm 2.09.10
- %ifndef cpuname
- cglobal_internal %1
- %else
- cglobal_internal %1 %+ SUFFIX
- %endif
-%else
- ; HACK: work around %+ broken with empty SUFFIX for nasm 2.09.10
- %ifndef cpuname
- cglobal_internal %1, %2
- %else
+%macro cglobal 1-2+ "" ; name, [PROLOGUE args]
cglobal_internal %1 %+ SUFFIX, %2
- %endif
-%endif
%endmacro
%macro cglobal_internal 1-2+
%ifndef cglobaled_%1
%1:
RESET_MM_PERMUTATION ; not really needed, but makes disassembly somewhat nicer
%assign stack_offset 0
- %if %0 > 1
+ %ifnidn %2, ""
PROLOGUE %2
%endif
%endmacro
%assign cpuflags_mmx (1<<0)
%assign cpuflags_mmx2 (1<<1) | cpuflags_mmx
%assign cpuflags_3dnow (1<<2) | cpuflags_mmx
-%assign cpuflags_3dnow2 (1<<3) | cpuflags_3dnow
+%assign cpuflags_3dnowext (1<<3) | cpuflags_3dnow
%assign cpuflags_sse (1<<4) | cpuflags_mmx2
%assign cpuflags_sse2 (1<<5) | cpuflags_sse
%assign cpuflags_sse2slow (1<<6) | cpuflags_sse2
; All subsequent functions (up to the next INIT_CPUFLAGS) is built for the specified cpu.
; You shouldn't need to invoke this macro directly, it's a subroutine for INIT_MMX &co.
%macro INIT_CPUFLAGS 0-2
-%ifdef __YASM_VER__
- CPU amdnop
-%endif
+ CPUNOP amdnop
%if %0 >= 1
%xdefine cpuname %1
%assign cpuflags cpuflags_%1
%elifidn %1, sse3
%define movu lddqu
%endif
- %ifdef __YASM_VER__
%if notcpuflag(mmx2)
- CPU basicnop
- %endif
+ CPUNOP basicnop
%endif
%else
%xdefine SUFFIX
; Append cpuflags to the callee's name iff the appended name is known and the plain name isn't
%macro call 1
- ; HACK: work around %+ broken with empty SUFFIX for nasm 2.09.10
- %ifndef cpuname
- call_internal %1, %1
- %else
- call_internal %1, %1 %+ SUFFIX
- %endif
+ call_internal %1 %+ SUFFIX, %1
%endmacro
%macro call_internal 2
- %xdefine %%i %1
- %ifndef cglobaled_%1
- %ifdef cglobaled_%2
- %xdefine %%i %2
+ %xdefine %%i %2
+ %ifndef cglobaled_%2
+ %ifdef cglobaled_%1
+ %xdefine %%i %1
%endif
%endif
call %%i