Home | History | Annotate | Line # | Download | only in arm
div.S revision 1.1.1.1.2.2
      1  1.1.1.1.2.2  pgoyette /*	$NetBSD: div.S,v 1.1.1.1.2.2 2018/09/06 06:56:39 pgoyette Exp $	*/
      2  1.1.1.1.2.2  pgoyette 
      3  1.1.1.1.2.2  pgoyette #------------------------------------------------------------------------------
      4  1.1.1.1.2.2  pgoyette #
      5  1.1.1.1.2.2  pgoyette # Copyright (c) 2011, ARM. All rights reserved.<BR>
      6  1.1.1.1.2.2  pgoyette #
      7  1.1.1.1.2.2  pgoyette # This program and the accompanying materials
      8  1.1.1.1.2.2  pgoyette # are licensed and made available under the terms and conditions of the BSD License
      9  1.1.1.1.2.2  pgoyette # which accompanies this distribution.  The full text of the license may be found at
     10  1.1.1.1.2.2  pgoyette # http://opensource.org/licenses/bsd-license.php
     11  1.1.1.1.2.2  pgoyette #
     12  1.1.1.1.2.2  pgoyette # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     13  1.1.1.1.2.2  pgoyette # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     14  1.1.1.1.2.2  pgoyette #
     15  1.1.1.1.2.2  pgoyette #------------------------------------------------------------------------------
     16  1.1.1.1.2.2  pgoyette 
     17  1.1.1.1.2.2  pgoyette #include "edk2asm.h"
     18  1.1.1.1.2.2  pgoyette 
     19  1.1.1.1.2.2  pgoyette .text
     20  1.1.1.1.2.2  pgoyette .align 2
     21  1.1.1.1.2.2  pgoyette GCC_ASM_EXPORT(__aeabi_uidiv)
     22  1.1.1.1.2.2  pgoyette GCC_ASM_EXPORT(__aeabi_uidivmod)
     23  1.1.1.1.2.2  pgoyette GCC_ASM_EXPORT(__aeabi_idiv)
     24  1.1.1.1.2.2  pgoyette GCC_ASM_EXPORT(__aeabi_idivmod)
     25  1.1.1.1.2.2  pgoyette 
     26  1.1.1.1.2.2  pgoyette #    AREA  Math, CODE, READONLY
     27  1.1.1.1.2.2  pgoyette 
     28  1.1.1.1.2.2  pgoyette #
     29  1.1.1.1.2.2  pgoyette #UINT32
     30  1.1.1.1.2.2  pgoyette #EFIAPI
     31  1.1.1.1.2.2  pgoyette #__aeabi_uidivmode (
     32  1.1.1.1.2.2  pgoyette #  IN UINT32  Dividen
     33  1.1.1.1.2.2  pgoyette #  IN UINT32  Divisor
     34  1.1.1.1.2.2  pgoyette #  );
     35  1.1.1.1.2.2  pgoyette #
     36  1.1.1.1.2.2  pgoyette 
     37  1.1.1.1.2.2  pgoyette ASM_PFX(__aeabi_uidiv):
     38  1.1.1.1.2.2  pgoyette ASM_PFX(__aeabi_uidivmod):
     39  1.1.1.1.2.2  pgoyette   rsbs    r12, r1, r0, LSR #4
     40  1.1.1.1.2.2  pgoyette   mov     r2, #0
     41  1.1.1.1.2.2  pgoyette   bcc     ASM_PFX(__arm_div4)
     42  1.1.1.1.2.2  pgoyette   rsbs    r12, r1, r0, LSR #8
     43  1.1.1.1.2.2  pgoyette   bcc     ASM_PFX(__arm_div8)
     44  1.1.1.1.2.2  pgoyette   mov     r3, #0
     45  1.1.1.1.2.2  pgoyette   b       ASM_PFX(__arm_div_large)
     46  1.1.1.1.2.2  pgoyette 
     47  1.1.1.1.2.2  pgoyette #
     48  1.1.1.1.2.2  pgoyette #INT32
     49  1.1.1.1.2.2  pgoyette #EFIAPI
     50  1.1.1.1.2.2  pgoyette #__aeabi_idivmode (
     51  1.1.1.1.2.2  pgoyette #  IN INT32  Dividen
     52  1.1.1.1.2.2  pgoyette #  IN INT32  Divisor
     53  1.1.1.1.2.2  pgoyette #  );
     54  1.1.1.1.2.2  pgoyette #
     55  1.1.1.1.2.2  pgoyette ASM_PFX(__aeabi_idiv):
     56  1.1.1.1.2.2  pgoyette ASM_PFX(__aeabi_idivmod):
     57  1.1.1.1.2.2  pgoyette   orrs    r12, r0, r1
     58  1.1.1.1.2.2  pgoyette   bmi     ASM_PFX(__arm_div_negative)
     59  1.1.1.1.2.2  pgoyette   rsbs    r12, r1, r0, LSR #1
     60  1.1.1.1.2.2  pgoyette   mov     r2, #0
     61  1.1.1.1.2.2  pgoyette   bcc     ASM_PFX(__arm_div1)
     62  1.1.1.1.2.2  pgoyette   rsbs    r12, r1, r0, LSR #4
     63  1.1.1.1.2.2  pgoyette   bcc     ASM_PFX(__arm_div4)
     64  1.1.1.1.2.2  pgoyette   rsbs    r12, r1, r0, LSR #8
     65  1.1.1.1.2.2  pgoyette   bcc     ASM_PFX(__arm_div8)
     66  1.1.1.1.2.2  pgoyette   mov     r3, #0
     67  1.1.1.1.2.2  pgoyette   b       ASM_PFX(__arm_div_large)
     68  1.1.1.1.2.2  pgoyette ASM_PFX(__arm_div8):
     69  1.1.1.1.2.2  pgoyette   rsbs    r12, r1, r0, LSR #7
     70  1.1.1.1.2.2  pgoyette   subcs   r0, r0, r1, LSL #7
     71  1.1.1.1.2.2  pgoyette   adc     r2, r2, r2
     72  1.1.1.1.2.2  pgoyette   rsbs    r12, r1, r0,LSR #6
     73  1.1.1.1.2.2  pgoyette   subcs   r0, r0, r1, LSL #6
     74  1.1.1.1.2.2  pgoyette   adc     r2, r2, r2
     75  1.1.1.1.2.2  pgoyette   rsbs    r12, r1, r0, LSR #5
     76  1.1.1.1.2.2  pgoyette   subcs   r0, r0, r1, LSL #5
     77  1.1.1.1.2.2  pgoyette   adc     r2, r2, r2
     78  1.1.1.1.2.2  pgoyette   rsbs    r12, r1, r0, LSR #4
     79  1.1.1.1.2.2  pgoyette   subcs   r0, r0, r1, LSL #4
     80  1.1.1.1.2.2  pgoyette   adc     r2, r2, r2
     81  1.1.1.1.2.2  pgoyette ASM_PFX(__arm_div4):
     82  1.1.1.1.2.2  pgoyette   rsbs    r12, r1, r0, LSR #3
     83  1.1.1.1.2.2  pgoyette   subcs   r0, r0, r1, LSL #3
     84  1.1.1.1.2.2  pgoyette   adc     r2, r2, r2
     85  1.1.1.1.2.2  pgoyette   rsbs    r12, r1, r0, LSR #2
     86  1.1.1.1.2.2  pgoyette   subcs   r0, r0, r1, LSL #2
     87  1.1.1.1.2.2  pgoyette   adcs    r2, r2, r2
     88  1.1.1.1.2.2  pgoyette   rsbs    r12, r1, r0, LSR #1
     89  1.1.1.1.2.2  pgoyette   subcs   r0, r0, r1, LSL #1
     90  1.1.1.1.2.2  pgoyette   adc     r2, r2, r2
     91  1.1.1.1.2.2  pgoyette ASM_PFX(__arm_div1):
     92  1.1.1.1.2.2  pgoyette   subs    r1, r0, r1
     93  1.1.1.1.2.2  pgoyette   movcc   r1, r0
     94  1.1.1.1.2.2  pgoyette   adc     r0, r2, r2
     95  1.1.1.1.2.2  pgoyette   bx      r14
     96  1.1.1.1.2.2  pgoyette ASM_PFX(__arm_div_negative):
     97  1.1.1.1.2.2  pgoyette   ands    r2, r1, #0x80000000
     98  1.1.1.1.2.2  pgoyette   rsbmi   r1, r1, #0
     99  1.1.1.1.2.2  pgoyette   eors    r3, r2, r0, ASR #32
    100  1.1.1.1.2.2  pgoyette   rsbcs   r0, r0, #0
    101  1.1.1.1.2.2  pgoyette   rsbs    r12, r1, r0, LSR #4
    102  1.1.1.1.2.2  pgoyette   bcc     label1
    103  1.1.1.1.2.2  pgoyette   rsbs    r12, r1, r0, LSR #8
    104  1.1.1.1.2.2  pgoyette   bcc     label2
    105  1.1.1.1.2.2  pgoyette ASM_PFX(__arm_div_large):
    106  1.1.1.1.2.2  pgoyette   lsl     r1, r1, #6
    107  1.1.1.1.2.2  pgoyette   rsbs    r12, r1, r0, LSR #8
    108  1.1.1.1.2.2  pgoyette   orr     r2, r2, #0xfc000000
    109  1.1.1.1.2.2  pgoyette   bcc     label2
    110  1.1.1.1.2.2  pgoyette   lsl     r1, r1, #6
    111  1.1.1.1.2.2  pgoyette   rsbs    r12, r1, r0, LSR #8
    112  1.1.1.1.2.2  pgoyette   orr     r2, r2, #0x3f00000
    113  1.1.1.1.2.2  pgoyette   bcc     label2
    114  1.1.1.1.2.2  pgoyette   lsl     r1, r1, #6
    115  1.1.1.1.2.2  pgoyette   rsbs    r12, r1, r0, LSR #8
    116  1.1.1.1.2.2  pgoyette   orr     r2, r2, #0xfc000
    117  1.1.1.1.2.2  pgoyette   orrcs   r2, r2, #0x3f00
    118  1.1.1.1.2.2  pgoyette   lslcs   r1, r1, #6
    119  1.1.1.1.2.2  pgoyette   rsbs    r12, r1, #0
    120  1.1.1.1.2.2  pgoyette   bcs     ASM_PFX(__aeabi_idiv0)
    121  1.1.1.1.2.2  pgoyette label3:
    122  1.1.1.1.2.2  pgoyette   lsrcs   r1, r1, #6
    123  1.1.1.1.2.2  pgoyette label2:
    124  1.1.1.1.2.2  pgoyette   rsbs    r12, r1, r0, LSR #7
    125  1.1.1.1.2.2  pgoyette   subcs   r0, r0, r1, LSL #7
    126  1.1.1.1.2.2  pgoyette   adc     r2, r2, r2
    127  1.1.1.1.2.2  pgoyette   rsbs    r12, r1, r0, LSR #6
    128  1.1.1.1.2.2  pgoyette   subcs   r0, r0, r1, LSL #6
    129  1.1.1.1.2.2  pgoyette   adc     r2, r2, r2
    130  1.1.1.1.2.2  pgoyette   rsbs    r12, r1, r0, LSR #5
    131  1.1.1.1.2.2  pgoyette   subcs   r0, r0, r1, LSL #5
    132  1.1.1.1.2.2  pgoyette   adc     r2, r2, r2
    133  1.1.1.1.2.2  pgoyette   rsbs    r12, r1, r0, LSR #4
    134  1.1.1.1.2.2  pgoyette   subcs   r0, r0, r1, LSL #4
    135  1.1.1.1.2.2  pgoyette   adc     r2, r2, r2
    136  1.1.1.1.2.2  pgoyette label1:
    137  1.1.1.1.2.2  pgoyette   rsbs    r12, r1, r0, LSR #3
    138  1.1.1.1.2.2  pgoyette   subcs   r0, r0, r1, LSL #3
    139  1.1.1.1.2.2  pgoyette   adc     r2, r2, r2
    140  1.1.1.1.2.2  pgoyette   rsbs    r12, r1, r0, LSR #2
    141  1.1.1.1.2.2  pgoyette   subcs   r0, r0, r1, LSL #2
    142  1.1.1.1.2.2  pgoyette   adcs    r2, r2, r2
    143  1.1.1.1.2.2  pgoyette   bcs     label3
    144  1.1.1.1.2.2  pgoyette   rsbs    r12, r1, r0, LSR #1
    145  1.1.1.1.2.2  pgoyette   subcs   r0, r0, r1, LSL #1
    146  1.1.1.1.2.2  pgoyette   adc     r2, r2, r2
    147  1.1.1.1.2.2  pgoyette   subs    r1, r0, r1
    148  1.1.1.1.2.2  pgoyette   movcc   r1, r0
    149  1.1.1.1.2.2  pgoyette   adc     r0, r2, r2
    150  1.1.1.1.2.2  pgoyette   asrs    r3, r3, #31
    151  1.1.1.1.2.2  pgoyette   rsbmi   r0, r0, #0
    152  1.1.1.1.2.2  pgoyette   rsbcs   r1, r1, #0
    153  1.1.1.1.2.2  pgoyette   bx      r14
    154  1.1.1.1.2.2  pgoyette 
    155  1.1.1.1.2.2  pgoyette   @ What to do about division by zero?  For now, just return.
    156  1.1.1.1.2.2  pgoyette ASM_PFX(__aeabi_idiv0):
    157  1.1.1.1.2.2  pgoyette   bx      r14
    158