1! Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 2! Imagination Technologies Ltd 3! 4! Integer modulus routines. 5! 6!! 7!! 32-bit modulus unsigned i/p - passed unsigned 32-bit numbers 8!! 9 .text 10 .global ___umodsi3 11 .type ___umodsi3,function 12 .align 2 13___umodsi3: 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 18 MOV PC,D1RtP 19 .size ___umodsi3,.-___umodsi3 20 21!! 22!! 32-bit modulus signed i/p - passed signed 32-bit numbers 23!! 24 .global ___modsi3 25 .type ___modsi3,function 26 .align 2 27___modsi3: 28 MOV D0FrT,D1RtP ! Save original return address 29 MOV A0.2,D1Ar1 ! Save A in A0.2 30 CALLR D1RtP,___divsi3 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 37 MOV PC, D1RtP 38 .size ___modsi3,.-___modsi3 39