+ default:
+ as_bad (_("Unknown opcode: `%s'"), str);
+ return;
+ }
+
+ /* Look up the opcode in the has table. */
+ if ((insn = (struct pa_opcode *) hash_find (op_hash, str)) == NULL)
+ {
+ as_bad ("Unknown opcode: `%s'", str);
+ return;
+ }
+
+ if (comma)
+ *--s = ',';
+
+ /* Mark the location where arguments for the instruction start, then
+ start processing them. */
+ argstart = s;
+ for (;;)
+ {
+ /* Do some initialization. */
+ opcode = insn->match;
+ strict = (insn->flags & FLAG_STRICT);
+ memset (&the_insn, 0, sizeof (the_insn));
+
+ the_insn.reloc = R_HPPA_NONE;
+
+ if (insn->arch >= pa20
+ && bfd_get_mach (stdoutput) < insn->arch)
+ goto failed;
+
+ /* Build the opcode, checking as we go to make
+ sure that the operands match. */
+ for (args = insn->args;; ++args)
+ {
+ /* Absorb white space in instruction. */
+ while (*s == ' ' || *s == '\t')
+ s++;
+
+ switch (*args)
+ {
+ /* End of arguments. */
+ case '\0':
+ if (*s == '\0')
+ match = TRUE;
+ break;
+
+ case '+':
+ if (*s == '+')
+ {
+ ++s;
+ continue;
+ }
+ if (*s == '-')
+ continue;
+ break;
+
+ /* These must match exactly. */
+ case '(':
+ case ')':
+ case ',':
+ case ' ':
+ if (*s++ == *args)
+ continue;
+ break;
+
+ /* Handle a 5 bit register or control register field at 10. */
+ case 'b':
+ case '^':
+ if (!pa_parse_number (&s, 0))
+ break;
+ num = pa_number;
+ CHECK_FIELD (num, 31, 0, 0);
+ INSERT_FIELD_AND_CONTINUE (opcode, num, 21);
+
+ /* Handle %sar or %cr11. No bits get set, we just verify that it
+ is there. */
+ case '!':
+ /* Skip whitespace before register. */
+ while (*s == ' ' || *s == '\t')
+ s = s + 1;
+
+ if (!strncasecmp (s, "%sar", 4))
+ {
+ s += 4;
+ continue;
+ }
+ else if (!strncasecmp (s, "%cr11", 5))
+ {
+ s += 5;
+ continue;
+ }
+ break;
+
+ /* Handle a 5 bit register field at 15. */
+ case 'x':
+ if (!pa_parse_number (&s, 0))
+ break;
+ num = pa_number;
+ CHECK_FIELD (num, 31, 0, 0);
+ INSERT_FIELD_AND_CONTINUE (opcode, num, 16);
+
+ /* Handle a 5 bit register field at 31. */
+ case 't':
+ if (!pa_parse_number (&s, 0))
+ break;
+ num = pa_number;
+ CHECK_FIELD (num, 31, 0, 0);
+ INSERT_FIELD_AND_CONTINUE (opcode, num, 0);
+
+ /* Handle a 5 bit register field at 10 and 15. */
+ case 'a':
+ if (!pa_parse_number (&s, 0))
+ break;
+ num = pa_number;
+ CHECK_FIELD (num, 31, 0, 0);
+ opcode |= num << 16;
+ INSERT_FIELD_AND_CONTINUE (opcode, num, 21);
+
+ /* Handle a 5 bit field length at 31. */
+ case 'T':
+ num = pa_get_absolute_expression (&the_insn, &s);
+ if (strict && the_insn.exp.X_op != O_constant)
+ break;
+ s = expr_end;
+ CHECK_FIELD (num, 32, 1, 0);
+ INSERT_FIELD_AND_CONTINUE (opcode, 32 - num, 0);
+
+ /* Handle a 5 bit immediate at 15. */
+ case '5':
+ num = pa_get_absolute_expression (&the_insn, &s);
+ if (strict && the_insn.exp.X_op != O_constant)
+ break;
+ s = expr_end;
+ /* When in strict mode, we want to just reject this
+ match instead of giving an out of range error. */
+ CHECK_FIELD (num, 15, -16, strict);
+ num = low_sign_unext (num, 5);
+ INSERT_FIELD_AND_CONTINUE (opcode, num, 16);
+
+ /* Handle a 5 bit immediate at 31. */
+ case 'V':
+ num = pa_get_absolute_expression (&the_insn, &s);
+ if (strict && the_insn.exp.X_op != O_constant)
+ break;
+ s = expr_end;
+ /* When in strict mode, we want to just reject this
+ match instead of giving an out of range error. */
+ CHECK_FIELD (num, 15, -16, strict);
+ num = low_sign_unext (num, 5);
+ INSERT_FIELD_AND_CONTINUE (opcode, num, 0);
+
+ /* Handle an unsigned 5 bit immediate at 31. */
+ case 'r':
+ num = pa_get_absolute_expression (&the_insn, &s);
+ if (strict && the_insn.exp.X_op != O_constant)
+ break;
+ s = expr_end;
+ CHECK_FIELD (num, 31, 0, strict);
+ INSERT_FIELD_AND_CONTINUE (opcode, num, 0);
+
+ /* Handle an unsigned 5 bit immediate at 15. */
+ case 'R':
+ num = pa_get_absolute_expression (&the_insn, &s);
+ if (strict && the_insn.exp.X_op != O_constant)
+ break;
+ s = expr_end;
+ CHECK_FIELD (num, 31, 0, strict);
+ INSERT_FIELD_AND_CONTINUE (opcode, num, 16);
+
+ /* Handle an unsigned 10 bit immediate at 15. */
+ case 'U':
+ num = pa_get_absolute_expression (&the_insn, &s);
+ if (strict && the_insn.exp.X_op != O_constant)
+ break;
+ s = expr_end;
+ CHECK_FIELD (num, 1023, 0, strict);
+ INSERT_FIELD_AND_CONTINUE (opcode, num, 16);
+
+ /* Handle a 2 bit space identifier at 17. */
+ case 's':
+ if (!pa_parse_number (&s, 0))
+ break;
+ num = pa_number;
+ CHECK_FIELD (num, 3, 0, 1);
+ INSERT_FIELD_AND_CONTINUE (opcode, num, 14);
+
+ /* Handle a 3 bit space identifier at 18. */
+ case 'S':
+ if (!pa_parse_number (&s, 0))
+ break;
+ num = pa_number;
+ CHECK_FIELD (num, 7, 0, 1);
+ opcode |= re_assemble_3 (num);
+ continue;
+
+ /* Handle all completers. */
+ case 'c':
+ switch (*++args)
+ {
+
+ /* Handle a completer for an indexing load or store. */
+ case 'X':
+ case 'x':
+ {
+ int uu = 0;
+ int m = 0;
+ int i = 0;
+ while (*s == ',' && i < 2)
+ {
+ s++;
+ if (strncasecmp (s, "sm", 2) == 0)
+ {
+ uu = 1;
+ m = 1;
+ s++;
+ i++;
+ }
+ else if (strncasecmp (s, "m", 1) == 0)
+ m = 1;
+ else if ((strncasecmp (s, "s ", 2) == 0)
+ || (strncasecmp (s, "s,", 2) == 0))
+ uu = 1;
+ else if (strict)
+ {
+ /* This is a match failure. */
+ s--;
+ break;
+ }
+ else
+ as_bad (_("Invalid Indexed Load Completer."));
+ s++;
+ i++;
+ }
+ if (i > 2)
+ as_bad (_("Invalid Indexed Load Completer Syntax."));
+ opcode |= m << 5;
+ INSERT_FIELD_AND_CONTINUE (opcode, uu, 13);
+ }
+
+ /* Handle a short load/store completer. */
+ case 'M':
+ case 'm':
+ case 'q':
+ case 'J':
+ case 'e':
+ {
+ int a = 0;
+ int m = 0;
+ if (*s == ',')
+ {
+ s++;
+ if (strncasecmp (s, "ma", 2) == 0)
+ {
+ a = 0;
+ m = 1;
+ s += 2;
+ }
+ else if (strncasecmp (s, "mb", 2) == 0)
+ {
+ a = 1;
+ m = 1;
+ s += 2;
+ }
+ else if (strict)
+ /* This is a match failure. */
+ s--;
+ else
+ {
+ as_bad (_("Invalid Short Load/Store Completer."));
+ s += 2;
+ }
+ }
+ /* If we did not get a ma/mb completer, then we do not
+ consider this a positive match for 'ce'. */
+ else if (*args == 'e')
+ break;
+
+ /* 'J', 'm', 'M' and 'q' are the same, except for where they
+ encode the before/after field. */
+ if (*args == 'm' || *args == 'M')
+ {
+ opcode |= m << 5;
+ INSERT_FIELD_AND_CONTINUE (opcode, a, 13);
+ }
+ else if (*args == 'q')
+ {
+ opcode |= m << 3;
+ INSERT_FIELD_AND_CONTINUE (opcode, a, 2);
+ }
+ else if (*args == 'J')
+ {
+ /* M bit is explicit in the major opcode. */
+ INSERT_FIELD_AND_CONTINUE (opcode, a, 2);
+ }
+ else if (*args == 'e')
+ {
+ /* Stash the ma/mb flag temporarily in the
+ instruction. We will use (and remove it)
+ later when handling 'J', 'K', '<' & '>'. */
+ opcode |= a;
+ continue;
+ }
+ }
+
+ /* Handle a stbys completer. */
+ case 'A':
+ case 's':
+ {
+ int a = 0;
+ int m = 0;
+ int i = 0;
+ while (*s == ',' && i < 2)
+ {
+ s++;
+ if (strncasecmp (s, "m", 1) == 0)
+ m = 1;
+ else if ((strncasecmp (s, "b ", 2) == 0)
+ || (strncasecmp (s, "b,", 2) == 0))
+ a = 0;
+ else if (strncasecmp (s, "e", 1) == 0)
+ a = 1;
+ /* In strict mode, this is a match failure. */
+ else if (strict)
+ {
+ s--;
+ break;
+ }
+ else
+ as_bad (_("Invalid Store Bytes Short Completer"));
+ s++;
+ i++;
+ }
+ if (i > 2)
+ as_bad (_("Invalid Store Bytes Short Completer"));
+ opcode |= m << 5;
+ INSERT_FIELD_AND_CONTINUE (opcode, a, 13);
+ }
+
+ /* Handle load cache hint completer. */
+ case 'c':
+ cmpltr = 0;
+ if (!strncmp (s, ",sl", 3))
+ {
+ s += 3;
+ cmpltr = 2;
+ }
+ INSERT_FIELD_AND_CONTINUE (opcode, cmpltr, 10);
+
+ /* Handle store cache hint completer. */
+ case 'C':
+ cmpltr = 0;
+ if (!strncmp (s, ",sl", 3))
+ {
+ s += 3;
+ cmpltr = 2;
+ }
+ else if (!strncmp (s, ",bc", 3))
+ {
+ s += 3;
+ cmpltr = 1;
+ }
+ INSERT_FIELD_AND_CONTINUE (opcode, cmpltr, 10);
+
+ /* Handle load and clear cache hint completer. */
+ case 'd':
+ cmpltr = 0;
+ if (!strncmp (s, ",co", 3))
+ {
+ s += 3;
+ cmpltr = 1;
+ }
+ INSERT_FIELD_AND_CONTINUE (opcode, cmpltr, 10);
+
+ /* Handle load ordering completer. */
+ case 'o':
+ if (strncmp (s, ",o", 2) != 0)
+ break;
+ s += 2;
+ continue;
+
+ /* Handle a branch gate completer. */
+ case 'g':
+ if (strncasecmp (s, ",gate", 5) != 0)
+ break;
+ s += 5;
+ continue;
+
+ /* Handle a branch link and push completer. */
+ case 'p':
+ if (strncasecmp (s, ",l,push", 7) != 0)
+ break;
+ s += 7;
+ continue;
+
+ /* Handle a branch link completer. */
+ case 'l':
+ if (strncasecmp (s, ",l", 2) != 0)
+ break;
+ s += 2;
+ continue;
+
+ /* Handle a branch pop completer. */
+ case 'P':
+ if (strncasecmp (s, ",pop", 4) != 0)
+ break;
+ s += 4;
+ continue;
+
+ /* Handle a local processor completer. */
+ case 'L':
+ if (strncasecmp (s, ",l", 2) != 0)
+ break;
+ s += 2;
+ continue;
+
+ /* Handle a PROBE read/write completer. */
+ case 'w':
+ flag = 0;
+ if (!strncasecmp (s, ",w", 2))
+ {
+ flag = 1;
+ s += 2;
+ }
+ else if (!strncasecmp (s, ",r", 2))
+ {
+ flag = 0;
+ s += 2;
+ }
+
+ INSERT_FIELD_AND_CONTINUE (opcode, flag, 6);
+
+ /* Handle MFCTL wide completer. */
+ case 'W':
+ if (strncasecmp (s, ",w", 2) != 0)
+ break;
+ s += 2;
+ continue;
+
+ /* Handle an RFI restore completer. */
+ case 'r':
+ flag = 0;
+ if (!strncasecmp (s, ",r", 2))
+ {
+ flag = 5;
+ s += 2;
+ }
+
+ INSERT_FIELD_AND_CONTINUE (opcode, flag, 5);
+
+ /* Handle a system control completer. */
+ case 'Z':
+ if (*s == ',' && (*(s + 1) == 'm' || *(s + 1) == 'M'))
+ {
+ flag = 1;
+ s += 2;
+ }
+ else
+ flag = 0;
+
+ INSERT_FIELD_AND_CONTINUE (opcode, flag, 5);
+
+ /* Handle intermediate/final completer for DCOR. */
+ case 'i':
+ flag = 0;
+ if (!strncasecmp (s, ",i", 2))
+ {
+ flag = 1;
+ s += 2;
+ }
+
+ INSERT_FIELD_AND_CONTINUE (opcode, flag, 6);
+
+ /* Handle zero/sign extension completer. */
+ case 'z':
+ flag = 1;
+ if (!strncasecmp (s, ",z", 2))
+ {
+ flag = 0;
+ s += 2;
+ }
+
+ INSERT_FIELD_AND_CONTINUE (opcode, flag, 10);
+
+ /* Handle add completer. */
+ case 'a':
+ flag = 1;
+ if (!strncasecmp (s, ",l", 2))
+ {
+ flag = 2;
+ s += 2;
+ }
+ else if (!strncasecmp (s, ",tsv", 4))
+ {
+ flag = 3;
+ s += 4;
+ }
+
+ INSERT_FIELD_AND_CONTINUE (opcode, flag, 10);
+
+ /* Handle 64 bit carry for ADD. */
+ case 'Y':
+ flag = 0;
+ if (!strncasecmp (s, ",dc,tsv", 7) ||
+ !strncasecmp (s, ",tsv,dc", 7))
+ {
+ flag = 1;
+ s += 7;
+ }
+ else if (!strncasecmp (s, ",dc", 3))
+ {
+ flag = 0;
+ s += 3;
+ }
+ else
+ break;
+
+ INSERT_FIELD_AND_CONTINUE (opcode, flag, 11);
+
+ /* Handle 32 bit carry for ADD. */
+ case 'y':
+ flag = 0;
+ if (!strncasecmp (s, ",c,tsv", 6) ||
+ !strncasecmp (s, ",tsv,c", 6))
+ {
+ flag = 1;
+ s += 6;
+ }
+ else if (!strncasecmp (s, ",c", 2))
+ {
+ flag = 0;
+ s += 2;
+ }
+ else
+ break;
+
+ INSERT_FIELD_AND_CONTINUE (opcode, flag, 11);
+
+ /* Handle trap on signed overflow. */
+ case 'v':
+ flag = 0;
+ if (!strncasecmp (s, ",tsv", 4))
+ {
+ flag = 1;
+ s += 4;
+ }
+
+ INSERT_FIELD_AND_CONTINUE (opcode, flag, 11);
+
+ /* Handle trap on condition and overflow. */
+ case 't':
+ flag = 0;
+ if (!strncasecmp (s, ",tc,tsv", 7) ||
+ !strncasecmp (s, ",tsv,tc", 7))
+ {
+ flag = 1;
+ s += 7;
+ }
+ else if (!strncasecmp (s, ",tc", 3))
+ {
+ flag = 0;
+ s += 3;
+ }
+ else
+ break;
+
+ INSERT_FIELD_AND_CONTINUE (opcode, flag, 11);
+
+ /* Handle 64 bit borrow for SUB. */
+ case 'B':
+ flag = 0;
+ if (!strncasecmp (s, ",db,tsv", 7) ||
+ !strncasecmp (s, ",tsv,db", 7))
+ {
+ flag = 1;
+ s += 7;
+ }
+ else if (!strncasecmp (s, ",db", 3))
+ {
+ flag = 0;
+ s += 3;
+ }
+ else
+ break;
+
+ INSERT_FIELD_AND_CONTINUE (opcode, flag, 11);
+
+ /* Handle 32 bit borrow for SUB. */
+ case 'b':
+ flag = 0;
+ if (!strncasecmp (s, ",b,tsv", 6) ||
+ !strncasecmp (s, ",tsv,b", 6))
+ {
+ flag = 1;
+ s += 6;
+ }
+ else if (!strncasecmp (s, ",b", 2))
+ {
+ flag = 0;
+ s += 2;
+ }
+ else
+ break;
+
+ INSERT_FIELD_AND_CONTINUE (opcode, flag, 11);
+
+ /* Handle trap condition completer for UADDCM. */
+ case 'T':
+ flag = 0;
+ if (!strncasecmp (s, ",tc", 3))
+ {
+ flag = 1;
+ s += 3;
+ }
+
+ INSERT_FIELD_AND_CONTINUE (opcode, flag, 6);
+
+ /* Handle signed/unsigned at 21. */
+ case 'S':
+ {
+ int sign = 1;
+ if (strncasecmp (s, ",s", 2) == 0)
+ {
+ sign = 1;
+ s += 2;
+ }
+ else if (strncasecmp (s, ",u", 2) == 0)
+ {
+ sign = 0;
+ s += 2;
+ }
+
+ INSERT_FIELD_AND_CONTINUE (opcode, sign, 10);
+ }
+
+ /* Handle left/right combination at 17:18. */
+ case 'h':
+ if (*s++ == ',')
+ {
+ int lr = 0;
+ if (*s == 'r')
+ lr = 2;
+ else if (*s == 'l')
+ lr = 0;
+ else
+ as_bad (_("Invalid left/right combination completer"));
+
+ s++;
+ INSERT_FIELD_AND_CONTINUE (opcode, lr, 13);
+ }
+ else
+ as_bad (_("Invalid left/right combination completer"));
+ break;
+
+ /* Handle saturation at 24:25. */
+ case 'H':
+ {
+ int sat = 3;
+ if (strncasecmp (s, ",ss", 3) == 0)
+ {
+ sat = 1;
+ s += 3;
+ }
+ else if (strncasecmp (s, ",us", 3) == 0)
+ {
+ sat = 0;
+ s += 3;
+ }
+
+ INSERT_FIELD_AND_CONTINUE (opcode, sat, 6);
+ }
+
+ /* Handle permutation completer. */
+ case '*':
+ if (*s++ == ',')
+ {
+ int permloc[4];
+ int perm = 0;
+ int i = 0;
+ permloc[0] = 13;
+ permloc[1] = 10;
+ permloc[2] = 8;
+ permloc[3] = 6;
+ for (; i < 4; i++)
+ {
+ switch (*s++)
+ {
+ case '0':
+ perm = 0;
+ break;
+ case '1':
+ perm = 1;
+ break;
+ case '2':
+ perm = 2;
+ break;
+ case '3':
+ perm = 3;
+ break;
+ default:
+ as_bad (_("Invalid permutation completer"));
+ }
+ opcode |= perm << permloc[i];
+ }
+ continue;
+ }
+ else
+ as_bad (_("Invalid permutation completer"));
+ break;
+
+ default:
+ abort ();
+ }
+ break;
+
+ /* Handle all conditions. */
+ case '?':
+ {
+ args++;
+ switch (*args)
+ {
+ /* Handle FP compare conditions. */
+ case 'f':
+ cond = pa_parse_fp_cmp_cond (&s);
+ INSERT_FIELD_AND_CONTINUE (opcode, cond, 0);
+
+ /* Handle an add condition. */
+ case 'A':
+ case 'a':
+ cmpltr = 0;
+ flag = 0;
+ if (*s == ',')
+ {
+ s++;
+
+ /* 64 bit conditions. */
+ if (*args == 'A')
+ {
+ if (*s == '*')
+ s++;
+ else
+ break;
+ }
+ else if (*s == '*')
+ break;
+
+ name = s;
+ while (*s != ',' && *s != ' ' && *s != '\t')
+ s += 1;
+ c = *s;
+ *s = 0x00;
+ if (strcmp (name, "=") == 0)
+ cmpltr = 1;
+ else if (strcmp (name, "<") == 0)
+ cmpltr = 2;
+ else if (strcmp (name, "<=") == 0)
+ cmpltr = 3;
+ else if (strcasecmp (name, "nuv") == 0)
+ cmpltr = 4;
+ else if (strcasecmp (name, "znv") == 0)
+ cmpltr = 5;
+ else if (strcasecmp (name, "sv") == 0)
+ cmpltr = 6;
+ else if (strcasecmp (name, "od") == 0)
+ cmpltr = 7;
+ else if (strcasecmp (name, "tr") == 0)
+ {
+ cmpltr = 0;
+ flag = 1;
+ }
+ else if (strcmp (name, "<>") == 0)
+ {
+ cmpltr = 1;
+ flag = 1;
+ }
+ else if (strcmp (name, ">=") == 0)
+ {
+ cmpltr = 2;
+ flag = 1;
+ }
+ else if (strcmp (name, ">") == 0)
+ {
+ cmpltr = 3;
+ flag = 1;
+ }
+ else if (strcasecmp (name, "uv") == 0)
+ {
+ cmpltr = 4;
+ flag = 1;
+ }
+ else if (strcasecmp (name, "vnz") == 0)
+ {
+ cmpltr = 5;
+ flag = 1;
+ }
+ else if (strcasecmp (name, "nsv") == 0)
+ {
+ cmpltr = 6;
+ flag = 1;
+ }
+ else if (strcasecmp (name, "ev") == 0)
+ {
+ cmpltr = 7;
+ flag = 1;
+ }
+ /* ",*" is a valid condition. */
+ else if (*args == 'a' || *name)
+ as_bad (_("Invalid Add Condition: %s"), name);
+ *s = c;
+ }
+ opcode |= cmpltr << 13;
+ INSERT_FIELD_AND_CONTINUE (opcode, flag, 12);
+
+ /* Handle non-negated add and branch condition. */
+ case 'd':
+ cmpltr = pa_parse_nonneg_add_cmpltr (&s);
+ if (cmpltr < 0)
+ {
+ as_bad (_("Invalid Add and Branch Condition"));
+ cmpltr = 0;
+ }
+ INSERT_FIELD_AND_CONTINUE (opcode, cmpltr, 13);
+
+ /* Handle 64 bit wide-mode add and branch condition. */
+ case 'W':
+ cmpltr = pa_parse_addb_64_cmpltr (&s);
+ if (cmpltr < 0)
+ {
+ as_bad (_("Invalid Add and Branch Condition"));
+ cmpltr = 0;
+ }
+ else
+ {
+ /* Negated condition requires an opcode change. */
+ opcode |= (cmpltr & 8) << 24;
+ }
+ INSERT_FIELD_AND_CONTINUE (opcode, cmpltr & 7, 13);
+
+ /* Handle a negated or non-negated add and branch
+ condition. */
+ case '@':
+ save_s = s;
+ cmpltr = pa_parse_nonneg_add_cmpltr (&s);
+ if (cmpltr < 0)
+ {
+ s = save_s;
+ cmpltr = pa_parse_neg_add_cmpltr (&s);
+ if (cmpltr < 0)
+ {
+ as_bad (_("Invalid Compare/Subtract Condition"));
+ cmpltr = 0;
+ }
+ else
+ {
+ /* Negated condition requires an opcode change. */
+ opcode |= 1 << 27;
+ }
+ }
+ INSERT_FIELD_AND_CONTINUE (opcode, cmpltr, 13);
+
+ /* Handle branch on bit conditions. */
+ case 'B':
+ case 'b':
+ cmpltr = 0;
+ if (*s == ',')
+ {
+ s++;
+
+ if (*args == 'B')
+ {
+ if (*s == '*')
+ s++;
+ else
+ break;
+ }
+ else if (*s == '*')
+ break;
+
+ if (strncmp (s, "<", 1) == 0)
+ {
+ cmpltr = 0;
+ s++;
+ }
+ else if (strncmp (s, ">=", 2) == 0)
+ {
+ cmpltr = 1;
+ s += 2;
+ }
+ else
+ as_bad (_("Invalid Bit Branch Condition: %c"), *s);
+ }
+ INSERT_FIELD_AND_CONTINUE (opcode, cmpltr, 15);
+
+ /* Handle a compare/subtract condition. */
+ case 'S':
+ case 's':
+ cmpltr = 0;
+ flag = 0;
+ if (*s == ',')
+ {
+ s++;
+
+ /* 64 bit conditions. */
+ if (*args == 'S')
+ {
+ if (*s == '*')
+ s++;
+ else
+ break;
+ }
+ else if (*s == '*')
+ break;
+
+ name = s;
+ while (*s != ',' && *s != ' ' && *s != '\t')
+ s += 1;
+ c = *s;
+ *s = 0x00;
+ if (strcmp (name, "=") == 0)
+ cmpltr = 1;
+ else if (strcmp (name, "<") == 0)
+ cmpltr = 2;
+ else if (strcmp (name, "<=") == 0)
+ cmpltr = 3;
+ else if (strcasecmp (name, "<<") == 0)
+ cmpltr = 4;
+ else if (strcasecmp (name, "<<=") == 0)
+ cmpltr = 5;
+ else if (strcasecmp (name, "sv") == 0)
+ cmpltr = 6;
+ else if (strcasecmp (name, "od") == 0)
+ cmpltr = 7;
+ else if (strcasecmp (name, "tr") == 0)
+ {
+ cmpltr = 0;
+ flag = 1;
+ }
+ else if (strcmp (name, "<>") == 0)
+ {
+ cmpltr = 1;
+ flag = 1;
+ }
+ else if (strcmp (name, ">=") == 0)
+ {
+ cmpltr = 2;
+ flag = 1;
+ }
+ else if (strcmp (name, ">") == 0)
+ {
+ cmpltr = 3;
+ flag = 1;
+ }
+ else if (strcasecmp (name, ">>=") == 0)
+ {
+ cmpltr = 4;
+ flag = 1;
+ }
+ else if (strcasecmp (name, ">>") == 0)
+ {
+ cmpltr = 5;
+ flag = 1;
+ }
+ else if (strcasecmp (name, "nsv") == 0)
+ {
+ cmpltr = 6;
+ flag = 1;
+ }
+ else if (strcasecmp (name, "ev") == 0)
+ {
+ cmpltr = 7;
+ flag = 1;
+ }
+ /* ",*" is a valid condition. */
+ else if (*args != 'S' || *name)
+ as_bad (_("Invalid Compare/Subtract Condition: %s"),
+ name);
+ *s = c;
+ }
+ opcode |= cmpltr << 13;
+ INSERT_FIELD_AND_CONTINUE (opcode, flag, 12);
+
+ /* Handle a non-negated compare condition. */
+ case 't':
+ cmpltr = pa_parse_nonneg_cmpsub_cmpltr (&s);
+ if (cmpltr < 0)
+ {
+ as_bad (_("Invalid Compare/Subtract Condition"));
+ cmpltr = 0;
+ }
+ INSERT_FIELD_AND_CONTINUE (opcode, cmpltr, 13);
+
+ /* Handle a 32 bit compare and branch condition. */
+ case 'n':
+ save_s = s;
+ cmpltr = pa_parse_nonneg_cmpsub_cmpltr (&s);
+ if (cmpltr < 0)
+ {
+ s = save_s;
+ cmpltr = pa_parse_neg_cmpsub_cmpltr (&s);
+ if (cmpltr < 0)
+ {
+ as_bad (_("Invalid Compare and Branch Condition"));
+ cmpltr = 0;
+ }
+ else
+ {
+ /* Negated condition requires an opcode change. */
+ opcode |= 1 << 27;
+ }
+ }
+
+ INSERT_FIELD_AND_CONTINUE (opcode, cmpltr, 13);
+
+ /* Handle a 64 bit compare and branch condition. */
+ case 'N':
+ cmpltr = pa_parse_cmpb_64_cmpltr (&s);
+ if (cmpltr >= 0)
+ {
+ /* Negated condition requires an opcode change. */
+ opcode |= (cmpltr & 8) << 26;
+ }
+ else
+ /* Not a 64 bit cond. Give 32 bit a chance. */
+ break;
+
+ INSERT_FIELD_AND_CONTINUE (opcode, cmpltr & 7, 13);
+
+ /* Handle a 64 bit cmpib condition. */
+ case 'Q':
+ cmpltr = pa_parse_cmpib_64_cmpltr (&s);
+ if (cmpltr < 0)
+ /* Not a 64 bit cond. Give 32 bit a chance. */
+ break;
+
+ INSERT_FIELD_AND_CONTINUE (opcode, cmpltr, 13);
+
+ /* Handle a logical instruction condition. */
+ case 'L':
+ case 'l':
+ cmpltr = 0;
+ flag = 0;
+ if (*s == ',')
+ {
+ s++;
+
+ /* 64 bit conditions. */
+ if (*args == 'L')
+ {
+ if (*s == '*')
+ s++;
+ else
+ break;
+ }
+ else if (*s == '*')
+ break;
+
+ name = s;
+ while (*s != ',' && *s != ' ' && *s != '\t')
+ s += 1;
+ c = *s;
+ *s = 0x00;
+
+ if (strcmp (name, "=") == 0)
+ cmpltr = 1;
+ else if (strcmp (name, "<") == 0)
+ cmpltr = 2;
+ else if (strcmp (name, "<=") == 0)
+ cmpltr = 3;
+ else if (strcasecmp (name, "od") == 0)
+ cmpltr = 7;
+ else if (strcasecmp (name, "tr") == 0)
+ {
+ cmpltr = 0;
+ flag = 1;
+ }
+ else if (strcmp (name, "<>") == 0)
+ {
+ cmpltr = 1;
+ flag = 1;
+ }
+ else if (strcmp (name, ">=") == 0)
+ {
+ cmpltr = 2;
+ flag = 1;
+ }
+ else if (strcmp (name, ">") == 0)
+ {
+ cmpltr = 3;
+ flag = 1;
+ }
+ else if (strcasecmp (name, "ev") == 0)
+ {
+ cmpltr = 7;
+ flag = 1;
+ }
+ /* ",*" is a valid condition. */
+ else if (*args != 'L' || *name)
+ as_bad (_("Invalid Logical Instruction Condition."));
+ *s = c;
+ }
+ opcode |= cmpltr << 13;
+ INSERT_FIELD_AND_CONTINUE (opcode, flag, 12);
+
+ /* Handle a shift/extract/deposit condition. */
+ case 'X':
+ case 'x':
+ case 'y':
+ cmpltr = 0;
+ if (*s == ',')
+ {
+ save_s = s++;
+
+ /* 64 bit conditions. */
+ if (*args == 'X')
+ {
+ if (*s == '*')
+ s++;
+ else
+ break;
+ }
+ else if (*s == '*')
+ break;
+
+ name = s;
+ while (*s != ',' && *s != ' ' && *s != '\t')
+ s += 1;
+ c = *s;
+ *s = 0x00;
+ if (strcmp (name, "=") == 0)
+ cmpltr = 1;
+ else if (strcmp (name, "<") == 0)
+ cmpltr = 2;
+ else if (strcasecmp (name, "od") == 0)
+ cmpltr = 3;
+ else if (strcasecmp (name, "tr") == 0)
+ cmpltr = 4;
+ else if (strcmp (name, "<>") == 0)
+ cmpltr = 5;
+ else if (strcmp (name, ">=") == 0)
+ cmpltr = 6;
+ else if (strcasecmp (name, "ev") == 0)
+ cmpltr = 7;
+ /* Handle movb,n. Put things back the way they were.
+ This includes moving s back to where it started. */
+ else if (strcasecmp (name, "n") == 0 && *args == 'y')
+ {
+ *s = c;
+ s = save_s;
+ continue;
+ }
+ /* ",*" is a valid condition. */
+ else if (*args != 'X' || *name)
+ as_bad (_("Invalid Shift/Extract/Deposit Condition."));
+ *s = c;
+ }
+ INSERT_FIELD_AND_CONTINUE (opcode, cmpltr, 13);
+
+ /* Handle a unit instruction condition. */
+ case 'U':
+ case 'u':
+ cmpltr = 0;
+ flag = 0;
+ if (*s == ',')
+ {
+ s++;
+
+ /* 64 bit conditions. */
+ if (*args == 'U')
+ {
+ if (*s == '*')
+ s++;
+ else
+ break;
+ }
+ else if (*s == '*')
+ break;
+
+ if (strncasecmp (s, "sbz", 3) == 0)
+ {
+ cmpltr = 2;
+ s += 3;
+ }
+ else if (strncasecmp (s, "shz", 3) == 0)
+ {
+ cmpltr = 3;
+ s += 3;
+ }
+ else if (strncasecmp (s, "sdc", 3) == 0)
+ {
+ cmpltr = 4;
+ s += 3;
+ }
+ else if (strncasecmp (s, "sbc", 3) == 0)
+ {
+ cmpltr = 6;
+ s += 3;
+ }
+ else if (strncasecmp (s, "shc", 3) == 0)
+ {
+ cmpltr = 7;
+ s += 3;
+ }
+ else if (strncasecmp (s, "tr", 2) == 0)
+ {
+ cmpltr = 0;
+ flag = 1;
+ s += 2;
+ }
+ else if (strncasecmp (s, "nbz", 3) == 0)
+ {
+ cmpltr = 2;
+ flag = 1;
+ s += 3;
+ }
+ else if (strncasecmp (s, "nhz", 3) == 0)
+ {
+ cmpltr = 3;
+ flag = 1;
+ s += 3;
+ }
+ else if (strncasecmp (s, "ndc", 3) == 0)
+ {
+ cmpltr = 4;
+ flag = 1;
+ s += 3;
+ }
+ else if (strncasecmp (s, "nbc", 3) == 0)
+ {
+ cmpltr = 6;
+ flag = 1;
+ s += 3;
+ }
+ else if (strncasecmp (s, "nhc", 3) == 0)
+ {
+ cmpltr = 7;
+ flag = 1;
+ s += 3;
+ }
+ else if (strncasecmp (s, "swz", 3) == 0)
+ {
+ cmpltr = 1;
+ flag = 0;
+ s += 3;
+ }
+ else if (strncasecmp (s, "swc", 3) == 0)
+ {
+ cmpltr = 5;
+ flag = 0;
+ s += 3;
+ }
+ else if (strncasecmp (s, "nwz", 3) == 0)
+ {
+ cmpltr = 1;
+ flag = 1;
+ s += 3;
+ }
+ else if (strncasecmp (s, "nwc", 3) == 0)
+ {
+ cmpltr = 5;
+ flag = 1;
+ s += 3;
+ }
+ /* ",*" is a valid condition. */
+ else if (*args != 'U' || (*s != ' ' && *s != '\t'))
+ as_bad (_("Invalid Unit Instruction Condition."));
+ }
+ opcode |= cmpltr << 13;
+ INSERT_FIELD_AND_CONTINUE (opcode, flag, 12);
+
+ default:
+ abort ();
+ }
+ break;
+ }
+
+ /* Handle a nullification completer for branch instructions. */
+ case 'n':
+ nullif = pa_parse_nullif (&s);
+ INSERT_FIELD_AND_CONTINUE (opcode, nullif, 1);
+
+ /* Handle a nullification completer for copr and spop insns. */
+ case 'N':
+ nullif = pa_parse_nullif (&s);
+ INSERT_FIELD_AND_CONTINUE (opcode, nullif, 5);
+
+ /* Handle ,%r2 completer for new syntax branches. */
+ case 'L':
+ if (*s == ',' && strncasecmp (s + 1, "%r2", 3) == 0)
+ s += 4;
+ else if (*s == ',' && strncasecmp (s + 1, "%rp", 3) == 0)
+ s += 4;
+ else
+ break;
+ continue;
+
+ /* Handle 3 bit entry into the fp compare array. Valid values
+ are 0..6 inclusive. */
+ case 'h':
+ get_expression (s);
+ s = expr_end;
+ if (the_insn.exp.X_op == O_constant)
+ {
+ num = evaluate_absolute (&the_insn);
+ CHECK_FIELD (num, 6, 0, 0);
+ num++;
+ INSERT_FIELD_AND_CONTINUE (opcode, num, 13);
+ }
+ else
+ break;
+
+ /* Handle 3 bit entry into the fp compare array. Valid values
+ are 0..6 inclusive. */
+ case 'm':
+ get_expression (s);
+ if (the_insn.exp.X_op == O_constant)
+ {
+ s = expr_end;
+ num = evaluate_absolute (&the_insn);
+ CHECK_FIELD (num, 6, 0, 0);
+ num = (num + 1) ^ 1;
+ INSERT_FIELD_AND_CONTINUE (opcode, num, 13);
+ }
+ else
+ break;
+
+ /* Handle graphics test completers for ftest */
+ case '=':
+ {
+ num = pa_parse_ftest_gfx_completer (&s);
+ INSERT_FIELD_AND_CONTINUE (opcode, num, 0);
+ }
+
+ /* Handle a 11 bit immediate at 31. */
+ case 'i':
+ the_insn.field_selector = pa_chk_field_selector (&s);
+ get_expression (s);
+ s = expr_end;
+ if (the_insn.exp.X_op == O_constant)
+ {
+ num = evaluate_absolute (&the_insn);
+ CHECK_FIELD (num, 1023, -1024, 0);
+ num = low_sign_unext (num, 11);
+ INSERT_FIELD_AND_CONTINUE (opcode, num, 0);
+ }
+ else
+ {
+ if (is_DP_relative (the_insn.exp))
+ the_insn.reloc = R_HPPA_GOTOFF;
+ else if (is_PC_relative (the_insn.exp))
+ the_insn.reloc = R_HPPA_PCREL_CALL;
+#ifdef OBJ_ELF
+ else if (is_tls_gdidx (the_insn.exp))
+ the_insn.reloc = R_PARISC_TLS_GD21L;
+ else if (is_tls_ldidx (the_insn.exp))
+ the_insn.reloc = R_PARISC_TLS_LDM21L;
+ else if (is_tls_dtpoff (the_insn.exp))
+ the_insn.reloc = R_PARISC_TLS_LDO21L;
+ else if (is_tls_ieoff (the_insn.exp))
+ the_insn.reloc = R_PARISC_TLS_IE21L;
+ else if (is_tls_leoff (the_insn.exp))
+ the_insn.reloc = R_PARISC_TLS_LE21L;
+#endif
+ else
+ the_insn.reloc = R_HPPA;
+ the_insn.format = 11;
+ continue;
+ }
+
+ /* Handle a 14 bit immediate at 31. */
+ case 'J':
+ the_insn.field_selector = pa_chk_field_selector (&s);
+ get_expression (s);
+ s = expr_end;
+ if (the_insn.exp.X_op == O_constant)
+ {
+ int mb;
+
+ /* XXX the completer stored away tidbits of information
+ for us to extract. We need a cleaner way to do this.
+ Now that we have lots of letters again, it would be
+ good to rethink this. */
+ mb = opcode & 1;
+ opcode -= mb;
+ num = evaluate_absolute (&the_insn);
+ if (mb != (num < 0))
+ break;
+ CHECK_FIELD (num, 8191, -8192, 0);
+ num = low_sign_unext (num, 14);
+ INSERT_FIELD_AND_CONTINUE (opcode, num, 0);
+ }
+ break;
+
+ /* Handle a 14 bit immediate at 31. */
+ case 'K':
+ the_insn.field_selector = pa_chk_field_selector (&s);
+ get_expression (s);
+ s = expr_end;
+ if (the_insn.exp.X_op == O_constant)
+ {
+ int mb;
+
+ mb = opcode & 1;
+ opcode -= mb;
+ num = evaluate_absolute (&the_insn);
+ if (mb == (num < 0))
+ break;
+ if (num % 4)
+ break;
+ CHECK_FIELD (num, 8191, -8192, 0);
+ num = low_sign_unext (num, 14);
+ INSERT_FIELD_AND_CONTINUE (opcode, num, 0);
+ }
+ break;
+
+ /* Handle a 16 bit immediate at 31. */
+ case '<':
+ the_insn.field_selector = pa_chk_field_selector (&s);
+ get_expression (s);
+ s = expr_end;
+ if (the_insn.exp.X_op == O_constant)
+ {
+ int mb;
+
+ mb = opcode & 1;
+ opcode -= mb;
+ num = evaluate_absolute (&the_insn);
+ if (mb != (num < 0))
+ break;
+ CHECK_FIELD (num, 32767, -32768, 0);
+ num = re_assemble_16 (num);
+ INSERT_FIELD_AND_CONTINUE (opcode, num, 0);
+ }
+ break;
+
+ /* Handle a 16 bit immediate at 31. */
+ case '>':
+ the_insn.field_selector = pa_chk_field_selector (&s);
+ get_expression (s);
+ s = expr_end;
+ if (the_insn.exp.X_op == O_constant)
+ {
+ int mb;
+
+ mb = opcode & 1;
+ opcode -= mb;
+ num = evaluate_absolute (&the_insn);
+ if (mb == (num < 0))
+ break;
+ if (num % 4)
+ break;
+ CHECK_FIELD (num, 32767, -32768, 0);
+ num = re_assemble_16 (num);
+ INSERT_FIELD_AND_CONTINUE (opcode, num, 0);
+ }
+ break;
+
+ /* Handle 14 bit immediate, shifted left three times. */
+ case '#':
+ if (bfd_get_mach (stdoutput) != pa20)
+ break;
+ the_insn.field_selector = pa_chk_field_selector (&s);
+ get_expression (s);
+ s = expr_end;
+ if (the_insn.exp.X_op == O_constant)
+ {
+ num = evaluate_absolute (&the_insn);
+ if (num & 0x7)
+ break;
+ CHECK_FIELD (num, 8191, -8192, 0);
+ if (num < 0)
+ opcode |= 1;
+ num &= 0x1fff;
+ num >>= 3;
+ INSERT_FIELD_AND_CONTINUE (opcode, num, 4);
+ }
+ else
+ {
+ if (is_DP_relative (the_insn.exp))
+ the_insn.reloc = R_HPPA_GOTOFF;
+ else if (is_PC_relative (the_insn.exp))
+ the_insn.reloc = R_HPPA_PCREL_CALL;
+#ifdef OBJ_ELF
+ else if (is_tls_gdidx (the_insn.exp))
+ the_insn.reloc = R_PARISC_TLS_GD21L;
+ else if (is_tls_ldidx (the_insn.exp))
+ the_insn.reloc = R_PARISC_TLS_LDM21L;
+ else if (is_tls_dtpoff (the_insn.exp))
+ the_insn.reloc = R_PARISC_TLS_LDO21L;
+ else if (is_tls_ieoff (the_insn.exp))
+ the_insn.reloc = R_PARISC_TLS_IE21L;
+ else if (is_tls_leoff (the_insn.exp))
+ the_insn.reloc = R_PARISC_TLS_LE21L;
+#endif
+ else
+ the_insn.reloc = R_HPPA;
+ the_insn.format = 14;
+ continue;
+ }
+ break;
+
+ /* Handle 14 bit immediate, shifted left twice. */
+ case 'd':
+ the_insn.field_selector = pa_chk_field_selector (&s);
+ get_expression (s);
+ s = expr_end;
+ if (the_insn.exp.X_op == O_constant)
+ {
+ num = evaluate_absolute (&the_insn);
+ if (num & 0x3)
+ break;
+ CHECK_FIELD (num, 8191, -8192, 0);
+ if (num < 0)
+ opcode |= 1;
+ num &= 0x1fff;
+ num >>= 2;
+ INSERT_FIELD_AND_CONTINUE (opcode, num, 3);
+ }
+ else
+ {
+ if (is_DP_relative (the_insn.exp))
+ the_insn.reloc = R_HPPA_GOTOFF;
+ else if (is_PC_relative (the_insn.exp))
+ the_insn.reloc = R_HPPA_PCREL_CALL;
+#ifdef OBJ_ELF
+ else if (is_tls_gdidx (the_insn.exp))
+ the_insn.reloc = R_PARISC_TLS_GD21L;
+ else if (is_tls_ldidx (the_insn.exp))
+ the_insn.reloc = R_PARISC_TLS_LDM21L;
+ else if (is_tls_dtpoff (the_insn.exp))
+ the_insn.reloc = R_PARISC_TLS_LDO21L;
+ else if (is_tls_ieoff (the_insn.exp))
+ the_insn.reloc = R_PARISC_TLS_IE21L;
+ else if (is_tls_leoff (the_insn.exp))
+ the_insn.reloc = R_PARISC_TLS_LE21L;
+#endif
+ else
+ the_insn.reloc = R_HPPA;
+ the_insn.format = 14;
+ continue;
+ }
+
+ /* Handle a 14 bit immediate at 31. */
+ case 'j':
+ the_insn.field_selector = pa_chk_field_selector (&s);
+ get_expression (s);
+ s = expr_end;
+ if (the_insn.exp.X_op == O_constant)
+ {
+ num = evaluate_absolute (&the_insn);
+ CHECK_FIELD (num, 8191, -8192, 0);
+ num = low_sign_unext (num, 14);
+ INSERT_FIELD_AND_CONTINUE (opcode, num, 0);
+ }
+ else
+ {
+ if (is_DP_relative (the_insn.exp))
+ the_insn.reloc = R_HPPA_GOTOFF;
+ else if (is_PC_relative (the_insn.exp))
+ the_insn.reloc = R_HPPA_PCREL_CALL;
+#ifdef OBJ_ELF
+ else if (is_tls_gdidx (the_insn.exp))
+ the_insn.reloc = R_PARISC_TLS_GD21L;
+ else if (is_tls_ldidx (the_insn.exp))
+ the_insn.reloc = R_PARISC_TLS_LDM21L;
+ else if (is_tls_dtpoff (the_insn.exp))
+ the_insn.reloc = R_PARISC_TLS_LDO21L;
+ else if (is_tls_ieoff (the_insn.exp))
+ the_insn.reloc = R_PARISC_TLS_IE21L;
+ else if (is_tls_leoff (the_insn.exp))
+ the_insn.reloc = R_PARISC_TLS_LE21L;
+#endif
+ else
+ the_insn.reloc = R_HPPA;
+ the_insn.format = 14;
+ continue;
+ }
+
+ /* Handle a 21 bit immediate at 31. */
+ case 'k':
+ the_insn.field_selector = pa_chk_field_selector (&s);
+ get_expression (s);
+ s = expr_end;
+ if (the_insn.exp.X_op == O_constant)
+ {
+ num = evaluate_absolute (&the_insn);
+ CHECK_FIELD (num >> 11, 1048575, -1048576, 0);
+ opcode |= re_assemble_21 (num);
+ continue;
+ }
+ else
+ {
+ if (is_DP_relative (the_insn.exp))
+ the_insn.reloc = R_HPPA_GOTOFF;
+ else if (is_PC_relative (the_insn.exp))
+ the_insn.reloc = R_HPPA_PCREL_CALL;
+#ifdef OBJ_ELF
+ else if (is_tls_gdidx (the_insn.exp))
+ the_insn.reloc = R_PARISC_TLS_GD21L;
+ else if (is_tls_ldidx (the_insn.exp))
+ the_insn.reloc = R_PARISC_TLS_LDM21L;
+ else if (is_tls_dtpoff (the_insn.exp))
+ the_insn.reloc = R_PARISC_TLS_LDO21L;
+ else if (is_tls_ieoff (the_insn.exp))
+ the_insn.reloc = R_PARISC_TLS_IE21L;
+ else if (is_tls_leoff (the_insn.exp))
+ the_insn.reloc = R_PARISC_TLS_LE21L;
+#endif
+ else
+ the_insn.reloc = R_HPPA;
+ the_insn.format = 21;
+ continue;
+ }
+
+ /* Handle a 16 bit immediate at 31 (PA 2.0 wide mode only). */
+ case 'l':
+ the_insn.field_selector = pa_chk_field_selector (&s);
+ get_expression (s);
+ s = expr_end;
+ if (the_insn.exp.X_op == O_constant)
+ {
+ num = evaluate_absolute (&the_insn);
+ CHECK_FIELD (num, 32767, -32768, 0);
+ opcode |= re_assemble_16 (num);
+ continue;
+ }
+ else
+ {
+ /* ??? Is this valid for wide mode? */
+ if (is_DP_relative (the_insn.exp))
+ the_insn.reloc = R_HPPA_GOTOFF;
+ else if (is_PC_relative (the_insn.exp))
+ the_insn.reloc = R_HPPA_PCREL_CALL;
+#ifdef OBJ_ELF
+ else if (is_tls_gdidx (the_insn.exp))
+ the_insn.reloc = R_PARISC_TLS_GD21L;
+ else if (is_tls_ldidx (the_insn.exp))
+ the_insn.reloc = R_PARISC_TLS_LDM21L;
+ else if (is_tls_dtpoff (the_insn.exp))
+ the_insn.reloc = R_PARISC_TLS_LDO21L;
+ else if (is_tls_ieoff (the_insn.exp))
+ the_insn.reloc = R_PARISC_TLS_IE21L;
+ else if (is_tls_leoff (the_insn.exp))
+ the_insn.reloc = R_PARISC_TLS_LE21L;
+#endif
+ else
+ the_insn.reloc = R_HPPA;
+ the_insn.format = 14;
+ continue;
+ }
+
+ /* Handle a word-aligned 16-bit imm. at 31 (PA2.0 wide). */
+ case 'y':
+ the_insn.field_selector = pa_chk_field_selector (&s);
+ get_expression (s);
+ s = expr_end;
+ if (the_insn.exp.X_op == O_constant)
+ {
+ num = evaluate_absolute (&the_insn);
+ CHECK_FIELD (num, 32767, -32768, 0);
+ CHECK_ALIGN (num, 4, 0);
+ opcode |= re_assemble_16 (num);
+ continue;
+ }
+ else
+ {
+ /* ??? Is this valid for wide mode? */
+ if (is_DP_relative (the_insn.exp))
+ the_insn.reloc = R_HPPA_GOTOFF;
+ else if (is_PC_relative (the_insn.exp))
+ the_insn.reloc = R_HPPA_PCREL_CALL;
+#ifdef OBJ_ELF
+ else if (is_tls_gdidx (the_insn.exp))
+ the_insn.reloc = R_PARISC_TLS_GD21L;
+ else if (is_tls_ldidx (the_insn.exp))
+ the_insn.reloc = R_PARISC_TLS_LDM21L;
+ else if (is_tls_dtpoff (the_insn.exp))
+ the_insn.reloc = R_PARISC_TLS_LDO21L;
+ else if (is_tls_ieoff (the_insn.exp))
+ the_insn.reloc = R_PARISC_TLS_IE21L;
+ else if (is_tls_leoff (the_insn.exp))
+ the_insn.reloc = R_PARISC_TLS_LE21L;
+#endif
+ else
+ the_insn.reloc = R_HPPA;
+ the_insn.format = 14;
+ continue;
+ }
+
+ /* Handle a dword-aligned 16-bit imm. at 31 (PA2.0 wide). */
+ case '&':
+ the_insn.field_selector = pa_chk_field_selector (&s);
+ get_expression (s);
+ s = expr_end;
+ if (the_insn.exp.X_op == O_constant)
+ {
+ num = evaluate_absolute (&the_insn);
+ CHECK_FIELD (num, 32767, -32768, 0);
+ CHECK_ALIGN (num, 8, 0);
+ opcode |= re_assemble_16 (num);
+ continue;
+ }
+ else
+ {
+ /* ??? Is this valid for wide mode? */
+ if (is_DP_relative (the_insn.exp))
+ the_insn.reloc = R_HPPA_GOTOFF;
+ else if (is_PC_relative (the_insn.exp))
+ the_insn.reloc = R_HPPA_PCREL_CALL;
+#ifdef OBJ_ELF
+ else if (is_tls_gdidx (the_insn.exp))
+ the_insn.reloc = R_PARISC_TLS_GD21L;
+ else if (is_tls_ldidx (the_insn.exp))
+ the_insn.reloc = R_PARISC_TLS_LDM21L;
+ else if (is_tls_dtpoff (the_insn.exp))
+ the_insn.reloc = R_PARISC_TLS_LDO21L;
+ else if (is_tls_ieoff (the_insn.exp))
+ the_insn.reloc = R_PARISC_TLS_IE21L;
+ else if (is_tls_leoff (the_insn.exp))
+ the_insn.reloc = R_PARISC_TLS_LE21L;
+#endif
+ else
+ the_insn.reloc = R_HPPA;
+ the_insn.format = 14;
+ continue;
+ }
+
+ /* Handle a 12 bit branch displacement. */
+ case 'w':
+ the_insn.field_selector = pa_chk_field_selector (&s);
+ get_expression (s);
+ s = expr_end;
+ the_insn.pcrel = 1;
+ if (!the_insn.exp.X_add_symbol
+ || !strcmp (S_GET_NAME (the_insn.exp.X_add_symbol),
+ FAKE_LABEL_NAME))
+ {
+ num = evaluate_absolute (&the_insn);
+ if (num % 4)
+ {
+ as_bad (_("Branch to unaligned address"));
+ break;
+ }
+ if (the_insn.exp.X_add_symbol)
+ num -= 8;
+ CHECK_FIELD (num, 8191, -8192, 0);
+ opcode |= re_assemble_12 (num >> 2);
+ continue;
+ }
+ else
+ {
+ the_insn.reloc = R_HPPA_PCREL_CALL;
+ the_insn.format = 12;
+ the_insn.arg_reloc = last_call_desc.arg_reloc;
+ memset (&last_call_desc, 0, sizeof (struct call_desc));
+ s = expr_end;
+ continue;
+ }
+
+ /* Handle a 17 bit branch displacement. */
+ case 'W':
+ the_insn.field_selector = pa_chk_field_selector (&s);
+ get_expression (s);
+ s = expr_end;
+ the_insn.pcrel = 1;
+ if (!the_insn.exp.X_add_symbol
+ || !strcmp (S_GET_NAME (the_insn.exp.X_add_symbol),
+ FAKE_LABEL_NAME))
+ {
+ num = evaluate_absolute (&the_insn);
+ if (num % 4)
+ {
+ as_bad (_("Branch to unaligned address"));
+ break;
+ }
+ if (the_insn.exp.X_add_symbol)
+ num -= 8;
+ CHECK_FIELD (num, 262143, -262144, 0);
+ opcode |= re_assemble_17 (num >> 2);
+ continue;
+ }
+ else
+ {
+ the_insn.reloc = R_HPPA_PCREL_CALL;
+ the_insn.format = 17;
+ the_insn.arg_reloc = last_call_desc.arg_reloc;
+ memset (&last_call_desc, 0, sizeof (struct call_desc));
+ continue;
+ }
+
+ /* Handle a 22 bit branch displacement. */
+ case 'X':
+ the_insn.field_selector = pa_chk_field_selector (&s);
+ get_expression (s);
+ s = expr_end;
+ the_insn.pcrel = 1;
+ if (!the_insn.exp.X_add_symbol
+ || !strcmp (S_GET_NAME (the_insn.exp.X_add_symbol),
+ FAKE_LABEL_NAME))
+ {
+ num = evaluate_absolute (&the_insn);
+ if (num % 4)
+ {
+ as_bad (_("Branch to unaligned address"));
+ break;
+ }
+ if (the_insn.exp.X_add_symbol)
+ num -= 8;
+ CHECK_FIELD (num, 8388607, -8388608, 0);
+ opcode |= re_assemble_22 (num >> 2);
+ }
+ else
+ {
+ the_insn.reloc = R_HPPA_PCREL_CALL;
+ the_insn.format = 22;
+ the_insn.arg_reloc = last_call_desc.arg_reloc;
+ memset (&last_call_desc, 0, sizeof (struct call_desc));
+ continue;
+ }
+
+ /* Handle an absolute 17 bit branch target. */
+ case 'z':
+ the_insn.field_selector = pa_chk_field_selector (&s);
+ get_expression (s);
+ s = expr_end;
+ the_insn.pcrel = 0;
+ if (!the_insn.exp.X_add_symbol
+ || !strcmp (S_GET_NAME (the_insn.exp.X_add_symbol),
+ FAKE_LABEL_NAME))
+ {
+ num = evaluate_absolute (&the_insn);
+ if (num % 4)
+ {
+ as_bad (_("Branch to unaligned address"));
+ break;
+ }
+ if (the_insn.exp.X_add_symbol)
+ num -= 8;
+ CHECK_FIELD (num, 262143, -262144, 0);
+ opcode |= re_assemble_17 (num >> 2);
+ continue;
+ }
+ else
+ {
+ the_insn.reloc = R_HPPA_ABS_CALL;
+ the_insn.format = 17;
+ the_insn.arg_reloc = last_call_desc.arg_reloc;
+ memset (&last_call_desc, 0, sizeof (struct call_desc));
+ continue;
+ }
+
+ /* Handle '%r1' implicit operand of addil instruction. */
+ case 'Z':
+ if (*s == ',' && *(s + 1) == '%' && *(s + 3) == '1'
+ && (*(s + 2) == 'r' || *(s + 2) == 'R'))
+ {
+ s += 4;
+ continue;
+ }
+ else
+ break;
+
+ /* Handle '%sr0,%r31' implicit operand of be,l instruction. */
+ case 'Y':
+ if (strncasecmp (s, "%sr0,%r31", 9) != 0)
+ break;
+ s += 9;
+ continue;
+
+ /* Handle immediate value of 0 for ordered load/store instructions. */
+ case '@':
+ if (*s != '0')
+ break;
+ s++;
+ continue;
+
+ /* Handle a 2 bit shift count at 25. */
+ case '.':
+ num = pa_get_absolute_expression (&the_insn, &s);
+ if (strict && the_insn.exp.X_op != O_constant)
+ break;
+ s = expr_end;
+ CHECK_FIELD (num, 3, 1, strict);
+ INSERT_FIELD_AND_CONTINUE (opcode, num, 6);
+
+ /* Handle a 4 bit shift count at 25. */
+ case '*':
+ num = pa_get_absolute_expression (&the_insn, &s);
+ if (strict && the_insn.exp.X_op != O_constant)
+ break;
+ s = expr_end;
+ CHECK_FIELD (num, 15, 0, strict);
+ INSERT_FIELD_AND_CONTINUE (opcode, num, 6);
+
+ /* Handle a 5 bit shift count at 26. */
+ case 'p':
+ num = pa_get_absolute_expression (&the_insn, &s);
+ if (strict && the_insn.exp.X_op != O_constant)
+ break;
+ s = expr_end;
+ CHECK_FIELD (num, 31, 0, strict);
+ INSERT_FIELD_AND_CONTINUE (opcode, 31 - num, 5);
+
+ /* Handle a 6 bit shift count at 20,22:26. */
+ case '~':
+ num = pa_get_absolute_expression (&the_insn, &s);
+ if (strict && the_insn.exp.X_op != O_constant)
+ break;
+ s = expr_end;
+ CHECK_FIELD (num, 63, 0, strict);
+ num = 63 - num;
+ opcode |= (num & 0x20) << 6;
+ INSERT_FIELD_AND_CONTINUE (opcode, num & 0x1f, 5);