From ab9c1236195af96fb99ddcc3ab9330714eabf30e Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Fri, 21 Sep 2007 18:06:47 +0000 Subject: [PATCH] Add some imm64 tests. svn path=/trunk/yasm/; revision=1983 --- modules/arch/x86/tests/Makefile.inc | 3 + modules/arch/x86/tests/imm64.asm | 35 ++++++ modules/arch/x86/tests/imm64.errwarn | 3 + modules/arch/x86/tests/imm64.hex | 175 +++++++++++++++++++++++++++ 4 files changed, 216 insertions(+) create mode 100644 modules/arch/x86/tests/imm64.asm create mode 100644 modules/arch/x86/tests/imm64.errwarn create mode 100644 modules/arch/x86/tests/imm64.hex diff --git a/modules/arch/x86/tests/Makefile.inc b/modules/arch/x86/tests/Makefile.inc index 3bd57e0e..87761177 100644 --- a/modules/arch/x86/tests/Makefile.inc +++ b/modules/arch/x86/tests/Makefile.inc @@ -55,6 +55,9 @@ EXTRA_DIST += modules/arch/x86/tests/fwdequ64.asm EXTRA_DIST += modules/arch/x86/tests/fwdequ64.hex EXTRA_DIST += modules/arch/x86/tests/genopcode.asm EXTRA_DIST += modules/arch/x86/tests/genopcode.hex +EXTRA_DIST += modules/arch/x86/tests/imm64.asm +EXTRA_DIST += modules/arch/x86/tests/imm64.errwarn +EXTRA_DIST += modules/arch/x86/tests/imm64.hex EXTRA_DIST += modules/arch/x86/tests/iret.asm EXTRA_DIST += modules/arch/x86/tests/iret.hex EXTRA_DIST += modules/arch/x86/tests/jmp64-1.asm diff --git a/modules/arch/x86/tests/imm64.asm b/modules/arch/x86/tests/imm64.asm new file mode 100644 index 00000000..5b41bfae --- /dev/null +++ b/modules/arch/x86/tests/imm64.asm @@ -0,0 +1,35 @@ +bits 64 +default abs +;extern label1 +label1: +label2: + +mov rax, 0x1000 ; 32-bit imm +mov rax, 0x1122334455667788 ; 64-bit imm (larger than signed 32-bit) +;mov rax, 0x80000000 ; 64-bit imm (larger than signed 32-bit) +mov rax, label1 ; 32-bit imm <--- not 64-bit! +mov rax, label2 ; 32-bit imm <--- not 64-bit! +mov rax, qword 0x1000 ; 64-bit imm +mov rax, qword label1 ; 64-bit imm +mov rax, qword label2 ; 64-bit imm + +mov qword [rax], 0x1000 ; 32-bit imm +mov qword [rax], 0x1122334455667788 ; 32-bit imm, overflow warning +;mov qword [rax], 0x80000000 ; 32-bit imm, overflow warning +mov qword [rax], label1 ; 32-bit imm (matches default above) +mov qword [rax], label2 ; 32-bit imm (matches default above) + +add rax, 0x1000 ; 32-bit imm +add rax, 0x1122334455667788 ; 32-bit imm, overflow warning +;add rax, 0x80000000 ; 32-bit imm, overflow warning +add rax, label1 ; 32-bit imm (matches default above) +add rax, label2 ; 32-bit imm (matches default above) + +mov [0x1000], rax ; 32-bit disp +mov [abs 0x1122334455667788], rax ; 64-bit disp +mov [label1], rax ; 32-bit disp +mov [label2], rax ; 32-bit disp +mov [qword 0x1000], rax ; 64-bit disp +mov [qword label1], rax ; 64-bit disp +mov [qword label2], rax ; 64-bit disp + diff --git a/modules/arch/x86/tests/imm64.errwarn b/modules/arch/x86/tests/imm64.errwarn new file mode 100644 index 00000000..a0487353 --- /dev/null +++ b/modules/arch/x86/tests/imm64.errwarn @@ -0,0 +1,3 @@ +-:17: warning: value does not fit in 32 bit field +-:23: warning: value does not fit in 32 bit field +-:29: warning: value does not fit in 32 bit field diff --git a/modules/arch/x86/tests/imm64.hex b/modules/arch/x86/tests/imm64.hex new file mode 100644 index 00000000..af46a719 --- /dev/null +++ b/modules/arch/x86/tests/imm64.hex @@ -0,0 +1,175 @@ +48 +c7 +c0 +00 +10 +00 +00 +48 +b8 +88 +77 +66 +55 +44 +33 +22 +11 +48 +c7 +c0 +00 +00 +00 +00 +48 +c7 +c0 +00 +00 +00 +00 +48 +b8 +00 +10 +00 +00 +00 +00 +00 +00 +48 +b8 +00 +00 +00 +00 +00 +00 +00 +00 +48 +b8 +00 +00 +00 +00 +00 +00 +00 +00 +48 +c7 +00 +00 +10 +00 +00 +48 +c7 +00 +88 +77 +66 +55 +48 +c7 +00 +00 +00 +00 +00 +48 +c7 +00 +00 +00 +00 +00 +48 +05 +00 +10 +00 +00 +48 +05 +88 +77 +66 +55 +48 +05 +00 +00 +00 +00 +48 +05 +00 +00 +00 +00 +48 +89 +04 +25 +00 +10 +00 +00 +48 +89 +04 +25 +88 +77 +66 +55 +48 +89 +04 +25 +00 +00 +00 +00 +48 +89 +04 +25 +00 +00 +00 +00 +48 +a3 +00 +10 +00 +00 +00 +00 +00 +00 +48 +a3 +00 +00 +00 +00 +00 +00 +00 +00 +48 +a3 +00 +00 +00 +00 +00 +00 +00 +00 -- 2.40.0