if (saved_ch && (*skip_whitespace (p2 + 1)) && current_templates && (current_templates->start->opcode_modifier & IS_PREFIX)) {
- if ((current_templates->start->opcode_modifier & (SIZE16 | SIZE32)) && ((current_templates->start->opcode_modifier & SIZE32) && (bits ^= 16))) {
+ if ((current_templates->start->opcode_modifier & (SIZE16 | SIZE32)) && (((current_templates->start->opcode_modifier & SIZE32) != 0) ^ (bits == 16))) {
report_at (get_filename (), get_line_number (), REPORT_ERROR, "redundant %s prefix", current_templates->name);
return 0;
instruction.disps[instruction.operands] = expr;
instruction.disp_operands++;
- instruction.types[instruction.operands] |= DISP16;
+ if ((bits == 16) ^ (!instruction.prefixes[ADDR_PREFIX])) {
+ instruction.types[instruction.operands] |= DISP32;
+ } else {
+ instruction.types[instruction.operands] |= DISP16;
+ }
if (finalize_displacement (instruction.disps[instruction.operands], operand_start)) {
return 1;
expr->add_symbol = 0;
expr->op_symbol = 0;
- expr->add_number = intel_types[i].size[0];
+ expr->add_number = intel_types[i].size[(bits == 16) ? 0 : 1];
return 1;
}
} else {
+ instruction.modrm.regmem = MODRM_REGMEM_TWO_BYTE_ADDRESSING;
instruction.sib.base = SIB_BASE_NO_BASE_REGISTER;
+
instruction.sib.index = instruction.index_reg->number;
instruction.sib.scale = instruction.log2_scale_factor;
- instruction.modrm.regmem = MODRM_REGMEM_TWO_BYTE_ADDRESSING;
-
instruction.types[operand] &= ~DISP;
instruction.types[operand] |= DISP32;
case 3:
- if (instruction.index_reg == 0) {
+ if (!instruction.index_reg) {
instruction.modrm.regmem = 7;
} else {
instruction.modrm.regmem = (instruction.index_reg->number - 6);
case 5:
- if (instruction.index_reg == 0) {
+ if (!instruction.index_reg) {
instruction.modrm.regmem = 6;