This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


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: Q for inline arm assembly: 'M' constraint?


bryceman@dpzone.com said:
> Thread model: single gcc version 3.3
>
> Also, I was using -O0, then tried -O1 per your suggestion on the code
> you submitted, but it still used registers.
foo:
        @ args = 0, pretend = 0, frame = 0
        @ frame_needed = 0, uses_anonymous_args = 0
        @ link register save eliminated.
        @ lr needed for prologue
        smull   r2, r3, r0, r1
        movs    r2, r2, lsr #15
        adc     r3, r2, r3, lsl #17

        mov     r0, r2
        mov     pc, lr
        .size   foo, .-foo
        .ident  "GCC: (GNU) 3.3.1 20030614 (prerelease)"
                     ***********************
So it's unlikely to be the fact that you were using 3.3.

> > with -O1 on the current development version of the compiler.
>
> I was not able to reproduce this, although my "const char n = 8; const
>  char m = 32 - n;" version compiled with warnings once I made it
> static,  for some reason. 

Note, if the inline isn't static, then you will get an out-of-line copy as 
well.  Check the places where it should be inlined.

Eg

foo:
        @ args = 0, pretend = 0, frame = 0
        @ frame_needed = 0, uses_anonymous_args = 0
        @ link register save eliminated.
        @ lr needed for prologue
        smull   r2, r3, r0, r1
        movs    r2, r2, lsr #15
        adc     r3, r2, r3, lsl #17

^^^^^^^^^^^^^^^^^^
Inlined copy, uses immediates.

        mov     r0, r2
        mov     pc, lr
        .size   foo, .-foo
        .align  2
        .global fixp_mul_32s_nX
        .type   fixp_mul_32s_nX, %function
fixp_mul_32s_nX:
        @ args = 0, pretend = 0, frame = 0
        @ frame_needed = 0, uses_anonymous_args = 0
        str     lr, [sp, #-4]!
        and     r2, r2, #255
        rsb     r3, r2, #32
        smull   ip, lr, r0, r1
        movs    ip, ip, lsr r2
        adc     lr, ip, lr, lsl r3

        mov     r0, ip
        ldr     pc, [sp], #4

out-of-line copy, for when called as a function.

R.


------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com


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