xref: /openbmc/u-boot/arch/arm/include/asm/unified.h (revision 85231c08)
1 /*
2  * include/asm-arm/unified.h - Unified Assembler Syntax helper macros
3  *
4  * Copyright (C) 2008 ARM Limited
5  *
6  * SPDX-License-Identifier:	GPL-2.0
7  */
8 
9 #ifndef __ASM_UNIFIED_H
10 #define __ASM_UNIFIED_H
11 
12 #if defined(__ASSEMBLY__) && defined(CONFIG_ARM_ASM_UNIFIED)
13 	.syntax unified
14 #endif
15 
16 #ifdef CONFIG_CPU_V7M
17 #define AR_CLASS(x...)
18 #define M_CLASS(x...)	x
19 #else
20 #define AR_CLASS(x...)	x
21 #define M_CLASS(x...)
22 #endif
23 
24 #ifdef CONFIG_THUMB2_KERNEL
25 
26 #if __GNUC__ < 4
27 #error Thumb-2 kernel requires gcc >= 4
28 #endif
29 
30 /* The CPSR bit describing the instruction set (Thumb) */
31 #define PSR_ISETSTATE	PSR_T_BIT
32 
33 #define ARM(x...)
34 #define THUMB(x...)	x
35 #ifdef __ASSEMBLY__
36 #define W(instr)	instr.w
37 #else
38 #define WASM(instr)	#instr ".w"
39 #endif
40 
41 #else	/* !CONFIG_THUMB2_KERNEL */
42 
43 /* The CPSR bit describing the instruction set (ARM) */
44 #define PSR_ISETSTATE	0
45 
46 #define ARM(x...)	x
47 #define THUMB(x...)
48 #ifdef __ASSEMBLY__
49 #define W(instr)	instr
50 #else
51 #define WASM(instr)	#instr
52 #endif
53 
54 #endif	/* CONFIG_THUMB2_KERNEL */
55 
56 #ifndef CONFIG_ARM_ASM_UNIFIED
57 
58 /*
59  * If the unified assembly syntax isn't used (in ARM mode), these
60  * macros expand to an empty string
61  */
62 #ifdef __ASSEMBLY__
63 	.macro	it, cond
64 	.endm
65 	.macro	itt, cond
66 	.endm
67 	.macro	ite, cond
68 	.endm
69 	.macro	ittt, cond
70 	.endm
71 	.macro	itte, cond
72 	.endm
73 	.macro	itet, cond
74 	.endm
75 	.macro	itee, cond
76 	.endm
77 	.macro	itttt, cond
78 	.endm
79 	.macro	ittte, cond
80 	.endm
81 	.macro	ittet, cond
82 	.endm
83 	.macro	ittee, cond
84 	.endm
85 	.macro	itett, cond
86 	.endm
87 	.macro	itete, cond
88 	.endm
89 	.macro	iteet, cond
90 	.endm
91 	.macro	iteee, cond
92 	.endm
93 #else	/* !__ASSEMBLY__ */
94 __asm__(
95 "	.macro	it, cond\n"
96 "	.endm\n"
97 "	.macro	itt, cond\n"
98 "	.endm\n"
99 "	.macro	ite, cond\n"
100 "	.endm\n"
101 "	.macro	ittt, cond\n"
102 "	.endm\n"
103 "	.macro	itte, cond\n"
104 "	.endm\n"
105 "	.macro	itet, cond\n"
106 "	.endm\n"
107 "	.macro	itee, cond\n"
108 "	.endm\n"
109 "	.macro	itttt, cond\n"
110 "	.endm\n"
111 "	.macro	ittte, cond\n"
112 "	.endm\n"
113 "	.macro	ittet, cond\n"
114 "	.endm\n"
115 "	.macro	ittee, cond\n"
116 "	.endm\n"
117 "	.macro	itett, cond\n"
118 "	.endm\n"
119 "	.macro	itete, cond\n"
120 "	.endm\n"
121 "	.macro	iteet, cond\n"
122 "	.endm\n"
123 "	.macro	iteee, cond\n"
124 "	.endm\n");
125 #endif	/* __ASSEMBLY__ */
126 
127 #endif	/* CONFIG_ARM_ASM_UNIFIED */
128 
129 #endif	/* !__ASM_UNIFIED_H */
130