🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #6378

power pc opcode bug in 2.7.2

#6378
From: Donn Seeley
Date: Thu, 07 Dec 1995 00:00
69 lines
3100 bytes
In the following example, the powerpc version of gcc produces an
RS6000 opcode that isn't understood by the powerpc assembler.  The
example source file is abstracted from cluster_read() in vfs_cluster.c
in the BSD/OS kernel...  For what it's worth, I'm still cross-compiling
from i386 to powerpc, although I don't think that matters here.

% cc -v -O2 -c max.c
gcc version 2.7.1
 /u/donn/ppclibexec/cpp -lang-c -v -iprefix /u/donn/ppclibexec/powerpc/2.7.1/ -undef -D__GNUC__=2 -D__GNUC_MINOR__=7 -D__bsdi__ -Dbsdi -Dunix -D__powerpc__ -D__bsdi__ -D__bsdi__ -D__unix__ -D__powerpc__ -D__bsdi -D__unix -Asystem(unix) -Asystem(bsd) -Acpu(powerpc) -Amachine(powerpc) -D__CHAR_UNSIGNED__ -D__OPTIMIZE__ -D_CALL_SYSV -D_BIG_ENDIAN -Amachine(bigendian) -D_ARCH_PPC max.c /tmp/cc021147.i
GNU CPP version 2.7.1 (PowerPC BSD/OS)
#include "..." search starts here:
#include <...> search starts here:
 /u/donn/ppclibexec/powerpc/2.7.1/local/include
 /u/donn/ppclibexec/powerpc/2.7.1/include
 /u/donn/ppclibexec/powerpc/2.7.1/include
 /u/donn/ppclibexec/powerpc/2.7.1/include
 /usr/local/include
 /usr/include
 /usr/include
 /usr/include
End of search list.
 /u/donn/ppclibexec/cc1 /tmp/cc021147.i -quiet -dumpbase max.c -O2 -version -o /tmp/cc021147.s
GNU C version 2.7.2 (PowerPC BSD/OS) compiled by GNU C version 2.7.1.
 as -u -mppc -V -Qy -o max.o /tmp/cc021147.s
GNU assembler version 2.6 (bsd/os), using BFD version 2.6
/tmp/cc021147.s: Assembler messages:
/tmp/cc021147.s:23: Error: Unrecognized opcode: `ai'
% cat max.c
struct v { unsigned int v_maxra, v_ralen; };

void
maxbug(struct v *vp, unsigned int ioblkno)
{

                if (ioblkno <= vp->v_maxra)
                        vp->v_ralen = ({ unsigned int _a = ( vp->v_ralen >> 1 ),
 _b = (  1 ); _a > _b ? _a : _b; }) ;
}
% 

The following patch seems to fix it, or at least makes 2.7.2 compile
the example into legal powerpc assembly:

Index: rs6000.md
===================================================================
RCS file: /master/usr.bin/gcc2/config/rs6000/rs6000.md,v
retrieving revision 2.3
diff -c -r2.3 rs6000.md
*** 2.3	1995/12/06 09:31:49
--- rs6000.md	1995/12/08 00:03:41
***************
*** 6909,6915 ****
    ""
    "@
     {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0
!    {sfi|subfic} %0,%1,-1\;a%I2 %0,%0,%2\;{sfe|subfe} %0,%0,%0"
    [(set_attr "length" "12")])
  
  (define_insn ""
--- 6909,6915 ----
    ""
    "@
     {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0
!    {sfi|subfic} %0,%1,-1\;{a%I2|add%I2} %0,%0,%2\;{sfe|subfe} %0,%0,%0"
    [(set_attr "length" "12")])
  
  (define_insn ""

Donn Seeley / BSDI Engineering
Technical Details
Message-ID: <199512080144.SAA19154@bsdi.BSDI.COM>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 113d02,f74ba7bd7b6794ce,start
X-Google-Attributes: gid113d02,public
From: donn@bsdi.com (Donn Seeley)
Subject: power pc opcode bug in 2.7.2
Date: 1995/12/07
Message-ID: <199512080144.SAA19154@bsdi.BSDI.COM>
X-Deja-AN: 121175718
distribution: gnu
sender: daemon@cis.ohio-state.edu
organization: GNUs Not Usenet
newsgroups: gnu.gcc.bug