Blame view

include/asm-alpha/compiler.h 4.42 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
  #ifndef __ALPHA_COMPILER_H
  #define __ALPHA_COMPILER_H
  
  /* 
   * Herein are macros we use when describing various patterns we want to GCC.
   * In all cases we can get better schedules out of the compiler if we hide
   * as little as possible inside inline assembly.  However, we want to be
   * able to know what we'll get out before giving up inline assembly.  Thus
   * these tests and macros.
   */
  
  #if __GNUC__ == 3 && __GNUC_MINOR__ >= 4 || __GNUC__ > 3
  # define __kernel_insbl(val, shift)	__builtin_alpha_insbl(val, shift)
  # define __kernel_inswl(val, shift)	__builtin_alpha_inswl(val, shift)
  # define __kernel_insql(val, shift)	__builtin_alpha_insql(val, shift)
  # define __kernel_inslh(val, shift)	__builtin_alpha_inslh(val, shift)
  # define __kernel_extbl(val, shift)	__builtin_alpha_extbl(val, shift)
  # define __kernel_extwl(val, shift)	__builtin_alpha_extwl(val, shift)
  # define __kernel_cmpbge(a, b)		__builtin_alpha_cmpbge(a, b)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
  #else
  # define __kernel_insbl(val, shift)					\
    ({ unsigned long __kir;						\
       __asm__("insbl %2,%1,%0" : "=r"(__kir) : "rI"(shift), "r"(val));	\
       __kir; })
  # define __kernel_inswl(val, shift)					\
    ({ unsigned long __kir;						\
       __asm__("inswl %2,%1,%0" : "=r"(__kir) : "rI"(shift), "r"(val));	\
       __kir; })
  # define __kernel_insql(val, shift)					\
    ({ unsigned long __kir;						\
       __asm__("insql %2,%1,%0" : "=r"(__kir) : "rI"(shift), "r"(val));	\
       __kir; })
  # define __kernel_inslh(val, shift)					\
    ({ unsigned long __kir;						\
       __asm__("inslh %2,%1,%0" : "=r"(__kir) : "rI"(shift), "r"(val));	\
       __kir; })
  # define __kernel_extbl(val, shift)					\
    ({ unsigned long __kir;						\
       __asm__("extbl %2,%1,%0" : "=r"(__kir) : "rI"(shift), "r"(val));	\
       __kir; })
  # define __kernel_extwl(val, shift)					\
    ({ unsigned long __kir;						\
       __asm__("extwl %2,%1,%0" : "=r"(__kir) : "rI"(shift), "r"(val));	\
       __kir; })
  # define __kernel_cmpbge(a, b)						\
    ({ unsigned long __kir;						\
       __asm__("cmpbge %r2,%1,%0" : "=r"(__kir) : "rI"(b), "rJ"(a));	\
       __kir; })
88ed39b06   Ivan Kokshaysky   alpha: build fixe...
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
  #endif
  
  #ifdef __alpha_cix__
  # if __GNUC__ == 3 && __GNUC_MINOR__ >= 4 || __GNUC__ > 3
  #  define __kernel_cttz(x)		__builtin_ctzl(x)
  #  define __kernel_ctlz(x)		__builtin_clzl(x)
  #  define __kernel_ctpop(x)		__builtin_popcountl(x)
  # else
  #  define __kernel_cttz(x)						\
     ({ unsigned long __kir;						\
        __asm__("cttz %1,%0" : "=r"(__kir) : "r"(x));			\
        __kir; })
  #  define __kernel_ctlz(x)						\
     ({ unsigned long __kir;						\
        __asm__("ctlz %1,%0" : "=r"(__kir) : "r"(x));			\
        __kir; })
  #  define __kernel_ctpop(x)						\
     ({ unsigned long __kir;						\
        __asm__("ctpop %1,%0" : "=r"(__kir) : "r"(x));			\
        __kir; })
  # endif
  #else
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
71
72
  # define __kernel_cttz(x)						\
    ({ unsigned long __kir;						\
88ed39b06   Ivan Kokshaysky   alpha: build fixe...
73
       __asm__(".arch ev67; cttz %1,%0" : "=r"(__kir) : "r"(x));		\
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
74
75
76
       __kir; })
  # define __kernel_ctlz(x)						\
    ({ unsigned long __kir;						\
88ed39b06   Ivan Kokshaysky   alpha: build fixe...
77
       __asm__(".arch ev67; ctlz %1,%0" : "=r"(__kir) : "r"(x));		\
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
78
79
80
       __kir; })
  # define __kernel_ctpop(x)						\
    ({ unsigned long __kir;						\
88ed39b06   Ivan Kokshaysky   alpha: build fixe...
81
       __asm__(".arch ev67; ctpop %1,%0" : "=r"(__kir) : "r"(x));		\
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
       __kir; })
  #endif
  
  
  /* 
   * Beginning with EGCS 1.1, GCC defines __alpha_bwx__ when the BWX 
   * extension is enabled.  Previous versions did not define anything
   * we could test during compilation -- too bad, so sad.
   */
  
  #if defined(__alpha_bwx__)
  #define __kernel_ldbu(mem)	(mem)
  #define __kernel_ldwu(mem)	(mem)
  #define __kernel_stb(val,mem)	((mem) = (val))
  #define __kernel_stw(val,mem)	((mem) = (val))
  #else
  #define __kernel_ldbu(mem)				\
    ({ unsigned char __kir;				\
88ed39b06   Ivan Kokshaysky   alpha: build fixe...
100
101
       __asm__(".arch ev56;				\
  	      ldbu %0,%1" : "=r"(__kir) : "m"(mem));	\
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
102
103
104
       __kir; })
  #define __kernel_ldwu(mem)				\
    ({ unsigned short __kir;				\
88ed39b06   Ivan Kokshaysky   alpha: build fixe...
105
106
       __asm__(".arch ev56;				\
  	      ldwu %0,%1" : "=r"(__kir) : "m"(mem));	\
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
107
       __kir; })
88ed39b06   Ivan Kokshaysky   alpha: build fixe...
108
109
110
111
112
113
  #define __kernel_stb(val,mem)				\
    __asm__(".arch ev56;					\
  	   stb %1,%0" : "=m"(mem) : "r"(val))
  #define __kernel_stw(val,mem)				\
    __asm__(".arch ev56;					\
  	   stw %1,%0" : "=m"(mem) : "r"(val))
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
114
  #endif
7f9d77d75   David Woodhouse   [PATCH] Fix 'make...
115
  #ifdef __KERNEL__
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
116
117
118
119
120
121
122
123
  /* Some idiots over in <linux/compiler.h> thought inline should imply
     always_inline.  This breaks stuff.  We'll include this file whenever
     we run into such problems.  */
  
  #include <linux/compiler.h>
  #undef inline
  #undef __inline__
  #undef __inline
7243cc05b   Ivan Kokshaysky   [PATCH] slab: alp...
124
125
  #undef __always_inline
  #define __always_inline		inline __attribute__((always_inline))
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
126

7f9d77d75   David Woodhouse   [PATCH] Fix 'make...
127
  #endif /* __KERNEL__ */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
128
  #endif /* __ALPHA_COMPILER_H */