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]

Argument passing


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?

Ivo
-- 
--------------------+--------------------------------+-+     +---+
| IVO JANSSEN       | ivo@ricardis.tudelft.nl        | |     |   |
| Ricardishof 1/428 | janssen@cardit.et.tudelft.nl   | |   |-+   |
| 2614 JE Delft     | elektron.et.tudelft.nl/~ivo/   | +->-|    (|)
| the Netherlands   | Dept of Electrical Engineering |     |-+   |
| +31-15-2855973    | Delft University of Technology |       |   |
+-------------------+--------------------------------+      --- ---

  Do you want to win $1000 by using you computer's idle time AND
  prove that 56-bit encryption isn't _that_ safe?
  Try http://rc5.distributed.net/