This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: powerpc opcode table checks
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: binutils at sourceware dot org
- Date: Fri, 20 Apr 2007 23:10:11 +0930
- Subject: Re: powerpc opcode table checks
- References: <20070420123126.GJ6840@bubble.grove.modra.org>
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