EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  <20042005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  <20042005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: PPC compiler splits up ints & shorts?
From: Dirk Zimoch <[email protected]>
To: "Laznovsky, Michael" <[email protected]>
Cc: [email protected]
Date: Thu, 30 Sep 2004 09:44:04 +0200
Hi Michael,

have vou tried this:

static void copy4 (int *p, volatile int *q, int n)

I always declare any pointer to hardware volatile to prevent the compliler from trying funny things.

BTW: I can't reproduce you assember code with neither gcc-2.8.1 on Tornado 1.0.1 nor with gcc-2.96 on Tornado 2.2. I always get word instructions, not byte instructions.

Dirk


Laznovsky, Michael wrote:
Hi- does anyone know why our power-pc compiler likes to turn short & int pointer
dereferences into byte moves, and how to get it to not to?  Some hardware may not
like this, as suggested by bus analyzer.

For instance, this code:

	static void copy4 (int *p, int *q, int n) {
	  while (n-- > 0) *q++ = *p++;
	}

generates this:

        .align 2
        .type    copy4,@function
copy4:
        mr 0,5
        cmpwi 1,0,0
        mr 7,3
        mr 6,4
        addi 5,5,-1
        bclr 4,5
        addi 4,4,3
        addi 3,3,3
.L16:
        lbz 9,-2(3)	<---
        lbz 11,-1(3)	<---
        lbz 10,0(3)	<---
        lbz 0,0(7)	<---
        addi 3,3,4
        addi 7,7,4
        mr 8,5
        addi 5,5,-1
        cmpwi 1,8,0
        slwi 0,0,24
        slwi 9,9,16
        or 9,9,0
        slwi 11,11,8
        or 11,11,9
        or 10,10,11
        srwi 0,10,24
        stb 0,0(6)	<---
        srwi 0,10,16
        stb 0,-2(4)	<---
        srwi 0,10,8
        stb 0,-1(4)	<---
        stb 10,0(4)	<---
        addi 4,4,4
        addi 6,6,4
        bc 12,5,.L16
        blr
.Lfe4:
        .size    copy4,.Lfe4-copy4

Switches which may be relevant:
    .../vxworks/devel/tor-2.0.2/cd/host/sun4-solaris2/bin/ccppc
        -B.../vxworks/devel/tor-2.0.2/cd/host/sun4-solaris2/lib/gcc-lib/
        -nostdinc
        -ansi
        -pedantic
        -DCPU=PPC604
        -D_GNU_TOOL
        -DTRUE=1
        -DNIVXI
        -O2
        -fstrength
        -reduce
        -Wall
        -DVXI
        -mcpu=604
        --no-builtin
        -mstrict-align
        -mlongcall
        -D_REENTRANT
        -DvxWorks
        -DV5_vxWorks
        -fno-builtin

"ccppc --version" yields:
	cygnus-2.7.2-960126 egcs-971225 tornado 2.0

I thought maybe #pragma pack() in the source had something to do with it, but that
made no difference.

I took a look in the tech-talk archives, but couldn't find anything related.  Could
be just poor search skills....

Thanks for any help!

Mike


-- Dr. Dirk Zimoch Swiss Light Source Paul Scherrer Institut Computing and Controls phone +41 56 310 5182 fax +41 56 310 4413

References:
PPC compiler splits up ints & shorts? Laznovsky, Michael

Navigate by Date:
Prev: Re [18] Rebekah Leary
Next: TRAPWRITE does not log settings made with ca_put_callback John A. Priller
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  <20042005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: RE: PPC compiler splits up ints & shorts? Lawrence T. Hoff
Next: RE: PPC compiler splits up ints & shorts? Laznovsky, Michael
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  <20042005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 10 Aug 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·