Blame SOURCES/Provide-Thumb-2-alternative-code-for-MAD_F_MLN.diff

6d692a
From: Dave Martin
6d692a
Subject: "rsc" doesnt exist anymore in thumb2
6d692a
6d692a
diff --git a/fixed.h b/fixed.h
6d692a
index 4b58abf..ba4bc26 100644
6d692a
--- a/fixed.h
6d692a
+++ b/fixed.h
6d692a
@@ -275,12 +275,25 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y)
6d692a
 	 : "+r" (lo), "+r" (hi)  \
6d692a
 	 : "%r" (x), "r" (y))
6d692a
 
6d692a
+#ifdef __thumb__
6d692a
+/* In Thumb-2, the RSB-immediate instruction is only allowed with a zero
6d692a
+	operand.  If needed this code can also support Thumb-1 
6d692a
+	(simply append "s" to the end of the second two instructions). */
6d692a
+#  define MAD_F_MLN(hi, lo)  \
6d692a
+    asm ("rsbs        %0, %0, #0\n\t"  \
6d692a
+	 "sbc   %1, %1, %1\n\t"  \
6d692a
+	 "sub   %1, %1, %2"  \
6d692a
+	 : "+&r" (lo), "=&r" (hi)  \
6d692a
+	 : "r" (hi)  \
6d692a
+	 : "cc")
6d692a
+#else /* ! __thumb__ */
6d692a
 #  define MAD_F_MLN(hi, lo)  \
6d692a
     asm ("rsbs	%0, %2, #0\n\t"  \
6d692a
 	 "rsc	%1, %3, #0"  \
6d692a
-	 : "=r" (lo), "=r" (hi)  \
6d692a
+	 : "=&r" (lo), "=r" (hi)  \
6d692a
 	 : "0" (lo), "1" (hi)  \
6d692a
 	 : "cc")
6d692a
+#endif /* __thumb__ */
6d692a
 
6d692a
 #  define mad_f_scale64(hi, lo)  \
6d692a
     ({ mad_fixed_t __result;  \