ns9xxx: let putc autodetect where to write
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / include / asm-alpha / compiler.h
blobda6bb199839c1dc221dbcd30a1737e364ee722f9
1 #ifndef __ALPHA_COMPILER_H
2 #define __ALPHA_COMPILER_H
4 /*
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)
20 #else
21 # define __kernel_insbl(val, shift) \
22 ({ unsigned long __kir; \
23 __asm__("insbl %2,%1,%0" : "=r"(__kir) : "rI"(shift), "r"(val)); \
24 __kir; })
25 # define __kernel_inswl(val, shift) \
26 ({ unsigned long __kir; \
27 __asm__("inswl %2,%1,%0" : "=r"(__kir) : "rI"(shift), "r"(val)); \
28 __kir; })
29 # define __kernel_insql(val, shift) \
30 ({ unsigned long __kir; \
31 __asm__("insql %2,%1,%0" : "=r"(__kir) : "rI"(shift), "r"(val)); \
32 __kir; })
33 # define __kernel_inslh(val, shift) \
34 ({ unsigned long __kir; \
35 __asm__("inslh %2,%1,%0" : "=r"(__kir) : "rI"(shift), "r"(val)); \
36 __kir; })
37 # define __kernel_extbl(val, shift) \
38 ({ unsigned long __kir; \
39 __asm__("extbl %2,%1,%0" : "=r"(__kir) : "rI"(shift), "r"(val)); \
40 __kir; })
41 # define __kernel_extwl(val, shift) \
42 ({ unsigned long __kir; \
43 __asm__("extwl %2,%1,%0" : "=r"(__kir) : "rI"(shift), "r"(val)); \
44 __kir; })
45 # define __kernel_cmpbge(a, b) \
46 ({ unsigned long __kir; \
47 __asm__("cmpbge %r2,%1,%0" : "=r"(__kir) : "rI"(b), "rJ"(a)); \
48 __kir; })
49 #endif
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
71 # define __kernel_cttz(x) \
72 ({ unsigned long __kir; \
73 __asm__(".arch ev67; cttz %1,%0" : "=r"(__kir) : "r"(x)); \
74 __kir; })
75 # define __kernel_ctlz(x) \
76 ({ unsigned long __kir; \
77 __asm__(".arch ev67; ctlz %1,%0" : "=r"(__kir) : "r"(x)); \
78 __kir; })
79 # define __kernel_ctpop(x) \
80 ({ unsigned long __kir; \
81 __asm__(".arch ev67; ctpop %1,%0" : "=r"(__kir) : "r"(x)); \
82 __kir; })
83 #endif
86 /*
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))
97 #else
98 #define __kernel_ldbu(mem) \
99 ({ unsigned char __kir; \
100 __asm__(".arch ev56; \
101 ldbu %0,%1" : "=r"(__kir) : "m"(mem)); \
102 __kir; })
103 #define __kernel_ldwu(mem) \
104 ({ unsigned short __kir; \
105 __asm__(".arch ev56; \
106 ldwu %0,%1" : "=r"(__kir) : "m"(mem)); \
107 __kir; })
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))
114 #endif
116 #ifdef __KERNEL__
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>
122 #undef inline
123 #undef __inline__
124 #undef __inline
125 #undef __always_inline
126 #define __always_inline inline __attribute__((always_inline))
128 #endif /* __KERNEL__ */
130 #endif /* __ALPHA_COMPILER_H */