This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: powerpc opcode table checks


unsubscrube

On 4/29/07, Alan Modra <amodra@bigpond.net.au> wrote:
rlwinm or similar instructions can specify a bitmask rather than the
start and end bits.  Of course, the mask can cover all 32 bits.  I
don't know what I was thinking to write 0xff.

opcodes/
        PR 4436
        * ppc-opc.c (powerpc_operands): Correct bitm for second entry of MBE.
gas/
        PR 4436
        * config/tc-ppc.c (ppc_insert_operand): Disable range check if
        min > max.

Index: opcodes/ppc-opc.c
===================================================================
RCS file: /cvs/src/src/opcodes/ppc-opc.c,v
retrieving revision 1.94
diff -u -p -r1.94 ppc-opc.c
--- opcodes/ppc-opc.c   21 Apr 2007 05:14:21 -0000      1.94
+++ opcodes/ppc-opc.c   30 Apr 2007 00:15:52 -0000
@@ -317,7 +317,7 @@ const struct powerpc_operand powerpc_ope
      description in opcode/ppc.h for what this means.  */
 #define MBE ME + 1
   { 0x1f, 6, NULL, NULL, PPC_OPERAND_OPTIONAL | PPC_OPERAND_NEXT },
-  { 0xff, 0, insert_mbe, extract_mbe, 0 },
+  { -1, 0, insert_mbe, extract_mbe, 0 },

   /* The MB or ME field in an MD or MDS form instruction.  The high
      bit is wrapped to the low end.  */
Index: gas/config/tc-ppc.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-ppc.c,v
retrieving revision 1.119
diff -u -p -r1.119 tc-ppc.c
--- gas/config/tc-ppc.c 21 Apr 2007 06:54:56 -0000      1.119
+++ gas/config/tc-ppc.c 30 Apr 2007 00:15:55 -0000
@@ -1516,7 +1516,7 @@ ppc_insert_operand (insn, operand, val,
 {
   long min, max, right;
   offsetT test;
-
+
   max = operand->bitm;
   right = max & -max;
   min = 0;
@@ -1554,8 +1554,7 @@ ppc_insert_operand (insn, operand, val,
   else
     test = val;

-  if (test < (offsetT) min
-      || test > (offsetT) max
+  if ((min <= max && (test < (offsetT) min || test > (offsetT) max))
       || (test & (right - 1)) != 0)
     as_bad_value_out_of_range (_("operand"),
                               test, (offsetT) min, (offsetT) max, file, line);

--
Alan Modra
IBM OzLabs - Linux Technology Centre



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]