libgcrypt-1.5.4-clang-arm.patch 4.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. fix from upstream
  2. From e67c67321ce240c93dd0fa2b21c649c0a8e233f7 Mon Sep 17 00:00:00 2001
  3. From: Jussi Kivilinna <jussi.kivilinna@iki.fi>
  4. Date: Tue, 22 Oct 2013 17:07:53 +0300
  5. Subject: [PATCH] mpi: allow building with clang on ARM
  6. * mpi/longlong.h [__arm__] (add_ssaaaa, sub_ddmmss, umul_ppmm)
  7. (count_leading_zeros): Do not cast assembly output arguments.
  8. [__arm__] (umul_ppmm): Remove the extra '%' ahead of assembly comment.
  9. [_ARM_ARCH >= 4] (umul_ppmm): Use correct inputs and outputs instead of
  10. registers.
  11. --
  12. Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
  13. ---
  14. mpi/longlong.h | 27 +++++++++++++--------------
  15. 1 file changed, 13 insertions(+), 14 deletions(-)
  16. diff --git a/mpi/longlong.h b/mpi/longlong.h
  17. index c2ab9c5..8c8260e 100644
  18. --- a/mpi/longlong.h
  19. +++ b/mpi/longlong.h
  20. @@ -188,8 +188,8 @@ extern UDItype __udiv_qrnnd ();
  21. #define add_ssaaaa(sh, sl, ah, al, bh, bl) \
  22. __asm__ ("adds %1, %4, %5\n" \
  23. "adc %0, %2, %3" \
  24. - : "=r" ((USItype)(sh)), \
  25. - "=&r" ((USItype)(sl)) \
  26. + : "=r" ((sh)), \
  27. + "=&r" ((sl)) \
  28. : "%r" ((USItype)(ah)), \
  29. "rI" ((USItype)(bh)), \
  30. "%r" ((USItype)(al)), \
  31. @@ -197,15 +197,15 @@ extern UDItype __udiv_qrnnd ();
  32. #define sub_ddmmss(sh, sl, ah, al, bh, bl) \
  33. __asm__ ("subs %1, %4, %5\n" \
  34. "sbc %0, %2, %3" \
  35. - : "=r" ((USItype)(sh)), \
  36. - "=&r" ((USItype)(sl)) \
  37. + : "=r" ((sh)), \
  38. + "=&r" ((sl)) \
  39. : "r" ((USItype)(ah)), \
  40. "rI" ((USItype)(bh)), \
  41. "r" ((USItype)(al)), \
  42. "rI" ((USItype)(bl)))
  43. #if defined __ARM_ARCH_2__ || defined __ARM_ARCH_3__
  44. #define umul_ppmm(xh, xl, a, b) \
  45. - __asm__ ("%@ Inlined umul_ppmm\n" \
  46. + __asm__ ("@ Inlined umul_ppmm\n" \
  47. "mov %|r0, %2, lsr #16 @ AAAA\n" \
  48. "mov %|r2, %3, lsr #16 @ BBBB\n" \
  49. "bic %|r1, %2, %|r0, lsl #16 @ aaaa\n" \
  50. @@ -218,20 +218,19 @@ extern UDItype __udiv_qrnnd ();
  51. "addcs %|r2, %|r2, #65536\n" \
  52. "adds %1, %|r1, %|r0, lsl #16\n" \
  53. "adc %0, %|r2, %|r0, lsr #16" \
  54. - : "=&r" ((USItype)(xh)), \
  55. - "=r" ((USItype)(xl)) \
  56. + : "=&r" ((xh)), \
  57. + "=r" ((xl)) \
  58. : "r" ((USItype)(a)), \
  59. "r" ((USItype)(b)) \
  60. : "r0", "r1", "r2")
  61. #else
  62. #define umul_ppmm(xh, xl, a, b) \
  63. - __asm__ ("%@ Inlined umul_ppmm\n" \
  64. - "umull %r1, %r0, %r2, %r3" \
  65. - : "=&r" ((USItype)(xh)), \
  66. - "=r" ((USItype)(xl)) \
  67. + __asm__ ("@ Inlined umul_ppmm\n" \
  68. + "umull %1, %0, %2, %3" \
  69. + : "=&r" ((xh)), \
  70. + "=r" ((xl)) \
  71. : "r" ((USItype)(a)), \
  72. - "r" ((USItype)(b)) \
  73. - : "r0", "r1")
  74. + "r" ((USItype)(b)))
  75. #endif
  76. #define UMUL_TIME 20
  77. #define UDIV_TIME 100
  78. --
  79. 2.4.4