1@/******************************************************************************
2@ *
3@ * Copyright (C) 2018 The Android Open Source Project
4@ *
5@ * Licensed under the Apache License, Version 2.0 (the "License");
6@ * you may not use this file except in compliance with the License.
7@ * You may obtain a copy of the License at:
8@ *
9@ * http://www.apache.org/licenses/LICENSE-2.0
10@ *
11@ * Unless required by applicable law or agreed to in writing, software
12@ * distributed under the License is distributed on an "AS IS" BASIS,
13@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14@ * See the License for the specific language governing permissions and
15@ * limitations under the License.
16@ *
17@ *****************************************************************************
18@ * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
19@*/
20
21
22.text
23.p2align 2
24        .global ixheaacd_fix_div_armv7
25
26ixheaacd_fix_div_armv7:
27    EOR             r12, r0, r1
28
29    MOVS            r3, r1, ASR #1
30    RSBMI           r3, r3, #0
31
32    MOVS            r2, r0, ASR #1
33    RSBMI           r2, r2, #0
34
35    MOV             r0, #0
36    BEQ             L2
37    MOV             r1, #0xf
38L1:
39    MOV             r2, r2, LSL #1
40    CMP             r2, r3
41    MOV             r0, r0, LSL #1
42    ADDCS           r0, r0, #1
43    SUBCS           r2, r2, r3
44    SUBS            r1, r1, #1
45    BGT             L1
46L2:
47    CMP             r12, #0
48    RSBLT           r0, r0, #0
49    BX              lr
50