Path: blob/master/arch/alpha/include/uapi/asm/compiler.h
26498 views
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */1#ifndef _UAPI__ALPHA_COMPILER_H2#define _UAPI__ALPHA_COMPILER_H34/*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 hide7* as little as possible inside inline assembly. However, we want to be8* able to know what we'll get out before giving up inline assembly. Thus9* these tests and macros.10*/1112#if __GNUC__ == 3 && __GNUC_MINOR__ >= 4 || __GNUC__ > 313# 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#else21# 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#endif5051#ifdef __alpha_cix__52# if __GNUC__ == 3 && __GNUC_MINOR__ >= 4 || __GNUC__ > 353# define __kernel_cttz(x) __builtin_ctzl(x)54# define __kernel_ctlz(x) __builtin_clzl(x)55# define __kernel_ctpop(x) __builtin_popcountl(x)56# else57# 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# endif70#else71# 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#endif848586/*87* Beginning with EGCS 1.1, GCC defines __alpha_bwx__ when the BWX88* extension is enabled. Previous versions did not define anything89* we could test during compilation -- too bad, so sad.90*/9192#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#endif9899#endif /* _UAPI__ALPHA_COMPILER_H */100101102