This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Why the const attribute cannot work?
- From: Richard Earnshaw <rearnsha at arm dot com>
- To: "=?gb2312?B?s8K/0g==?=" <chenken at mprc dot pku dot edu dot cn>
- Cc: gcc at gcc dot gnu dot org, Richard dot Earnshaw at arm dot com
- Date: Fri, 08 Mar 2002 12:12:27 +0000
- Subject: Re: Why the const attribute cannot work?
- Organization: ARM Ltd.
- Reply-to: Richard dot Earnshaw at arm dot com
> 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