From d31a3f5e7603380ee267051c89d5ef69aff00ddb Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Mon, 9 Sep 1996 18:37:10 +0000 Subject: [PATCH] * config/tc-mips.c (append_insn): Don't swap an instruction which sets a condition code with an instruction which uses a condition code. (mips_ip): In cases 'N' and 'M', look for $fccN rather than an immediate value. --- gas/ChangeLog | 6 ++++++ gas/config/tc-mips.c | 31 ++++++++++++++++++++----------- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 7c6858c2e43..2084da53bff 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,5 +1,11 @@ Mon Sep 9 10:57:42 1996 Ian Lance Taylor + * config/tc-mips.c (append_insn): Don't swap an instruction which + sets a condition code with an instruction which uses a condition + code. + (mips_ip): In cases 'N' and 'M', look for $fccN rather than an + immediate value. + * config/tc-mips.c (md_begin): Recognize r5000 for cpu. If mips_cpu is 5000, set interlocks and cop_interlocks. (mips_ip): Give a better error message if the ISA level is wrong. diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index 6d6d4081991..4185adb315e 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -1417,7 +1417,13 @@ append_insn (place, ip, address_expr, reloc_type, unmatched_hi) && insn_uses_reg (ip, ((prev_prev_insn.insn_opcode >> OP_SH_RT) & OP_MASK_RT), - 0))) + 0)) + /* If one instruction sets a condition code and the + other one uses a condition code, we can not swap. */ + || ((pinfo & INSN_READ_COND_CODE) + && (prev_pinfo & INSN_WRITE_COND_CODE)) + || ((pinfo & INSN_WRITE_COND_CODE) + && (prev_pinfo & INSN_READ_COND_CODE))) { /* We could do even better for unconditional branches to portions of this object file; we could pick up the @@ -5891,20 +5897,23 @@ mips_ip (str, ip) case 'N': /* 3 bit branch condition code */ case 'M': /* 3 bit compare condition code */ - my_getExpression (&imm_expr, s); - check_absolute_expr (ip, &imm_expr); - if ((unsigned long) imm_expr.X_add_number > 7) + if (strncmp (s, "$fcc", 4) != 0) + break; + s += 4; + regno = 0; + do { - as_warn ("Condition code > 7 (%ld)", - (long) imm_expr.X_add_number); - imm_expr.X_add_number &= 7; + regno *= 10; + regno += *s - '0'; + ++s; } + while (isdigit (*s)); + if (regno > 7) + as_bad ("invalid condition code register $fcc%d", regno); if (*args == 'N') - ip->insn_opcode |= imm_expr.X_add_number << OP_SH_BCC; + ip->insn_opcode |= regno << OP_SH_BCC; else - ip->insn_opcode |= imm_expr.X_add_number << OP_SH_CCC; - imm_expr.X_op = O_absent; - s = expr_end; + ip->insn_opcode |= regno << OP_SH_CCC; continue; default: -- 2.30.2