]> granicus.if.org Git - yasm/commitdiff
Comment "Op1Add is only used for FPU, so no need to do REX" is incorrect;
authorPeter Johnson <peter@tortall.net>
Tue, 9 Mar 2004 07:15:53 +0000 (07:15 -0000)
committerPeter Johnson <peter@tortall.net>
Tue, 9 Mar 2004 07:15:53 +0000 (07:15 -0000)
BSWAP uses Op1Add!

Reported by: vclaudepierre@tiscali.fr
Bugzilla bug: 27

svn path=/trunk/yasm/; revision=1101

modules/arch/x86/tests/Makefile.inc
modules/arch/x86/tests/bswap64.asm [new file with mode: 0644]
modules/arch/x86/tests/bswap64.errwarn [new file with mode: 0644]
modules/arch/x86/tests/bswap64.hex [new file with mode: 0644]
modules/arch/x86/x86id.re

index 6943146f79b95d74371029ff6b78122cafc82349..9a78b067b4e7895143a8bbea581bcba54d6fee40 100644 (file)
@@ -14,6 +14,9 @@ EXTRA_DIST += modules/arch/x86/tests/addrop-err.errwarn
 EXTRA_DIST += modules/arch/x86/tests/bittest.asm
 EXTRA_DIST += modules/arch/x86/tests/bittest.errwarn
 EXTRA_DIST += modules/arch/x86/tests/bittest.hex
+EXTRA_DIST += modules/arch/x86/tests/bswap64.asm
+EXTRA_DIST += modules/arch/x86/tests/bswap64.errwarn
+EXTRA_DIST += modules/arch/x86/tests/bswap64.hex
 EXTRA_DIST += modules/arch/x86/tests/cpubasic-err.asm
 EXTRA_DIST += modules/arch/x86/tests/cpubasic-err.errwarn
 EXTRA_DIST += modules/arch/x86/tests/div-err.asm
diff --git a/modules/arch/x86/tests/bswap64.asm b/modules/arch/x86/tests/bswap64.asm
new file mode 100644 (file)
index 0000000..d6a39ad
--- /dev/null
@@ -0,0 +1,4 @@
+[bits 64]
+
+bswap r8
+bswap rax
diff --git a/modules/arch/x86/tests/bswap64.errwarn b/modules/arch/x86/tests/bswap64.errwarn
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/modules/arch/x86/tests/bswap64.hex b/modules/arch/x86/tests/bswap64.hex
new file mode 100644 (file)
index 0000000..91560d3
--- /dev/null
@@ -0,0 +1,6 @@
+49 
+0f 
+c8 
+48 
+0f 
+c8 
index 9faa110c85a1eec0de570f50da1ef59d56e30a37..ecad2ab63ee3e25393718425cd267d2537e0f878 100644 (file)
@@ -2212,10 +2212,17 @@ yasm_x86__parse_insn(yasm_arch *arch, const unsigned long data[4],
                        yasm_internal_error(N_("invalid operand conversion"));
                    break;
                case OPA_Op1Add:
-                   /* Op1Add is only used for FPU, so no need to do REX */
-                   if (op->type == YASM_INSN__OPERAND_REG)
-                       d.op[1] += (unsigned char)(op->data.reg&7);
-                   else
+                   if (op->type == YASM_INSN__OPERAND_REG) {
+                       unsigned char opadd;
+                       if (yasm_x86__set_rex_from_reg(&d.rex, &opadd,
+                               op->data.reg, arch_x86->mode_bits,
+                               X86_REX_B)) {
+                           yasm__error(line,
+                               N_("invalid combination of opcode and operands"));
+                           return NULL;
+                       }
+                       d.op[1] += opadd;
+                   } else
                        yasm_internal_error(N_("invalid operand conversion"));
                    break;
                case OPA_SpareEA: