This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: optimization options not working


I will try to be descriptive this time .

This is test.c

 main()
  {
  int a,b,c;
   a= 5;
   b=10;
   d=30;
  c=  a*b + 30 ;
}

now , suppose i build gcc for an ARM processor.
After build, compile stage ---

with no optimization options as mentioned above, this is what i get in
assembly.

        .file   "test1234.c"
        .text
        .align  2
        .global main
        .type   main, %function
main:
        @ args = 0, pretend = 0, frame = 16
        @ frame_needed = 1, uses_anonymous_args = 0
        mov     ip, sp
        stmfd   sp!, {fp, ip, lr, pc}
        sub     fp, ip, #4
        sub     sp, sp, #16
        mov     r3, #5
        str     r3, [fp, #-28]
        mov     r3, #10
        str     r3, [fp, #-24]
        mov     r3, #30
        str     r3, [fp, #-16]
        ldr     r2, [fp, #-28]
        ldr     r3, [fp, #-24]
        mul     r1, r3, r2
        mov     r3, r1
        mov     r2, r3, asl #2
        mov     r3, r2, asl #5
        rsb     r3, r2, r3
        add     r3, r3, r1
        mov     r2, r3, asl #2
        add     r3, r3, r2
        mov     r3, r3, asl #4
        add     r3, r3, #299008
        add     r3, r3, #992
        str     r3, [fp, #-20]
        sub     sp, fp, #12
        ldmfd   sp, {fp, sp, pc}
        .size   main, .-main


   
-- 
View this message in context: http://old.nabble.com/optimization-options-not-working-tp27637400p27714105.html
Sent from the gcc - Help mailing list archive at Nabble.com.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]