Path: blob/master/arch/alpha/include/asm/compiler.h
15126 views
#ifndef __ALPHA_COMPILER_H1#define __ALPHA_COMPILER_H23/*4* Herein are macros we use when describing various patterns we want to GCC.5* In all cases we can get better schedules out of the compiler if we hide6* as little as possible inside inline assembly. However, we want to be7* able to know what we'll get out before giving up inline assembly. Thus8* these tests and macros.9*/1011#if __GNUC__ == 3 && __GNUC_MINOR__ >= 4 || __GNUC__ > 312# define __kernel_insbl(val, shift) __builtin_alpha_insbl(val, shift)13# define __kernel_inswl(val, shift) __builtin_alpha_inswl(val, shift)14# define __kernel_insql(val, shift) __builtin_alpha_insql(val, shift)15# define __kernel_inslh(val, shift) __builtin_alpha_inslh(val, shift)16# define __kernel_extbl(val, shift) __builtin_alpha_extbl(val, shift)17# define __kernel_extwl(val, shift) __builtin_alpha_extwl(val, shift)18# define __kernel_cmpbge(a, b) __builtin_alpha_cmpbge(a, b)19#else20# define __kernel_insbl(val, shift) \21({ unsigned long __kir; \22__asm__("insbl %2,%1,%0" : "=r"(__kir) : "rI"(shift), "r"(val)); \23__kir; })24# define __kernel_inswl(val, shift) \25({ unsigned long __kir; \26__asm__("inswl %2,%1,%0" : "=r"(__kir) : "rI"(shift), "r"(val)); \27__kir; })28# define __kernel_insql(val, shift) \29({ unsigned long __kir; \30__asm__("insql %2,%1,%0" : "=r"(__kir) : "rI"(shift), "r"(val)); \31__kir; })32# define __kernel_inslh(val, shift) \33({ unsigned long __kir; \34__asm__("inslh %2,%1,%0" : "=r"(__kir) : "rI"(shift), "r"(val)); \35__kir; })36# define __kernel_extbl(val, shift) \37({ unsigned long __kir; \38__asm__("extbl %2,%1,%0" : "=r"(__kir) : "rI"(shift), "r"(val)); \39__kir; })40# define __kernel_extwl(val, shift) \41({ unsigned long __kir; \42__asm__("extwl %2,%1,%0" : "=r"(__kir) : "rI"(shift), "r"(val)); \43__kir; })44# define __kernel_cmpbge(a, b) \45({ unsigned long __kir; \46__asm__("cmpbge %r2,%1,%0" : "=r"(__kir) : "rI"(b), "rJ"(a)); \47__kir; })48#endif4950#ifdef __alpha_cix__51# if __GNUC__ == 3 && __GNUC_MINOR__ >= 4 || __GNUC__ > 352# define __kernel_cttz(x) __builtin_ctzl(x)53# define __kernel_ctlz(x) __builtin_clzl(x)54# define __kernel_ctpop(x) __builtin_popcountl(x)55# else56# define __kernel_cttz(x) \57({ unsigned long __kir; \58__asm__("cttz %1,%0" : "=r"(__kir) : "r"(x)); \59__kir; })60# define __kernel_ctlz(x) \61({ unsigned long __kir; \62__asm__("ctlz %1,%0" : "=r"(__kir) : "r"(x)); \63__kir; })64# define __kernel_ctpop(x) \65({ unsigned long __kir; \66__asm__("ctpop %1,%0" : "=r"(__kir) : "r"(x)); \67__kir; })68# endif69#else70# define __kernel_cttz(x) \71({ unsigned long __kir; \72__asm__(".arch ev67; cttz %1,%0" : "=r"(__kir) : "r"(x)); \73__kir; })74# define __kernel_ctlz(x) \75({ unsigned long __kir; \76__asm__(".arch ev67; ctlz %1,%0" : "=r"(__kir) : "r"(x)); \77__kir; })78# define __kernel_ctpop(x) \79({ unsigned long __kir; \80__asm__(".arch ev67; ctpop %1,%0" : "=r"(__kir) : "r"(x)); \81__kir; })82#endif838485/*86* Beginning with EGCS 1.1, GCC defines __alpha_bwx__ when the BWX87* extension is enabled. Previous versions did not define anything88* we could test during compilation -- too bad, so sad.89*/9091#if defined(__alpha_bwx__)92#define __kernel_ldbu(mem) (mem)93#define __kernel_ldwu(mem) (mem)94#define __kernel_stb(val,mem) ((mem) = (val))95#define __kernel_stw(val,mem) ((mem) = (val))96#else97#define __kernel_ldbu(mem) \98({ unsigned char __kir; \99__asm__(".arch ev56; \100ldbu %0,%1" : "=r"(__kir) : "m"(mem)); \101__kir; })102#define __kernel_ldwu(mem) \103({ unsigned short __kir; \104__asm__(".arch ev56; \105ldwu %0,%1" : "=r"(__kir) : "m"(mem)); \106__kir; })107#define __kernel_stb(val,mem) \108__asm__(".arch ev56; \109stb %1,%0" : "=m"(mem) : "r"(val))110#define __kernel_stw(val,mem) \111__asm__(".arch ev56; \112stw %1,%0" : "=m"(mem) : "r"(val))113#endif114115#ifdef __KERNEL__116/* Some idiots over in <linux/compiler.h> thought inline should imply117always_inline. This breaks stuff. We'll include this file whenever118we run into such problems. */119120#include <linux/compiler.h>121#undef inline122#undef __inline__123#undef __inline124#undef __always_inline125#define __always_inline inline __attribute__((always_inline))126127#endif /* __KERNEL__ */128129#endif /* __ALPHA_COMPILER_H */130131132