Path: blob/main/contrib/llvm-project/compiler-rt/lib/builtins/avr/divmodqi4.S
35290 views
//===------------- divmodqi4.S - sint8 div & mod --------------------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7//8// As described at9// https://gcc.gnu.org/wiki/avr-gcc#Exceptions_to_the_Calling_Convention, the10// prototype is `struct {sint8, sint8} __divmodqi4(sint8, sint8)`.11// The sint8 quotient is returned via R24, and the sint8 remainder is returned12// via R25, while registers R23/Rtmp and bit T in SREG are clobbered.13//14//===----------------------------------------------------------------------===//1516.text17.align 21819#ifdef __AVR_TINY__20.set __tmp_reg__, 1621#else22.set __tmp_reg__, 023#endif2425.globl __divmodqi426.type __divmodqi4, @function2728__divmodqi4:29bst r24, 730mov __tmp_reg__, r2431eor __tmp_reg__, r2232sbrc r24, 733neg r2434sbrc r22, 735neg r2236rcall __udivmodqi4 ; Call __udivmodqi4 to do real calculation.37brtc __divmodqi4_138neg r253940__divmodqi4_1:41sbrc __tmp_reg__, 742neg r2443ret ; Return quotient via R24 and remainder via R25.444546