This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: no mul/div instruction
- From: Ian Lance Taylor <iant at google dot com>
- To: Kunal Parmar <kunalparmar at gmail dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Tue, 22 Apr 2008 10:24:01 -0700
- Subject: Re: no mul/div instruction
- References: <480E164A.6020205@gmail.com>
Kunal Parmar <kunalparmar@gmail.com> writes:
> I am porting GCC to a new 16 bit RISC architecture which does not have
> multiplication and division instructions. I figured that I have to provide
> emulation routines for the multiplication and division which will be
> inserted into libgcc2.a. But I am confused about which versions of these
> routines to provide i.e. do I provide __mulsi3 or __mulhi3 or both.
It depends on UNITS_PER_WORD. If UNITS_PER_WORD is 4, you need
__mulsi3. If UNITS_PER_WORD is 2, you need __mulhi3, and, if you have
32-bit integer types, you will also need __mulsi3. In the latter case
you can, if you like, get code for __mulsi3 from longlong.h--see the
comments at the top of the file.
Ian