From patchwork Sun Sep 15 14:29:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Maciej W. Rozycki" X-Patchwork-Id: 97565 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 31437385DDC4 for ; Sun, 15 Sep 2024 14:30:08 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from angie.orcam.me.uk (angie.orcam.me.uk [IPv6:2001:4190:8020::34]) by sourceware.org (Postfix) with ESMTP id 4B9483858C53 for ; Sun, 15 Sep 2024 14:29:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4B9483858C53 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=orcam.me.uk Authentication-Results: sourceware.org; spf=none smtp.mailfrom=orcam.me.uk ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 4B9483858C53 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:4190:8020::34 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1726410573; cv=none; b=Bq/MvuWzZltuSktMkzoORIe9dP75PMEPuxxTL/Vn6juDMNgt+ceoRIxZakz7Yazib6ivqMxSBjxWTORfnYDve4fd/CNL5ayfOuDENv2RjX6LoWIIFbdf9BEhYe+IIxPPFNOs8o+oGoxDBdsxl6G9gSpUej+s53JSCQpK3C+R4j8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1726410573; c=relaxed/simple; bh=ZpFekEzJz7ALaaoH2x7ZDraDAFD9F3jUDHtX94/u0Os=; h=Date:From:To:Subject:Message-ID:MIME-Version; b=UBbCJAPKfHcSNrwI9cl+EClX8iKIQZx+vvt6FTAEl2HTpm0vFnutf0JYVVMXaUljd2C3yPnh6BeWSlFL1IwdyQYe9XhryLinDZl30U/1iLT0YlvCN1TRAPz9V85AWj3hXHLnOkFlisZChfxpWsgdR5Vrn9p8OtKm9EAZkj5vh5g= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by angie.orcam.me.uk (Postfix, from userid 500) id CD4EA92009C; Sun, 15 Sep 2024 16:29:29 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by angie.orcam.me.uk (Postfix) with ESMTP id C6D5492009B for ; Sun, 15 Sep 2024 15:29:29 +0100 (BST) Date: Sun, 15 Sep 2024 15:29:29 +0100 (BST) From: "Maciej W. Rozycki" To: binutils@sourceware.org Subject: [committed 1/2] MIPS/GAS/testsuite: Print instructions in hex in division tests In-Reply-To: Message-ID: References: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 X-Spam-Status: No, score=-3487.7 required=5.0 tests=BAYES_00, KAM_ASCII_DIVIDERS, KAM_DMARC_STATUS, KAM_INFOUSMEBIZ, KAM_LAZY_DOMAIN_SECURITY, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces~patchwork=sourceware.org@sourceware.org Add `--show-raw-insn' to division tests so as to verify branch offsets without the need to know actual offsets into the text section individual instructions have been assembled at. Add `-z' where applicable to make interlock NOP instructions appear in output so as to verify them without the need to know the offsets too. Replace individual offsets to match against with generic patterns so that a change in the expansion of an assembly macro does not affect code that follows. --- gas/testsuite/gas/mips/allegrex@div-trap.d | 2 gas/testsuite/gas/mips/div.d | 166 ++++++++++++------------ gas/testsuite/gas/mips/div64.d | 42 +++--- gas/testsuite/gas/mips/mips1@div-trap.d | 2 gas/testsuite/gas/mips/mips1@div.d | 196 +++++++++++++++-------------- gas/testsuite/gas/mips/mips2@div-trap.d | 2 gas/testsuite/gas/mips/mips2@div.d | 2 gas/testsuite/gas/mips/mips3@div.d | 2 gas/testsuite/gas/mips/mips3@div64.d | 52 +++---- gas/testsuite/gas/mips/mips4@div.d | 2 gas/testsuite/gas/mips/mips4@div64.d | 2 gas/testsuite/gas/mips/mips5@div.d | 2 gas/testsuite/gas/mips/mips5@div64.d | 2 gas/testsuite/gas/mips/r3000@div-trap.d | 2 gas/testsuite/gas/mips/r3000@div.d | 2 gas/testsuite/gas/mips/r3900@div-trap.d | 2 gas/testsuite/gas/mips/r3900@div.d | 2 gas/testsuite/gas/mips/r4000@div.d | 2 gas/testsuite/gas/mips/r4000@div64.d | 2 gas/testsuite/gas/mips/vr5400@div.d | 2 gas/testsuite/gas/mips/vr5400@div64.d | 2 21 files changed, 249 insertions(+), 241 deletions(-) binutils-mips-gas-test-div-dump.diff Index: binutils-gdb/gas/testsuite/gas/mips/allegrex@div-trap.d =================================================================== --- binutils-gdb.orig/gas/testsuite/gas/mips/allegrex@div-trap.d +++ binutils-gdb/gas/testsuite/gas/mips/allegrex@div-trap.d @@ -1,5 +1,5 @@ #as: -32 -trap -#objdump: -dr --prefix-addresses +#objdump: -dr --prefix-addresses --show-raw-insn #name: MIPS div with traps #source: div.s #dump: div.d Index: binutils-gdb/gas/testsuite/gas/mips/div.d =================================================================== --- binutils-gdb.orig/gas/testsuite/gas/mips/div.d +++ binutils-gdb/gas/testsuite/gas/mips/div.d @@ -1,90 +1,90 @@ #as: -32 -#objdump: -dr --prefix-addresses +#objdump: -dr --prefix-addresses --show-raw-insn #name: MIPS div # Test the div macro. .*: +file format .*mips.* -Disassembly of section .text: -0+0000 <[^>]*> div zero,a0,a1 -0+0004 <[^>]*> bnez a1,0+0010 -0+0008 <[^>]*> div zero,a0,a1 -0+000c <[^>]*> break (0x0,0x7|0x7) -0+0010 <[^>]*> li at,-1 -0+0014 <[^>]*> bne a1,at,0+0028 -0+0018 <[^>]*> lui at,0x8000 -0+001c <[^>]*> bne a0,at,0+0028 -0+0020 <[^>]*> nop -0+0024 <[^>]*> break (0x0,0x6|0x6) -0+0028 <[^>]*> mflo a0 -0+002c <[^>]*> bnez a2,0+0038 -0+0030 <[^>]*> div zero,a1,a2 -0+0034 <[^>]*> break (0x0,0x7|0x7) -0+0038 <[^>]*> li at,-1 -0+003c <[^>]*> bne a2,at,0+0050 -0+0040 <[^>]*> lui at,0x8000 -0+0044 <[^>]*> bne a1,at,0+0050 -0+0048 <[^>]*> nop -0+004c <[^>]*> break (0x0,0x6|0x6) -0+0050 <[^>]*> mflo a0 -0+0054 <[^>]*> move a0,a0 -0+0058 <[^>]*> move a0,a1 -0+005c <[^>]*> neg a0,a0 -0+0060 <[^>]*> neg a0,a1 -0+0064 <[^>]*> li at,2 -0+0068 <[^>]*> div zero,a0,at -0+006c <[^>]*> mflo a0 -0+0070 <[^>]*> li at,2 -0+0074 <[^>]*> div zero,a1,at -0+0078 <[^>]*> mflo a0 -0+007c <[^>]*> li at,0x8000 -0+0080 <[^>]*> div zero,a0,at -0+0084 <[^>]*> mflo a0 -0+0088 <[^>]*> li at,0x8000 -0+008c <[^>]*> div zero,a1,at -0+0090 <[^>]*> mflo a0 -0+0094 <[^>]*> li at,-32768 -0+0098 <[^>]*> div zero,a0,at -0+009c <[^>]*> mflo a0 -0+00a0 <[^>]*> li at,-32768 -0+00a4 <[^>]*> div zero,a1,at -0+00a8 <[^>]*> mflo a0 -0+00ac <[^>]*> lui at,0x1 -0+00b0 <[^>]*> div zero,a0,at -0+00b4 <[^>]*> mflo a0 -0+00b8 <[^>]*> lui at,0x1 -0+00bc <[^>]*> div zero,a1,at -0+00c0 <[^>]*> mflo a0 -0+00c4 <[^>]*> lui at,0x1 -0+00c8 <[^>]*> ori at,at,0xa5a5 -0+00cc <[^>]*> div zero,a0,at -0+00d0 <[^>]*> mflo a0 -0+00d4 <[^>]*> lui at,0x1 -0+00d8 <[^>]*> ori at,at,0xa5a5 -0+00dc <[^>]*> div zero,a1,at -0+00e0 <[^>]*> mflo a0 -0+00e4 <[^>]*> divu zero,a0,a1 -0+00e8 <[^>]*> bnez a1,0+0f4 -0+00ec <[^>]*> divu zero,a0,a1 -0+00f0 <[^>]*> break (0x0,0x7|0x7) -0+00f4 <[^>]*> mflo a0 -0+00f8 <[^>]*> bnez a2,0+0104 -0+00fc <[^>]*> divu zero,a1,a2 -0+0100 <[^>]*> break (0x0,0x7|0x7) -0+0104 <[^>]*> mflo a0 -0+0108 <[^>]*> move a0,a0 -0+010c <[^>]*> bnez a2,0+0118 -0+0110 <[^>]*> div zero,a1,a2 -0+0114 <[^>]*> break (0x0,0x7|0x7) -0+0118 <[^>]*> li at,-1 -0+011c <[^>]*> bne a2,at,0+0130 -0+0120 <[^>]*> lui at,0x8000 -0+0124 <[^>]*> bne a1,at,0+0130 -0+0128 <[^>]*> nop -0+012c <[^>]*> break (0x0,0x6|0x6) -0+0130 <[^>]*> mfhi a0 -0+0134 <[^>]*> li at,2 -0+0138 <[^>]*> divu zero,a1,at -0+013c <[^>]*> mfhi a0 - ... +Disassembly of section \.text: +[0-9a-f]+ <[^>]*> 0085001a div zero,a0,a1 +[0-9a-f]+ <[^>]*> 14a00002 bnez a1,[0-9a-f]+ <[^>]*> +[0-9a-f]+ <[^>]*> 0085001a div zero,a0,a1 +[0-9a-f]+ <[^>]*> 0007000d break 0x7 +[0-9a-f]+ <[^>]*> 2401ffff li at,-1 +[0-9a-f]+ <[^>]*> 14a10004 bne a1,at,[0-9a-f]+ <[^>]*> +[0-9a-f]+ <[^>]*> 3c018000 lui at,0x8000 +[0-9a-f]+ <[^>]*> 14810002 bne a0,at,[0-9a-f]+ <[^>]*> +[0-9a-f]+ <[^>]*> 00000000 nop +[0-9a-f]+ <[^>]*> 0006000d break 0x6 +[0-9a-f]+ <[^>]*> 00002012 mflo a0 +[0-9a-f]+ <[^>]*> 14c00002 bnez a2,[0-9a-f]+ <[^>]*> +[0-9a-f]+ <[^>]*> 00a6001a div zero,a1,a2 +[0-9a-f]+ <[^>]*> 0007000d break 0x7 +[0-9a-f]+ <[^>]*> 2401ffff li at,-1 +[0-9a-f]+ <[^>]*> 14c10004 bne a2,at,[0-9a-f]+ <[^>]*> +[0-9a-f]+ <[^>]*> 3c018000 lui at,0x8000 +[0-9a-f]+ <[^>]*> 14a10002 bne a1,at,[0-9a-f]+ <[^>]*> +[0-9a-f]+ <[^>]*> 00000000 nop +[0-9a-f]+ <[^>]*> 0006000d break 0x6 +[0-9a-f]+ <[^>]*> 00002012 mflo a0 +[0-9a-f]+ <[^>]*> 00802025 move a0,a0 +[0-9a-f]+ <[^>]*> 00a02025 move a0,a1 +[0-9a-f]+ <[^>]*> 00042022 neg a0,a0 +[0-9a-f]+ <[^>]*> 00052022 neg a0,a1 +[0-9a-f]+ <[^>]*> 24010002 li at,2 +[0-9a-f]+ <[^>]*> 0081001a div zero,a0,at +[0-9a-f]+ <[^>]*> 00002012 mflo a0 +[0-9a-f]+ <[^>]*> 24010002 li at,2 +[0-9a-f]+ <[^>]*> 00a1001a div zero,a1,at +[0-9a-f]+ <[^>]*> 00002012 mflo a0 +[0-9a-f]+ <[^>]*> 34018000 li at,0x8000 +[0-9a-f]+ <[^>]*> 0081001a div zero,a0,at +[0-9a-f]+ <[^>]*> 00002012 mflo a0 +[0-9a-f]+ <[^>]*> 34018000 li at,0x8000 +[0-9a-f]+ <[^>]*> 00a1001a div zero,a1,at +[0-9a-f]+ <[^>]*> 00002012 mflo a0 +[0-9a-f]+ <[^>]*> 24018000 li at,-32768 +[0-9a-f]+ <[^>]*> 0081001a div zero,a0,at +[0-9a-f]+ <[^>]*> 00002012 mflo a0 +[0-9a-f]+ <[^>]*> 24018000 li at,-32768 +[0-9a-f]+ <[^>]*> 00a1001a div zero,a1,at +[0-9a-f]+ <[^>]*> 00002012 mflo a0 +[0-9a-f]+ <[^>]*> 3c010001 lui at,0x1 +[0-9a-f]+ <[^>]*> 0081001a div zero,a0,at +[0-9a-f]+ <[^>]*> 00002012 mflo a0 +[0-9a-f]+ <[^>]*> 3c010001 lui at,0x1 +[0-9a-f]+ <[^>]*> 00a1001a div zero,a1,at +[0-9a-f]+ <[^>]*> 00002012 mflo a0 +[0-9a-f]+ <[^>]*> 3c010001 lui at,0x1 +[0-9a-f]+ <[^>]*> 3421a5a5 ori at,at,0xa5a5 +[0-9a-f]+ <[^>]*> 0081001a div zero,a0,at +[0-9a-f]+ <[^>]*> 00002012 mflo a0 +[0-9a-f]+ <[^>]*> 3c010001 lui at,0x1 +[0-9a-f]+ <[^>]*> 3421a5a5 ori at,at,0xa5a5 +[0-9a-f]+ <[^>]*> 00a1001a div zero,a1,at +[0-9a-f]+ <[^>]*> 00002012 mflo a0 +[0-9a-f]+ <[^>]*> 0085001b divu zero,a0,a1 +[0-9a-f]+ <[^>]*> 14a00002 bnez a1,[0-9a-f]+ <[^>]*> +[0-9a-f]+ <[^>]*> 0085001b divu zero,a0,a1 +[0-9a-f]+ <[^>]*> 0007000d break 0x7 +[0-9a-f]+ <[^>]*> 00002012 mflo a0 +[0-9a-f]+ <[^>]*> 14c00002 bnez a2,[0-9a-f]+ <[^>]*> +[0-9a-f]+ <[^>]*> 00a6001b divu zero,a1,a2 +[0-9a-f]+ <[^>]*> 0007000d break 0x7 +[0-9a-f]+ <[^>]*> 00002012 mflo a0 +[0-9a-f]+ <[^>]*> 00802025 move a0,a0 +[0-9a-f]+ <[^>]*> 14c00002 bnez a2,[0-9a-f]+ <[^>]*> +[0-9a-f]+ <[^>]*> 00a6001a div zero,a1,a2 +[0-9a-f]+ <[^>]*> 0007000d break 0x7 +[0-9a-f]+ <[^>]*> 2401ffff li at,-1 +[0-9a-f]+ <[^>]*> 14c10004 bne a2,at,[0-9a-f]+ <[^>]*> +[0-9a-f]+ <[^>]*> 3c018000 lui at,0x8000 +[0-9a-f]+ <[^>]*> 14a10002 bne a1,at,[0-9a-f]+ <[^>]*> +[0-9a-f]+ <[^>]*> 00000000 nop +[0-9a-f]+ <[^>]*> 0006000d break 0x6 +[0-9a-f]+ <[^>]*> 00002010 mfhi a0 +[0-9a-f]+ <[^>]*> 24010002 li at,2 +[0-9a-f]+ <[^>]*> 00a1001b divu zero,a1,at +[0-9a-f]+ <[^>]*> 00002010 mfhi a0 + \.\.\. Index: binutils-gdb/gas/testsuite/gas/mips/div64.d =================================================================== --- binutils-gdb.orig/gas/testsuite/gas/mips/div64.d +++ binutils-gdb/gas/testsuite/gas/mips/div64.d @@ -1,5 +1,5 @@ #as: -32 -#objdump: -dr --prefix-addresses +#objdump: -dr --prefix-addresses --show-raw-insn #name: MIPS 64-bit div # Test the div macro. @@ -7,24 +7,24 @@ .*: +file format .*mips.* Disassembly of section \.text: -0+0000 <[^>]*> bnez a2,0+000c -0+0004 <[^>]*> ddiv zero,a1,a2 -0+0008 <[^>]*> break (0x0,0x7|0x7) -0+000c <[^>]*> (daddiu at,zero,-1|li at,-1) -0+0010 <[^>]*> bne a2,at,0+0028 -0+0014 <[^>]*> (daddiu at,zero,1|li at,1) -0+0018 <[^>]*> dsll32 at,at,0x1f -0+001c <[^>]*> bne a1,at,0+0028 -0+0020 <[^>]*> nop -0+0024 <[^>]*> break (0x0,0x6|0x6) -0+0028 <[^>]*> mflo a0 -0+002c <[^>]*> li at,2 -0+0030 <[^>]*> ddivu zero,a1,at -0+0034 <[^>]*> mflo a0 -0+0038 <[^>]*> li at,0x8000 -0+003c <[^>]*> ddiv zero,a1,at -0+0040 <[^>]*> mfhi a0 -0+0044 <[^>]*> li at,-32768 -0+0048 <[^>]*> ddivu zero,a1,at -0+004c <[^>]*> mfhi a0 +[0-9a-f]+ <[^>]*> 14c00002 bnez a2,[0-9a-f]+ <[^>]*> +[0-9a-f]+ <[^>]*> 00a6001e ddiv zero,a1,a2 +[0-9a-f]+ <[^>]*> 0007000d break 0x7 +[0-9a-f]+ <[^>]*> 2401ffff li at,-1 +[0-9a-f]+ <[^>]*> 14c10005 bne a2,at,[0-9a-f]+ <[^>]*> +[0-9a-f]+ <[^>]*> 24010001 li at,1 +[0-9a-f]+ <[^>]*> 00010ffc dsll32 at,at,0x1f +[0-9a-f]+ <[^>]*> 14a10002 bne a1,at,[0-9a-f]+ <[^>]*> +[0-9a-f]+ <[^>]*> 00000000 nop +[0-9a-f]+ <[^>]*> 0006000d break 0x6 +[0-9a-f]+ <[^>]*> 00002012 mflo a0 +[0-9a-f]+ <[^>]*> 24010002 li at,2 +[0-9a-f]+ <[^>]*> 00a1001f ddivu zero,a1,at +[0-9a-f]+ <[^>]*> 00002012 mflo a0 +[0-9a-f]+ <[^>]*> 34018000 li at,0x8000 +[0-9a-f]+ <[^>]*> 00a1001e ddiv zero,a1,at +[0-9a-f]+ <[^>]*> 00002010 mfhi a0 +[0-9a-f]+ <[^>]*> 24018000 li at,-32768 +[0-9a-f]+ <[^>]*> 00a1001f ddivu zero,a1,at +[0-9a-f]+ <[^>]*> 00002010 mfhi a0 \.\.\. Index: binutils-gdb/gas/testsuite/gas/mips/mips1@div-trap.d =================================================================== --- binutils-gdb.orig/gas/testsuite/gas/mips/mips1@div-trap.d +++ binutils-gdb/gas/testsuite/gas/mips/mips1@div-trap.d @@ -1,5 +1,5 @@ #as: -32 -trap -#objdump: -dr --prefix-addresses +#objdump: -drz --prefix-addresses --show-raw-insn #name: MIPS div with traps #source: div.s #dump: mips1@div.d Index: binutils-gdb/gas/testsuite/gas/mips/mips1@div.d =================================================================== --- binutils-gdb.orig/gas/testsuite/gas/mips/mips1@div.d +++ binutils-gdb/gas/testsuite/gas/mips/mips1@div.d @@ -1,5 +1,5 @@ #as: -32 -#objdump: -dr --prefix-addresses +#objdump: -drz --prefix-addresses --show-raw-insn #name: MIPS div #source: div.s @@ -7,96 +7,104 @@ .*: +file format .*mips.* -Disassembly of section .text: -0+0000 <[^>]*> div zero,a0,a1 -0+0004 <[^>]*> bnez a1,0+0010 -0+0008 <[^>]*> div zero,a0,a1 -0+000c <[^>]*> break (0x0,0x7|0x7) -0+0010 <[^>]*> li at,-1 -0+0014 <[^>]*> bne a1,at,0+0028 -0+0018 <[^>]*> lui at,0x8000 -0+001c <[^>]*> bne a0,at,0+0028 -0+0020 <[^>]*> nop -0+0024 <[^>]*> break (0x0,0x6|0x6) -0+0028 <[^>]*> mflo a0 -0+002c <[^>]*> nop -0+0030 <[^>]*> bnez a2,0+003c -0+0034 <[^>]*> div zero,a1,a2 -0+0038 <[^>]*> break (0x0,0x7|0x7) -0+003c <[^>]*> li at,-1 -0+0040 <[^>]*> bne a2,at,0+0054 -0+0044 <[^>]*> lui at,0x8000 -0+0048 <[^>]*> bne a1,at,0+0054 -0+004c <[^>]*> nop -0+0050 <[^>]*> break (0x0,0x6|0x6) -0+0054 <[^>]*> mflo a0 -0+0058 <[^>]*> move a0,a0 -0+005c <[^>]*> move a0,a1 -0+0060 <[^>]*> neg a0,a0 -0+0064 <[^>]*> neg a0,a1 -0+0068 <[^>]*> li at,2 -0+006c <[^>]*> div zero,a0,at -0+0070 <[^>]*> mflo a0 -0+0074 <[^>]*> li at,2 -0+0078 <[^>]*> nop -0+007c <[^>]*> div zero,a1,at -0+0080 <[^>]*> mflo a0 -0+0084 <[^>]*> li at,0x8000 -0+0088 <[^>]*> nop -0+008c <[^>]*> div zero,a0,at -0+0090 <[^>]*> mflo a0 -0+0094 <[^>]*> li at,0x8000 -0+0098 <[^>]*> nop -0+009c <[^>]*> div zero,a1,at -0+00a0 <[^>]*> mflo a0 -0+00a4 <[^>]*> li at,-32768 -0+00a8 <[^>]*> nop -0+00ac <[^>]*> div zero,a0,at -0+00b0 <[^>]*> mflo a0 -0+00b4 <[^>]*> li at,-32768 -0+00b8 <[^>]*> nop -0+00bc <[^>]*> div zero,a1,at -0+00c0 <[^>]*> mflo a0 -0+00c4 <[^>]*> lui at,0x1 -0+00c8 <[^>]*> nop -0+00cc <[^>]*> div zero,a0,at -0+00d0 <[^>]*> mflo a0 -0+00d4 <[^>]*> lui at,0x1 -0+00d8 <[^>]*> nop -0+00dc <[^>]*> div zero,a1,at -0+00e0 <[^>]*> mflo a0 -0+00e4 <[^>]*> lui at,0x1 -0+00e8 <[^>]*> ori at,at,0xa5a5 -0+00ec <[^>]*> div zero,a0,at -0+00f0 <[^>]*> mflo a0 -0+00f4 <[^>]*> lui at,0x1 -0+00f8 <[^>]*> ori at,at,0xa5a5 -0+00fc <[^>]*> div zero,a1,at -0+0100 <[^>]*> mflo a0 - ... -0+010c <[^>]*> divu zero,a0,a1 -0+0110 <[^>]*> bnez a1,0+011c -0+0114 <[^>]*> divu zero,a0,a1 -0+0118 <[^>]*> break (0x0,0x7|0x7) -0+011c <[^>]*> mflo a0 -0+0120 <[^>]*> nop -0+0124 <[^>]*> bnez a2,0+0130 -0+0128 <[^>]*> divu zero,a1,a2 -0+012c <[^>]*> break (0x0,0x7|0x7) -0+0130 <[^>]*> mflo a0 -0+0134 <[^>]*> move a0,a0 -0+0138 <[^>]*> bnez a2,0+0144 -0+013c <[^>]*> div zero,a1,a2 -0+0140 <[^>]*> break (0x0,0x7|0x7) -0+0144 <[^>]*> li at,-1 -0+0148 <[^>]*> bne a2,at,0+015c -0+014c <[^>]*> lui at,0x8000 -0+0150 <[^>]*> bne a1,at,0+015c -0+0154 <[^>]*> nop -0+0158 <[^>]*> break (0x0,0x6|0x6) -0+015c <[^>]*> mfhi a0 -0+0160 <[^>]*> li at,2 -0+0164 <[^>]*> nop -0+0168 <[^>]*> divu zero,a1,at -0+016c <[^>]*> mfhi a0 - ... +Disassembly of section \.text: +[0-9a-f]+ <[^>]*> 0085001a div zero,a0,a1 +[0-9a-f]+ <[^>]*> 14a00002 bnez a1,[0-9a-f]+ <[^>]*> +[0-9a-f]+ <[^>]*> 0085001a div zero,a0,a1 +[0-9a-f]+ <[^>]*> 0007000d break 0x7 +[0-9a-f]+ <[^>]*> 2401ffff li at,-1 +[0-9a-f]+ <[^>]*> 14a10004 bne a1,at,[0-9a-f]+ <[^>]*> +[0-9a-f]+ <[^>]*> 3c018000 lui at,0x8000 +[0-9a-f]+ <[^>]*> 14810002 bne a0,at,[0-9a-f]+ <[^>]*> +[0-9a-f]+ <[^>]*> 00000000 nop +[0-9a-f]+ <[^>]*> 0006000d break 0x6 +[0-9a-f]+ <[^>]*> 00002012 mflo a0 +[0-9a-f]+ <[^>]*> 00000000 nop +[0-9a-f]+ <[^>]*> 14c00002 bnez a2,[0-9a-f]+ <[^>]*> +[0-9a-f]+ <[^>]*> 00a6001a div zero,a1,a2 +[0-9a-f]+ <[^>]*> 0007000d break 0x7 +[0-9a-f]+ <[^>]*> 2401ffff li at,-1 +[0-9a-f]+ <[^>]*> 14c10004 bne a2,at,[0-9a-f]+ <[^>]*> +[0-9a-f]+ <[^>]*> 3c018000 lui at,0x8000 +[0-9a-f]+ <[^>]*> 14a10002 bne a1,at,[0-9a-f]+ <[^>]*> +[0-9a-f]+ <[^>]*> 00000000 nop +[0-9a-f]+ <[^>]*> 0006000d break 0x6 +[0-9a-f]+ <[^>]*> 00002012 mflo a0 +[0-9a-f]+ <[^>]*> 00802025 move a0,a0 +[0-9a-f]+ <[^>]*> 00a02025 move a0,a1 +[0-9a-f]+ <[^>]*> 00042022 neg a0,a0 +[0-9a-f]+ <[^>]*> 00052022 neg a0,a1 +[0-9a-f]+ <[^>]*> 24010002 li at,2 +[0-9a-f]+ <[^>]*> 0081001a div zero,a0,at +[0-9a-f]+ <[^>]*> 00002012 mflo a0 +[0-9a-f]+ <[^>]*> 24010002 li at,2 +[0-9a-f]+ <[^>]*> 00000000 nop +[0-9a-f]+ <[^>]*> 00a1001a div zero,a1,at +[0-9a-f]+ <[^>]*> 00002012 mflo a0 +[0-9a-f]+ <[^>]*> 34018000 li at,0x8000 +[0-9a-f]+ <[^>]*> 00000000 nop +[0-9a-f]+ <[^>]*> 0081001a div zero,a0,at +[0-9a-f]+ <[^>]*> 00002012 mflo a0 +[0-9a-f]+ <[^>]*> 34018000 li at,0x8000 +[0-9a-f]+ <[^>]*> 00000000 nop +[0-9a-f]+ <[^>]*> 00a1001a div zero,a1,at +[0-9a-f]+ <[^>]*> 00002012 mflo a0 +[0-9a-f]+ <[^>]*> 24018000 li at,-32768 +[0-9a-f]+ <[^>]*> 00000000 nop +[0-9a-f]+ <[^>]*> 0081001a div zero,a0,at +[0-9a-f]+ <[^>]*> 00002012 mflo a0 +[0-9a-f]+ <[^>]*> 24018000 li at,-32768 +[0-9a-f]+ <[^>]*> 00000000 nop +[0-9a-f]+ <[^>]*> 00a1001a div zero,a1,at +[0-9a-f]+ <[^>]*> 00002012 mflo a0 +[0-9a-f]+ <[^>]*> 3c010001 lui at,0x1 +[0-9a-f]+ <[^>]*> 00000000 nop +[0-9a-f]+ <[^>]*> 0081001a div zero,a0,at +[0-9a-f]+ <[^>]*> 00002012 mflo a0 +[0-9a-f]+ <[^>]*> 3c010001 lui at,0x1 +[0-9a-f]+ <[^>]*> 00000000 nop +[0-9a-f]+ <[^>]*> 00a1001a div zero,a1,at +[0-9a-f]+ <[^>]*> 00002012 mflo a0 +[0-9a-f]+ <[^>]*> 3c010001 lui at,0x1 +[0-9a-f]+ <[^>]*> 3421a5a5 ori at,at,0xa5a5 +[0-9a-f]+ <[^>]*> 0081001a div zero,a0,at +[0-9a-f]+ <[^>]*> 00002012 mflo a0 +[0-9a-f]+ <[^>]*> 3c010001 lui at,0x1 +[0-9a-f]+ <[^>]*> 3421a5a5 ori at,at,0xa5a5 +[0-9a-f]+ <[^>]*> 00a1001a div zero,a1,at +[0-9a-f]+ <[^>]*> 00002012 mflo a0 +[0-9a-f]+ <[^>]*> 00000000 nop +[0-9a-f]+ <[^>]*> 00000000 nop +[0-9a-f]+ <[^>]*> 0085001b divu zero,a0,a1 +[0-9a-f]+ <[^>]*> 14a00002 bnez a1,[0-9a-f]+ <[^>]*> +[0-9a-f]+ <[^>]*> 0085001b divu zero,a0,a1 +[0-9a-f]+ <[^>]*> 0007000d break 0x7 +[0-9a-f]+ <[^>]*> 00002012 mflo a0 +[0-9a-f]+ <[^>]*> 00000000 nop +[0-9a-f]+ <[^>]*> 14c00002 bnez a2,[0-9a-f]+ <[^>]*> +[0-9a-f]+ <[^>]*> 00a6001b divu zero,a1,a2 +[0-9a-f]+ <[^>]*> 0007000d break 0x7 +[0-9a-f]+ <[^>]*> 00002012 mflo a0 +[0-9a-f]+ <[^>]*> 00802025 move a0,a0 +[0-9a-f]+ <[^>]*> 14c00002 bnez a2,[0-9a-f]+ <[^>]*> +[0-9a-f]+ <[^>]*> 00a6001a div zero,a1,a2 +[0-9a-f]+ <[^>]*> 0007000d break 0x7 +[0-9a-f]+ <[^>]*> 2401ffff li at,-1 +[0-9a-f]+ <[^>]*> 14c10004 bne a2,at,[0-9a-f]+ <[^>]*> +[0-9a-f]+ <[^>]*> 3c018000 lui at,0x8000 +[0-9a-f]+ <[^>]*> 14a10002 bne a1,at,[0-9a-f]+ <[^>]*> +[0-9a-f]+ <[^>]*> 00000000 nop +[0-9a-f]+ <[^>]*> 0006000d break 0x6 +[0-9a-f]+ <[^>]*> 00002010 mfhi a0 +[0-9a-f]+ <[^>]*> 24010002 li at,2 +[0-9a-f]+ <[^>]*> 00000000 nop +[0-9a-f]+ <[^>]*> 00a1001b divu zero,a1,at +[0-9a-f]+ <[^>]*> 00002010 mfhi a0 +[0-9a-f]+ <[^>]*> 00000000 nop +[0-9a-f]+ <[^>]*> 00000000 nop +[0-9a-f]+ <[^>]*> 00000000 nop +[0-9a-f]+ <[^>]*> 00000000 nop +[0-9a-f]+ <[^>]*> 00000000 nop +[0-9a-f]+ <[^>]*> 00000000 nop +[0-9a-f]+ <[^>]*> 00000000 nop +[0-9a-f]+ <[^>]*> 00000000 nop Index: binutils-gdb/gas/testsuite/gas/mips/mips2@div-trap.d =================================================================== --- binutils-gdb.orig/gas/testsuite/gas/mips/mips2@div-trap.d +++ binutils-gdb/gas/testsuite/gas/mips/mips2@div-trap.d @@ -1,5 +1,5 @@ #as: -32 -trap -#objdump: -drz --prefix-addresses --show-raw-insn +#objdump: -drz --prefix-addresses --show-raw-insn --show-raw-insn #name: MIPS div with traps #source: div.s Index: binutils-gdb/gas/testsuite/gas/mips/mips2@div.d =================================================================== --- binutils-gdb.orig/gas/testsuite/gas/mips/mips2@div.d +++ binutils-gdb/gas/testsuite/gas/mips/mips2@div.d @@ -1,5 +1,5 @@ #as: -32 -#objdump: -dr --prefix-addresses +#objdump: -drz --prefix-addresses --show-raw-insn #name: MIPS div #source: div.s #dump: mips1@div.d Index: binutils-gdb/gas/testsuite/gas/mips/mips3@div.d =================================================================== --- binutils-gdb.orig/gas/testsuite/gas/mips/mips3@div.d +++ binutils-gdb/gas/testsuite/gas/mips/mips3@div.d @@ -1,5 +1,5 @@ #as: -32 -#objdump: -dr --prefix-addresses +#objdump: -drz --prefix-addresses --show-raw-insn #name: MIPS div #source: div.s #dump: mips1@div.d Index: binutils-gdb/gas/testsuite/gas/mips/mips3@div64.d =================================================================== --- binutils-gdb.orig/gas/testsuite/gas/mips/mips3@div64.d +++ binutils-gdb/gas/testsuite/gas/mips/mips3@div64.d @@ -1,5 +1,5 @@ #as: -32 -#objdump: -dr --prefix-addresses +#objdump: -dr --prefix-addresses --show-raw-insn #name: MIPS 64-bit div #source: div64.s @@ -7,28 +7,28 @@ .*: +file format .*mips.* -Disassembly of section .text: -0+0000 <[^>]*> bnez a2,0+000c -0+0004 <[^>]*> ddiv zero,a1,a2 -0+0008 <[^>]*> break (0x0,0x7|0x7) -0+000c <[^>]*> (daddiu at,zero,-1|li at,-1) -0+0010 <[^>]*> bne a2,at,0+0028 -0+0014 <[^>]*> (daddiu at,zero,1|li at,1) -0+0018 <[^>]*> dsll32 at,at,0x1f -0+001c <[^>]*> bne a1,at,0+0028 -0+0020 <[^>]*> nop -0+0024 <[^>]*> break (0x0,0x6|0x6) -0+0028 <[^>]*> mflo a0 -0+002c <[^>]*> li at,2 -0+0030 <[^>]*> nop -0+0034 <[^>]*> ddivu zero,a1,at -0+0038 <[^>]*> mflo a0 -0+003c <[^>]*> li at,0x8000 -0+0040 <[^>]*> nop -0+0044 <[^>]*> ddiv zero,a1,at -0+0048 <[^>]*> mfhi a0 -0+004c <[^>]*> li at,-32768 -0+0050 <[^>]*> nop -0+0054 <[^>]*> ddivu zero,a1,at -0+0058 <[^>]*> mfhi a0 - ... +Disassembly of section \.text: +[0-9a-f]+ <[^>]*> 14c00002 bnez a2,[0-9a-f]+ <[^>]*> +[0-9a-f]+ <[^>]*> 00a6001e ddiv zero,a1,a2 +[0-9a-f]+ <[^>]*> 0007000d break 0x7 +[0-9a-f]+ <[^>]*> 2401ffff li at,-1 +[0-9a-f]+ <[^>]*> 14c10005 bne a2,at,[0-9a-f]+ <[^>]*> +[0-9a-f]+ <[^>]*> 24010001 li at,1 +[0-9a-f]+ <[^>]*> 00010ffc dsll32 at,at,0x1f +[0-9a-f]+ <[^>]*> 14a10002 bne a1,at,[0-9a-f]+ <[^>]*> +[0-9a-f]+ <[^>]*> 00000000 nop +[0-9a-f]+ <[^>]*> 0006000d break 0x6 +[0-9a-f]+ <[^>]*> 00002012 mflo a0 +[0-9a-f]+ <[^>]*> 24010002 li at,2 +[0-9a-f]+ <[^>]*> 00000000 nop +[0-9a-f]+ <[^>]*> 00a1001f ddivu zero,a1,at +[0-9a-f]+ <[^>]*> 00002012 mflo a0 +[0-9a-f]+ <[^>]*> 34018000 li at,0x8000 +[0-9a-f]+ <[^>]*> 00000000 nop +[0-9a-f]+ <[^>]*> 00a1001e ddiv zero,a1,at +[0-9a-f]+ <[^>]*> 00002010 mfhi a0 +[0-9a-f]+ <[^>]*> 24018000 li at,-32768 +[0-9a-f]+ <[^>]*> 00000000 nop +[0-9a-f]+ <[^>]*> 00a1001f ddivu zero,a1,at +[0-9a-f]+ <[^>]*> 00002010 mfhi a0 + \.\.\. Index: binutils-gdb/gas/testsuite/gas/mips/mips4@div.d =================================================================== --- binutils-gdb.orig/gas/testsuite/gas/mips/mips4@div.d +++ binutils-gdb/gas/testsuite/gas/mips/mips4@div.d @@ -1,5 +1,5 @@ #as: -32 -#objdump: -dr --prefix-addresses +#objdump: -drz --prefix-addresses --show-raw-insn #name: MIPS div #source: div.s #dump: mips1@div.d Index: binutils-gdb/gas/testsuite/gas/mips/mips4@div64.d =================================================================== --- binutils-gdb.orig/gas/testsuite/gas/mips/mips4@div64.d +++ binutils-gdb/gas/testsuite/gas/mips/mips4@div64.d @@ -1,5 +1,5 @@ #as: -32 -#objdump: -dr --prefix-addresses +#objdump: -dr --prefix-addresses --show-raw-insn #name: MIPS 64-bit div #source: div64.s #dump: mips3@div64.d Index: binutils-gdb/gas/testsuite/gas/mips/mips5@div.d =================================================================== --- binutils-gdb.orig/gas/testsuite/gas/mips/mips5@div.d +++ binutils-gdb/gas/testsuite/gas/mips/mips5@div.d @@ -1,5 +1,5 @@ #as: -32 -#objdump: -dr --prefix-addresses +#objdump: -drz --prefix-addresses --show-raw-insn #name: MIPS div #source: div.s #dump: mips1@div.d Index: binutils-gdb/gas/testsuite/gas/mips/mips5@div64.d =================================================================== --- binutils-gdb.orig/gas/testsuite/gas/mips/mips5@div64.d +++ binutils-gdb/gas/testsuite/gas/mips/mips5@div64.d @@ -1,5 +1,5 @@ #as: -32 -#objdump: -dr --prefix-addresses +#objdump: -dr --prefix-addresses --show-raw-insn #name: MIPS 64-bit div #source: div64.s #dump: mips3@div64.d Index: binutils-gdb/gas/testsuite/gas/mips/r3000@div-trap.d =================================================================== --- binutils-gdb.orig/gas/testsuite/gas/mips/r3000@div-trap.d +++ binutils-gdb/gas/testsuite/gas/mips/r3000@div-trap.d @@ -1,5 +1,5 @@ #as: -32 -trap -#objdump: -dr --prefix-addresses +#objdump: -drz --prefix-addresses --show-raw-insn #name: MIPS div with traps #source: div.s #dump: mips1@div.d Index: binutils-gdb/gas/testsuite/gas/mips/r3000@div.d =================================================================== --- binutils-gdb.orig/gas/testsuite/gas/mips/r3000@div.d +++ binutils-gdb/gas/testsuite/gas/mips/r3000@div.d @@ -1,5 +1,5 @@ #as: -32 -#objdump: -dr --prefix-addresses +#objdump: -drz --prefix-addresses --show-raw-insn #name: MIPS div #source: div.s #dump: mips1@div.d Index: binutils-gdb/gas/testsuite/gas/mips/r3900@div-trap.d =================================================================== --- binutils-gdb.orig/gas/testsuite/gas/mips/r3900@div-trap.d +++ binutils-gdb/gas/testsuite/gas/mips/r3900@div-trap.d @@ -1,5 +1,5 @@ #as: -32 -trap -#objdump: -dr --prefix-addresses +#objdump: -drz --prefix-addresses --show-raw-insn #name: MIPS div with traps #source: div.s #dump: mips1@div.d Index: binutils-gdb/gas/testsuite/gas/mips/r3900@div.d =================================================================== --- binutils-gdb.orig/gas/testsuite/gas/mips/r3900@div.d +++ binutils-gdb/gas/testsuite/gas/mips/r3900@div.d @@ -1,5 +1,5 @@ #as: -32 -#objdump: -dr --prefix-addresses +#objdump: -drz --prefix-addresses --show-raw-insn #name: MIPS div #source: div.s #dump: mips1@div.d Index: binutils-gdb/gas/testsuite/gas/mips/r4000@div.d =================================================================== --- binutils-gdb.orig/gas/testsuite/gas/mips/r4000@div.d +++ binutils-gdb/gas/testsuite/gas/mips/r4000@div.d @@ -1,5 +1,5 @@ #as: -32 -#objdump: -dr --prefix-addresses +#objdump: -drz --prefix-addresses --show-raw-insn #name: MIPS div #source: div.s #dump: mips1@div.d Index: binutils-gdb/gas/testsuite/gas/mips/r4000@div64.d =================================================================== --- binutils-gdb.orig/gas/testsuite/gas/mips/r4000@div64.d +++ binutils-gdb/gas/testsuite/gas/mips/r4000@div64.d @@ -1,5 +1,5 @@ #as: -32 -#objdump: -dr --prefix-addresses +#objdump: -dr --prefix-addresses --show-raw-insn #name: MIPS 64-bit div #source: div64.s #dump: mips3@div64.d Index: binutils-gdb/gas/testsuite/gas/mips/vr5400@div.d =================================================================== --- binutils-gdb.orig/gas/testsuite/gas/mips/vr5400@div.d +++ binutils-gdb/gas/testsuite/gas/mips/vr5400@div.d @@ -1,5 +1,5 @@ #as: -32 -#objdump: -dr --prefix-addresses +#objdump: -drz --prefix-addresses --show-raw-insn #name: MIPS div #source: div.s #dump: mips1@div.d Index: binutils-gdb/gas/testsuite/gas/mips/vr5400@div64.d =================================================================== --- binutils-gdb.orig/gas/testsuite/gas/mips/vr5400@div64.d +++ binutils-gdb/gas/testsuite/gas/mips/vr5400@div64.d @@ -1,5 +1,5 @@ #as: -32 -#objdump: -dr --prefix-addresses +#objdump: -dr --prefix-addresses --show-raw-insn #name: MIPS 64-bit div #source: div64.s #dump: mips3@div64.d From patchwork Sun Sep 15 14:29:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Maciej W. Rozycki" X-Patchwork-Id: 97566 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A9106385842C for ; Sun, 15 Sep 2024 14:30:11 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from angie.orcam.me.uk (angie.orcam.me.uk [78.133.224.34]) by sourceware.org (Postfix) with ESMTP id 659CE3858435 for ; Sun, 15 Sep 2024 14:29:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 659CE3858435 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=orcam.me.uk Authentication-Results: sourceware.org; spf=none smtp.mailfrom=orcam.me.uk ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 659CE3858435 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=78.133.224.34 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1726410577; cv=none; b=gY/4JROXXl7SKr4qZGq9/7QV35aelhB+bIRk21ALvEc+rFu+tERWys8Y+nHuT4gPvBT9xn2VfPKXw9kKdvzBPt9xxZI877/0u8nfIOAwoBb/Ot6g/8d/QdoG7KhHiXVdSOzmtOqK5+2DqKN9uXMy64DYp3xiRehlqPiG6cPgmF0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1726410577; c=relaxed/simple; bh=tGuosXJLe3ZsgF7Vyq0Gsba+LGUpHELwAcW0XwuEJF4=; h=Date:From:To:Subject:Message-ID:MIME-Version; b=M4dk3Ijub+g9fxm8WJ1AJVhK6QVC0gd+uXJi8A4rKeZN7TzsY7oKp77o/BQGvv/GS6JZXmjz5bTnKyWj+8qveleaSpG+oMolkGfzHlqk/wIKaZgOC9rbv/iWF/w0m0FvDqECuEvPubDzOXTfU8NSTKRUZPLithMbA/Y4jyC6SiA= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by angie.orcam.me.uk (Postfix, from userid 500) id E50CA92009D; Sun, 15 Sep 2024 16:29:33 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by angie.orcam.me.uk (Postfix) with ESMTP id E166992009B for ; Sun, 15 Sep 2024 15:29:33 +0100 (BST) Date: Sun, 15 Sep 2024 15:29:33 +0100 (BST) From: "Maciej W. Rozycki" To: binutils@sourceware.org Subject: [committed 2/2] MIPS/GAS: Discard redundant instruction from DDIV/DREM macros In-Reply-To: Message-ID: References: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 X-Spam-Status: No, score=-1162.6 required=5.0 tests=BAYES_00, KAM_ASCII_DIVIDERS, KAM_DMARC_STATUS, KAM_INFOUSMEBIZ, KAM_LAZY_DOMAIN_SECURITY, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces~patchwork=sourceware.org@sourceware.org A sequence such as: li at,-1 bne xx,at,0f li at,1 dsll32 at,at,0x1f is produced in the expansion of the DDIV and DREM assembly macros, where a redundant `li at,1' instruction is used to load an intermediate value of 1 into $at, which is then left-shifted by 63 with `dsll32 at,at,0x1f' yielding 0x8000000000000000. However this value likewise results from left-shifting the value of -1, already present in $at at this point. Remove the extraneous instruction then, shortening the sequence emitted. Adjust dumps in the testsuite accordingly. --- gas/config/tc-mips.c | 5 +---- gas/testsuite/gas/mips/div64-trap.d | 3 +-- gas/testsuite/gas/mips/div64.d | 3 +-- gas/testsuite/gas/mips/micromips-compact.d | 3 --- gas/testsuite/gas/mips/micromips-insn32.d | 3 --- gas/testsuite/gas/mips/micromips-noinsn32.d | 3 --- gas/testsuite/gas/mips/micromips-trap.d | 3 --- gas/testsuite/gas/mips/micromips.d | 3 --- gas/testsuite/gas/mips/micromips@div64-trap.d | 1 - gas/testsuite/gas/mips/micromips@div64.d | 1 - gas/testsuite/gas/mips/mips3@div64-trap.d | 3 +-- gas/testsuite/gas/mips/mips3@div64.d | 3 +-- 12 files changed, 5 insertions(+), 29 deletions(-) binutils-mips-gas-ddiv-drem-overflow.diff Index: binutils-gdb/gas/config/tc-mips.c =================================================================== --- binutils-gdb.orig/gas/config/tc-mips.c +++ binutils-gdb/gas/config/tc-mips.c @@ -10831,13 +10831,10 @@ macro (struct mips_cl_insn *ip, char *st if (mips_opts.micromips) micromips_label_expr (&label_expr); else - label_expr.X_add_number = (mips_use_trap () - ? (dbl ? 12 : 8) : (dbl ? 20 : 16)); + label_expr.X_add_number = mips_use_trap () ? 8 : 16; macro_build (&label_expr, "bne", "s,t,p", op[2], AT); if (dbl) { - expr1.X_add_number = 1; - load_register (AT, &expr1, dbl); macro_build (NULL, "dsll32", SHFT_FMT, AT, AT, 31); } else Index: binutils-gdb/gas/testsuite/gas/mips/div64-trap.d =================================================================== --- binutils-gdb.orig/gas/testsuite/gas/mips/div64-trap.d +++ binutils-gdb/gas/testsuite/gas/mips/div64-trap.d @@ -11,8 +11,7 @@ [0-9a-f]+ <[^>]*> 00c001f4 teq a2,zero,0x7 [0-9a-f]+ <[^>]*> 00a6001e ddiv zero,a1,a2 [0-9a-f]+ <[^>]*> 2401ffff li at,-1 -[0-9a-f]+ <[^>]*> 14c10003 bne a2,at,[0-9a-f]+ <[^>]*> -[0-9a-f]+ <[^>]*> 24010001 li at,1 +[0-9a-f]+ <[^>]*> 14c10002 bne a2,at,[0-9a-f]+ <[^>]*> [0-9a-f]+ <[^>]*> 00010ffc dsll32 at,at,0x1f [0-9a-f]+ <[^>]*> 00a101b4 teq a1,at,0x6 [0-9a-f]+ <[^>]*> 00002012 mflo a0 Index: binutils-gdb/gas/testsuite/gas/mips/div64.d =================================================================== --- binutils-gdb.orig/gas/testsuite/gas/mips/div64.d +++ binutils-gdb/gas/testsuite/gas/mips/div64.d @@ -11,8 +11,7 @@ [0-9a-f]+ <[^>]*> 00a6001e ddiv zero,a1,a2 [0-9a-f]+ <[^>]*> 0007000d break 0x7 [0-9a-f]+ <[^>]*> 2401ffff li at,-1 -[0-9a-f]+ <[^>]*> 14c10005 bne a2,at,[0-9a-f]+ <[^>]*> -[0-9a-f]+ <[^>]*> 24010001 li at,1 +[0-9a-f]+ <[^>]*> 14c10004 bne a2,at,[0-9a-f]+ <[^>]*> [0-9a-f]+ <[^>]*> 00010ffc dsll32 at,at,0x1f [0-9a-f]+ <[^>]*> 14a10002 bne a1,at,[0-9a-f]+ <[^>]*> [0-9a-f]+ <[^>]*> 00000000 nop Index: binutils-gdb/gas/testsuite/gas/mips/micromips-compact.d =================================================================== --- binutils-gdb.orig/gas/testsuite/gas/mips/micromips-compact.d +++ binutils-gdb/gas/testsuite/gas/mips/micromips-compact.d @@ -6523,7 +6523,6 @@ [ 0-9a-f]+: 3020 ffff li at,-1 [ 0-9a-f]+: b424 fffe bne a0,at,[0-9a-f]+ <.*\+0x[0-9a-f]+> [ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 .* -[ 0-9a-f]+: 3020 0001 li at,1 [ 0-9a-f]+: 5821 f808 dsll32 at,at,0x1f [ 0-9a-f]+: b423 fffe bne v1,at,[0-9a-f]+ <.*\+0x[0-9a-f]+> [ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 .* @@ -6960,7 +6959,6 @@ [ 0-9a-f]+: 3020 ffff li at,-1 [ 0-9a-f]+: b423 fffe bne v1,at,[0-9a-f]+ <.*\+0x[0-9a-f]+> [ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 .* -[ 0-9a-f]+: 3020 0001 li at,1 [ 0-9a-f]+: 5821 f808 dsll32 at,at,0x1f [ 0-9a-f]+: b420 fffe bne zero,at,[0-9a-f]+ <.*\+0x[0-9a-f]+> [ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 .* @@ -6978,7 +6976,6 @@ [ 0-9a-f]+: 3020 ffff li at,-1 [ 0-9a-f]+: b43f fffe bne ra,at,[0-9a-f]+ <.*\+0x[0-9a-f]+> [ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 .* -[ 0-9a-f]+: 3020 0001 li at,1 [ 0-9a-f]+: 5821 f808 dsll32 at,at,0x1f [ 0-9a-f]+: b420 fffe bne zero,at,[0-9a-f]+ <.*\+0x[0-9a-f]+> [ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 .* Index: binutils-gdb/gas/testsuite/gas/mips/micromips-insn32.d =================================================================== --- binutils-gdb.orig/gas/testsuite/gas/mips/micromips-insn32.d +++ binutils-gdb/gas/testsuite/gas/mips/micromips-insn32.d @@ -6547,7 +6547,6 @@ [ 0-9a-f]+: 3020 ffff li at,-1 [ 0-9a-f]+: b424 fffe bne a0,at,[0-9a-f]+ <.*\+0x[0-9a-f]+> [ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 .* -[ 0-9a-f]+: 3020 0001 li at,1 [ 0-9a-f]+: 5821 f808 dsll32 at,at,0x1f [ 0-9a-f]+: b423 fffe bne v1,at,[0-9a-f]+ <.*\+0x[0-9a-f]+> [ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 .* @@ -6984,7 +6983,6 @@ [ 0-9a-f]+: 3020 ffff li at,-1 [ 0-9a-f]+: b423 fffe bne v1,at,[0-9a-f]+ <.*\+0x[0-9a-f]+> [ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 .* -[ 0-9a-f]+: 3020 0001 li at,1 [ 0-9a-f]+: 5821 f808 dsll32 at,at,0x1f [ 0-9a-f]+: b420 fffe bne zero,at,[0-9a-f]+ <.*\+0x[0-9a-f]+> [ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 .* @@ -7002,7 +7000,6 @@ [ 0-9a-f]+: 3020 ffff li at,-1 [ 0-9a-f]+: b43f fffe bne ra,at,[0-9a-f]+ <.*\+0x[0-9a-f]+> [ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 .* -[ 0-9a-f]+: 3020 0001 li at,1 [ 0-9a-f]+: 5821 f808 dsll32 at,at,0x1f [ 0-9a-f]+: b420 fffe bne zero,at,[0-9a-f]+ <.*\+0x[0-9a-f]+> [ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 .* Index: binutils-gdb/gas/testsuite/gas/mips/micromips-noinsn32.d =================================================================== --- binutils-gdb.orig/gas/testsuite/gas/mips/micromips-noinsn32.d +++ binutils-gdb/gas/testsuite/gas/mips/micromips-noinsn32.d @@ -6524,7 +6524,6 @@ [ 0-9a-f]+: 3020 ffff li at,-1 [ 0-9a-f]+: b424 fffe bne a0,at,[0-9a-f]+ <.*\+0x[0-9a-f]+> [ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 .* -[ 0-9a-f]+: 3020 0001 li at,1 [ 0-9a-f]+: 5821 f808 dsll32 at,at,0x1f [ 0-9a-f]+: b423 fffe bne v1,at,[0-9a-f]+ <.*\+0x[0-9a-f]+> [ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 .* @@ -6961,7 +6960,6 @@ [ 0-9a-f]+: 3020 ffff li at,-1 [ 0-9a-f]+: b423 fffe bne v1,at,[0-9a-f]+ <.*\+0x[0-9a-f]+> [ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 .* -[ 0-9a-f]+: 3020 0001 li at,1 [ 0-9a-f]+: 5821 f808 dsll32 at,at,0x1f [ 0-9a-f]+: b420 fffe bne zero,at,[0-9a-f]+ <.*\+0x[0-9a-f]+> [ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 .* @@ -6979,7 +6977,6 @@ [ 0-9a-f]+: 3020 ffff li at,-1 [ 0-9a-f]+: b43f fffe bne ra,at,[0-9a-f]+ <.*\+0x[0-9a-f]+> [ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 .* -[ 0-9a-f]+: 3020 0001 li at,1 [ 0-9a-f]+: 5821 f808 dsll32 at,at,0x1f [ 0-9a-f]+: b420 fffe bne zero,at,[0-9a-f]+ <.*\+0x[0-9a-f]+> [ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 .* Index: binutils-gdb/gas/testsuite/gas/mips/micromips-trap.d =================================================================== --- binutils-gdb.orig/gas/testsuite/gas/mips/micromips-trap.d +++ binutils-gdb/gas/testsuite/gas/mips/micromips-trap.d @@ -6526,7 +6526,6 @@ [ 0-9a-f]+: 3020 ffff li at,-1 [ 0-9a-f]+: b424 fffe bne a0,at,[0-9a-f]+ <.*\+0x[0-9a-f]+> [ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 .* -[ 0-9a-f]+: 3020 0001 li at,1 [ 0-9a-f]+: 5821 f808 dsll32 at,at,0x1f [ 0-9a-f]+: 0023 603c teq v1,at,0x6 @@ -6928,7 +6927,6 @@ [ 0-9a-f]+: 3020 ffff li at,-1 [ 0-9a-f]+: b423 fffe bne v1,at,[0-9a-f]+ <.*\+0x[0-9a-f]+> [ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 .* -[ 0-9a-f]+: 3020 0001 li at,1 [ 0-9a-f]+: 5821 f808 dsll32 at,at,0x1f [ 0-9a-f]+: 0020 603c teq zero,at,0x6 @@ -6939,7 +6937,6 @@ [ 0-9a-f]+: 3020 ffff li at,-1 [ 0-9a-f]+: b43f fffe bne ra,at,[0-9a-f]+ <.*\+0x[0-9a-f]+> [ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 .* -[ 0-9a-f]+: 3020 0001 li at,1 [ 0-9a-f]+: 5821 f808 dsll32 at,at,0x1f [ 0-9a-f]+: 0020 603c teq zero,at,0x6 Index: binutils-gdb/gas/testsuite/gas/mips/micromips.d =================================================================== --- binutils-gdb.orig/gas/testsuite/gas/mips/micromips.d +++ binutils-gdb/gas/testsuite/gas/mips/micromips.d @@ -6602,7 +6602,6 @@ [ 0-9a-f]+: 3020 ffff li at,-1 [ 0-9a-f]+: b424 fffe bne a0,at,[0-9a-f]+ <.*\+0x[0-9a-f]+> [ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 .* -[ 0-9a-f]+: 3020 0001 li at,1 [ 0-9a-f]+: 5821 f808 dsll32 at,at,0x1f [ 0-9a-f]+: b423 fffe bne v1,at,[0-9a-f]+ <.*\+0x[0-9a-f]+> [ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 .* @@ -7039,7 +7038,6 @@ [ 0-9a-f]+: 3020 ffff li at,-1 [ 0-9a-f]+: b423 fffe bne v1,at,[0-9a-f]+ <.*\+0x[0-9a-f]+> [ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 .* -[ 0-9a-f]+: 3020 0001 li at,1 [ 0-9a-f]+: 5821 f808 dsll32 at,at,0x1f [ 0-9a-f]+: b420 fffe bne zero,at,[0-9a-f]+ <.*\+0x[0-9a-f]+> [ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 .* @@ -7057,7 +7055,6 @@ [ 0-9a-f]+: 3020 ffff li at,-1 [ 0-9a-f]+: b43f fffe bne ra,at,[0-9a-f]+ <.*\+0x[0-9a-f]+> [ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 .* -[ 0-9a-f]+: 3020 0001 li at,1 [ 0-9a-f]+: 5821 f808 dsll32 at,at,0x1f [ 0-9a-f]+: b420 fffe bne zero,at,[0-9a-f]+ <.*\+0x[0-9a-f]+> [ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 .* Index: binutils-gdb/gas/testsuite/gas/mips/micromips@div64-trap.d =================================================================== --- binutils-gdb.orig/gas/testsuite/gas/mips/micromips@div64-trap.d +++ binutils-gdb/gas/testsuite/gas/mips/micromips@div64-trap.d @@ -13,7 +13,6 @@ [0-9a-f]+ <[^>]*> 3020 ffff li at,-1 [0-9a-f]+ <[^>]*> b426 fffe bne a2,at,[0-9a-f]+ <[^>]*> [0-9a-f]+: R_MICROMIPS_PC16_S1 \.L\^_0 -[0-9a-f]+ <[^>]*> 3020 0001 li at,1 [0-9a-f]+ <[^>]*> 5821 f808 dsll32 at,at,0x1f [0-9a-f]+ <[^>]*> 0025 603c teq a1,at,0x6 [0-9a-f]+ <\.L\^_0> 4644 mflo a0 Index: binutils-gdb/gas/testsuite/gas/mips/micromips@div64.d =================================================================== --- binutils-gdb.orig/gas/testsuite/gas/mips/micromips@div64.d +++ binutils-gdb/gas/testsuite/gas/mips/micromips@div64.d @@ -15,7 +15,6 @@ [0-9a-f]+ <\.L\^_0> 3020 ffff li at,-1 [0-9a-f]+ <[^>]*> b426 fffe bne a2,at,[0-9a-f]+ <[^>]*> [0-9a-f]+: R_MICROMIPS_PC16_S1 \.L\^_1 -[0-9a-f]+ <[^>]*> 3020 0001 li at,1 [0-9a-f]+ <[^>]*> 5821 f808 dsll32 at,at,0x1f [0-9a-f]+ <[^>]*> b425 fffe bne a1,at,[0-9a-f]+ <[^>]*> [0-9a-f]+: R_MICROMIPS_PC16_S1 \.L\^_1 Index: binutils-gdb/gas/testsuite/gas/mips/mips3@div64-trap.d =================================================================== --- binutils-gdb.orig/gas/testsuite/gas/mips/mips3@div64-trap.d +++ binutils-gdb/gas/testsuite/gas/mips/mips3@div64-trap.d @@ -11,8 +11,7 @@ [0-9a-f]+ <[^>]*> 00c001f4 teq a2,zero,0x7 [0-9a-f]+ <[^>]*> 00a6001e ddiv zero,a1,a2 [0-9a-f]+ <[^>]*> 2401ffff li at,-1 -[0-9a-f]+ <[^>]*> 14c10003 bne a2,at,[0-9a-f]+ <[^>]*> -[0-9a-f]+ <[^>]*> 24010001 li at,1 +[0-9a-f]+ <[^>]*> 14c10002 bne a2,at,[0-9a-f]+ <[^>]*> [0-9a-f]+ <[^>]*> 00010ffc dsll32 at,at,0x1f [0-9a-f]+ <[^>]*> 00a101b4 teq a1,at,0x6 [0-9a-f]+ <[^>]*> 00002012 mflo a0 Index: binutils-gdb/gas/testsuite/gas/mips/mips3@div64.d =================================================================== --- binutils-gdb.orig/gas/testsuite/gas/mips/mips3@div64.d +++ binutils-gdb/gas/testsuite/gas/mips/mips3@div64.d @@ -12,8 +12,7 @@ [0-9a-f]+ <[^>]*> 00a6001e ddiv zero,a1,a2 [0-9a-f]+ <[^>]*> 0007000d break 0x7 [0-9a-f]+ <[^>]*> 2401ffff li at,-1 -[0-9a-f]+ <[^>]*> 14c10005 bne a2,at,[0-9a-f]+ <[^>]*> -[0-9a-f]+ <[^>]*> 24010001 li at,1 +[0-9a-f]+ <[^>]*> 14c10004 bne a2,at,[0-9a-f]+ <[^>]*> [0-9a-f]+ <[^>]*> 00010ffc dsll32 at,at,0x1f [0-9a-f]+ <[^>]*> 14a10002 bne a1,at,[0-9a-f]+ <[^>]*> [0-9a-f]+ <[^>]*> 00000000 nop