Index: config/tc-mips.c =================================================================== RCS file: /cvs/src/src/gas/config/tc-mips.c,v retrieving revision 1.506 diff -u -p -r1.506 tc-mips.c --- config/tc-mips.c 22 May 2012 01:55:16 -0000 1.506 +++ config/tc-mips.c 5 Jun 2012 20:34:48 -0000 @@ -4078,7 +4078,6 @@ append_insn (struct mips_cl_insn *ip, ex (unsigned long) address_expr->X_add_number); ip->insn_opcode |= ((address_expr->X_add_number >> shift) & 0x3ffffff); - ip->complete_p = 0; } break; @@ -4090,7 +4089,6 @@ append_insn (struct mips_cl_insn *ip, ex (((address_expr->X_add_number & 0x7c0000) << 3) | ((address_expr->X_add_number & 0xf800000) >> 7) | ((address_expr->X_add_number & 0x3fffc) >> 2)); - ip->complete_p = 0; break; case BFD_RELOC_16_PCREL_S2: @@ -4101,7 +4099,9 @@ append_insn (struct mips_cl_insn *ip, ex if ((address_expr->X_add_number & ((1 << shift) - 1)) != 0) as_bad (_("branch to misaligned address (0x%lx)"), (unsigned long) address_expr->X_add_number); - if (!mips_relax_branch) + if (mips_relax_branch) + ip->complete_p = 0; + else { if ((address_expr->X_add_number + (1 << (shift + 15))) & ~((1 << (shift + 16)) - 1)) @@ -4110,7 +4110,6 @@ append_insn (struct mips_cl_insn *ip, ex ip->insn_opcode |= ((address_expr->X_add_number >> shift) & 0xffff); } - ip->complete_p = 0; } break; Index: testsuite/gas/mips/branch-misc-5.d =================================================================== RCS file: testsuite/gas/mips/branch-misc-5.d diff -N testsuite/gas/mips/branch-misc-5.d --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ testsuite/gas/mips/branch-misc-5.d 5 Jun 2012 20:34:48 -0000 @@ -0,0 +1,17 @@ +#skip: mips-*-ecoff +#objdump: -dr --prefix-addresses --show-raw-insn +#name: MIPS branch-misc-5 +#as: -32 + +# Test the branches to constant offset. + +.*: +file format .*mips.* + +Disassembly of section .text: +0+0000 <[^>]*> 156c0003 bne t3,t4,00000010 <[^>]*> +0+0004 <[^>]*> 00000000 nop +0+0008 <[^>]*> 156cfffd bne t3,t4,00000000 +0+000c <[^>]*> 00000000 nop +0+0010 <[^>]*> 0411fffd bal 00000008 <[^>]*> +0+0014 <[^>]*> 00000000 nop + \.\.\. Index: testsuite/gas/mips/branch-misc-5.s =================================================================== RCS file: testsuite/gas/mips/branch-misc-5.s diff -N testsuite/gas/mips/branch-misc-5.s --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ testsuite/gas/mips/branch-misc-5.s 5 Jun 2012 20:34:48 -0000 @@ -0,0 +1,11 @@ +# Source file used to test the branches with constant offsets + + .text + +x: + bne $11, $12, 12 + bne $11, $12, -12 + bal -12 + +# Force at least 8 (non-delay-slot) zero bytes, to make 'objdump' print ... + .space 8 Index: testsuite/gas/mips/micromips@branch-misc-5.d =================================================================== RCS file: testsuite/gas/mips/micromips@branch-misc-5.d diff -N testsuite/gas/mips/micromips@branch-misc-5.d --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ testsuite/gas/mips/micromips@branch-misc-5.d 5 Jun 2012 20:34:48 -0000 @@ -0,0 +1,17 @@ +#objdump: -dr --prefix-addresses --show-raw-insn +#name: MIPS branch-misc-5 +#source: branch-misc-5.s +#as: -32 + +# Test the branches to constant offsets + +.*: +file format .*mips.* + +Disassembly of section \.text: +0+0000 <[^>]*> b58b 0006 bne t3,t4,00000010 <[^>]*> +0+0004 <[^>]*> 0c00 nop +0+0006 <[^>]*> b58b fffa bne t3,t4,fffffffe <[^>]*> +0+000a <[^>]*> 0c00 nop +0+000c <[^>]*> 4060 fffa bal 00000004 <[^>]*> +0+0010 <[^>]*> 0000 0000 nop + \.\.\. Index: testsuite/gas/mips/mips.exp =================================================================== RCS file: /cvs/src/src/gas/testsuite/gas/mips/mips.exp,v retrieving revision 1.199 diff -u -p -r1.199 mips.exp --- testsuite/gas/mips/mips.exp 8 Jan 2012 12:33:54 -0000 1.199 +++ testsuite/gas/mips/mips.exp 5 Jun 2012 20:34:48 -0000 @@ -503,6 +503,7 @@ if { [istarget mips*-*-vxworks*] } { run_dump_test_arches "branch-misc-2pic" [mips_arch_list_matching mips1] run_dump_test_arches "branch-misc-2-64" [mips_arch_list_matching mips3] run_dump_test_arches "branch-misc-2pic-64" [mips_arch_list_matching mips3] + run_dump_test_arches "branch-misc-5" [mips_arch_list_matching mips1] run_dump_test "branch-misc-3" run_dump_test "branch-swap" run_dump_test "div"