aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/alpha/kernel/sys_titan.c3
-rw-r--r--include/asm-alpha/compiler.h47
2 files changed, 36 insertions, 14 deletions
diff --git a/arch/alpha/kernel/sys_titan.c b/arch/alpha/kernel/sys_titan.c
index 29ab7db81c30..f009b7bc0943 100644
--- a/arch/alpha/kernel/sys_titan.c
+++ b/arch/alpha/kernel/sys_titan.c
@@ -257,8 +257,7 @@ titan_dispatch_irqs(u64 mask)
257 */ 257 */
258 while (mask) { 258 while (mask) {
259 /* convert to SRM vector... priority is <63> -> <0> */ 259 /* convert to SRM vector... priority is <63> -> <0> */
260 __asm__("ctlz %1, %0" : "=r"(vector) : "r"(mask)); 260 vector = 63 - __kernel_ctlz(mask);
261 vector = 63 - vector;
262 mask &= ~(1UL << vector); /* clear it out */ 261 mask &= ~(1UL << vector); /* clear it out */
263 vector = 0x900 + (vector << 4); /* convert to SRM vector */ 262 vector = 0x900 + (vector << 4); /* convert to SRM vector */
264 263
diff --git a/include/asm-alpha/compiler.h b/include/asm-alpha/compiler.h
index d2768cc3d7a4..da6bb199839c 100644
--- a/include/asm-alpha/compiler.h
+++ b/include/asm-alpha/compiler.h
@@ -17,9 +17,6 @@
17# define __kernel_extbl(val, shift) __builtin_alpha_extbl(val, shift) 17# define __kernel_extbl(val, shift) __builtin_alpha_extbl(val, shift)
18# define __kernel_extwl(val, shift) __builtin_alpha_extwl(val, shift) 18# define __kernel_extwl(val, shift) __builtin_alpha_extwl(val, shift)
19# define __kernel_cmpbge(a, b) __builtin_alpha_cmpbge(a, b) 19# define __kernel_cmpbge(a, b) __builtin_alpha_cmpbge(a, b)
20# define __kernel_cttz(x) __builtin_ctzl(x)
21# define __kernel_ctlz(x) __builtin_clzl(x)
22# define __kernel_ctpop(x) __builtin_popcountl(x)
23#else 20#else
24# define __kernel_insbl(val, shift) \ 21# define __kernel_insbl(val, shift) \
25 ({ unsigned long __kir; \ 22 ({ unsigned long __kir; \
@@ -49,17 +46,39 @@
49 ({ unsigned long __kir; \ 46 ({ unsigned long __kir; \
50 __asm__("cmpbge %r2,%1,%0" : "=r"(__kir) : "rI"(b), "rJ"(a)); \ 47 __asm__("cmpbge %r2,%1,%0" : "=r"(__kir) : "rI"(b), "rJ"(a)); \
51 __kir; }) 48 __kir; })
49#endif
50
51#ifdef __alpha_cix__
52# if __GNUC__ == 3 && __GNUC_MINOR__ >= 4 || __GNUC__ > 3
53# define __kernel_cttz(x) __builtin_ctzl(x)
54# define __kernel_ctlz(x) __builtin_clzl(x)
55# define __kernel_ctpop(x) __builtin_popcountl(x)
56# else
57# define __kernel_cttz(x) \
58 ({ unsigned long __kir; \
59 __asm__("cttz %1,%0" : "=r"(__kir) : "r"(x)); \
60 __kir; })
61# define __kernel_ctlz(x) \
62 ({ unsigned long __kir; \
63 __asm__("ctlz %1,%0" : "=r"(__kir) : "r"(x)); \
64 __kir; })
65# define __kernel_ctpop(x) \
66 ({ unsigned long __kir; \
67 __asm__("ctpop %1,%0" : "=r"(__kir) : "r"(x)); \
68 __kir; })
69# endif
70#else
52# define __kernel_cttz(x) \ 71# define __kernel_cttz(x) \
53 ({ unsigned long __kir; \ 72 ({ unsigned long __kir; \
54 __asm__("cttz %1,%0" : "=r"(__kir) : "r"(x)); \ 73 __asm__(".arch ev67; cttz %1,%0" : "=r"(__kir) : "r"(x)); \
55 __kir; }) 74 __kir; })
56# define __kernel_ctlz(x) \ 75# define __kernel_ctlz(x) \
57 ({ unsigned long __kir; \ 76 ({ unsigned long __kir; \
58 __asm__("ctlz %1,%0" : "=r"(__kir) : "r"(x)); \ 77 __asm__(".arch ev67; ctlz %1,%0" : "=r"(__kir) : "r"(x)); \
59 __kir; }) 78 __kir; })
60# define __kernel_ctpop(x) \ 79# define __kernel_ctpop(x) \
61 ({ unsigned long __kir; \ 80 ({ unsigned long __kir; \
62 __asm__("ctpop %1,%0" : "=r"(__kir) : "r"(x)); \ 81 __asm__(".arch ev67; ctpop %1,%0" : "=r"(__kir) : "r"(x)); \
63 __kir; }) 82 __kir; })
64#endif 83#endif
65 84
@@ -78,16 +97,20 @@
78#else 97#else
79#define __kernel_ldbu(mem) \ 98#define __kernel_ldbu(mem) \
80 ({ unsigned char __kir; \ 99 ({ unsigned char __kir; \
81 __asm__("ldbu %0,%1" : "=r"(__kir) : "m"(mem)); \ 100 __asm__(".arch ev56; \
101 ldbu %0,%1" : "=r"(__kir) : "m"(mem)); \
82 __kir; }) 102 __kir; })
83#define __kernel_ldwu(mem) \ 103#define __kernel_ldwu(mem) \
84 ({ unsigned short __kir; \ 104 ({ unsigned short __kir; \
85 __asm__("ldwu %0,%1" : "=r"(__kir) : "m"(mem)); \ 105 __asm__(".arch ev56; \
106 ldwu %0,%1" : "=r"(__kir) : "m"(mem)); \
86 __kir; }) 107 __kir; })
87#define __kernel_stb(val,mem) \ 108#define __kernel_stb(val,mem) \
88 __asm__("stb %1,%0" : "=m"(mem) : "r"(val)) 109 __asm__(".arch ev56; \
89#define __kernel_stw(val,mem) \ 110 stb %1,%0" : "=m"(mem) : "r"(val))
90 __asm__("stw %1,%0" : "=m"(mem) : "r"(val)) 111#define __kernel_stw(val,mem) \
112 __asm__(".arch ev56; \
113 stw %1,%0" : "=m"(mem) : "r"(val))
91#endif 114#endif
92 115
93#ifdef __KERNEL__ 116#ifdef __KERNEL__