1 #ifndef __ALPHA_COMPILER_H
2 #define __ALPHA_COMPILER_H
5 * Herein are macros we use when describing various patterns we want to GCC.
6 * In all cases we can get better schedules out of the compiler if we hide
7 * as little as possible inside inline assembly. However, we want to be
8 * able to know what we'll get out before giving up inline assembly. Thus
9 * these tests and macros.
12 #if __GNUC__ == 3 && __GNUC_MINOR__ >= 4 || __GNUC__ > 3
13 # define __kernel_insbl(val, shift) __builtin_alpha_insbl(val, shift)
14 # define __kernel_inswl(val, shift) __builtin_alpha_inswl(val, shift)
15 # define __kernel_insql(val, shift) __builtin_alpha_insql(val, shift)
16 # define __kernel_inslh(val, shift) __builtin_alpha_inslh(val, shift)
17 # define __kernel_extbl(val, shift) __builtin_alpha_extbl(val, shift)
18 # define __kernel_extwl(val, shift) __builtin_alpha_extwl(val, shift)
19 # define __kernel_cmpbge(a, b) __builtin_alpha_cmpbge(a, b)
21 # define __kernel_insbl(val, shift) \
22 ({ unsigned long __kir; \
23 __asm__("insbl %2,%1,%0" : "=r"(__kir) : "rI"(shift), "r"(val)); \
25 # define __kernel_inswl(val, shift) \
26 ({ unsigned long __kir; \
27 __asm__("inswl %2,%1,%0" : "=r"(__kir) : "rI"(shift), "r"(val)); \
29 # define __kernel_insql(val, shift) \
30 ({ unsigned long __kir; \
31 __asm__("insql %2,%1,%0" : "=r"(__kir) : "rI"(shift), "r"(val)); \
33 # define __kernel_inslh(val, shift) \
34 ({ unsigned long __kir; \
35 __asm__("inslh %2,%1,%0" : "=r"(__kir) : "rI"(shift), "r"(val)); \
37 # define __kernel_extbl(val, shift) \
38 ({ unsigned long __kir; \
39 __asm__("extbl %2,%1,%0" : "=r"(__kir) : "rI"(shift), "r"(val)); \
41 # define __kernel_extwl(val, shift) \
42 ({ unsigned long __kir; \
43 __asm__("extwl %2,%1,%0" : "=r"(__kir) : "rI"(shift), "r"(val)); \
45 # define __kernel_cmpbge(a, b) \
46 ({ unsigned long __kir; \
47 __asm__("cmpbge %r2,%1,%0" : "=r"(__kir) : "rI"(b), "rJ"(a)); \
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)
57 # define __kernel_cttz(x) \
58 ({ unsigned long __kir; \
59 __asm__("cttz %1,%0" : "=r"(__kir) : "r"(x)); \
61 # define __kernel_ctlz(x) \
62 ({ unsigned long __kir; \
63 __asm__("ctlz %1,%0" : "=r"(__kir) : "r"(x)); \
65 # define __kernel_ctpop(x) \
66 ({ unsigned long __kir; \
67 __asm__("ctpop %1,%0" : "=r"(__kir) : "r"(x)); \
71 # define __kernel_cttz(x) \
72 ({ unsigned long __kir; \
73 __asm__(".arch ev67; cttz %1,%0" : "=r"(__kir) : "r"(x)); \
75 # define __kernel_ctlz(x) \
76 ({ unsigned long __kir; \
77 __asm__(".arch ev67; ctlz %1,%0" : "=r"(__kir) : "r"(x)); \
79 # define __kernel_ctpop(x) \
80 ({ unsigned long __kir; \
81 __asm__(".arch ev67; ctpop %1,%0" : "=r"(__kir) : "r"(x)); \
87 * Beginning with EGCS 1.1, GCC defines __alpha_bwx__ when the BWX
88 * extension is enabled. Previous versions did not define anything
89 * we could test during compilation -- too bad, so sad.
92 #if defined(__alpha_bwx__)
93 #define __kernel_ldbu(mem) (mem)
94 #define __kernel_ldwu(mem) (mem)
95 #define __kernel_stb(val,mem) ((mem) = (val))
96 #define __kernel_stw(val,mem) ((mem) = (val))
98 #define __kernel_ldbu(mem) \
99 ({ unsigned char __kir; \
100 __asm__(".arch ev56; \
101 ldbu %0,%1" : "=r"(__kir) : "m"(mem)); \
103 #define __kernel_ldwu(mem) \
104 ({ unsigned short __kir; \
105 __asm__(".arch ev56; \
106 ldwu %0,%1" : "=r"(__kir) : "m"(mem)); \
108 #define __kernel_stb(val,mem) \
109 __asm__(".arch ev56; \
110 stb %1,%0" : "=m"(mem) : "r"(val))
111 #define __kernel_stw(val,mem) \
112 __asm__(".arch ev56; \
113 stw %1,%0" : "=m"(mem) : "r"(val))
117 /* Some idiots over in <linux/compiler.h> thought inline should imply
118 always_inline. This breaks stuff. We'll include this file whenever
119 we run into such problems. */
121 #include <linux/compiler.h>
125 #undef __always_inline
126 #define __always_inline inline __attribute__((always_inline))
128 #endif /* __KERNEL__ */
130 #endif /* __ALPHA_COMPILER_H */