+ if (0 == (SYNTAX_VALID & class))
+ {
+ as_bad ("invalid syntax class");
+ ignore_rest_of_line ();
+ return;
+ }
+
+ if ((0x3 == opcode) & (class & SYNTAX_3OP))
+ {
+ as_bad ("opcode 0x3 and SYNTAX_3OP invalid");
+ ignore_rest_of_line ();
+ return;
+ }
+
+ switch (suffixcode)
+ {
+ case 0:
+ strcat (syntax, "%.q%.f ");
+ break;
+ case 1:
+ strcat (syntax, "%.f ");
+ break;
+ case 2:
+ strcat (syntax, "%.q ");
+ break;
+ case 3:
+ strcat (syntax, " ");
+ break;
+ default:
+ as_bad ("unknown suffix class");
+ ignore_rest_of_line ();
+ return;
+ break;
+ };
+
+ strcat (syntax, ((opcode == 0x3) ? "%a,%b" : ((class & SYNTAX_3OP) ? "%a,%b,%c" : "%b,%c")));
+ if (suffixcode < 2)
+ strcat (syntax, "%F");
+ strcat (syntax, "%S%L");
+
+ ext_op = (struct arc_opcode *) xmalloc (sizeof (struct arc_opcode));
+ if (NULL == ext_op)
+ {
+ ignore_rest_of_line ();
+ return;
+ }
+
+ ext_op->syntax = xstrdup (syntax);
+ if (NULL == ext_op->syntax)
+ {
+ ignore_rest_of_line ();
+ return;
+ }
+
+ ext_op->mask = I (-1) | ((0x3 == opcode) ? C (-1) : 0);
+ ext_op->value = I (opcode) | ((0x3 == opcode) ? C (subopcode) : 0);
+ ext_op->flags = class;
+ ext_op->next_asm = arc_ext_opcodes;
+ ext_op->next_dis = arc_ext_opcodes;
+ arc_ext_opcodes = ext_op;
+
+ /* OK, now that we know what this inst is, put a description in the
+ arc extension section of the output file. */
+
+ old_sec = now_seg;
+ old_subsec = now_subseg;
+
+ arc_set_ext_seg ();
+
+ p = frag_more (1);
+ *p = 5 + name_len + 1;
+ p = frag_more (1);
+ *p = EXT_INSTRUCTION;
+ p = frag_more (1);
+ *p = opcode;
+ p = frag_more (1);
+ *p = subopcode;
+ p = frag_more (1);
+ *p = (class & (OP1_MUST_BE_IMM | OP1_IMM_IMPLIED) ? IGNORE_FIRST_OPD : 0);
+ p = frag_more (name_len);
+ strncpy (p, syntax, name_len);
+ p = frag_more (1);
+ *p = '\0';
+
+ subseg_set (old_sec, old_subsec);
+
+ demand_empty_rest_of_line ();