zpl: Fix memory leaks
[vlc/gmpfix.git] / contrib / src / mad / Provide-Thumb-2-alternative-code-for-MAD_F_MLN.diff
blob46415107d248081fc2d7ab08d61cca4f662aaf77
1 From: Dave Martin
2 Subject: "rsc" doesnt exist anymore in thumb2
4 diff --git a/fixed.h b/fixed.h
5 index 4b58abf..ba4bc26 100644
6 --- a/fixed.h
7 +++ b/fixed.h
8 @@ -275,12 +275,25 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y)
9 : "+r" (lo), "+r" (hi) \
10 : "%r" (x), "r" (y))
12 +#ifdef __thumb__
13 +/* In Thumb-2, the RSB-immediate instruction is only allowed with a zero
14 + operand. If needed this code can also support Thumb-1
15 + (simply append "s" to the end of the second two instructions). */
16 +# define MAD_F_MLN(hi, lo) \
17 + asm ("rsbs %0, %0, #0\n\t" \
18 + "sbc %1, %1, %1\n\t" \
19 + "sub %1, %1, %2" \
20 + : "+&r" (lo), "=&r" (hi) \
21 + : "r" (hi) \
22 + : "cc")
23 +#else /* ! __thumb__ */
24 # define MAD_F_MLN(hi, lo) \
25 asm ("rsbs %0, %2, #0\n\t" \
26 "rsc %1, %3, #0" \
27 - : "=r" (lo), "=r" (hi) \
28 + : "=&r" (lo), "=r" (hi) \
29 : "0" (lo), "1" (hi) \
30 : "cc")
31 +#endif /* __thumb__ */
33 # define mad_f_scale64(hi, lo) \
34 ({ mad_fixed_t __result; \