GCC assmbler for powerpc-eabi
marian
marian@jozep.com.au
Tue Apr 7 00:51:00 GMT 2009
Ok I seem to have caused some consternation here, the code is not
intended to do anything meaningful, it is part of the assessment as to
whether GCC/GDB is a valid replacement for our current tool set. It's
role is to get assembler so we cam verify function call overhead as part
of the initial static analysis of each tool used. Unfortunately I picked
sprintf as a test library call and it appears that this causes the
compiler to emit the crxor even when no math is being performed.
ref. PowerPC Microprocessor 32-bit Family: The Programming Environments
sec. 2.1.3.2 Condition Register CR1 Field Definition
pp. 2-6
ref. PowerPC 405-S Embedded Processor Core
sec. 2.3.4 Condition Register
The 405 ref seems to conflict, or seems to define a usage that is less
specific than the general reference.
The question is still, why do I have the crxor assembler statements
before every "bl sprintf" statement in the function?
Files are attached and the build was done from inside ecos/test..
So fixing my compile line so it doesn't barf,
../gnutools/powerpc-eabi/bin/powerpc-eabi-gcc -S -O2 println.c
-I./ecos_install/include/
I get a build result of
println.c: In function âmyCallâ:
println.c:11: warning: incompatible implicit declaration of built-in
function âsprintfâ
println.c: In function âmyCall2â:
println.c:15: warning: incompatible implicit declaration of built-in
function âsprintfâ
println.c: In function âmainâ:
println.c:23: warning: incompatible implicit declaration of built-in
function âprintfâ
which gives me an assembler function which still has
myCall2:
mflr 0
stwu 1,-8(1)
lis 9,pstr@ha
lis 4,.LC0@ha
la 4,.LC0@l(4)
stw 0,12(1)
lwz 5,pstr@l(9)
crxor 6,6,6 <<<< WHY <<<<<<
bl sprintf
lwz 0,12(1)
addi 1,1,8
mtlr 0
blr
On Mon, 2009-04-06 at 10:35 -0700, John (Eljay) Love-Jensen wrote:
> Hi Jeff,
>
> > o The compiler barfed until I swapped the #define and the #include
>
> As it should, since that #define is really weird and will break most header
> files and most code.
>
> (I¹m not sure why you want to replace ³unsigned² with ³int size_t².)
>
> > o The -finline-functions switch has no effect until one specifies the -O3
> switch.
>
> The -finline-functions switch is enabled by default with -O3.
>
> You can enable it manually at -O1 or -O2.
>
> HTH,
> --Eljay
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: println.c
Type: text/x-csrc
Size: 404 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20090407/603db02e/attachment.bin>
-------------- next part --------------
.file "println.c"
.gnu_attribute 4, 1
.gnu_attribute 8, 1
.section ".text"
.align 2
.globl myCall2
.type myCall2, @function
myCall2:
mflr 0
stwu 1,-8(1)
lis 9,pstr@ha
lis 4,.LC0@ha
la 4,.LC0@l(4)
stw 0,12(1)
lwz 5,pstr@l(9)
crxor 6,6,6
bl sprintf
lwz 0,12(1)
addi 1,1,8
mtlr 0
blr
.size myCall2, .-myCall2
.align 2
.globl myCall
.type myCall, @function
myCall:
stwu 1,-32(1)
mflr 0
stw 29,20(1)
lis 29,pstr@ha
stw 27,12(1)
mr 27,3
lwz 3,pstr@l(29)
stw 0,36(1)
stw 28,16(1)
crxor 6,6,6
bl atoi
mr 28,3
lwz 3,pstr@l(29)
crxor 6,6,6
bl atof
lis 4,.LC1@ha
mr 6,3
mr 5,28
la 4,.LC1@l(4)
mr 3,27
crxor 6,6,6
bl sprintf
lwz 28,pstr@l(29)
mr 3,28
bl strlen
lis 9,blowup@ha
mr 5,3
lwz 3,blowup@l(9)
mr 4,28
bl memcpy
lwz 0,36(1)
lwz 27,12(1)
mtlr 0
lwz 28,16(1)
lwz 29,20(1)
addi 1,1,32
blr
.size myCall, .-myCall
.globl __eabi
.align 2
.globl main
.type main, @function
main:
stwu 1,-56(1)
mflr 0
stw 29,44(1)
addi 29,1,8
stw 0,60(1)
bl __eabi
mr 3,29
bl myCall
lis 9,pstr@ha
lwz 5,pstr@l(9)
lis 4,.LC0@ha
la 4,.LC0@l(4)
mr 3,29
crxor 6,6,6
bl sprintf
mr 3,29
bl puts
lwz 0,60(1)
li 3,0
lwz 29,44(1)
mtlr 0
addi 1,1,56
blr
.size main, .-main
.globl pstr
.globl blowup
.section .rodata.str1.4,"aMS",@progbits,1
.align 2
.LC0:
.string "Hello baby %s"
.zero 2
.LC1:
.string "Hello baby %f %u"
.zero 3
.LC2:
.string "42"
.section .sbss,"aw",@nobits
.align 2
.type blowup, @object
.size blowup, 4
blowup:
.zero 4
.section .sdata,"aw",@progbits
.align 2
.type pstr, @object
.size pstr, 4
pstr:
.long .LC2
.ident "GCC: (eCosCentric GNU tools 4.3.2-sw) 4.3.2"
More information about the Gcc-help
mailing list