0004-thumb2-fixed-arm.patch 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. Fixes Thumb2-related build failure
  2. Patch below comes from the Debian libmad package.
  3. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  4. From: Dave Martin
  5. Subject: "rsc" doesnt exist anymore in thumb2
  6. diff --git a/fixed.h b/fixed.h
  7. index 4b58abf..ba4bc26 100644
  8. --- a/fixed.h
  9. +++ b/fixed.h
  10. @@ -275,12 +275,25 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y)
  11. : "+r" (lo), "+r" (hi) \
  12. : "%r" (x), "r" (y))
  13. +#ifdef __thumb__
  14. +/* In Thumb-2, the RSB-immediate instruction is only allowed with a zero
  15. + operand. If needed this code can also support Thumb-1
  16. + (simply append "s" to the end of the second two instructions). */
  17. +# define MAD_F_MLN(hi, lo) \
  18. + asm ("rsbs %0, %0, #0\n\t" \
  19. + "sbc %1, %1, %1\n\t" \
  20. + "sub %1, %1, %2" \
  21. + : "+&r" (lo), "=&r" (hi) \
  22. + : "r" (hi) \
  23. + : "cc")
  24. +#else /* ! __thumb__ */
  25. # define MAD_F_MLN(hi, lo) \
  26. asm ("rsbs %0, %2, #0\n\t" \
  27. "rsc %1, %3, #0" \
  28. - : "=r" (lo), "=r" (hi) \
  29. + : "=&r" (lo), "=r" (hi) \
  30. : "0" (lo), "1" (hi) \
  31. : "cc")
  32. +#endif /* __thumb__ */
  33. # define mad_f_scale64(hi, lo) \
  34. ({ mad_fixed_t __result; \