18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef __ALPHA_SPECIAL_INSNS_H
38c2ecf20Sopenharmony_ci#define __ALPHA_SPECIAL_INSNS_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_cienum implver_enum {
68c2ecf20Sopenharmony_ci	IMPLVER_EV4,
78c2ecf20Sopenharmony_ci	IMPLVER_EV5,
88c2ecf20Sopenharmony_ci	IMPLVER_EV6
98c2ecf20Sopenharmony_ci};
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#ifdef CONFIG_ALPHA_GENERIC
128c2ecf20Sopenharmony_ci#define implver()				\
138c2ecf20Sopenharmony_ci({ unsigned long __implver;			\
148c2ecf20Sopenharmony_ci   __asm__ ("implver %0" : "=r"(__implver));	\
158c2ecf20Sopenharmony_ci   (enum implver_enum) __implver; })
168c2ecf20Sopenharmony_ci#else
178c2ecf20Sopenharmony_ci/* Try to eliminate some dead code.  */
188c2ecf20Sopenharmony_ci#ifdef CONFIG_ALPHA_EV4
198c2ecf20Sopenharmony_ci#define implver() IMPLVER_EV4
208c2ecf20Sopenharmony_ci#endif
218c2ecf20Sopenharmony_ci#ifdef CONFIG_ALPHA_EV5
228c2ecf20Sopenharmony_ci#define implver() IMPLVER_EV5
238c2ecf20Sopenharmony_ci#endif
248c2ecf20Sopenharmony_ci#if defined(CONFIG_ALPHA_EV6)
258c2ecf20Sopenharmony_ci#define implver() IMPLVER_EV6
268c2ecf20Sopenharmony_ci#endif
278c2ecf20Sopenharmony_ci#endif
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_cienum amask_enum {
308c2ecf20Sopenharmony_ci	AMASK_BWX = (1UL << 0),
318c2ecf20Sopenharmony_ci	AMASK_FIX = (1UL << 1),
328c2ecf20Sopenharmony_ci	AMASK_CIX = (1UL << 2),
338c2ecf20Sopenharmony_ci	AMASK_MAX = (1UL << 8),
348c2ecf20Sopenharmony_ci	AMASK_PRECISE_TRAP = (1UL << 9),
358c2ecf20Sopenharmony_ci};
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci#define amask(mask)						\
388c2ecf20Sopenharmony_ci({ unsigned long __amask, __input = (mask);			\
398c2ecf20Sopenharmony_ci   __asm__ ("amask %1,%0" : "=r"(__amask) : "rI"(__input));	\
408c2ecf20Sopenharmony_ci   __amask; })
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci#endif /* __ALPHA_SPECIAL_INSNS_H */
43