This is the mail archive of the gcc@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: Why the const attribute cannot work?



> it will call function muladd three times instead of only once.When I add -O2
> option, the compiler with the x86 backend can recognize the common muladd
> function and optimize the code, but the compiler with the arm backend still
> cannot recognize  it and still call the function three times.
>     I donnot know why the arm compiler cannot do the common muladd function
> elimination, and why the compilers with x86 and arm backends treat the same
> program differently by this question.As we know, the common expression
> elimination will be done in the frontend, which is independent of the target
> machine.
>     By the way, the version I use is 2.9.5.

Try a more recent compiler:

gcc-3.1 branch:

main:
        @ args = 0, pretend = 0, frame = 0
        @ frame_needed = 0, uses_anonymous_args = 0
        str     lr, [sp, #-4]!
        mov     r0, #1
        mov     r1, #2
        bl      muladd
        mov     r3, r0, asl #1
        mla     r3, r0, r3, r0
        cmp     r3, #36
        blne    abort
.L3:
        mov     r0, #0
        bl      exit



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