0001-thumb2-support.patch 6.4 KB

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