This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
PATCH: Don't set register operand twice
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: binutils at sourceware dot org
- Date: Wed, 11 Nov 2009 18:22:33 -0800
- Subject: PATCH: Don't set register operand twice
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
I checked in this patch to avoid setting register operand twice.
H.J.
---
2009-11-11 H.J. Lu <hongjiu.lu@intel.com>
* config/tc-i386.c (build_modrm_byte): Don't set register
operand twice.
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 2996751..e787215 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -5344,19 +5344,23 @@ build_modrm_byte (void)
i.vex.register_specifier = i.op[vex_reg].regs;
}
- /* If there is an extension opcode to put here, the
- register number must be put into the regmem field. */
- if (i.tm.extension_opcode != None)
+ /* Don't set OP operand twice. */
+ if (vex_reg != op)
{
- i.rm.regmem = i.op[op].regs->reg_num;
- if ((i.op[op].regs->reg_flags & RegRex) != 0)
- i.rex |= REX_B;
- }
- else
- {
- i.rm.reg = i.op[op].regs->reg_num;
- if ((i.op[op].regs->reg_flags & RegRex) != 0)
- i.rex |= REX_R;
+ /* If there is an extension opcode to put here, the
+ register number must be put into the regmem field. */
+ if (i.tm.extension_opcode != None)
+ {
+ i.rm.regmem = i.op[op].regs->reg_num;
+ if ((i.op[op].regs->reg_flags & RegRex) != 0)
+ i.rex |= REX_B;
+ }
+ else
+ {
+ i.rm.reg = i.op[op].regs->reg_num;
+ if ((i.op[op].regs->reg_flags & RegRex) != 0)
+ i.rex |= REX_R;
+ }
}
/* Now, if no memory operand has set i.rm.mode = 0, 1, 2 we