From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11855 invoked by alias); 17 Feb 2005 00:25:01 -0000 Mailing-List: contact binutils-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sources.redhat.com Received: (qmail 11787 invoked from network); 17 Feb 2005 00:24:49 -0000 Received: from unknown (HELO iris1.csv.ica.uni-stuttgart.de) (129.69.118.2) by sourceware.org with SMTP; 17 Feb 2005 00:24:49 -0000 Received: from rembrandt.csv.ica.uni-stuttgart.de ([129.69.118.42]) by iris1.csv.ica.uni-stuttgart.de with esmtp id 1D1ZTL-00073x-00; Thu, 17 Feb 2005 01:24:47 +0100 Received: from ica2_ts by rembrandt.csv.ica.uni-stuttgart.de with local (Exim 3.35 #1 (Debian)) id 1D1ZTL-0008Eg-00; Thu, 17 Feb 2005 01:24:47 +0100 Date: Thu, 17 Feb 2005 07:10:00 -0000 To: "Maciej W. Rozycki" Cc: binutils@sources.redhat.com Subject: Re: [PATCH] MIPS gas: Fix macro expansions for .set noat Message-ID: <20050217002446.GJ1757@rembrandt.csv.ica.uni-stuttgart.de> References: <20050216154924.GG1757@rembrandt.csv.ica.uni-stuttgart.de> <20050216192153.GH1757@rembrandt.csv.ica.uni-stuttgart.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.6+20040907i From: Thiemo Seufer X-SW-Source: 2005-02/txt/msg00385.txt.bz2 Maciej W. Rozycki wrote: > On Wed, 16 Feb 2005, Thiemo Seufer wrote: > > > > More comments about that change -- as I understand our policy wrt $at > > > being used with ".set noat" in effect is to go for it regardless and only > > > issue a warning (that can be converted to an error with --fatal-warnings). > > > Therefore we shouldn't use as_bad() in this case. > > > > IMHO it should be an error if the result can't work at all. I don't > > see a case where overwriting the base register before its use could > > be the programmers intention. > > I do agree it's of questionable use and I proposed changing it a few > years ago, but I got a response as I expressed above. Then if it's to be > done, it should be done consistently for all cases -- replacing respective > as_warn() calls with as_bad() ones should be the right way. Hm, OTOH it could simply be sloppy coding, and falling over it is not necessarily the right thing to do. I plan to commit the appended patch, it partially reverts the earlier change. Comments? Thiemo 2005-02-16 Thiemo Seufer /gas/ChangeLog * config/tc-mips.c (macro): Don't fail but warn on $at uses after .set noat, it may only be sloppy coding. Don't try to avoid $at use by sacrificing the target register before it is stored, it won't work. /gas/testsuite/ChangeLog * gas/mips/noat-1.s, gas/mips/noat-1.d, gas/mips/noat-2.s, gas/mips/noat2.l, gas/mips/noat-3.s, gas/mips/noat-3.l, gas/mips/noat-4.s, gas/mips/noat-4.l, gas/mips/noat-5.s, gas/mips/noat-5.l, gas/mips/noat-6.s, gas/mips/noat-6.l, gas/mips/noat-7.s, gas/mips/noat-7.l: New files, testcases for .set noat and macro expansion. * gas/mips/mips.exp: Run new testcases. Index: gas/config/tc-mips.c =================================================================== RCS file: /cvs/src/src/gas/config/tc-mips.c,v retrieving revision 1.282 diff -u -p -r1.282 tc-mips.c --- gas/config/tc-mips.c 16 Feb 2005 15:49:13 -0000 1.282 +++ gas/config/tc-mips.c 16 Feb 2005 23:26:33 -0000 @@ -5761,23 +5761,14 @@ macro (struct mips_cl_insn *ip) case M_LWU_AB: s = "lwu"; ld: - /* XXX Why don't we try to use AT for all expansions? */ - if (!mips_opts.noat && (breg == treg || coproc || lr)) + if (breg == treg || coproc || lr) { tempreg = AT; used_at = 1; } - else if (breg == treg - && (offset_expr.X_op != O_constant - || (offset_expr.X_add_number > 0x7fff - || offset_expr.X_add_number < -0x8000))) - { - as_bad(_("load expansion needs $at register")); - } else { tempreg = treg; - used_at = 0; } goto ld_st; case M_SB_AB: @@ -5847,23 +5838,8 @@ macro (struct mips_cl_insn *ip) case M_SDR_AB: s = "sdr"; st: - if (!mips_opts.noat) - { - tempreg = AT; - used_at = 1; - } - else if (breg == treg - && (offset_expr.X_op != O_constant - || (offset_expr.X_add_number > 0x7fff - || offset_expr.X_add_number < -0x8000))) - { - as_bad(_("store expansion needs $at register")); - } - else - { - tempreg = treg; - used_at = 0; - } + tempreg = AT; + used_at = 1; ld_st: /* Itbl support may require additional care here. */ if (mask == M_LWC1_AB Index: gas/testsuite/gas/mips/mips.exp =================================================================== RCS file: /cvs/src/src/gas/testsuite/gas/mips/mips.exp,v retrieving revision 1.98 diff -u -p -r1.98 mips.exp --- gas/testsuite/gas/mips/mips.exp 15 Feb 2005 19:57:53 -0000 1.98 +++ gas/testsuite/gas/mips/mips.exp 16 Feb 2005 23:26:35 -0000 @@ -738,4 +738,12 @@ if { [istarget mips*-*-*] } then { run_dump_test "macro-warn-1-n32" run_dump_test "macro-warn-2-n32" } + + run_dump_test "noat-1" + run_list_test "noat-2" "" + run_list_test "noat-3" "" + run_list_test "noat-4" "" + run_list_test "noat-5" "" + run_list_test "noat-6" "" + run_list_test "noat-7" "" } Index: gas/testsuite/gas/mips/noat-1.d =================================================================== RCS file: gas/testsuite/gas/mips/noat-1.d diff -N gas/testsuite/gas/mips/noat-1.d --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gas/testsuite/gas/mips/noat-1.d 16 Feb 2005 23:26:35 -0000 @@ -0,0 +1,15 @@ +#as: -32 +#objdump: -dr + +.*: +file format .*mips + +Disassembly of section \.text: + +00000000 <\.text>: + 0: 8f7b7fff lw k1,32767\(k1\) + 4: 00000000 nop + 8: 8f7b8000 lw k1,-32768\(k1\) + c: 00000000 nop + 10: af7b7fff sw k1,32767\(k1\) + 14: af7b8000 sw k1,-32768\(k1\) + \.\.\. Index: gas/testsuite/gas/mips/noat-1.s =================================================================== RCS file: gas/testsuite/gas/mips/noat-1.s diff -N gas/testsuite/gas/mips/noat-1.s --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gas/testsuite/gas/mips/noat-1.s 16 Feb 2005 23:26:35 -0000 @@ -0,0 +1,7 @@ + .set noat + lw $27, 0x7fff($27) + lw $27, -0x8000($27) + sw $27, 0x7fff($27) + sw $27, -0x8000($27) + + .space 8 Index: gas/testsuite/gas/mips/noat-2.l =================================================================== RCS file: gas/testsuite/gas/mips/noat-2.l diff -N gas/testsuite/gas/mips/noat-2.l --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gas/testsuite/gas/mips/noat-2.l 16 Feb 2005 23:26:35 -0000 @@ -0,0 +1,2 @@ +.*\.s: Assembler messages: +.*\.s:2: Warning: Macro used \$at after "\.set noat" Index: gas/testsuite/gas/mips/noat-2.s =================================================================== RCS file: gas/testsuite/gas/mips/noat-2.s diff -N gas/testsuite/gas/mips/noat-2.s --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gas/testsuite/gas/mips/noat-2.s 16 Feb 2005 23:26:35 -0000 @@ -0,0 +1,4 @@ + .set noat + lw $27, 0x8000($27) + + .space 8 Index: gas/testsuite/gas/mips/noat-3.l =================================================================== RCS file: gas/testsuite/gas/mips/noat-3.l diff -N gas/testsuite/gas/mips/noat-3.l --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gas/testsuite/gas/mips/noat-3.l 16 Feb 2005 23:26:35 -0000 @@ -0,0 +1,2 @@ +.*\.s: Assembler messages: +.*\.s:2: Warning: Macro used \$at after "\.set noat" Index: gas/testsuite/gas/mips/noat-3.s =================================================================== RCS file: gas/testsuite/gas/mips/noat-3.s diff -N gas/testsuite/gas/mips/noat-3.s --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gas/testsuite/gas/mips/noat-3.s 16 Feb 2005 23:26:35 -0000 @@ -0,0 +1,4 @@ + .set noat + lw $27, -0x8001($27) + + .space 8 Index: gas/testsuite/gas/mips/noat-4.l =================================================================== RCS file: gas/testsuite/gas/mips/noat-4.l diff -N gas/testsuite/gas/mips/noat-4.l --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gas/testsuite/gas/mips/noat-4.l 16 Feb 2005 23:26:35 -0000 @@ -0,0 +1,2 @@ +.*\.s: Assembler messages: +.*\.s:2: Warning: Macro used \$at after "\.set noat" Index: gas/testsuite/gas/mips/noat-4.s =================================================================== RCS file: gas/testsuite/gas/mips/noat-4.s diff -N gas/testsuite/gas/mips/noat-4.s --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gas/testsuite/gas/mips/noat-4.s 16 Feb 2005 23:26:35 -0000 @@ -0,0 +1,4 @@ + .set noat + lw $27, symbol($27) + + .space 8 Index: gas/testsuite/gas/mips/noat-5.l =================================================================== RCS file: gas/testsuite/gas/mips/noat-5.l diff -N gas/testsuite/gas/mips/noat-5.l --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gas/testsuite/gas/mips/noat-5.l 16 Feb 2005 23:26:35 -0000 @@ -0,0 +1,2 @@ +.*\.s: Assembler messages: +.*\.s:2: Warning: Macro used \$at after "\.set noat" Index: gas/testsuite/gas/mips/noat-5.s =================================================================== RCS file: gas/testsuite/gas/mips/noat-5.s diff -N gas/testsuite/gas/mips/noat-5.s --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gas/testsuite/gas/mips/noat-5.s 16 Feb 2005 23:26:35 -0000 @@ -0,0 +1,4 @@ + .set noat + sw $27, 0x8000($27) + + .space 8 Index: gas/testsuite/gas/mips/noat-6.l =================================================================== RCS file: gas/testsuite/gas/mips/noat-6.l diff -N gas/testsuite/gas/mips/noat-6.l --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gas/testsuite/gas/mips/noat-6.l 16 Feb 2005 23:26:35 -0000 @@ -0,0 +1,2 @@ +.*\.s: Assembler messages: +.*\.s:2: Warning: Macro used \$at after "\.set noat" Index: gas/testsuite/gas/mips/noat-6.s =================================================================== RCS file: gas/testsuite/gas/mips/noat-6.s diff -N gas/testsuite/gas/mips/noat-6.s --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gas/testsuite/gas/mips/noat-6.s 16 Feb 2005 23:26:35 -0000 @@ -0,0 +1,4 @@ + .set noat + sw $27, -0x8001($27) + + .space 8 Index: gas/testsuite/gas/mips/noat-7.l =================================================================== RCS file: gas/testsuite/gas/mips/noat-7.l diff -N gas/testsuite/gas/mips/noat-7.l --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gas/testsuite/gas/mips/noat-7.l 16 Feb 2005 23:26:35 -0000 @@ -0,0 +1,2 @@ +.*\.s: Assembler messages: +.*\.s:2: Warning: Macro used \$at after "\.set noat" Index: gas/testsuite/gas/mips/noat-7.s =================================================================== RCS file: gas/testsuite/gas/mips/noat-7.s diff -N gas/testsuite/gas/mips/noat-7.s --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gas/testsuite/gas/mips/noat-7.s 16 Feb 2005 23:26:35 -0000 @@ -0,0 +1,4 @@ + .set noat + sw $27, symbol($27) + + .space 8