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