1 /* tc-i386.c -- Assemble Intel syntax code for ix86/x86-64
2 Copyright (C) 2009-2014 Free Software Foundation, Inc.
4 This file is part of GAS, the GNU Assembler.
6 GAS is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3, or (at your option)
11 GAS is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GAS; see the file COPYING. If not, write to the Free
18 Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
23 operatorT op_modifier; /* Operand modifier. */
24 int is_mem; /* 1 if operand is memory reference. */
25 int is_indirect; /* 1 if operand is indirect reference. */
26 int has_offset; /* 1 if operand has offset. */
27 unsigned int in_offset; /* >=1 if processing operand of offset. */
28 unsigned int in_bracket; /* >=1 if processing operand in brackets. */
29 unsigned int in_scale; /* >=1 if processing multipication operand
31 i386_operand_type reloc_types; /* Value obtained from lex_got(). */
32 const reg_entry *base; /* Base register (if any). */
33 const reg_entry *index; /* Index register (if any). */
34 offsetT scale_factor; /* Accumulated scale factor. */
39 /* offset X_add_symbol */
40 #define O_offset O_md32
41 /* offset X_add_symbol */
42 #define O_short O_md31
43 /* near ptr X_add_symbol */
44 #define O_near_ptr O_md30
45 /* far ptr X_add_symbol */
46 #define O_far_ptr O_md29
47 /* byte ptr X_add_symbol */
48 #define O_byte_ptr O_md28
49 /* word ptr X_add_symbol */
50 #define O_word_ptr O_md27
51 /* dword ptr X_add_symbol */
52 #define O_dword_ptr O_md26
53 /* qword ptr X_add_symbol */
54 #define O_qword_ptr O_md25
55 /* oword ptr X_add_symbol */
56 #define O_oword_ptr O_md24
57 /* fword ptr X_add_symbol */
58 #define O_fword_ptr O_md23
59 /* tbyte ptr X_add_symbol */
60 #define O_tbyte_ptr O_md22
61 /* xmmword ptr X_add_symbol */
62 #define O_xmmword_ptr O_md21
63 /* ymmword ptr X_add_symbol */
64 #define O_ymmword_ptr O_md20
65 /* zmmword ptr X_add_symbol */
66 #define O_zmmword_ptr O_md19
72 unsigned int operands;
74 const i386_operators[] =
76 { "and", O_bit_and, 2 },
82 { "mod", O_modulus, 2 },
84 { "not", O_bit_not, 1 },
85 { "offset", O_offset, 1 },
86 { "or", O_bit_inclusive_or, 2 },
87 { "shl", O_left_shift, 2 },
88 { "short", O_short, 1 },
89 { "shr", O_right_shift, 2 },
90 { "xor", O_bit_exclusive_or, 2 },
91 { NULL, O_illegal, 0 }
102 #define I386_TYPE(t, n) { #t, O_##t##_ptr, { n, n, n } }
108 I386_TYPE(tbyte, 10),
109 I386_TYPE(oword, 16),
110 I386_TYPE(xmmword, 16),
111 I386_TYPE(ymmword, 32),
112 I386_TYPE(zmmword, 64),
114 { "near", O_near_ptr, { 0xff04, 0xff02, 0xff08 } },
115 { "far", O_far_ptr, { 0xff06, 0xff05, 0xff06 } },
116 { NULL, O_illegal, { 0, 0, 0 } }
119 operatorT i386_operator (const char *name, unsigned int operands, char *pc)
130 switch (*input_line_pointer)
133 ++input_line_pointer;
136 ++input_line_pointer;
139 if (this_operand >= 0 && i.reloc[this_operand] == NO_RELOC)
142 char *gotfree_input_line = lex_got (&i.reloc[this_operand],
144 &intel_state.reloc_types);
146 if (!gotfree_input_line)
148 free (gotfree_input_line);
149 *input_line_pointer++ = '+';
150 memset (input_line_pointer, '0', adjust - 1);
151 input_line_pointer[adjust - 1] = ' ';
159 for (j = 0; i386_operators[j].name; ++j)
160 if (strcasecmp (i386_operators[j].name, name) == 0)
162 if (i386_operators[j].operands
163 && i386_operators[j].operands != operands)
165 return i386_operators[j].op;
168 for (j = 0; i386_types[j].name; ++j)
169 if (strcasecmp (i386_types[j].name, name) == 0)
171 if (i386_types[j].name && *pc == ' ')
173 char *pname = ++input_line_pointer;
174 char c = get_symbol_end ();
176 if (strcasecmp (pname, "ptr") == 0)
180 if (intel_syntax > 0 || operands != 1)
182 return i386_types[j].op;
185 *input_line_pointer = c;
186 input_line_pointer = pname - 1;
192 static int i386_intel_parse_name (const char *name, expressionS *e)
196 if (! strcmp (name, "$"))
198 current_location (e);
202 for (j = 0; i386_types[j].name; ++j)
203 if (strcasecmp(i386_types[j].name, name) == 0)
205 e->X_op = O_constant;
206 e->X_add_number = i386_types[j].sz[flag_code];
207 e->X_add_symbol = NULL;
208 e->X_op_symbol = NULL;
215 static INLINE int i386_intel_check (const reg_entry *rreg,
216 const reg_entry *base,
217 const reg_entry *iindex)
219 if ((this_operand >= 0
220 && rreg != i.op[this_operand].regs)
221 || base != intel_state.base
222 || iindex != intel_state.index)
224 as_bad (_("invalid use of register"));
230 static INLINE void i386_intel_fold (expressionS *e, symbolS *sym)
232 expressionS *exp = symbol_get_value_expression (sym);
233 if (S_GET_SEGMENT (sym) == absolute_section)
235 offsetT val = e->X_add_number;
238 e->X_add_number += val;
242 if (exp->X_op == O_symbol
243 && strcmp (S_GET_NAME (exp->X_add_symbol),
244 GLOBAL_OFFSET_TABLE_NAME) == 0)
245 sym = exp->X_add_symbol;
246 e->X_add_symbol = sym;
247 e->X_op_symbol = NULL;
253 i386_intel_simplify_register (expressionS *e)
257 if (this_operand < 0 || intel_state.in_offset)
259 as_bad (_("invalid use of register"));
263 if (e->X_op == O_register)
264 reg_num = e->X_add_number;
266 reg_num = e->X_md - 1;
268 if (!intel_state.in_bracket)
270 if (i.op[this_operand].regs)
272 as_bad (_("invalid use of register"));
275 if (i386_regtab[reg_num].reg_type.bitfield.sreg3
276 && i386_regtab[reg_num].reg_num == RegFlat)
278 as_bad (_("invalid use of pseudo-register"));
281 i.op[this_operand].regs = i386_regtab + reg_num;
283 else if (!intel_state.index
284 && (i386_regtab[reg_num].reg_type.bitfield.regxmm
285 || i386_regtab[reg_num].reg_type.bitfield.regymm
286 || i386_regtab[reg_num].reg_type.bitfield.regzmm))
287 intel_state.index = i386_regtab + reg_num;
288 else if (!intel_state.base && !intel_state.in_scale)
289 intel_state.base = i386_regtab + reg_num;
290 else if (!intel_state.index)
292 if (intel_state.in_scale
293 || current_templates->start->base_opcode == 0xf30f1b /* bndmk */
294 || (current_templates->start->base_opcode & ~1) == 0x0f1a /* bnd{ld,st}x */
295 || i386_regtab[reg_num].reg_type.bitfield.baseindex)
296 intel_state.index = i386_regtab + reg_num;
299 /* Convert base to index and make ESP/RSP the base. */
300 intel_state.index = intel_state.base;
301 intel_state.base = i386_regtab + reg_num;
306 /* esp is invalid as index */
307 intel_state.index = i386_regtab + REGNAM_EAX + ESP_REG_NUM;
312 static int i386_intel_simplify (expressionS *);
314 static INLINE int i386_intel_simplify_symbol(symbolS *sym)
316 int ret = i386_intel_simplify (symbol_get_value_expression (sym));
320 S_SET_SEGMENT(sym, absolute_section);
326 static int i386_intel_simplify (expressionS *e)
328 const reg_entry *the_reg = (this_operand >= 0
329 ? i.op[this_operand].regs : NULL);
330 const reg_entry *base = intel_state.base;
331 const reg_entry *state_index = intel_state.index;
342 if (!i386_intel_simplify_symbol (e->X_add_symbol)
343 || !i386_intel_check(the_reg, intel_state.base,
347 if (!intel_state.in_offset)
348 ++intel_state.in_bracket;
349 ret = i386_intel_simplify_symbol (e->X_op_symbol);
350 if (!intel_state.in_offset)
351 --intel_state.in_bracket;
357 i386_intel_fold (e, e->X_op_symbol);
361 intel_state.has_offset = 1;
362 ++intel_state.in_offset;
363 ret = i386_intel_simplify_symbol (e->X_add_symbol);
364 --intel_state.in_offset;
365 if (!ret || !i386_intel_check(the_reg, base, state_index))
367 i386_intel_fold (e, e->X_add_symbol);
382 if (intel_state.op_modifier == O_absent)
383 intel_state.op_modifier = e->X_op;
386 if (symbol_get_value_expression (e->X_add_symbol)->X_op
389 as_bad (_("invalid use of register"));
392 if (!i386_intel_simplify_symbol (e->X_add_symbol))
394 i386_intel_fold (e, e->X_add_symbol);
398 if (symbol_get_value_expression (e->X_op_symbol)->X_op
401 as_bad (_("invalid use of register"));
404 if (!i386_intel_simplify_symbol (e->X_op_symbol)
405 || !i386_intel_check(the_reg, intel_state.base,
408 if (!intel_state.in_offset)
409 intel_state.seg = e->X_add_symbol;
410 i386_intel_fold (e, e->X_op_symbol);
414 if (this_operand >= 0 && intel_state.in_bracket)
416 expressionS *scale = NULL;
417 int has_index = (intel_state.index != NULL);
419 if (!intel_state.in_scale++)
420 intel_state.scale_factor = 1;
422 ret = i386_intel_simplify_symbol (e->X_add_symbol);
423 if (ret && !has_index && intel_state.index)
424 scale = symbol_get_value_expression (e->X_op_symbol);
427 ret = i386_intel_simplify_symbol (e->X_op_symbol);
428 if (ret && !scale && !has_index && intel_state.index)
429 scale = symbol_get_value_expression (e->X_add_symbol);
433 resolve_expression (scale);
434 if (scale->X_op != O_constant
435 || intel_state.index->reg_type.bitfield.reg16)
436 scale->X_add_number = 0;
437 intel_state.scale_factor *= scale->X_add_number;
440 --intel_state.in_scale;
444 if (!intel_state.in_scale)
445 switch (intel_state.scale_factor)
448 i.log2_scale_factor = 0;
451 i.log2_scale_factor = 1;
454 i.log2_scale_factor = 2;
457 i.log2_scale_factor = 3;
460 /* esp is invalid as index */
461 intel_state.index = i386_regtab + REGNAM_EAX + ESP_REG_NUM;
470 ret = i386_intel_simplify_register (e);
473 gas_assert (e->X_add_number < (unsigned short) -1);
474 e->X_md = (unsigned short) e->X_add_number + 1;
475 e->X_op = O_constant;
482 return i386_intel_simplify_register (e);
488 && !i386_intel_simplify_symbol (e->X_add_symbol))
490 if (e->X_op == O_add || e->X_op == O_subtract)
492 base = intel_state.base;
493 state_index = intel_state.index;
495 if (!i386_intel_check (the_reg, base, state_index)
497 && !i386_intel_simplify_symbol (e->X_op_symbol))
498 || !i386_intel_check (the_reg,
500 ? base : intel_state.base),
502 ? state_index : intel_state.index)))
507 if (this_operand >= 0
508 && e->X_op == O_symbol
509 && !intel_state.in_offset)
511 segT seg = S_GET_SEGMENT (e->X_add_symbol);
513 if (seg != absolute_section
514 && seg != reg_section
515 && seg != expr_section)
516 intel_state.is_mem |= 2 - !intel_state.in_bracket;
522 int i386_need_index_operator (void)
524 return intel_syntax < 0;
528 i386_intel_operand (char *operand_string, int got_a_float)
530 char *saved_input_line_pointer, *buf;
532 expressionS exp, *expP;
536 /* Handle vector immediates. */
537 if (RC_SAE_immediate (operand_string))
540 /* Initialize state structure. */
541 intel_state.op_modifier = O_absent;
542 intel_state.is_mem = 0;
543 intel_state.is_indirect = 0;
544 intel_state.has_offset = 0;
545 intel_state.base = NULL;
546 intel_state.index = NULL;
547 intel_state.seg = NULL;
548 operand_type_set (&intel_state.reloc_types, ~0);
549 gas_assert (!intel_state.in_offset);
550 gas_assert (!intel_state.in_bracket);
551 gas_assert (!intel_state.in_scale);
553 saved_input_line_pointer = input_line_pointer;
554 input_line_pointer = buf = xstrdup (operand_string);
557 memset (&exp, 0, sizeof(exp));
558 exp_seg = expression (&exp);
559 ret = i386_intel_simplify (&exp);
564 /* Handle vector operations. */
565 if (*input_line_pointer == '{')
567 char *end = check_VecOperations (input_line_pointer, NULL);
569 input_line_pointer = end;
574 if (!is_end_of_line[(unsigned char) *input_line_pointer])
576 as_bad (_("junk `%s' after expression"), input_line_pointer);
579 else if (exp.X_op == O_illegal || exp.X_op == O_absent)
581 as_bad (_("invalid expression"));
584 else if (!intel_state.has_offset
585 && input_line_pointer > buf
586 && *(input_line_pointer - 1) == ']')
588 intel_state.is_mem |= 1;
589 intel_state.is_indirect = 1;
592 input_line_pointer = saved_input_line_pointer;
595 gas_assert (!intel_state.in_offset);
596 gas_assert (!intel_state.in_bracket);
597 gas_assert (!intel_state.in_scale);
602 if (intel_state.op_modifier != O_absent
603 && current_templates->start->base_opcode != 0x8d /* lea */)
605 i.types[this_operand].bitfield.unspecified = 0;
607 switch (intel_state.op_modifier)
610 i.types[this_operand].bitfield.byte = 1;
611 suffix = BYTE_MNEM_SUFFIX;
615 i.types[this_operand].bitfield.word = 1;
616 if ((current_templates->start->name[0] == 'l'
617 && current_templates->start->name[2] == 's'
618 && current_templates->start->name[3] == 0)
619 || current_templates->start->base_opcode == 0x62 /* bound */)
620 suffix = BYTE_MNEM_SUFFIX; /* so it will cause an error */
621 else if (got_a_float == 2) /* "fi..." */
622 suffix = SHORT_MNEM_SUFFIX;
624 suffix = WORD_MNEM_SUFFIX;
628 i.types[this_operand].bitfield.dword = 1;
629 if ((current_templates->start->name[0] == 'l'
630 && current_templates->start->name[2] == 's'
631 && current_templates->start->name[3] == 0)
632 || current_templates->start->base_opcode == 0x62 /* bound */)
633 suffix = WORD_MNEM_SUFFIX;
634 else if (flag_code == CODE_16BIT
635 && (current_templates->start->opcode_modifier.jump
636 || current_templates->start->opcode_modifier.jumpdword))
637 suffix = LONG_DOUBLE_MNEM_SUFFIX;
638 else if (got_a_float == 1) /* "f..." */
639 suffix = SHORT_MNEM_SUFFIX;
641 suffix = LONG_MNEM_SUFFIX;
645 i.types[this_operand].bitfield.fword = 1;
646 if (current_templates->start->name[0] == 'l'
647 && current_templates->start->name[2] == 's'
648 && current_templates->start->name[3] == 0)
649 suffix = LONG_MNEM_SUFFIX;
650 else if (!got_a_float)
652 if (flag_code == CODE_16BIT)
653 add_prefix (DATA_PREFIX_OPCODE);
654 suffix = LONG_DOUBLE_MNEM_SUFFIX;
657 suffix = BYTE_MNEM_SUFFIX; /* so it will cause an error */
661 i.types[this_operand].bitfield.qword = 1;
662 if (current_templates->start->base_opcode == 0x62 /* bound */
663 || got_a_float == 1) /* "f..." */
664 suffix = LONG_MNEM_SUFFIX;
666 suffix = QWORD_MNEM_SUFFIX;
670 i.types[this_operand].bitfield.tbyte = 1;
671 if (got_a_float == 1)
672 suffix = LONG_DOUBLE_MNEM_SUFFIX;
674 suffix = BYTE_MNEM_SUFFIX; /* so it will cause an error */
679 i.types[this_operand].bitfield.xmmword = 1;
680 suffix = XMMWORD_MNEM_SUFFIX;
684 i.types[this_operand].bitfield.ymmword = 1;
685 suffix = YMMWORD_MNEM_SUFFIX;
689 i.types[this_operand].bitfield.zmmword = 1;
690 suffix = ZMMWORD_MNEM_SUFFIX;
694 suffix = LONG_DOUBLE_MNEM_SUFFIX;
697 if (!current_templates->start->opcode_modifier.jump
698 && !current_templates->start->opcode_modifier.jumpdword)
699 suffix = got_a_float /* so it will cause an error */
701 : LONG_DOUBLE_MNEM_SUFFIX;
705 BAD_CASE (intel_state.op_modifier);
711 else if (i.suffix != suffix)
713 as_bad (_("conflicting operand size modifiers"));
718 /* Operands for jump/call need special consideration. */
719 if (current_templates->start->opcode_modifier.jump
720 || current_templates->start->opcode_modifier.jumpdword
721 || current_templates->start->opcode_modifier.jumpintersegment)
723 if (i.op[this_operand].regs
726 || intel_state.is_mem > 1)
727 i.types[this_operand].bitfield.jumpabsolute = 1;
729 switch (intel_state.op_modifier)
733 i.types[this_operand].bitfield.jumpabsolute = 1;
735 intel_state.is_mem = 1;
739 if (!intel_state.seg)
741 intel_state.is_mem = 1;
742 if (intel_state.op_modifier == O_absent)
744 if (intel_state.is_indirect == 1)
745 i.types[this_operand].bitfield.jumpabsolute = 1;
748 as_bad (_("cannot infer the segment part of the operand"));
751 else if (S_GET_SEGMENT (intel_state.seg) == reg_section)
752 i.types[this_operand].bitfield.jumpabsolute = 1;
755 i386_operand_type types;
757 if (i.imm_operands >= MAX_IMMEDIATE_OPERANDS)
759 as_bad (_("at most %d immediate operands are allowed"),
760 MAX_IMMEDIATE_OPERANDS);
763 expP = &im_expressions[i.imm_operands++];
764 memset (expP, 0, sizeof(*expP));
765 expP->X_op = O_symbol;
766 expP->X_add_symbol = intel_state.seg;
767 i.op[this_operand].imms = expP;
769 resolve_expression (expP);
770 operand_type_set (&types, ~0);
771 if (!i386_finalize_immediate (S_GET_SEGMENT (intel_state.seg),
772 expP, types, operand_string))
774 if (i.operands < MAX_OPERANDS)
776 this_operand = i.operands++;
777 i.types[this_operand].bitfield.unspecified = 1;
779 if (suffix == LONG_DOUBLE_MNEM_SUFFIX)
781 intel_state.seg = NULL;
782 intel_state.is_mem = 0;
786 i.types[this_operand].bitfield.jumpabsolute = 1;
789 if (i.types[this_operand].bitfield.jumpabsolute)
790 intel_state.is_mem |= 1;
792 else if (intel_state.seg)
793 intel_state.is_mem |= 1;
795 if (i.op[this_operand].regs)
797 i386_operand_type temp;
799 /* Register operand. */
800 if (intel_state.base || intel_state.index || intel_state.seg)
802 as_bad (_("invalid operand"));
806 temp = i.op[this_operand].regs->reg_type;
807 temp.bitfield.baseindex = 0;
808 i.types[this_operand] = operand_type_or (i.types[this_operand],
810 i.types[this_operand].bitfield.unspecified = 0;
813 else if (intel_state.base
816 || intel_state.is_mem)
818 /* Memory operand. */
819 if ((int) i.mem_operands
820 >= 2 - !current_templates->start->opcode_modifier.isstring)
824 call 0x9090,0x90909090
825 lcall 0x9090,0x90909090
826 jmp 0x9090,0x90909090
827 ljmp 0x9090,0x90909090
830 if ((current_templates->start->opcode_modifier.jumpintersegment
831 || current_templates->start->opcode_modifier.jumpdword
832 || current_templates->start->opcode_modifier.jump)
834 && intel_state.seg == NULL
835 && i.mem_operands == 1
836 && i.disp_operands == 1
837 && intel_state.op_modifier == O_absent)
839 /* Try to process the first operand as immediate, */
841 if (i386_finalize_immediate (exp_seg, i.op[0].imms,
842 intel_state.reloc_types,
846 expP = &im_expressions[0];
847 i.op[this_operand].imms = expP;
850 /* Try to process the second operand as immediate, */
851 if (i386_finalize_immediate (exp_seg, expP,
852 intel_state.reloc_types,
858 i.types[0].bitfield.mem = 0;
859 i.types[0].bitfield.disp16 = 0;
860 i.types[0].bitfield.disp32 = 0;
861 i.types[0].bitfield.disp32s = 0;
867 as_bad (_("too many memory references for `%s'"),
868 current_templates->start->name);
872 expP = &disp_expressions[i.disp_operands];
873 memcpy (expP, &exp, sizeof(exp));
874 resolve_expression (expP);
876 if (expP->X_op != O_constant
877 || expP->X_add_number
878 || (!intel_state.base
879 && !intel_state.index))
881 i.op[this_operand].disps = expP;
884 if (flag_code == CODE_64BIT)
886 i.types[this_operand].bitfield.disp32 = 1;
887 if (!i.prefix[ADDR_PREFIX])
889 i.types[this_operand].bitfield.disp64 = 1;
890 i.types[this_operand].bitfield.disp32s = 1;
893 else if (!i.prefix[ADDR_PREFIX] ^ (flag_code == CODE_16BIT))
894 i.types[this_operand].bitfield.disp32 = 1;
896 i.types[this_operand].bitfield.disp16 = 1;
898 #if defined (OBJ_AOUT) || defined (OBJ_MAYBE_AOUT)
900 * exp_seg is used only for verification in
901 * i386_finalize_displacement, and we can end up seeing reg_section
902 * here - but we know we removed all registers from the expression
903 * (or error-ed on any remaining ones) in i386_intel_simplify. I
904 * consider the check in i386_finalize_displacement bogus anyway, in
905 * particular because it doesn't allow for expr_section, so I'd
906 * rather see that check (and the similar one in
907 * i386_finalize_immediate) use SEG_NORMAL(), but not being an a.out
908 * expert I can't really say whether that would have other bad side
911 if (OUTPUT_FLAVOR == bfd_target_aout_flavour
912 && exp_seg == reg_section)
913 exp_seg = expP->X_op != O_constant ? undefined_section
917 if (!i386_finalize_displacement (exp_seg, expP,
918 intel_state.reloc_types,
923 if (intel_state.base || intel_state.index)
924 i.types[this_operand].bitfield.baseindex = 1;
930 expP = symbol_get_value_expression (intel_state.seg);
931 if (expP->X_op != O_full_ptr)
933 intel_state.seg = expP->X_add_symbol;
935 if (expP->X_op != O_register)
937 as_bad (_("segment register name expected"));
940 if (!i386_regtab[expP->X_add_number].reg_type.bitfield.sreg2
941 && !i386_regtab[expP->X_add_number].reg_type.bitfield.sreg3)
943 as_bad (_("invalid use of register"));
946 switch (i386_regtab[expP->X_add_number].reg_num)
948 case 0: i.seg[i.mem_operands] = &es; break;
949 case 1: i.seg[i.mem_operands] = &cs; break;
950 case 2: i.seg[i.mem_operands] = &ss; break;
951 case 3: i.seg[i.mem_operands] = &ds; break;
952 case 4: i.seg[i.mem_operands] = &fs; break;
953 case 5: i.seg[i.mem_operands] = &gs; break;
954 case RegFlat: i.seg[i.mem_operands] = NULL; break;
958 /* Swap base and index in 16-bit memory operands like
959 [si+bx]. Since i386_index_check is also used in AT&T
960 mode we have to do that here. */
963 && intel_state.base->reg_type.bitfield.reg16
964 && intel_state.index->reg_type.bitfield.reg16
965 && intel_state.base->reg_num >= 6
966 && intel_state.index->reg_num < 6)
968 i.base_reg = intel_state.index;
969 i.index_reg = intel_state.base;
973 i.base_reg = intel_state.base;
974 i.index_reg = intel_state.index;
977 if (!i386_index_check (operand_string))
980 i.types[this_operand].bitfield.mem = 1;
986 if (i.imm_operands >= MAX_IMMEDIATE_OPERANDS)
988 as_bad (_("at most %d immediate operands are allowed"),
989 MAX_IMMEDIATE_OPERANDS);
993 expP = &im_expressions[i.imm_operands++];
994 i.op[this_operand].imms = expP;
997 return i386_finalize_immediate (exp_seg, expP, intel_state.reloc_types,