From 2bcaa278be7762c0bc49255e6750de0c3446eb7d Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Thu, 16 Oct 2008 02:44:49 +0000 Subject: [PATCH] Add movbe instruction and CPU feature. Noticed by: Mark Charney svn path=/trunk/yasm/; revision=2156 --- modules/arch/x86/gen_x86_insn.py | 18 +++ modules/arch/x86/tests/Makefile.inc | 2 + modules/arch/x86/tests/movbe.asm | 20 ++++ modules/arch/x86/tests/movbe.hex | 176 ++++++++++++++++++++++++++++ modules/arch/x86/x86arch.h | 1 + modules/arch/x86/x86cpu.gperf | 2 + 6 files changed, 219 insertions(+) create mode 100644 modules/arch/x86/tests/movbe.asm create mode 100644 modules/arch/x86/tests/movbe.hex diff --git a/modules/arch/x86/gen_x86_insn.py b/modules/arch/x86/gen_x86_insn.py index 6397d9c9..95202d01 100755 --- a/modules/arch/x86/gen_x86_insn.py +++ b/modules/arch/x86/gen_x86_insn.py @@ -7039,6 +7039,24 @@ add_insn("xsave", "twobytemem", modifiers=[4, 0x0F, 0xAE], add_insn("xrstor", "twobytemem", modifiers=[5, 0x0F, 0xAE], cpu=["XSAVE", "386"]) +##################################################################### +# Intel MOVBE instruction +##################################################################### +for sz in (16, 32, 64): + add_group("movbe", + cpu=["MOVBE"], + opersize=sz, + opcode=[0x0F, 0x38, 0xF0], + operands=[Operand(type="Reg", size=sz, dest="Spare"), + Operand(type="Mem", size=sz, relaxed=True, dest="EA")]) + add_group("movbe", + cpu=["MOVBE"], + opersize=sz, + opcode=[0x0F, 0x38, 0xF1], + operands=[Operand(type="Mem", size=sz, relaxed=True, dest="EA"), + Operand(type="Reg", size=sz, dest="Spare")]) +add_insn("movbe", "movbe") + ##################################################################### # AMD 3DNow! instructions ##################################################################### diff --git a/modules/arch/x86/tests/Makefile.inc b/modules/arch/x86/tests/Makefile.inc index 4f83c1ed..687fb31a 100644 --- a/modules/arch/x86/tests/Makefile.inc +++ b/modules/arch/x86/tests/Makefile.inc @@ -101,6 +101,8 @@ EXTRA_DIST += modules/arch/x86/tests/mem64rip.asm EXTRA_DIST += modules/arch/x86/tests/mem64rip.hex EXTRA_DIST += modules/arch/x86/tests/mixcase.asm EXTRA_DIST += modules/arch/x86/tests/mixcase.hex +EXTRA_DIST += modules/arch/x86/tests/movbe.asm +EXTRA_DIST += modules/arch/x86/tests/movbe.hex EXTRA_DIST += modules/arch/x86/tests/movdq32.asm EXTRA_DIST += modules/arch/x86/tests/movdq32.hex EXTRA_DIST += modules/arch/x86/tests/movdq64.asm diff --git a/modules/arch/x86/tests/movbe.asm b/modules/arch/x86/tests/movbe.asm new file mode 100644 index 00000000..637524ae --- /dev/null +++ b/modules/arch/x86/tests/movbe.asm @@ -0,0 +1,20 @@ +[bits 64] +movbe cx, [5] +movbe cx, word [5] +movbe ecx, [5] +movbe ecx, dword [5] +movbe rcx, [5] +movbe rcx, qword [5] +movbe r9, [5] +movbe r9, qword [5] +movbe [5], bx +movbe word [5], bx +movbe [5], ebx +movbe dword [5], ebx +movbe [5], r10d +movbe dword [5], r10d +movbe [5], rbx +movbe qword [5], rbx +movbe [5], r10 +movbe qword [5], r10 + diff --git a/modules/arch/x86/tests/movbe.hex b/modules/arch/x86/tests/movbe.hex new file mode 100644 index 00000000..108bedf7 --- /dev/null +++ b/modules/arch/x86/tests/movbe.hex @@ -0,0 +1,176 @@ +66 +0f +38 +f0 +0c +25 +05 +00 +00 +00 +66 +0f +38 +f0 +0c +25 +05 +00 +00 +00 +0f +38 +f0 +0c +25 +05 +00 +00 +00 +0f +38 +f0 +0c +25 +05 +00 +00 +00 +48 +0f +38 +f0 +0c +25 +05 +00 +00 +00 +48 +0f +38 +f0 +0c +25 +05 +00 +00 +00 +4c +0f +38 +f0 +0c +25 +05 +00 +00 +00 +4c +0f +38 +f0 +0c +25 +05 +00 +00 +00 +66 +0f +38 +f1 +1c +25 +05 +00 +00 +00 +66 +0f +38 +f1 +1c +25 +05 +00 +00 +00 +0f +38 +f1 +1c +25 +05 +00 +00 +00 +0f +38 +f1 +1c +25 +05 +00 +00 +00 +44 +0f +38 +f1 +14 +25 +05 +00 +00 +00 +44 +0f +38 +f1 +14 +25 +05 +00 +00 +00 +48 +0f +38 +f1 +1c +25 +05 +00 +00 +00 +48 +0f +38 +f1 +1c +25 +05 +00 +00 +00 +4c +0f +38 +f1 +14 +25 +05 +00 +00 +00 +4c +0f +38 +f1 +14 +25 +05 +00 +00 +00 diff --git a/modules/arch/x86/x86arch.h b/modules/arch/x86/x86arch.h index adcc87ea..41cde219 100644 --- a/modules/arch/x86/x86arch.h +++ b/modules/arch/x86/x86arch.h @@ -70,6 +70,7 @@ #define CPU_FMA 36 /* Intel Fused-Multiply-Add Extensions */ #define CPU_AES 37 /* AES instruction */ #define CPU_CLMUL 38 /* PCLMULQDQ instruction */ +#define CPU_MOVBE 39 /* MOVBE instruction */ typedef struct yasm_arch_x86 { yasm_arch_base arch; /* base structure */ diff --git a/modules/arch/x86/x86cpu.gperf b/modules/arch/x86/x86cpu.gperf index 526e1569..29c0f49d 100644 --- a/modules/arch/x86/x86cpu.gperf +++ b/modules/arch/x86/x86cpu.gperf @@ -350,6 +350,8 @@ clmul, x86_cpu_set, CPU_CLMUL noclmul, x86_cpu_clear, CPU_CLMUL pclmulqdq, x86_cpu_set, CPU_CLMUL nopclmulqdq, x86_cpu_clear, CPU_CLMUL +movbe, x86_cpu_set, CPU_MOVBE +nomovbe, x86_cpu_clear, CPU_MOVBE %% void -- 2.40.0