From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25440 invoked by alias); 20 Apr 2007 13:40:25 -0000 Received: (qmail 25416 invoked by uid 22791); 20 Apr 2007 13:40:21 -0000 X-Spam-Check-By: sourceware.org Received: from omta01ps.mx.bigpond.com (HELO omta01ps.mx.bigpond.com) (144.140.82.153) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 20 Apr 2007 14:40:16 +0100 Received: from oaamta01ps.mx.bigpond.com ([144.136.165.71]) by omta01ps.mx.bigpond.com with ESMTP id <20070420134012.KLVU19666.omta01ps.mx.bigpond.com@oaamta01ps.mx.bigpond.com> for ; Fri, 20 Apr 2007 13:40:12 +0000 Received: from bubble.grove.modra.org ([144.136.165.71]) by oaamta01ps.mx.bigpond.com with ESMTP id <20070420134012.WWHX9311.oaamta01ps.mx.bigpond.com@bubble.grove.modra.org> for ; Fri, 20 Apr 2007 13:40:12 +0000 Received: by bubble.grove.modra.org (Postfix, from userid 500) id 111C733BDA3; Fri, 20 Apr 2007 23:10:11 +0930 (CST) Date: Fri, 20 Apr 2007 13:50:00 -0000 From: Alan Modra To: binutils@sourceware.org Subject: Re: powerpc opcode table checks Message-ID: <20070420134011.GK6840@bubble.grove.modra.org> Mail-Followup-To: binutils@sourceware.org References: <20070420123126.GJ6840@bubble.grove.modra.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20070420123126.GJ6840@bubble.grove.modra.org> User-Agent: Mutt/1.5.9i X-IsSubscribed: yes 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: 2007-04/txt/msg00263.txt.bz2 I should have tested the error cases better before committing. This fixes some silly mistakes, and adds somes tests. gas/ * messages.c (as_internal_value_out_of_range): Fix typo in error message. Return after printing domain error. * config/tc-ppc.c (ppc_insert_operand): Preserve low zero bits in max when shifting right. gas/testsuite * gas/ppc/range64.s: New. * gas/ppc/range64.l: New. * gas/ppc/range.s: New. * gas/ppc/range.l: New. * gas/ppc/ppc.exp (run_list_test): New. Use to run new tests. Index: gas/messages.c =================================================================== RCS file: /cvs/src/src/gas/messages.c,v retrieving revision 1.18 diff -u -p -r1.18 messages.c --- gas/messages.c 20 Apr 2007 12:25:14 -0000 1.18 +++ gas/messages.c 20 Apr 2007 13:15:40 -0000 @@ -464,13 +464,14 @@ as_internal_value_out_of_range (char * abort (); /* xgettext:c-format */ - err = _("%s out of domain (%d is not a multiple of %d"); + err = _("%s out of domain (%d is not a multiple of %d)"); if (bad) as_bad_where (file, line, err, prefix, (int) val, (int) right); else as_warn_where (file, line, err, prefix, (int) val, (int) right); + return; } if ( val < HEX_MAX_THRESHOLD Index: gas/config/tc-ppc.c =================================================================== RCS file: /cvs/src/src/gas/config/tc-ppc.c,v retrieving revision 1.116 diff -u -p -r1.116 tc-ppc.c --- gas/config/tc-ppc.c 20 Apr 2007 12:25:15 -0000 1.116 +++ gas/config/tc-ppc.c 20 Apr 2007 13:15:44 -0000 @@ -1508,8 +1508,8 @@ ppc_insert_operand (insn, operand, val, if ((operand->flags & PPC_OPERAND_SIGNED) != 0) { if ((operand->flags & PPC_OPERAND_SIGNOPT) == 0) - max >>= 1; - min = ~(max | ((max & -max) - 1)) ; + max = (max >> 1) & -right; + min = ~max & -right; if (!ppc_obj64) { Index: gas/testsuite/gas/ppc/ppc.exp =================================================================== RCS file: /cvs/src/src/gas/testsuite/gas/ppc/ppc.exp,v retrieving revision 1.12 diff -u -p -r1.12 ppc.exp --- gas/testsuite/gas/ppc/ppc.exp 24 Oct 2006 01:27:29 -0000 1.12 +++ gas/testsuite/gas/ppc/ppc.exp 20 Apr 2007 13:15:52 -0000 @@ -2,6 +2,19 @@ # Some PowerPC tests # +proc run_list_test { name opts } { + global srcdir subdir + set testname "ppc $name" + set file $srcdir/$subdir/$name + gas_run ${name}.s $opts ">&dump.out" + if { [regexp_diff "dump.out" "${file}.l"] } then { + fail $testname + verbose "output is [file_contents "dump.out"]" 2 + return + } + pass $testname +} + # These tests are currently ELF specific, only because nobody has # converted them to look for XCOFF relocations. @@ -12,6 +25,7 @@ if { [istarget powerpc64*-*-*] || [istar run_dump_test "test1elf64" run_dump_test "power4" run_dump_test "cell" + run_list_test "range64" "-a64" } elseif { [istarget powerpc*-*aix*] } then { run_dump_test "test1xcoff32" } elseif { [istarget powerpc*-*-*bsd*] \ @@ -39,5 +53,6 @@ if { [istarget powerpc*-*-*] } then { run_dump_test "altivec" run_dump_test "booke" run_dump_test "e500" + run_list_test "range" "-a32" } } Index: gas/testsuite/gas/ppc/range64.l =================================================================== RCS file: gas/testsuite/gas/ppc/range64.l diff -N gas/testsuite/gas/ppc/range64.l --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gas/testsuite/gas/ppc/range64.l 20 Apr 2007 13:25:28 -0000 @@ -0,0 +1,6 @@ +.*: Assembler messages: +.*:3: Error: operand out of domain \(-1 is not a multiple of 4\) +.*:4: Error: operand out of domain \(2 is not a multiple of 4\) +.*:5: Error: operand out of range.* +.*:6: Error: operand out of range.* +.*:7: Error: operand out of range.* Index: gas/testsuite/gas/ppc/range64.s =================================================================== RCS file: gas/testsuite/gas/ppc/range64.s diff -N gas/testsuite/gas/ppc/range64.s --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gas/testsuite/gas/ppc/range64.s 20 Apr 2007 13:25:28 -0000 @@ -0,0 +1,7 @@ + .text + ld 4,-32768(3) + ld 5,-1(3) + ld 6,2(3) + ld 7,32767(3) + ld 8,32768(3) + ld 9,-32769(3) Index: gas/testsuite/gas/ppc/range.l =================================================================== RCS file: gas/testsuite/gas/ppc/range.l diff -N gas/testsuite/gas/ppc/range.l --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gas/testsuite/gas/ppc/range.l 20 Apr 2007 13:25:28 -0000 @@ -0,0 +1,3 @@ +.*: Assembler messages: +.*:6: Error: operand out of range.* +.*:7: Error: operand out of range.* Index: gas/testsuite/gas/ppc/range.s =================================================================== RCS file: gas/testsuite/gas/ppc/range.s diff -N gas/testsuite/gas/ppc/range.s --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gas/testsuite/gas/ppc/range.s 20 Apr 2007 13:25:28 -0000 @@ -0,0 +1,7 @@ + .text + lbz 4,-32768(3) + lbz 5,-1(3) + lbz 6,2(3) + lbz 7,32767(3) + lbz 8,32768(3) + lbz 9,-32769(3) -- Alan Modra IBM OzLabs - Linux Technology Centre