1 ! SPDX-License-Identifier: GPL-2.0
2 ! Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
3 ! Imagination Technologies Ltd
5 ! Integer modulus routines.
8 !! 32-bit modulus unsigned i/p - passed unsigned 32-bit numbers
12 .type ___umodsi3,function
15 MOV D0FrT,D1RtP ! Save original return address
16 CALLR D1RtP,___udivsi3
17 MOV D1RtP,D0FrT ! Recover return address
18 MOV D0Re0,D1Ar1 ! Return remainder
20 .size ___umodsi3,.-___umodsi3
23 !! 32-bit modulus signed i/p - passed signed 32-bit numbers
26 .type ___modsi3,function
29 MOV D0FrT,D1RtP ! Save original return address
30 MOV A0.2,D1Ar1 ! Save A in A0.2
32 MOV D1RtP,D0FrT ! Recover return address
33 MOV D1Re0,A0.2 ! Recover A
34 MOV D0Re0,D1Ar1 ! Return remainder
35 ORS D1Re0,D1Re0,D1Re0 ! Was A negative?
36 NEG D1Ar1,D1Ar1 ! Negate remainder
37 MOVMI D0Re0,D1Ar1 ! Return neg remainder
39 .size ___modsi3,.-___modsi3