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        .code 32
23       .eabi_attribute 24, 1            @Tag_ABI_align_needed
24       .eabi_attribute 25, 1            @Tag_ABI_align_preserved
25.text
26.p2align 2
27    .global ixheaacd_shiftrountine_with_rnd
28ixheaacd_shiftrountine_with_rnd:
29    STMFD           sp!, {r4-r12, r14}
30    MOV             r4, #0x1f
31    ADD             r12, r2, r3, LSL #1
32    MOV             r9, #0x8000
33    SUBS            r3, r3, #1
34    BMI             S_WITH_R_L6
35
36S_WITH_R_L5:
37    LDR             r5, [r1, r3, LSL #2]
38    LDR             r7, [r0, r3, LSL #2]
39    LDR             r14, [r0], #4
40    LDR             r10, [r1], #4
41
42    ADD             r6, r5, r7
43    SUB             r5, r5, r7
44    ADD             r7, r10, r14
45    SUB             r4, r10, r14
46
47
48
49
50
51
52
53
54
55
56
57    MOVS            r10, r4, ASR #0x15
58    CMNLT           r10, #1
59
60    MOVLT           r4, #0x80000000
61    MVNGT           r4, #0x80000000
62    MOVEQ           r4, r4, LSL #10
63
64    MOVS            r10, r5, ASR #0x15
65    QADD            r4, r4, r9
66    CMNLT           r10, #1
67    MOV             r4, r4, ASR #16
68    MOVLT           r5, #0x80000000
69    MVNGT           r5, #0x80000000
70    MOVEQ           r5, r5, LSL #10
71    MOV             r14, r3, lsl #1
72
73
74    MOVS            r10, r6, ASR #0x15
75    QADD            r5, r5, r9
76    CMNLT           r10, #1
77    MOV             r5, r5, ASR #16
78    MOVLT           r6, #0x80000000
79
80    STRH            r5, [r2, r14]
81    MVNGT           r6, #0x80000000
82    MOVEQ           r6, r6, LSL #10
83
84    MOVS            r10, r7, ASR #0x15
85    QADD            r6, r6, r9
86    CMNLT           r10, #1
87    MOV             r6, r6, ASR #16
88    MOVLT           r7, #0x80000000
89    MVNGT           r7, #0x80000000
90    MOVEQ           r7, r7, LSL #10
91
92    QADD            r7, r7, r9
93    STRH            r4, [r2], #2
94
95    MOV             r7, r7, ASR #16
96
97
98    STRH            r7, [r12, r14]
99    SUBS            r3, r3, #2
100    STRH            r6, [r12], #2
101    BGE             S_WITH_R_L5
102S_WITH_R_L6:
103    LDMFD           sp!, {r4-r12, r15}
104
105
106
107
108
109
110
111
112