From 8c5785748f9e839cdc26d828ada728a26ebab80f Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Tue, 18 Jul 2006 05:16:12 +0000 Subject: [PATCH] Fix (hopefully finally) fsub and fdiv operand reversal for GAS mode. svn path=/trunk/yasm/; revision=1593 --- modules/arch/x86/tests/gas32/gas-farithr.asm | 8 +++++++ modules/arch/x86/tests/gas32/gas-farithr.hex | 24 ++++++++++---------- modules/arch/x86/x86id.c | 6 +++-- modules/arch/x86/x86parse.gap | 12 ++++------ 4 files changed, 28 insertions(+), 22 deletions(-) diff --git a/modules/arch/x86/tests/gas32/gas-farithr.asm b/modules/arch/x86/tests/gas32/gas-farithr.asm index ded3800b..4b1ca13b 100644 --- a/modules/arch/x86/tests/gas32/gas-farithr.asm +++ b/modules/arch/x86/tests/gas32/gas-farithr.asm @@ -1,10 +1,18 @@ .text fsub %st(0),%st(1) + fsub %st(3),%st fsubp %st(0),%st(1) + #fsubp %st(3),%st fsubr %st(0),%st(1) + fsubr %st(3),%st fsubrp %st(0),%st(1) + #fsubrp %st(3),%st fdiv %st(0),%st(1) + fdiv %st(3),%st fdivp %st(0),%st(1) + #fdivp %st(3),%st fdivr %st(0),%st(1) + fdivr %st(3),%st fdivrp %st(0),%st(1) + #fdivrp %st(3),%st diff --git a/modules/arch/x86/tests/gas32/gas-farithr.hex b/modules/arch/x86/tests/gas32/gas-farithr.hex index 8b802893..f0f4bddc 100644 --- a/modules/arch/x86/tests/gas32/gas-farithr.hex +++ b/modules/arch/x86/tests/gas32/gas-farithr.hex @@ -64,18 +64,26 @@ b0 00 dc e1 +d8 +e3 de e1 dc e9 +d8 +eb de e9 dc f1 +d8 +f3 de f1 dc f9 +d8 +fb de f9 00 @@ -206,14 +214,6 @@ ff 00 00 00 -00 -00 -00 -00 -00 -00 -00 -00 17 00 00 @@ -230,7 +230,7 @@ ff 00 00 00 -50 +58 00 00 00 @@ -270,7 +270,7 @@ ff 00 00 00 -74 +7c 00 00 00 @@ -310,7 +310,7 @@ ff 00 00 00 -78 +80 00 00 00 @@ -354,7 +354,7 @@ ff 00 00 00 -10 +18 00 00 00 diff --git a/modules/arch/x86/x86id.c b/modules/arch/x86/x86id.c index ebabf2ba..cf8eef52 100644 --- a/modules/arch/x86/x86id.c +++ b/modules/arch/x86/x86id.c @@ -1494,8 +1494,10 @@ static const x86_insn_info farith_insn[] = { {OPT_ST0|OPS_80|OPA_None, OPT_Reg|OPS_80|OPA_Op1Add, 0} }, { CPU_FPU, MOD_Op1Add, 0, 0, 0, 2, {0xDC, 0x00, 0}, 0, 1, {OPT_Reg|OPS_80|OPTM_To|OPA_Op1Add, 0, 0} }, - { CPU_FPU, MOD_Op1Add, 0, 0, 0, 2, {0xDC, 0x00, 0}, 0, 2, - {OPT_Reg|OPS_80|OPA_Op1Add, OPT_ST0|OPS_80|OPA_None, 0} } + { CPU_FPU, MOD_Op1Add|MOD_GasIllegal, 0, 0, 0, 2, {0xDC, 0x00, 0}, 0, 2, + {OPT_Reg|OPS_80|OPA_Op1Add, OPT_ST0|OPS_80|OPA_None, 0} }, + { CPU_FPU, MOD_Gap0|MOD_Op1Add|MOD_GasOnly, 0, 0, 0, 2, {0xDC, 0x00, 0}, + 0, 2, {OPT_Reg|OPS_80|OPA_Op1Add, OPT_ST0|OPS_80|OPA_None, 0} } }; static const x86_insn_info farithp_insn[] = { { CPU_FPU, MOD_Op1Add, 0, 0, 0, 2, {0xDE, 0x01, 0}, 0, 0, {0, 0, 0} }, diff --git a/modules/arch/x86/x86parse.gap b/modules/arch/x86/x86parse.gap index b8b5e3cb..ce4e4f97 100644 --- a/modules/arch/x86/x86parse.gap +++ b/modules/arch/x86/x86parse.gap @@ -347,26 +347,22 @@ INSN - fldz NONE twobyte 0xD9EE CPU_FPU INSN - fadd "ls" farith 0x00C0C0 CPU_FPU INSN - faddp NONE farithp 0xC0 CPU_FPU INSN - fiadd "ls" fiarith 0x00DA CPU_FPU -INSN nasm fsub NONE farith 0x04E0E8 CPU_FPU -INSN gas fsub "ls" farith 0x04E8E0 CPU_FPU +INSN - fsub "ls" farith 0x04E0E8 CPU_FPU INSN - fisub "ls" fiarith 0x04DA CPU_FPU INSN nasm fsubp NONE farithp 0xE8 CPU_FPU INSN gas fsubp NONE farithp 0xE0 CPU_FPU -INSN nasm fsubr NONE farith 0x05E8E0 CPU_FPU -INSN gas fsubr "ls" farith 0x05E0E8 CPU_FPU +INSN - fsubr "ls" farith 0x05E8E0 CPU_FPU INSN - fisubr "ls" fiarith 0x05DA CPU_FPU INSN nasm fsubrp NONE farithp 0xE0 CPU_FPU INSN gas fsubrp NONE farithp 0xE8 CPU_FPU INSN - fmul "ls" farith 0x01C8C8 CPU_FPU INSN - fimul "ls" fiarith 0x01DA CPU_FPU INSN - fmulp NONE farithp 0xC8 CPU_FPU -INSN nasm fdiv NONE farith 0x06F0F8 CPU_FPU -INSN gas fdiv "ls" farith 0x06F8F0 CPU_FPU +INSN - fdiv "ls" farith 0x06F0F8 CPU_FPU INSN - fidiv "ls" fiarith 0x06DA CPU_FPU INSN nasm fdivp NONE farithp 0xF8 CPU_FPU INSN gas fdivp NONE farithp 0xF0 CPU_FPU -INSN nasm fdivr NONE farith 0x07F8F0 CPU_FPU -INSN gas fdivr "ls" farith 0x07F0F8 CPU_FPU +INSN - fdivr "ls" farith 0x07F8F0 CPU_FPU INSN - fidivr "ls" fiarith 0x07DA CPU_FPU INSN nasm fdivrp NONE farithp 0xF0 CPU_FPU INSN gas fdivrp NONE farithp 0xF8 CPU_FPU -- 2.40.0