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