xref: /linux/arch/loongarch/include/asm/gpr-num.h (revision be239684b18e1cdcafcf8c7face4a2f562c745ad)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 #ifndef __ASM_GPR_NUM_H
3 #define __ASM_GPR_NUM_H
4 
5 #ifdef __ASSEMBLY__
6 
7 	.equ	.L__gpr_num_zero, 0
8 	.irp	num,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31
9 	.equ	.L__gpr_num_$r\num, \num
10 	.endr
11 
12 	/* ABI names of registers */
13 	.equ	.L__gpr_num_$ra, 1
14 	.equ	.L__gpr_num_$tp, 2
15 	.equ	.L__gpr_num_$sp, 3
16 	.irp	num,0,1,2,3,4,5,6,7
17 	.equ	.L__gpr_num_$a\num, 4 + \num
18 	.endr
19 	.irp	num,0,1,2,3,4,5,6,7,8
20 	.equ	.L__gpr_num_$t\num, 12 + \num
21 	.endr
22 	.equ	.L__gpr_num_$s9, 22
23 	.equ	.L__gpr_num_$fp, 22
24 	.irp	num,0,1,2,3,4,5,6,7,8
25 	.equ	.L__gpr_num_$s\num, 23 + \num
26 	.endr
27 
28 #else /* __ASSEMBLY__ */
29 
30 #define __DEFINE_ASM_GPR_NUMS					\
31 "	.equ	.L__gpr_num_zero, 0\n"				\
32 "	.irp	num,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31\n" \
33 "	.equ	.L__gpr_num_$r\\num, \\num\n"			\
34 "	.endr\n"						\
35 "	.equ	.L__gpr_num_$ra, 1\n"				\
36 "	.equ	.L__gpr_num_$tp, 2\n"				\
37 "	.equ	.L__gpr_num_$sp, 3\n"				\
38 "	.irp	num,0,1,2,3,4,5,6,7\n"				\
39 "	.equ	.L__gpr_num_$a\\num, 4 + \\num\n"		\
40 "	.endr\n"						\
41 "	.irp	num,0,1,2,3,4,5,6,7,8\n"			\
42 "	.equ	.L__gpr_num_$t\\num, 12 + \\num\n"		\
43 "	.endr\n"						\
44 "	.equ	.L__gpr_num_$s9, 22\n"				\
45 "	.equ	.L__gpr_num_$fp, 22\n"				\
46 "	.irp	num,0,1,2,3,4,5,6,7,8\n"			\
47 "	.equ	.L__gpr_num_$s\\num, 23 + \\num\n"		\
48 "	.endr\n"						\
49 
50 #endif /* __ASSEMBLY__ */
51 
52 #endif /* __ASM_GPR_NUM_H */
53