Hi,
I would like to optimize our C code using modulo(%).
My question is whether I can use _remi (RTS built-in asm function) for this purpose.
I'm asking this because UG says that this function is not intended to be called directly from user application code.
======
http://www.ti.com/lit/ug/spru187o/spru187o.pdf
7.7 Run-Time-Support Arithmetic Routines
These routines follow the standard C/C++ calling sequence. The compiler automatically adds these routines when appropriate; they are not intended to be called directly by your programs.
======
On the other hand, remi.asm (rstsrc.zip came from CGT) mentions that he will use the following core registers during his operation:
; Regs used:
; A1 = neg_num, zero_quo
; A2 = mag_num, neg_quo
; A4 = arg1: numerator, abs_num, retval: remainder
; A5 = copy numerator
; A6 = copy neg_num
; B0 = subc loop counter
; B1 = loop counter, neg_den, mod
; B2 = mag_den, neg_loopcount, modulo_shift
; B3 = return address
; B4 = arg2: denominator, abs_den
;
; Regs killed:
; A1, A2, A4, A5, A6, B0, B1, B2, B4
;
; Regs used but not killed:
; B3
So, if the above registers are taken care (push/pop operation to/from stack) at caller side, I believe it is okay to use this function.
And I guess TI's C compiler (for c674x) can take care it automatically under its compile rule for "calling assembly routine from C code".
How do you think ?
If you have other solutions for % optimization, it will be helpful for us.
Best Regards,
Kawada