[arm] Fix thumb2 inline assembly under LLVM.

When using `ADD' with an immediate operand, the instruction is
actually `ADD Rd, Rn, #<imm12>', that is, the maximum of the
immediate operand cannot exceed 4095.  It will fail to compile with
LLVM.

However, in GCC, due to some legacy compatibility considerations,
`ADD.W' will be automatically emitted when the immediate operand is
larger than 4095.

* builds/unix/ftconfig.in, include/freetype/config/ftconfig.h
(FT_MulFix_arm) [__GNUC__]: Support clang compiler.

* src/truetype/ttinterp.c (TT_MulFix14_arm) [__GNUC__]: Ditto.
This commit is contained in:
Chongyu Zhu 2013-10-15 11:40:34 +02:00 committed by Werner Lemberg
parent b6695243b7
commit 41632b58ef
4 changed files with 30 additions and 0 deletions

View File

@ -1,3 +1,21 @@
2013-10-15 Chongyu Zhu <lembacon@gmail.com>
[arm] Fix thumb2 inline assembly under LLVM.
When using `ADD' with an immediate operand, the instruction is
actually `ADD Rd, Rn, #<imm12>', that is, the maximum of the
immediate operand cannot exceed 4095. It will fail to compile with
LLVM.
However, in GCC, due to some legacy compatibility considerations,
`ADD.W' will be automatically emitted when the immediate operand is
larger than 4095.
* builds/unix/ftconfig.in, include/freetype/config/ftconfig.h
(FT_MulFix_arm) [__GNUC__]: Support clang compiler.
* src/truetype/ttinterp.c (TT_MulFix14_arm) [__GNUC__]: Ditto.
2013-10-12 Werner Lemberg <wl@gnu.org>
[autofit] Improve tracing of `latin' hinter.

View File

@ -419,7 +419,11 @@ FT_BEGIN_HEADER
__asm__ __volatile__ (
"smull %1, %2, %4, %3\n\t" /* (lo=%1,hi=%2) = a*b */
"mov %0, %2, asr #31\n\t" /* %0 = (hi >> 31) */
#ifdef __clang__
"add.w %0, %0, #0x8000\n\t" /* %0 += 0x8000 */
#else
"add %0, %0, #0x8000\n\t" /* %0 += 0x8000 */
#endif
"adds %1, %1, %0\n\t" /* %1 += %0 */
"adc %2, %2, #0\n\t" /* %2 += carry */
"mov %0, %1, lsr #16\n\t" /* %0 = %1 >> 16 */

View File

@ -386,7 +386,11 @@ FT_BEGIN_HEADER
__asm__ __volatile__ (
"smull %1, %2, %4, %3\n\t" /* (lo=%1,hi=%2) = a*b */
"mov %0, %2, asr #31\n\t" /* %0 = (hi >> 31) */
#ifdef __clang__
"add.w %0, %0, #0x8000\n\t" /* %0 += 0x8000 */
#else
"add %0, %0, #0x8000\n\t" /* %0 += 0x8000 */
#endif
"adds %1, %1, %0\n\t" /* %1 += %0 */
"adc %2, %2, #0\n\t" /* %2 += carry */
"mov %0, %1, lsr #16\n\t" /* %0 = %1 >> 16 */

View File

@ -1470,7 +1470,11 @@
__asm__ __volatile__ (
"smull %1, %2, %4, %3\n\t" /* (lo=%1,hi=%2) = a*b */
"mov %0, %2, asr #31\n\t" /* %0 = (hi >> 31) */
#ifdef __clang__
"add.w %0, %0, #0x2000\n\t" /* %0 += 0x2000 */
#else
"add %0, %0, #0x2000\n\t" /* %0 += 0x2000 */
#endif
"adds %1, %1, %0\n\t" /* %1 += %0 */
"adc %2, %2, #0\n\t" /* %2 += carry */
"mov %0, %1, lsr #14\n\t" /* %0 = %1 >> 16 */