/media/libvpx/solaris.patch

http://github.com/zpao/v8monkey · Patch · 147 lines · 139 code · 8 blank · 0 comment · 0 complexity · 580b7f024dcb1c5504c0891d43cfa937 MD5 · raw file

  1. diff --git a/media/libvpx/vp8/common/loopfilter_filters.c b/media/libvpx/vp8/common/loopfilter_filters.c
  2. --- a/media/libvpx/vp8/common/loopfilter_filters.c
  3. +++ b/media/libvpx/vp8/common/loopfilter_filters.c
  4. @@ -11,10 +11,14 @@
  5. #include <stdlib.h>
  6. #include "loopfilter.h"
  7. #include "onyxc_int.h"
  8. +#ifdef __SUNPRO_C
  9. +#define __inline inline
  10. +#endif
  11. +
  12. typedef unsigned char uc;
  13. static __inline signed char vp8_signed_char_clamp(int t)
  14. {
  15. t = (t < -128 ? -128 : t);
  16. diff --git a/media/libvpx/vpx_ports/mem.h b/media/libvpx/vpx_ports/mem.h
  17. --- a/media/libvpx/vpx_ports/mem.h
  18. +++ b/media/libvpx/vpx_ports/mem.h
  19. @@ -9,17 +9,17 @@
  20. */
  21. #ifndef VPX_PORTS_MEM_H
  22. #define VPX_PORTS_MEM_H
  23. #include "vpx_config.h"
  24. #include "vpx/vpx_integer.h"
  25. -#if defined(__GNUC__) && __GNUC__
  26. +#if (defined(__GNUC__) && __GNUC__) || defined(__SUNPRO_C)
  27. #define DECLARE_ALIGNED(n,typ,val) typ val __attribute__ ((aligned (n)))
  28. #elif defined(_MSC_VER)
  29. #define DECLARE_ALIGNED(n,typ,val) __declspec(align(n)) typ val
  30. #else
  31. #warning No alignment directives known for this compiler.
  32. #define DECLARE_ALIGNED(n,typ,val) typ val
  33. #endif
  34. #endif
  35. diff --git a/media/libvpx/vpx_ports/x86.h b/media/libvpx/vpx_ports/x86.h
  36. --- a/media/libvpx/vpx_ports/x86.h
  37. +++ b/media/libvpx/vpx_ports/x86.h
  38. @@ -45,16 +45,36 @@
  39. #define cpuid(func,ax,bx,cx,dx)\
  40. __asm__ __volatile__ (\
  41. "mov %%ebx, %%edi \n\t" \
  42. "cpuid \n\t" \
  43. "xchg %%edi, %%ebx \n\t" \
  44. : "=a" (ax), "=D" (bx), "=c" (cx), "=d" (dx) \
  45. : "a" (func));
  46. #endif
  47. +#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
  48. +#if ARCH_X86_64
  49. +#define cpuid(func,ax,bx,cx,dx)\
  50. + asm volatile (\
  51. + "xchg %rsi, %rbx \n\t" \
  52. + "cpuid \n\t" \
  53. + "movl %ebx, %edi \n\t" \
  54. + "xchg %rsi, %rbx \n\t" \
  55. + : "=a" (ax), "=D" (bx), "=c" (cx), "=d" (dx) \
  56. + : "a" (func));
  57. +#else
  58. +#define cpuid(func,ax,bx,cx,dx)\
  59. + asm volatile (\
  60. + "pushl %ebx \n\t" \
  61. + "cpuid \n\t" \
  62. + "movl %ebx, %edi \n\t" \
  63. + "popl %ebx \n\t" \
  64. + : "=a" (ax), "=D" (bx), "=c" (cx), "=d" (dx) \
  65. + : "a" (func));
  66. +#endif
  67. #else
  68. #if ARCH_X86_64
  69. void __cpuid(int CPUInfo[4], int info_type);
  70. #pragma intrinsic(__cpuid)
  71. #define cpuid(func,a,b,c,d) do{\
  72. int regs[4];\
  73. __cpuid(regs,func); a=regs[0]; b=regs[1]; c=regs[2]; d=regs[3];\
  74. } while(0)
  75. @@ -108,29 +128,36 @@ unsigned __int64 __rdtsc(void);
  76. #endif
  77. static unsigned int
  78. x86_readtsc(void)
  79. {
  80. #if defined(__GNUC__) && __GNUC__
  81. unsigned int tsc;
  82. __asm__ __volatile__("rdtsc\n\t":"=a"(tsc):);
  83. return tsc;
  84. +#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
  85. + unsigned int tsc;
  86. + asm volatile("rdtsc\n\t":"=a"(tsc):);
  87. + return tsc;
  88. #else
  89. #if ARCH_X86_64
  90. return __rdtsc();
  91. #else
  92. __asm rdtsc;
  93. #endif
  94. #endif
  95. }
  96. #if defined(__GNUC__) && __GNUC__
  97. #define x86_pause_hint()\
  98. __asm__ __volatile__ ("pause \n\t")
  99. +#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
  100. +#define x86_pause_hint()\
  101. + asm volatile ("pause \n\t")
  102. #else
  103. #if ARCH_X86_64
  104. #define x86_pause_hint()\
  105. _mm_pause();
  106. #else
  107. #define x86_pause_hint()\
  108. __asm pause
  109. #endif
  110. @@ -144,16 +171,29 @@ x87_set_control_word(unsigned short mode
  111. }
  112. static unsigned short
  113. x87_get_control_word(void)
  114. {
  115. unsigned short mode;
  116. __asm__ __volatile__("fstcw %0\n\t":"=m"(*&mode):);
  117. return mode;
  118. }
  119. +#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
  120. +static void
  121. +x87_set_control_word(unsigned short mode)
  122. +{
  123. + asm volatile("fldcw %0" : : "m"(*&mode));
  124. +}
  125. +static unsigned short
  126. +x87_get_control_word(void)
  127. +{
  128. + unsigned short mode;
  129. + asm volatile("fstcw %0\n\t":"=m"(*&mode):);
  130. + return mode;
  131. +}
  132. #elif ARCH_X86_64
  133. /* No fldcw intrinsics on Windows x64, punt to external asm */
  134. extern void vpx_winx64_fldcw(unsigned short mode);
  135. extern unsigned short vpx_winx64_fstcw(void);
  136. #define x87_set_control_word vpx_winx64_fldcw
  137. #define x87_get_control_word vpx_winx64_fstcw
  138. #else
  139. static void