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.
13 * EGCS (of varying versions) does a good job of using insxl and extxl.
16 #if __GNUC__ > 2 || __GNUC_MINOR__ >= 91
17 #define __kernel_insbl(val, shift) \
18 (((unsigned long)(val) & 0xfful) << ((shift) * 8))
19 #define __kernel_inswl(val, shift) \
20 (((unsigned long)(val) & 0xfffful) << ((shift) * 8))
22 #define __kernel_insbl(val, shift) \
23 ({ unsigned long __kir; \
24 __asm__("insbl %2,%1,%0" : "=r"(__kir) : "rI"(shift), "r"(val)); \
26 #define __kernel_inswl(val, shift) \
27 ({ unsigned long __kir; \
28 __asm__("inswl %2,%1,%0" : "=r"(__kir) : "rI"(shift), "r"(val)); \
32 #if __GNUC__ > 2 || __GNUC_MINOR__ >= 92
33 #define __kernel_extbl(val, shift) (((val) >> (((shift) & 7) * 8)) & 0xfful)
34 #define __kernel_extwl(val, shift) (((val) >> (((shift) & 7) * 8)) & 0xfffful)
36 #define __kernel_extbl(val, shift) \
37 ({ unsigned long __kir; \
38 __asm__("extbl %2,%1,%0" : "=r"(__kir) : "rI"(shift), "r"(val)); \
40 #define __kernel_extwl(val, shift) \
41 ({ unsigned long __kir; \
42 __asm__("extwl %2,%1,%0" : "=r"(__kir) : "rI"(shift), "r"(val)); \
48 * Beginning with EGCS 1.1, GCC defines __alpha_bwx__ when the BWX
49 * extension is enabled. Previous versions did not define anything
50 * we could test during compilation, so allow users to tell us when
51 * the compiler will DTRT.
54 #if defined(HAVE_BWX) || defined(__alpha_bwx__)
55 #define __kernel_ldbu(mem) (mem)
56 #define __kernel_ldwu(mem) (mem)
57 #define __kernel_stb(val,mem) ((mem) = (val))
58 #define __kernel_stw(val,mem) ((mem) = (val))
60 #define __kernel_ldbu(mem) \
61 ({ unsigned char __kir; \
62 __asm__("ldbu %0,%1" : "=r"(__kir) : "m"(mem)); \
64 #define __kernel_ldwu(mem) \
65 ({ unsigned short __kir; \
66 __asm__("ldwu %0,%1" : "=r"(__kir) : "m"(mem)); \
68 #define __kernel_stb(val,mem) \
69 __asm__("stb %1,%0" : "=m"(mem) : "r"(val))
70 #define __kernel_stw(val,mem) \
71 __asm__("stw %1,%0" : "=m"(mem) : "r"(val))
74 #endif /* __ALPHA_COMPILER_H */