This is the mail archive of the gcc-help@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: gcc porting - machine description for realizing multiplication with a routine call


On Thu, Feb 7, 2013 at 11:07 AM, Diego Bernini <diego.bernini@gmail.com> wrote:

> if I not provide any MD statement for multiplication, GCC generates a
>
> call __mulqi3
>
> So I can think to provide an assembly routine "__mulqi3".

That is certainly the easiest approach.

> But the problem (from my understanding) is how to ensure to save and
> restore properly the registers which are used internally by the
> routine, and to manage the input and output register sof the routine
> properly too.

The __mulqi3 function will be called like any function.  It can access
its parameters and save registers like any function.

> I can't find any advice on the web on how to easily implement
> multiplication when no a "mul" instruction is provided by the target
> architecture ISA. Surely a proper assembly routine must be provided,
> but I miss how to "link" it properly.

Example: libgcc/config/m68k/lb1sf68.S.  It will be used because
libgcc/config/m68k/t-floatlib sets LIB1ASMSRC.  And libgcc/config.host
adds t-floatlib to tmake_file for appropriate targets.

Ian


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