You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
2.0 KiB

  1. --- a/fixed.h
  2. +++ b/fixed.h
  3. @@ -299,6 +299,23 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t
  4. # elif defined(FPM_MIPS)
  5. +/* Test for gcc >= maj.min, as per __GNUC_PREREQ in glibc */
  6. +#if defined (__GNUC__) && defined (__GNUC_MINOR__)
  7. +#define __GNUC_PREREQ(maj, min) \
  8. + ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
  9. +#else
  10. +#define __GNUC_PREREQ(maj, min) 0
  11. +#endif
  12. +
  13. +#if __GNUC_PREREQ(4,4)
  14. + typedef unsigned int u64_di_t __attribute__ ((mode (DI)));
  15. +# define MAD_F_MLX(hi, lo, x, y) \
  16. + do { \
  17. + u64_di_t __ll = (u64_di_t) (x) * (y); \
  18. + hi = __ll >> 32; \
  19. + lo = __ll; \
  20. + } while (0)
  21. +#else
  22. /*
  23. * This MIPS version is fast and accurate; the disposition of the least
  24. * significant bit depends on OPT_ACCURACY via mad_f_scale64().
  25. @@ -328,6 +345,7 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t
  26. : "%r" ((x) >> 12), "r" ((y) >> 16))
  27. # define MAD_F_MLZ(hi, lo) ((mad_fixed_t) (lo))
  28. # endif
  29. +#endif /* __GNU_PREREQ(4,4) */
  30. # if defined(OPT_SPEED)
  31. # define mad_f_scale64(hi, lo) \
  32. --- a/mad.h
  33. +++ b/mad.h
  34. @@ -344,6 +344,23 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t
  35. # elif defined(FPM_MIPS)
  36. +/* Test for gcc >= maj.min, as per __GNUC_PREREQ in glibc */
  37. +#if defined (__GNUC__) && defined (__GNUC_MINOR__)
  38. +#define __GNUC_PREREQ(maj, min) \
  39. + ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
  40. +#else
  41. +#define __GNUC_PREREQ(maj, min) 0
  42. +#endif
  43. +
  44. +#if __GNUC_PREREQ(4,4)
  45. + typedef unsigned int u64_di_t __attribute__ ((mode (DI)));
  46. +# define MAD_F_MLX(hi, lo, x, y) \
  47. + do { \
  48. + u64_di_t __ll = (u64_di_t) (x) * (y); \
  49. + hi = __ll >> 32; \
  50. + lo = __ll; \
  51. + } while (0)
  52. +#else
  53. /*
  54. * This MIPS version is fast and accurate; the disposition of the least
  55. * significant bit depends on OPT_ACCURACY via mad_f_scale64().
  56. @@ -373,6 +390,7 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t
  57. : "%r" ((x) >> 12), "r" ((y) >> 16))
  58. # define MAD_F_MLZ(hi, lo) ((mad_fixed_t) (lo))
  59. # endif
  60. +#endif /* __GNU_PREREQ(4,4) */
  61. # if defined(OPT_SPEED)
  62. # define mad_f_scale64(hi, lo) \