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: no mul/div instruction


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


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