From 3c853d931322f71b01a217f05bb8302f32a263d2 Mon Sep 17 00:00:00 2001 From: Dave Anglin Date: Fri, 31 Dec 2010 16:43:46 +0000 Subject: PR gas/11395 * config/tc-hppa.c (pa_ip): Revert last change. Add variable need_cond to determine whether a 64-bit condition is needed for 'A' and 'S' conditions. Default to 32-bit never condition for logical and unit instructions. Add error message for missing branch on bit condition. * hppa.h (pa_opcodes): Revert last change. Exchange 32 and 64-bit "bb" entries. * hppa-dis.c (compare_cond_64_names): Change never condition to ",*". (add_cond_64_names): Likewise. (logical_cond_64_names): Likewise. (unit_cond_64_names): Likewise. --- gas/config/tc-hppa.c | 53 +++++++++++++++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 23 deletions(-) (limited to 'gas/config/tc-hppa.c') diff --git a/gas/config/tc-hppa.c b/gas/config/tc-hppa.c index b2c5076..e688f71 100644 --- a/gas/config/tc-hppa.c +++ b/gas/config/tc-hppa.c @@ -3204,7 +3204,7 @@ pa_ip (char *str) const char *args; int match = FALSE; int comma = 0; - int cmpltr, nullif, flag, cond, num; + int cmpltr, nullif, flag, cond, need_cond, num; int immediate_check = 0, pos = -1, len = -1; unsigned long opcode; struct pa_opcode *insn; @@ -3264,6 +3264,7 @@ pa_ip (char *str) opcode = insn->match; strict = (insn->flags & FLAG_STRICT); memset (&the_insn, 0, sizeof (the_insn)); + need_cond = 1; the_insn.reloc = R_HPPA_NONE; @@ -3758,8 +3759,8 @@ pa_ip (char *str) else break; - /* Set doubleword carry bit. */ - opcode |= 0x20; + /* Condition is not required with "dc". */ + need_cond = 0; INSERT_FIELD_AND_CONTINUE (opcode, flag, 11); /* Handle 32 bit carry for ADD. */ @@ -3828,8 +3829,8 @@ pa_ip (char *str) else break; - /* Set doubleword borrow bit. */ - opcode |= 0x20; + /* Condition is not required with "db". */ + need_cond = 0; INSERT_FIELD_AND_CONTINUE (opcode, flag, 11); /* Handle 32 bit borrow for SUB. */ @@ -3973,14 +3974,6 @@ pa_ip (char *str) /* Handle an add condition. */ case 'A': - /* PR gas/11395 - If we don't have a ",*" condition or "dc" completer, - then we have a doubleword carry match failure. */ - if (*s != ',' && !(opcode & 0x20)) - break; - opcode |= 0x20; - /* Fall through. */ - case 'a': cmpltr = 0; flag = 0; @@ -4063,6 +4056,11 @@ pa_ip (char *str) as_bad (_("Invalid Add Condition: %s"), name); *s = c; } + /* Except with "dc", we have a match failure with + 'A' if we don't have a doubleword condition. */ + else if (*args == 'A' && need_cond) + break; + opcode |= cmpltr << 13; INSERT_FIELD_AND_CONTINUE (opcode, flag, 12); @@ -4142,20 +4140,15 @@ pa_ip (char *str) s += 2; } else - as_bad (_("Invalid Bit Branch Condition: %c"), *s); + as_bad (_("Invalid Branch On Bit Condition: %c"), *s); } + else + as_bad (_("Missing Branch On Bit Condition")); + INSERT_FIELD_AND_CONTINUE (opcode, cmpltr, 15); /* Handle a compare/subtract condition. */ case 'S': - /* PR gas/11395 - If we don't have a ",*" condition or "dc" completer, - then we have a doubleword carry match failure. */ - if (*s != ',' && !(opcode & 0x20)) - break; - opcode |= 0x20; - /* Fall through. */ - case 's': cmpltr = 0; flag = 0; @@ -4239,6 +4232,11 @@ pa_ip (char *str) name); *s = c; } + /* Except with "db", we have a match failure with + 'S' if we don't have a doubleword condition. */ + else if (*args == 'S' && need_cond) + break; + opcode |= cmpltr << 13; INSERT_FIELD_AND_CONTINUE (opcode, flag, 12); @@ -4297,7 +4295,7 @@ pa_ip (char *str) INSERT_FIELD_AND_CONTINUE (opcode, cmpltr, 13); - /* Handle a logical instruction condition. */ + /* Handle a logical instruction condition. */ case 'L': case 'l': cmpltr = 0; @@ -4361,6 +4359,10 @@ pa_ip (char *str) as_bad (_("Invalid Logical Instruction Condition.")); *s = c; } + /* 32-bit is default for no condition. */ + else if (*args == 'L') + break; + opcode |= cmpltr << 13; INSERT_FIELD_AND_CONTINUE (opcode, flag, 12); @@ -4419,6 +4421,7 @@ pa_ip (char *str) as_bad (_("Invalid Shift/Extract/Deposit Condition.")); *s = c; } + INSERT_FIELD_AND_CONTINUE (opcode, cmpltr, 13); /* Handle a unit instruction condition. */ @@ -4530,6 +4533,10 @@ pa_ip (char *str) else if (*args != 'U' || (*s != ' ' && *s != '\t')) as_bad (_("Invalid Unit Instruction Condition.")); } + /* 32-bit is default for no condition. */ + else if (*args == 'U') + break; + opcode |= cmpltr << 13; INSERT_FIELD_AND_CONTINUE (opcode, flag, 12); -- cgit v1.1