public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* multiply by a constant on an arm7TDMI
@ 2001-06-22  9:02 Franck MAMALET FT-R&D DIH/OCF
  0 siblings, 0 replies; only message in thread
From: Franck MAMALET FT-R&D DIH/OCF @ 2001-06-22  9:02 UTC (permalink / raw)
  To: gcc-help

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1276 bytes --]

Hi,
I try to compile this kind of code:
     y = x * 0x3501;  /*(x and y are short);*/
with arm-elf-gcc for the target arm7tdmi.
The code generated by arm-elf-gcc doesn't   generate a 'mul'
instruction but a sequence of 'rsb' and 'add' instructions.
It is not a bug and it gives the good result but several multiplication
are in the same function and it has to store intermediate results in memory:
 str     r3, [fp, #-92]^M
        ldr    
r2, [fp, #-92]^M
        rsb    
r3, r3, r3, asl #4^M
        ldr    
r4, [fp, #-92
        rsb    
r3, r2, r3, asl #2
        add    
r3, r2, r3, asl #3
        add    
ip, r4, r3, asl #5
This solution is far more complex than a simple 'mul' instruction (even
if 'mul' can take 4 cycles on an ARM7).
Can anyone help me to avoid generating such a code and forcing arm-elf-gcc
to use 'mul' instruction.
Thanks,
regards,
Franck.
 
 
 
 
-- 
& france telecom 
Mamalet Franck
FTR&D DIH/OCF
Tél  : 04 76 76 45 71   Fax : 04 76 90 34 43
franck.mamalet@rd.francetelecom.fr
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-06-22  9:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-22  9:02 multiply by a constant on an arm7TDMI Franck MAMALET FT-R&D DIH/OCF

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).