1 1.1 jmcneill /* $NetBSD: ldivmod.S,v 1.1.1.1 2018/08/16 18:17:47 jmcneill Exp $ */ 2 1.1 jmcneill 3 1.1 jmcneill //------------------------------------------------------------------------------ 4 1.1 jmcneill // 5 1.1 jmcneill // Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR> 6 1.1 jmcneill // 7 1.1 jmcneill // This program and the accompanying materials 8 1.1 jmcneill // are licensed and made available under the terms and conditions of the BSD License 9 1.1 jmcneill // which accompanies this distribution. The full text of the license may be found at 10 1.1 jmcneill // http://opensource.org/licenses/bsd-license.php 11 1.1 jmcneill // 12 1.1 jmcneill // THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 13 1.1 jmcneill // WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 14 1.1 jmcneill // 15 1.1 jmcneill //------------------------------------------------------------------------------ 16 1.1 jmcneill 17 1.1 jmcneill 18 1.1 jmcneill #include "edk2asm.h" 19 1.1 jmcneill 20 1.1 jmcneill .text 21 1.1 jmcneill .align 2 22 1.1 jmcneill GCC_ASM_EXPORT(__aeabi_ldivmod) 23 1.1 jmcneill 24 1.1 jmcneill // 25 1.1 jmcneill // A pair of (unsigned) long longs is returned in {{r0, r1}, {r2, r3}}, 26 1.1 jmcneill // the quotient in {r0, r1}, and the remainder in {r2, r3}. 27 1.1 jmcneill // 28 1.1 jmcneill //__value_in_regs lldiv_t 29 1.1 jmcneill //EFIAPI 30 1.1 jmcneill //__aeabi_ldivmod ( 31 1.1 jmcneill // IN UINT64 Dividen 32 1.1 jmcneill // IN UINT64 Divisor 33 1.1 jmcneill // )// 34 1.1 jmcneill // 35 1.1 jmcneill 36 1.1 jmcneill ASM_PFX(__aeabi_ldivmod): 37 1.1 jmcneill push {r4,lr} 38 1.1 jmcneill asrs r4,r1,#1 39 1.1 jmcneill eor r4,r4,r3,LSR #1 40 1.1 jmcneill bpl L_Test1 41 1.1 jmcneill rsbs r0,r0,#0 42 1.1 jmcneill rsc r1,r1,#0 43 1.1 jmcneill L_Test1: 44 1.1 jmcneill tst r3,r3 45 1.1 jmcneill bpl L_Test2 46 1.1 jmcneill rsbs r2,r2,#0 47 1.1 jmcneill rsc r3,r3,#0 48 1.1 jmcneill L_Test2: 49 1.1 jmcneill bl ASM_PFX(__aeabi_uldivmod) 50 1.1 jmcneill tst r4,#0x40000000 51 1.1 jmcneill beq L_Test3 52 1.1 jmcneill rsbs r0,r0,#0 53 1.1 jmcneill rsc r1,r1,#0 54 1.1 jmcneill L_Test3: 55 1.1 jmcneill tst r4,#0x80000000 56 1.1 jmcneill beq L_Exit 57 1.1 jmcneill rsbs r2,r2,#0 58 1.1 jmcneill rsc r3,r3,#0 59 1.1 jmcneill L_Exit: 60 1.1 jmcneill pop {r4,pc} 61 1.1 jmcneill 62 1.1 jmcneill 63 1.1 jmcneill 64