This is the mail archive of the crossgcc@cygnus.com mailing list for the crossgcc project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Ivo Janssen writes: > Hello, > > I have the following problem: > My 16 processor does not have a multiply. So I wrote an > emulator-function which does repeated adds, named __mulqi3. > QI because 16bit=1 storage unit. int is also 16 bit. (QI) > The compiler is supposed to pass args in "r0", "r1" to "r4". > The rest via stack. > > But when I do int a=12; int b=34; c=a*b; > the compiler puts 12 in "r10", 34 in "r6" and expects the return value > in "r3", instead of "r0". And, it calles __mulsi3. So it is expecting > 4-word values, instead of 1word values (remember, word=16bit). > > How can I instruct the compiler to use __mulqi3 with exactly 1 word (=1 > register) wide arguments? I have had similar problems with porting the TMS320C[34]x DSPs where BITS_PER_UNIT = 32 and BITS_PER_WORD = 32. I had to patch optabs.c to get the libcalls to work. Unfortunately, libgcc2 is broken for processors where BITS_PER_UNIT != 8. Index: optabs.c =================================================================== RCS file: /usr/local/src/cvsroot/gnu/gcc/optabs.c,v retrieving revision 1.1.1.1 retrieving revision 1.2.2.1 diff -c -r1.1.1.1 -r1.2.2.1 *** optabs.c 1997/07/09 02:21:49 1.1.1.1 --- optabs.c 1997/09/18 03:20:13 1.2.2.1 *************** *** 3965,3971 **** register char *opname; register int suffix; { ! init_libfuncs (optable, SImode, TImode, opname, suffix); } /* Initialize the libfunc fields of an entire group of entries in some --- 3965,3971 ---- register char *opname; register int suffix; { ! init_libfuncs (optable, QImode, TImode, opname, suffix); } /* Initialize the libfunc fields of an entire group of entries in some *************** *** 3979,3985 **** register char *opname; register int suffix; { ! init_libfuncs (optable, SFmode, TFmode, opname, suffix); } /* Initialize the libfunc fields of an entire group of entries in some --- 3979,3985 ---- register char *opname; register int suffix; { ! init_libfuncs (optable, QFmode, TFmode, opname, suffix); } /* Initialize the libfunc fields of an entire group of entries in some