From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11665 invoked by alias); 25 Feb 2011 00:57:57 -0000 Received: (qmail 11654 invoked by uid 22791); 25 Feb 2011 00:57:56 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 25 Feb 2011 00:57:49 +0000 Received: (qmail 20259 invoked from network); 25 Feb 2011 00:57:47 -0000 Received: from unknown (HELO tp.orcam.me.uk) (macro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 25 Feb 2011 00:57:47 -0000 Date: Fri, 25 Feb 2011 00:57:00 -0000 From: "Maciej W. Rozycki" To: binutils@sourceware.org cc: Richard Sandiford Subject: [PATCH] MIPS/GAS: Disable branch relaxation for BPOSGE32/64 Message-ID: User-Agent: Alpine 1.10 (DEB 962 2008-03-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2011-02/txt/msg00300.txt.bz2 Hi, Here's a change to disable branch relaxation for the BPOSGE32 and BPOSGE64 MIPS DSP instructions. They have no complementing branches and therefore cannot be relaxed using our current infrastructure -- an extra unconditional branch over the long jump would have to be produced and I think there's little demand for such a feature, hence my simple change. Currently trying to assemble an out-of-range branch of this kind yields an error like this: relax-bposge.s:12: Internal error! Assertion failure in md_convert_frag at [...]/gas/config/tc-mips.c line 17346. Please report this bug. Regression-tested with the mips-sde-elf and mips-gnu-linux targets. OK to apply? 2011-02-21 Maciej W. Rozycki gas/ * config/tc-mips.c (append_insn): Disable branch relaxation for DSP instructions. gas/testsuite/ * gas/mips/relax-bposge.l: New test for DSP branch relaxation. * gas/mips/relax-bposge.s: Source for the new test. * gas/mips/mips.exp: Run the new test. Maciej binutils-gas-mips-relax-dsp.diff Index: binutils-fsf-trunk-quilt/gas/config/tc-mips.c =================================================================== --- binutils-fsf-trunk-quilt.orig/gas/config/tc-mips.c 2011-02-24 23:46:08.000000000 +0000 +++ binutils-fsf-trunk-quilt/gas/config/tc-mips.c 2011-02-24 23:46:09.000000000 +0000 @@ -3132,6 +3132,8 @@ append_insn (struct mips_cl_insn *ip, ex out that the branch was out-of-range, we'll get an error. */ && !mips_opts.warn_about_macros && (mips_opts.at || mips_pic == NO_PIC) + /* Don't relax BPOSGE32/64 as they have no complementing branches. */ + && !(ip->insn_mo->membership & (INSN_DSP64 | INSN_DSP)) && !mips_opts.mips16) { relaxed_branch = TRUE; Index: binutils-fsf-trunk-quilt/gas/testsuite/gas/mips/mips.exp =================================================================== --- binutils-fsf-trunk-quilt.orig/gas/testsuite/gas/mips/mips.exp 2011-02-24 23:46:08.000000000 +0000 +++ binutils-fsf-trunk-quilt/gas/testsuite/gas/mips/mips.exp 2011-02-24 23:46:09.000000000 +0000 @@ -708,6 +708,8 @@ if { [istarget mips*-*-vxworks*] } { run_dump_test "relax-swap1-mips1" run_dump_test "relax-swap1-mips2" run_dump_test "relax-swap2" + run_list_test_arches "relax-bposge" "-mdsp -relax-branch" \ + [mips_arch_list_matching mips64r2] run_list_test "illegal" "-32" run_list_test "baddata1" "-32" Index: binutils-fsf-trunk-quilt/gas/testsuite/gas/mips/relax-bposge.l =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ binutils-fsf-trunk-quilt/gas/testsuite/gas/mips/relax-bposge.l 2011-02-24 23:46:09.000000000 +0000 @@ -0,0 +1,5 @@ +.*: Assembler messages: +.*:6: Warning: Relaxed out-of-range branch into a jump +.*:9: Warning: Relaxed out-of-range branch into a jump +.*:7: Error: Branch out of range +.*:8: Error: Branch out of range Index: binutils-fsf-trunk-quilt/gas/testsuite/gas/mips/relax-bposge.s =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ binutils-fsf-trunk-quilt/gas/testsuite/gas/mips/relax-bposge.s 2011-02-24 23:46:09.000000000 +0000 @@ -0,0 +1,12 @@ +# Source file to test branch relaxation with the BPOSGE32 and BPOSGE64 +# instructions. + + .text +foo: + b bar + bposge32 bar + bposge64 bar + bal bar + + .space 0x20000 +bar: