1 ! Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
2 ! Imagination Technologies Ltd
4 ! Integer modulus routines.
7 !! 32-bit modulus unsigned i/p - passed unsigned 32-bit numbers
11 .type ___umodsi3,function
14 MOV D0FrT,D1RtP ! Save original return address
15 CALLR D1RtP,___udivsi3
16 MOV D1RtP,D0FrT ! Recover return address
17 MOV D0Re0,D1Ar1 ! Return remainder
19 .size ___umodsi3,.-___umodsi3
22 !! 32-bit modulus signed i/p - passed signed 32-bit numbers
25 .type ___modsi3,function
28 MOV D0FrT,D1RtP ! Save original return address
29 MOV A0.2,D1Ar1 ! Save A in A0.2
31 MOV D1RtP,D0FrT ! Recover return address
32 MOV D1Re0,A0.2 ! Recover A
33 MOV D0Re0,D1Ar1 ! Return remainder
34 ORS D1Re0,D1Re0,D1Re0 ! Was A negative?
35 NEG D1Ar1,D1Ar1 ! Negate remainder
36 MOVMI D0Re0,D1Ar1 ! Return neg remainder
38 .size ___modsi3,.-___modsi3