1 //===------------- divmodhi4.S - sint16 div & mod -------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
10 // https://gcc.gnu.org/wiki/avr-gcc#Exceptions_to_the_Calling_Convention, the
11 // prototype is `struct {sint16, sint16} __divmodhi4(sint16, sint16)`.
12 // The sint16 quotient is returned via R23:R22, and the sint16 remainder is
13 // returned via R25:R24, while registers R21/R26/27/Rtmp and bit T in SREG
16 //===----------------------------------------------------------------------===//
28 .type __divmodhi4, @function
40 rcall __udivmodhi4 ; Call __udivmodhi4 to do real calculation.
49 ret ; Return quotient via R23:R22 and remainder via R25:R24.
57 ret ; Return quotient via R23:R22 and remainder via R25:r24.