public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@bigpond.net.au>
To: binutils@sourceware.org
Subject: Re: powerpc opcode table checks
Date: Mon, 30 Apr 2007 05:05:00 -0000	[thread overview]
Message-ID: <20070430002358.GA13774@bubble.grove.modra.org> (raw)
In-Reply-To: <20070420134011.GK6840@bubble.grove.modra.org>

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

  reply	other threads:[~2007-04-30  0:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-20 12:44 Alan Modra
2007-04-20 13:50 ` Alan Modra
2007-04-30  5:05   ` Alan Modra [this message]
2007-04-30  8:21     ` Mark Ewert
2007-04-30 23:57       ` Ben Elliston

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070430002358.GA13774@bubble.grove.modra.org \
    --to=amodra@bigpond.net.au \
    --cc=binutils@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).