b6f7369299a612118afebe587e5f62f7d3b5a7c5
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / speex / 0001-thumb2-support.patch
1 Make speex Thumb2 compatible
2
3 Patch written by Michael Hope from Linaro, available at
4 http://lists.xiph.org/pipermail/speex-dev/2010-November/008041.html.
5
6 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
7
8 diff --git a/libspeex/filters_arm4.h b/libspeex/filters_arm4.h
9 index 7a74042..6ec1f75 100644
10 --- a/libspeex/filters_arm4.h
11 +++ b/libspeex/filters_arm4.h
12 @@ -47,8 +47,10 @@ int normalize16(const spx_sig_t *x, spx_word16_t *y, spx_sig_t max_scale, int le
13  
14           "\tldr %4, [%0], #4 \n"
15           "\tcmps %4, %1 \n"
16 +         "\tit gt \n"
17           "\tmovgt %1, %4 \n"
18           "\tcmps %4, %3 \n"
19 +         "\tit lt \n"
20           "\tmovlt %3, %4 \n"
21  
22           "\tsubs %2, %2, #1 \n"
23 @@ -56,6 +58,7 @@ int normalize16(const spx_sig_t *x, spx_word16_t *y, spx_sig_t max_scale, int le
24  
25           "\trsb %3, %3, #0 \n"
26           "\tcmp %1, %3 \n"
27 +         "\tit lt \n"
28           "\tmovlt %1, %3 \n"
29     : "=r" (dead1), "=r" (max_val), "=r" (dead3), "=r" (dead4),
30     "=r" (dead5), "=r" (dead6)
31 diff --git a/libspeex/fixed_arm4.h b/libspeex/fixed_arm4.h
32 index b6981ca..b6218ca 100644
33 --- a/libspeex/fixed_arm4.h
34 +++ b/libspeex/fixed_arm4.h
35 @@ -69,72 +69,90 @@ static inline short DIV32_16(int a, int b)
36     __asm__ __volatile__ (
37           "\teor %5, %0, %1\n"
38           "\tmovs %4, %0\n"
39 +         "\tit mi \n"
40           "\trsbmi %0, %0, #0 \n"
41           "\tmovs %4, %1\n"
42 +         "\tit mi \n"
43           "\trsbmi %1, %1, #0 \n"
44           "\tmov %4, #1\n"
45  
46           "\tsubs %3, %0, %1, asl #14 \n"
47 +         "\titt pl \n"
48           "\tmovpl %0, %3 \n"
49           "\torrpl %2, %2, %4, asl #14 \n"
50  
51           "\tsubs %3, %0, %1, asl #13 \n"
52 +         "\titt pl \n"
53           "\tmovpl %0, %3 \n"
54           "\torrpl %2, %2, %4, asl #13 \n"
55  
56           "\tsubs %3, %0, %1, asl #12 \n"
57 +         "\titt pl \n"
58           "\tmovpl %0, %3 \n"
59           "\torrpl %2, %2, %4, asl #12 \n"
60  
61           "\tsubs %3, %0, %1, asl #11 \n"
62 +         "\titt pl \n"
63           "\tmovpl %0, %3 \n"
64           "\torrpl %2, %2, %4, asl #11 \n"
65  
66           "\tsubs %3, %0, %1, asl #10 \n"
67 +         "\titt pl \n"
68           "\tmovpl %0, %3 \n"
69           "\torrpl %2, %2, %4, asl #10 \n"
70  
71           "\tsubs %3, %0, %1, asl #9 \n"
72 +         "\titt pl \n"
73           "\tmovpl %0, %3 \n"
74           "\torrpl %2, %2, %4, asl #9 \n"
75  
76           "\tsubs %3, %0, %1, asl #8 \n"
77 +         "\titt pl \n"
78           "\tmovpl %0, %3 \n"
79           "\torrpl %2, %2, %4, asl #8 \n"
80  
81           "\tsubs %3, %0, %1, asl #7 \n"
82 +         "\titt pl \n"
83           "\tmovpl %0, %3 \n"
84           "\torrpl %2, %2, %4, asl #7 \n"
85  
86           "\tsubs %3, %0, %1, asl #6 \n"
87 +         "\titt pl \n"
88           "\tmovpl %0, %3 \n"
89           "\torrpl %2, %2, %4, asl #6 \n"
90           
91           "\tsubs %3, %0, %1, asl #5 \n"
92 +         "\titt pl \n"
93           "\tmovpl %0, %3 \n"
94           "\torrpl %2, %2, %4, asl #5 \n"
95  
96           "\tsubs %3, %0, %1, asl #4 \n"
97 +         "\titt pl \n"
98           "\tmovpl %0, %3 \n"
99           "\torrpl %2, %2, %4, asl #4 \n"
100  
101           "\tsubs %3, %0, %1, asl #3 \n"
102 +         "\titt pl \n"
103           "\tmovpl %0, %3 \n"
104           "\torrpl %2, %2, %4, asl #3 \n"
105  
106           "\tsubs %3, %0, %1, asl #2 \n"
107 +         "\titt pl \n"
108           "\tmovpl %0, %3 \n"
109           "\torrpl %2, %2, %4, asl #2 \n"
110  
111           "\tsubs %3, %0, %1, asl #1 \n"
112 +         "\titt pl \n"
113           "\tmovpl %0, %3 \n"
114           "\torrpl %2, %2, %4, asl #1 \n"
115  
116           "\tsubs %3, %0, %1 \n"
117 +         "\titt pl \n"
118           "\tmovpl %0, %3 \n"
119           "\torrpl %2, %2, %4 \n"
120  
121           "\tmovs %5, %5, lsr #31 \n"
122 +         "\tit ne \n"
123           "\trsbne %2, %2, #0 \n"
124     : "=r" (dead1), "=r" (dead2), "=r" (res),
125     "=r" (dead3), "=r" (dead4), "=r" (dead5)
126 diff --git a/libspeex/fixed_arm5e.h b/libspeex/fixed_arm5e.h
127 index 9b4861c..bdadd02 100644
128 --- a/libspeex/fixed_arm5e.h
129 +++ b/libspeex/fixed_arm5e.h
130 @@ -97,72 +97,90 @@ static inline short DIV32_16(int a, int b)
131     __asm__ __volatile__ (
132           "\teor %5, %0, %1\n"
133           "\tmovs %4, %0\n"
134 +         "\tit mi \n"
135           "\trsbmi %0, %0, #0 \n"
136           "\tmovs %4, %1\n"
137 +         "\tit mi \n"
138           "\trsbmi %1, %1, #0 \n"
139           "\tmov %4, #1\n"
140  
141           "\tsubs %3, %0, %1, asl #14 \n"
142 +         "\titt pl \n"
143           "\torrpl %2, %2, %4, asl #14 \n"
144           "\tmovpl %0, %3 \n"
145  
146           "\tsubs %3, %0, %1, asl #13 \n"
147 +         "\titt pl \n"
148           "\torrpl %2, %2, %4, asl #13 \n"
149           "\tmovpl %0, %3 \n"
150  
151           "\tsubs %3, %0, %1, asl #12 \n"
152 +         "\titt pl \n"
153           "\torrpl %2, %2, %4, asl #12 \n"
154           "\tmovpl %0, %3 \n"
155  
156           "\tsubs %3, %0, %1, asl #11 \n"
157 +         "\titt pl \n"
158           "\torrpl %2, %2, %4, asl #11 \n"
159           "\tmovpl %0, %3 \n"
160  
161           "\tsubs %3, %0, %1, asl #10 \n"
162 +         "\titt pl \n"
163           "\torrpl %2, %2, %4, asl #10 \n"
164           "\tmovpl %0, %3 \n"
165  
166           "\tsubs %3, %0, %1, asl #9 \n"
167 +         "\titt pl \n"
168           "\torrpl %2, %2, %4, asl #9 \n"
169           "\tmovpl %0, %3 \n"
170  
171           "\tsubs %3, %0, %1, asl #8 \n"
172 +         "\titt pl \n"
173           "\torrpl %2, %2, %4, asl #8 \n"
174           "\tmovpl %0, %3 \n"
175  
176           "\tsubs %3, %0, %1, asl #7 \n"
177 +         "\titt pl \n"
178           "\torrpl %2, %2, %4, asl #7 \n"
179           "\tmovpl %0, %3 \n"
180  
181           "\tsubs %3, %0, %1, asl #6 \n"
182 +         "\titt pl \n"
183           "\torrpl %2, %2, %4, asl #6 \n"
184           "\tmovpl %0, %3 \n"
185  
186           "\tsubs %3, %0, %1, asl #5 \n"
187 +         "\titt pl \n"
188           "\torrpl %2, %2, %4, asl #5 \n"
189           "\tmovpl %0, %3 \n"
190  
191           "\tsubs %3, %0, %1, asl #4 \n"
192 +         "\titt pl \n"
193           "\torrpl %2, %2, %4, asl #4 \n"
194           "\tmovpl %0, %3 \n"
195  
196           "\tsubs %3, %0, %1, asl #3 \n"
197 +         "\titt pl \n"
198           "\torrpl %2, %2, %4, asl #3 \n"
199           "\tmovpl %0, %3 \n"
200  
201           "\tsubs %3, %0, %1, asl #2 \n"
202 +         "\titt pl \n"
203           "\torrpl %2, %2, %4, asl #2 \n"
204           "\tmovpl %0, %3 \n"
205  
206           "\tsubs %3, %0, %1, asl #1 \n"
207 +         "\titt pl \n"
208           "\torrpl %2, %2, %4, asl #1 \n"
209           "\tmovpl %0, %3 \n"
210  
211           "\tsubs %3, %0, %1 \n"
212 +         "\titt pl \n"
213           "\torrpl %2, %2, %4 \n"
214           "\tmovpl %0, %3 \n"
215           
216           "\tmovs %5, %5, lsr #31 \n"
217 +         "\tit ne \n"
218           "\trsbne %2, %2, #0 \n"
219     : "=r" (dead1), "=r" (dead2), "=r" (res),
220     "=r" (dead3), "=r" (dead4), "=r" (dead5)