Originally committed as revision 1004 to svn://svn.ffmpeg.org/ffmpeg/trunk
| ... | ... |
@@ -22,6 +22,21 @@ |
| 22 | 22 |
|
| 23 | 23 |
#include <inttypes.h> |
| 24 | 24 |
|
| 25 |
+#if defined __GNUC__ |
|
| 26 |
+# define GNUC_PREREQ(maj, min) \ |
|
| 27 |
+ ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) |
|
| 28 |
+#else |
|
| 29 |
+# define GNUC_PREREQ(maj, min) 0 |
|
| 30 |
+#endif |
|
| 31 |
+ |
|
| 32 |
+#if GNUC_PREREQ(2,96) |
|
| 33 |
+# define likely(x) __builtin_expect((x) != 0, 1) |
|
| 34 |
+# define unlikely(x) __builtin_expect((x) != 0, 0) |
|
| 35 |
+#else |
|
| 36 |
+# define likely(x) (x) |
|
| 37 |
+# define unlikely(x) (x) |
|
| 38 |
+#endif |
|
| 39 |
+ |
|
| 25 | 40 |
#define AMASK_BWX (1 << 0) |
| 26 | 41 |
#define AMASK_FIX (1 << 1) |
| 27 | 42 |
#define AMASK_CIX (1 << 2) |
| ... | ... |
@@ -45,6 +60,7 @@ inline static uint64_t WORD_VEC(uint64_t x) |
| 45 | 45 |
#define ldl(p) (*(const int32_t *) (p)) |
| 46 | 46 |
#define stl(l, p) do { *(uint32_t *) (p) = (l); } while (0)
|
| 47 | 47 |
#define stq(l, p) do { *(uint64_t *) (p) = (l); } while (0)
|
| 48 |
+#define sextw(x) ((int16_t) (x)) |
|
| 48 | 49 |
|
| 49 | 50 |
#ifdef __GNUC__ |
| 50 | 51 |
#define ASM_ACCEPT_MVI asm (".arch pca56")
|
| ... | ... |
@@ -52,10 +68,26 @@ struct unaligned_long { uint64_t l; } __attribute__((packed));
|
| 52 | 52 |
#define ldq_u(p) (*(const uint64_t *) (((uint64_t) (p)) & ~7ul)) |
| 53 | 53 |
#define uldq(a) (((const struct unaligned_long *) (a))->l) |
| 54 | 54 |
|
| 55 |
-#if __GNUC__ >= 3 && __GNUC_MINOR__ >= 3 |
|
| 55 |
+#if GNUC_PREREQ(3,0) |
|
| 56 |
+/* Unfortunately, __builtin_prefetch is slightly buggy on Alpha. The |
|
| 57 |
+ defines here are kludged so we still get the right |
|
| 58 |
+ instruction. This needs to be adapted as soon as gcc is fixed. */ |
|
| 59 |
+# define prefetch(p) __builtin_prefetch((p), 0, 1) |
|
| 60 |
+# define prefetch_en(p) __builtin_prefetch((p), 1, 1) |
|
| 61 |
+# define prefetch_m(p) __builtin_prefetch((p), 0, 0) |
|
| 62 |
+# define prefetch_men(p) __builtin_prefetch((p), 1, 0) |
|
| 63 |
+#else |
|
| 64 |
+# define prefetch(p) asm volatile("ldl $31,%0" : : "m"(*(const char *) (p)) : "memory")
|
|
| 65 |
+# define prefetch_en(p) asm volatile("ldq $31,%0" : : "m"(*(const char *) (p)) : "memory")
|
|
| 66 |
+# define prefetch_m(p) asm volatile("lds $f31,%0" : : "m"(*(const char *) (p)) : "memory")
|
|
| 67 |
+# define prefetch_men(p) asm volatile("ldt $f31,%0" : : "m"(*(const char *) (p)) : "memory")
|
|
| 68 |
+#endif |
|
| 69 |
+ |
|
| 70 |
+#if GNUC_PREREQ(3,3) |
|
| 56 | 71 |
#define cmpbge __builtin_alpha_cmpbge |
| 57 | 72 |
/* Avoid warnings. */ |
| 58 | 73 |
#define extql(a, b) __builtin_alpha_extql(a, (uint64_t) (b)) |
| 74 |
+#define extwl(a, b) __builtin_alpha_extwl(a, (uint64_t) (b)) |
|
| 59 | 75 |
#define extqh(a, b) __builtin_alpha_extqh(a, (uint64_t) (b)) |
| 60 | 76 |
#define zap __builtin_alpha_zap |
| 61 | 77 |
#define zapnot __builtin_alpha_zapnot |
| ... | ... |
@@ -78,6 +110,7 @@ struct unaligned_long { uint64_t l; } __attribute__((packed));
|
| 78 | 78 |
#else |
| 79 | 79 |
#define cmpbge(a, b) ({ uint64_t __r; asm ("cmpbge %r1,%2,%0" : "=r" (__r) : "rJ" (a), "rI" (b)); __r; })
|
| 80 | 80 |
#define extql(a, b) ({ uint64_t __r; asm ("extql %r1,%2,%0" : "=r" (__r) : "rJ" (a), "rI" (b)); __r; })
|
| 81 |
+#define extwl(a, b) ({ uint64_t __r; asm ("extwl %r1,%2,%0" : "=r" (__r) : "rJ" (a), "rI" (b)); __r; })
|
|
| 81 | 82 |
#define extqh(a, b) ({ uint64_t __r; asm ("extqh %r1,%2,%0" : "=r" (__r) : "rJ" (a), "rI" (b)); __r; })
|
| 82 | 83 |
#define zap(a, b) ({ uint64_t __r; asm ("zap %r1,%2,%0" : "=r" (__r) : "rJ" (a), "rI" (b)); __r; })
|
| 83 | 84 |
#define zapnot(a, b) ({ uint64_t __r; asm ("zapnot %r1,%2,%0" : "=r" (__r) : "rJ" (a), "rI" (b)); __r; })
|
| ... | ... |
@@ -99,7 +132,7 @@ struct unaligned_long { uint64_t l; } __attribute__((packed));
|
| 99 | 99 |
#define unpkbw(a) ({ uint64_t __r; asm ("unpkbw %r1,%0" : "=r" (__r) : "rJ" (a)); __r; })
|
| 100 | 100 |
#endif |
| 101 | 101 |
|
| 102 |
-#elif defined(__DECC) /* Digital/Compaq "ccc" compiler */ |
|
| 102 |
+#elif defined(__DECC) /* Digital/Compaq/hp "ccc" compiler */ |
|
| 103 | 103 |
|
| 104 | 104 |
#include <c_asm.h> |
| 105 | 105 |
#define ASM_ACCEPT_MVI |
| ... | ... |
@@ -107,6 +140,7 @@ struct unaligned_long { uint64_t l; } __attribute__((packed));
|
| 107 | 107 |
#define uldq(a) (*(const __unaligned uint64_t *) (a)) |
| 108 | 108 |
#define cmpbge(a, b) asm ("cmpbge %a0,%a1,%v0", a, b)
|
| 109 | 109 |
#define extql(a, b) asm ("extql %a0,%a1,%v0", a, b)
|
| 110 |
+#define extwl(a, b) asm ("extwl %a0,%a1,%v0", a, b)
|
|
| 110 | 111 |
#define extqh(a, b) asm ("extqh %a0,%a1,%v0", a, b)
|
| 111 | 112 |
#define zap(a, b) asm ("zap %a0,%a1,%v0", a, b)
|
| 112 | 113 |
#define zapnot(a, b) asm ("zapnot %a0,%a1,%v0", a, b)
|