x86inc.asm does not work rightly in yasm
In Windows 64bit, code:
%include "../inc_x86/x86inc.asm"
%macro REMAP_REG 2
%xdefine r%1 r%2
%xdefine r%1q r%2q
%endmacro
REMAP_REG 14, 13
%error r12
will output "test.asm(10): warning : r12" when compile with yasm, which means r12 is undefine.
But the code outputs "test.asm(10): error : R15" when compile with nasm, which performs as I excepted.
I also test the code which expands the macro:
%include "../inc_x86/x86inc.asm"
%xdefine r14 r13
%xdefine r14q r13q
%error r12
It outputs "test.asm(6): warning : R15" when compile with yasm.
In x86inc, registers will be defined in the following code:
%macro DECLARE_REG 2-3
%define r%1q %2
%define r%1d %2d
%define r%1w %2w
%define r%1b %2b
%define r%1h %2h
%define %2q %2
%if %0 == 2
%define r%1m %2d
%define r%1mp %2
%elif ARCH_X86_64 ; memory
%define r%1m [rstk + stack_offset + %3]
%define r%1mp qword r %+ %1 %+ m
%else
%define r%1m [rstk + stack_offset + %3]
%define r%1mp dword r %+ %1 %+ m
%endif
%define r%1 %2
%endmacro
DECLARE_REG 0, rcx
DECLARE_REG 1, rdx
DECLARE_REG 2, R8
DECLARE_REG 3, R9
DECLARE_REG 4, R10, 40
DECLARE_REG 5, R11, 48
DECLARE_REG 6, rax, 56
DECLARE_REG 7, rdi, 64
DECLARE_REG 8, rsi, 72
DECLARE_REG 9, rbx, 80
DECLARE_REG 10, rbp, 88
DECLARE_REG 11, R14, 96
DECLARE_REG 12, R15, 104
DECLARE_REG 13, R12, 112
DECLARE_REG 14, R13, 120
When I remove the code
%define %2q %2
in the DECLARE_REG
macro, everything will be ok.
The REMAP_REG
macro is used in the dav1d decoder and it is compiled with nasm. The error appears when I try to complie it with yasm. I want to know is there anything wrong with x86inc.asm?