Interesting. "my" compiler does not do that, therefore I
cannot know for sure how to help out. In general, however, compilers
are free to treat memory locations in any way they see fit, unless
you use the "volatile" qualifier, which tells the compiler that
an address does *not* behave like a typical memory cell, and that
no assumptions can be made for purposes of optimization. I.e.
Try this instead (or compile with -fvolatile):
static void copy4 (volatile int *p, volatile int *q, int n) {
while (n-- > 0) *q++ = *p++;
}
With my compiler it made no difference. All accesses were
32-bit.
HTH -- Larry
GNU C version gcc-2.96 (2.96+) 19990621 AltiVec (powerpc-wrs-vxworks)
compiled by GNU C version 2.96 20000731 (Red Hat Linux 7.3 2.96-113).
.align 2
.type copy4,@function
copy4:
mr 0,5
cmpwi 0,0,0
addi 5,5,-1
bclr 4,1
.L5:
mr 0,5
lwz 9,0(3)
cmpwi 0,0,0
stw 9,0(4)
addi 3,3,4
addi 4,4,4
addi 5,5,-1
bc 12,1,.L5
blr
- References:
- PPC compiler splits up ints & shorts? Laznovsky, Michael
- Navigate by Date:
- Prev:
RE: PPC compiler splits up ints & shorts? Laznovsky, Michael
- Next:
RE: PPC compiler splits up ints & shorts? Lawrence T. Hoff
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
<2004>
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
PPC compiler splits up ints & shorts? Laznovsky, Michael
- Next:
Re: PPC compiler splits up ints & shorts? Dirk Zimoch
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
<2004>
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|