return;
}
+ if (optimize_for_space
+ && i.tm.opcode_space == SPACE_0F
+ && (i.tm.base_opcode | 1) == 0xb7
+ && i.reg_operands == 2
+ && !i.op[0].regs->reg_flags
+ && !i.op[1].regs->reg_flags
+ && (i.types[0].bitfield.byte
+ ? i.types[1].bitfield.word
+ && i.op[0].regs->reg_num < 4
+ && i.op[1].regs->reg_num == i.op[0].regs->reg_num
+ && (!i.suffix || i.suffix == WORD_MNEM_SUFFIX)
+ : i.types[1].bitfield.dword
+ && flag_code == CODE_16BIT
+ && i.op[0].regs->reg_type.bitfield.baseindex
+ && i.op[0].regs->reg_num != EBP_REG_NUM))
+ {
+ /* Optimize: -Os:
+ movzb %r8, %r16 -> mov $0, %r8h
+
+ %r8 being one of %al, %cl, %dl, or %bl, with %r16 being the
+ matching 16-bit reg.
+ */
+
+ i.tm.opcode_space = SPACE_BASE;
+ i.tm.opcode_modifier.w = 0;
+ i.reg_operands = 1;
+ if (i.types[0].bitfield.byte)
+ {
+ i.tm.base_opcode = 0xb0;
+ i.tm.opcode_modifier.modrm = 0;
+ copy_operand (1, 0);
+ i.op[1].regs += 4;
+
+ im_expressions[0].X_op = O_constant;
+ im_expressions[0].X_add_number = 0;
+ i.op[0].imms = &im_expressions[0];
+ operand_type_set (&i.types[0], 0);
+ i.types[0].bitfield.imm8 = 1;
+ i.tm.operand_types[0] = i.types[0];
+ i.tm.operand_types[0].bitfield.class = ClassNone;
+ i.imm_operands = 1;
+
+ i.suffix = 0;
+ return;
+ }
+
+ /* In 16-bit mode, optimize: -Os:
+ movzw %r16, %r32 -> lea (%r16), %r32
+
+ %r16 being one of %bx, %si, or %di.
+ */
+ i.tm.base_opcode = 0x8d;
+
+ i.base_reg = i.op[0].regs;
+ operand_type_set (&i.types[0], 0);
+ i.types[0].bitfield.baseindex = 1;
+ i.tm.operand_types[0] = i.types[0];
+ i.op[0].disps = NULL;
+ i.flags[0] = Operand_Mem;
+ i.mem_operands = 1;
+ return;
+ }
+
if (optimize_for_space
&& (i.tm.mnem_off == MN_test
|| (i.tm.base_opcode == 0xf6
movsxd, 0x63, x64, Intel64|Modrm|NoSuf, { Reg16|Unspecified|BaseIndex, Reg16 }
// Move with zero extend.
-movzb, 0xfb6, i386, Modrm|No_bSuf|No_sSuf, { Reg8|Unspecified|BaseIndex, Reg16|Reg32|Reg64 }
-movzw, 0xfb7, i386, Modrm|No_bSuf|No_wSuf|No_sSuf, { Reg16|Unspecified|BaseIndex, Reg32|Reg64 }
+movzb, 0xfb6, i386, Modrm|No_bSuf|No_sSuf|Optimize, { Reg8|Unspecified|BaseIndex, Reg16|Reg32|Reg64 }
+movzw, 0xfb7, i386, Modrm|No_bSuf|No_wSuf|No_sSuf|Optimize, { Reg16|Unspecified|BaseIndex, Reg32|Reg64 }
// The 64-bit variant is not particularly useful since the zero extend
// 32->64 is implicit, but we can encode them.
-movzx, 0xfb6, i386, W|Modrm|No_lSuf|No_sSuf|No_qSuf, { Reg8|Reg16|Unspecified|BaseIndex, Reg16|Reg32|Reg64 }
+movzx, 0xfb6, i386, W|Modrm|No_lSuf|No_sSuf|No_qSuf|Optimize, { Reg8|Reg16|Unspecified|BaseIndex, Reg16|Reg32|Reg64 }
// Push instructions.
push, 0x50, No64, ImplicitStackOp|No_bSuf|No_sSuf|No_qSuf, { Reg16|Reg32 }
0, 0, 0, 0, 0, 0 } } } },
{ MN_movzb, 0xb6, 2, SPACE_0F, None,
{ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
0, 0 },
{ { 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } },
{ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } },
0, 0,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