Bug 4448 - overstrict check for powerpc lswi
Summary: overstrict check for powerpc lswi
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: gas (show other bugs)
Version: 2.18
: P2 normal
Target Milestone: ---
Assignee: Alan Modra
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-05-02 07:16 UTC by Matthias Klose
Modified: 2007-05-02 11:26 UTC (History)
1 user (show)

See Also:
Host:
Target: powerpc-linux-gnu
Build:
Last reconfirmed: 2007-05-02 12:26:48


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Klose 2007-05-02 07:16:09 UTC
[ forwarded from http://bugs.debian.org/421799 ]

seen with 20070426 CVS

The opcode check for the lswi instruction is overstrict:

| $ cat test.S
|         lswi 5,24,0
| $ as test.S 
| test.S: Assembler messages:
| test.S:1: Error: operand out of range (0 is not between 1 and 32)

The IBM reference say:
| lswi 	 RT, RA, NB
| NB is the byte count.
| N is NB, which is the number of bytes to load. If NB is 0, then N is 32.
Comment 1 Alan Modra 2007-05-02 11:03:45 UTC
Did someone hit this in real code?  I've always taken the description in the
reference manual to mean the field rather than what is specified on the assembly
line.  Quite obviously, a value of 0 in the 5-bit field means transfer 32 bytes,
but it seems reasonable to me that a 0 as the third arg for lswi in assembler be
rejected.  You can't transfer zero bytes using lswi. 
Comment 2 Alan Modra 2007-05-02 11:04:29 UTC
Hmm, I guess there isn't any harm in allowing a zero in the third arg to mean 32.
Comment 3 Matthias Klose 2007-05-02 11:35:15 UTC
seen in linux-2.6.21 build by a Debian maintainer:

  CC      arch/powerpc/kernel/binfmt_elf32.o
{standard input}: Assembler messages:
{standard input}:988: Error: operand out of range (0 is not between 1 and 32)
{standard input}:989: Error: operand out of range (0 is not between 1 and 32)
Comment 4 Alan Modra 2007-05-02 12:13:12 UTC
Eep, I see.  gcc/config/rs6000.c:expand_block_move masks the byte count to 5 bits.