/* tc-i386.c -- Assemble Intel syntax code for ix86/x86-64
- Copyright (C) 2009-2020 Free Software Foundation, Inc.
+ Copyright (C) 2009-2021 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
{
unsigned int j;
+#ifdef SVR4_COMMENT_CHARS
+ if (!name && operands == 2 && *input_line_pointer == '\\')
+ switch (input_line_pointer[1])
+ {
+ case '/': input_line_pointer += 2; return O_divide;
+ case '%': input_line_pointer += 2; return O_modulus;
+ case '*': input_line_pointer += 2; return O_multiply;
+ }
+#endif
+
if (!intel_syntax)
return O_absent;
intel_state.base = i386_regtab + reg_num;
else if (!intel_state.index)
{
+ const insn_template *t = current_templates->start;
+
if (intel_state.in_scale
- || current_templates->start->base_opcode == 0xf30f1b /* bndmk */
- || (current_templates->start->base_opcode & ~1) == 0x0f1a /* bnd{ld,st}x */
+ || (t->opcode_modifier.opcodeprefix == PREFIX_0XF3
+ && t->opcode_modifier.opcodespace == SPACE_0F
+ && t->base_opcode == 0x1b /* bndmk */)
+ || (t->opcode_modifier.opcodeprefix == PREFIX_NONE
+ && t->opcode_modifier.opcodespace == SPACE_0F
+ && (t->base_opcode & ~1) == 0x1a /* bnd{ld,st}x */)
|| i386_regtab[reg_num].reg_type.bitfield.baseindex)
intel_state.index = i386_regtab + reg_num;
else
else
{
/* esp is invalid as index */
- intel_state.index = i386_regtab + REGNAM_EAX + ESP_REG_NUM;
+ intel_state.index = reg_eax + ESP_REG_NUM;
}
return 2;
}
break;
default:
/* esp is invalid as index */
- intel_state.index = i386_regtab + REGNAM_EAX + ESP_REG_NUM;
+ intel_state.index = reg_eax + ESP_REG_NUM;
break;
}
return 0;
if (intel_state.op_modifier != O_absent
- && current_templates->start->base_opcode != 0x8d /* lea */)
+ && (current_templates->start->opcode_modifier.opcodespace != SPACE_BASE
+ || current_templates->start->base_opcode != 0x8d /* lea */))
{
i.types[this_operand].bitfield.unspecified = 0;
if ((current_templates->start->name[0] == 'l'
&& current_templates->start->name[2] == 's'
&& current_templates->start->name[3] == 0)
- || current_templates->start->base_opcode == 0x62 /* bound */)
+ || (current_templates->start->opcode_modifier.opcodespace == SPACE_BASE
+ && current_templates->start->base_opcode == 0x62 /* bound */))
suffix = WORD_MNEM_SUFFIX;
else if (flag_code != CODE_32BIT
&& (current_templates->start->opcode_modifier.jump == JUMP
case O_qword_ptr: /* O_mmword_ptr */
i.types[this_operand].bitfield.qword = 1;
- if (current_templates->start->base_opcode == 0x62 /* bound */
+ if ((current_templates->start->opcode_modifier.opcodespace == SPACE_BASE
+ && current_templates->start->base_opcode == 0x62 /* bound */)
|| got_a_float == 1) /* "f..." */
suffix = LONG_MNEM_SUFFIX;
else
|| current_templates->start->opcode_modifier.jump == JUMP_DWORD
|| current_templates->start->opcode_modifier.jump == JUMP_INTERSEGMENT)
{
- bfd_boolean jumpabsolute = FALSE;
+ bool jumpabsolute = false;
if (i.op[this_operand].regs
|| intel_state.base
|| intel_state.index
|| intel_state.is_mem > 1)
- jumpabsolute = TRUE;
+ jumpabsolute = true;
else
switch (intel_state.op_modifier)
{
case O_near_ptr:
if (intel_state.seg)
- jumpabsolute = TRUE;
+ jumpabsolute = true;
else
intel_state.is_mem = 1;
break;
if (intel_state.op_modifier == O_absent)
{
if (intel_state.is_indirect == 1)
- jumpabsolute = TRUE;
+ jumpabsolute = true;
break;
}
as_bad (_("cannot infer the segment part of the operand"));
return 0;
}
else if (S_GET_SEGMENT (intel_state.seg) == reg_section)
- jumpabsolute = TRUE;
+ jumpabsolute = true;
else
{
i386_operand_type types;
}
break;
default:
- jumpabsolute = TRUE;
+ jumpabsolute = true;
break;
}
if (jumpabsolute)
{
- i.jumpabsolute = TRUE;
+ i.jumpabsolute = true;
intel_state.is_mem |= 1;
}
}
as_warn (_("redundant segment overrides"));
break;
}
- switch (i386_regtab[expP->X_add_number].reg_num)
- {
- case 0: i.seg[i.mem_operands] = &es; break;
- case 1: i.seg[i.mem_operands] = &cs; break;
- case 2: i.seg[i.mem_operands] = &ss; break;
- case 3: i.seg[i.mem_operands] = &ds; break;
- case 4: i.seg[i.mem_operands] = &fs; break;
- case 5: i.seg[i.mem_operands] = &gs; break;
- case RegFlat: i.seg[i.mem_operands] = NULL; break;
- }
+ if (i386_regtab[expP->X_add_number].reg_num == RegFlat)
+ i.seg[i.mem_operands] = NULL;
+ else
+ i.seg[i.mem_operands] = &i386_regtab[expP->X_add_number];
}
if (!i386_index_check (operand_string))