diff options
author | David Ung <davidu@mips.com> | 2005-10-19 18:47:09 +0000 |
---|---|---|
committer | David Ung <davidu@mips.com> | 2005-10-19 18:47:09 +0000 |
commit | 290248614c6058e929e4403124d2cc106d130c83 (patch) | |
tree | 7434850e60493dc216ecd6fceb9e3a1a58ee3cd1 /gas/config/tc-mips.c | |
parent | 33c5e3a91d4d2265fc4c8a44210952616680b10b (diff) | |
download | gdb-290248614c6058e929e4403124d2cc106d130c83.zip gdb-290248614c6058e929e4403124d2cc106d130c83.tar.gz gdb-290248614c6058e929e4403124d2cc106d130c83.tar.bz2 |
* config/tc-mips.c (append_insn): Convert MIPS16 jr/jalr jumps
into jrc/jalrc versions if ISA_MIPS32+ and not doing the swap,
hence avoiding to emit a nop.
* gas/mips/mips.exp: Run new test.
* gas/testsuite/gas/mips/mips16e-jrc.s: New test for converting
jalr/jr to the compact jalrc/jrc instructions.
* gas/testsuite/gas/mips/mips16e-jrc.d: New.
Diffstat (limited to 'gas/config/tc-mips.c')
-rw-r--r-- | gas/config/tc-mips.c | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index 6e06105..7ae421d 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -2693,12 +2693,29 @@ append_insn (struct mips_cl_insn *ip, expressionS *address_expr, sync.p, we can not swap. */ || (prev_pinfo & INSN_SYNC)) { - /* We could do even better for unconditional branches to - portions of this object file; we could pick up the - instruction at the destination, put it in the delay - slot, and bump the destination address. */ - insert_into_history (0, 1, ip); - emit_nop (); + if (mips_opts.mips16 + && (pinfo & INSN_UNCOND_BRANCH_DELAY) + && (pinfo & (MIPS16_INSN_READ_X | MIPS16_INSN_READ_31)) + && (mips_opts.isa == ISA_MIPS32 + || mips_opts.isa == ISA_MIPS32R2 + || mips_opts.isa == ISA_MIPS64 + || mips_opts.isa == ISA_MIPS64R2)) + { + /* Convert MIPS16 jr/jalr into a "compact" jump. */ + ip->insn_opcode |= 0x0080; + install_insn (ip); + insert_into_history (0, 1, ip); + } + else + { + /* We could do even better for unconditional branches to + portions of this object file; we could pick up the + instruction at the destination, put it in the delay + slot, and bump the destination address. */ + insert_into_history (0, 1, ip); + emit_nop (); + } + if (mips_relax.sequence) mips_relax.sizes[mips_relax.sequence - 1] += 4; } |