xref: /openbmc/linux/arch/arm/net/bpf_jit_32.h (revision 4b4193256c8d3bc3a5397b5cd9494c2ad386317d)
1b886d83cSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
2ddecdfceSMircea Gherzan /*
3ddecdfceSMircea Gherzan  * Just-In-Time compiler for BPF filters on 32bit ARM
4ddecdfceSMircea Gherzan  *
5ddecdfceSMircea Gherzan  * Copyright (c) 2011 Mircea Gherzan <mgherzan@gmail.com>
6ddecdfceSMircea Gherzan  */
7ddecdfceSMircea Gherzan 
8ddecdfceSMircea Gherzan #ifndef PFILTER_OPCODES_ARM_H
9ddecdfceSMircea Gherzan #define PFILTER_OPCODES_ARM_H
10ddecdfceSMircea Gherzan 
1139c13c20SShubham Bansal /* ARM 32bit Registers */
12ddecdfceSMircea Gherzan #define ARM_R0	0
13ddecdfceSMircea Gherzan #define ARM_R1	1
14ddecdfceSMircea Gherzan #define ARM_R2	2
15ddecdfceSMircea Gherzan #define ARM_R3	3
16ddecdfceSMircea Gherzan #define ARM_R4	4
17ddecdfceSMircea Gherzan #define ARM_R5	5
18ddecdfceSMircea Gherzan #define ARM_R6	6
19ddecdfceSMircea Gherzan #define ARM_R7	7
20ddecdfceSMircea Gherzan #define ARM_R8	8
21ddecdfceSMircea Gherzan #define ARM_R9	9
22ddecdfceSMircea Gherzan #define ARM_R10	10
2339c13c20SShubham Bansal #define ARM_FP	11	/* Frame Pointer */
2439c13c20SShubham Bansal #define ARM_IP	12	/* Intra-procedure scratch register */
2539c13c20SShubham Bansal #define ARM_SP	13	/* Stack pointer: as load/store base reg */
2639c13c20SShubham Bansal #define ARM_LR	14	/* Link Register */
2739c13c20SShubham Bansal #define ARM_PC	15	/* Program counter */
28ddecdfceSMircea Gherzan 
2939c13c20SShubham Bansal #define ARM_COND_EQ		0x0	/* == */
3039c13c20SShubham Bansal #define ARM_COND_NE		0x1	/* != */
3139c13c20SShubham Bansal #define ARM_COND_CS		0x2	/* unsigned >= */
32ddecdfceSMircea Gherzan #define ARM_COND_HS		ARM_COND_CS
3339c13c20SShubham Bansal #define ARM_COND_CC		0x3	/* unsigned < */
34ddecdfceSMircea Gherzan #define ARM_COND_LO		ARM_COND_CC
3539c13c20SShubham Bansal #define ARM_COND_MI		0x4	/* < 0 */
3639c13c20SShubham Bansal #define ARM_COND_PL		0x5	/* >= 0 */
3739c13c20SShubham Bansal #define ARM_COND_VS		0x6	/* Signed Overflow */
3839c13c20SShubham Bansal #define ARM_COND_VC		0x7	/* No Signed Overflow */
3939c13c20SShubham Bansal #define ARM_COND_HI		0x8	/* unsigned > */
4039c13c20SShubham Bansal #define ARM_COND_LS		0x9	/* unsigned <= */
4139c13c20SShubham Bansal #define ARM_COND_GE		0xa	/* Signed >= */
4239c13c20SShubham Bansal #define ARM_COND_LT		0xb	/* Signed < */
4339c13c20SShubham Bansal #define ARM_COND_GT		0xc	/* Signed > */
4439c13c20SShubham Bansal #define ARM_COND_LE		0xd	/* Signed <= */
4539c13c20SShubham Bansal #define ARM_COND_AL		0xe	/* None */
46ddecdfceSMircea Gherzan 
47ddecdfceSMircea Gherzan /* register shift types */
48ddecdfceSMircea Gherzan #define SRTYPE_LSL		0
49ddecdfceSMircea Gherzan #define SRTYPE_LSR		1
50ddecdfceSMircea Gherzan #define SRTYPE_ASR		2
51ddecdfceSMircea Gherzan #define SRTYPE_ROR		3
5239c13c20SShubham Bansal #define SRTYPE_ASL		(SRTYPE_LSL)
53ddecdfceSMircea Gherzan 
54ddecdfceSMircea Gherzan #define ARM_INST_ADD_R		0x00800000
5539c13c20SShubham Bansal #define ARM_INST_ADDS_R		0x00900000
5639c13c20SShubham Bansal #define ARM_INST_ADC_R		0x00a00000
5739c13c20SShubham Bansal #define ARM_INST_ADC_I		0x02a00000
58ddecdfceSMircea Gherzan #define ARM_INST_ADD_I		0x02800000
5939c13c20SShubham Bansal #define ARM_INST_ADDS_I		0x02900000
60ddecdfceSMircea Gherzan 
61ddecdfceSMircea Gherzan #define ARM_INST_AND_R		0x00000000
62b85062acSJiong Wang #define ARM_INST_ANDS_R		0x00100000
63ddecdfceSMircea Gherzan #define ARM_INST_AND_I		0x02000000
64ddecdfceSMircea Gherzan 
65ddecdfceSMircea Gherzan #define ARM_INST_BIC_R		0x01c00000
66ddecdfceSMircea Gherzan #define ARM_INST_BIC_I		0x03c00000
67ddecdfceSMircea Gherzan 
68ddecdfceSMircea Gherzan #define ARM_INST_B		0x0a000000
69ddecdfceSMircea Gherzan #define ARM_INST_BX		0x012FFF10
70ddecdfceSMircea Gherzan #define ARM_INST_BLX_R		0x012fff30
71ddecdfceSMircea Gherzan 
72ddecdfceSMircea Gherzan #define ARM_INST_CMP_R		0x01500000
73ddecdfceSMircea Gherzan #define ARM_INST_CMP_I		0x03500000
74ddecdfceSMircea Gherzan 
752bea29b7SMircea Gherzan #define ARM_INST_EOR_R		0x00200000
763cbe2041SDaniel Borkmann #define ARM_INST_EOR_I		0x02200000
772bea29b7SMircea Gherzan 
78a8ef95a0SRussell King #define ARM_INST_LDST__U	0x00800000
79828e2b90SRussell King #define ARM_INST_LDST__IMM12	0x00000fff
80a8ef95a0SRussell King #define ARM_INST_LDRB_I		0x05500000
81ddecdfceSMircea Gherzan #define ARM_INST_LDRB_R		0x07d00000
828c9602d3SRussell King #define ARM_INST_LDRD_I		0x014000d0
83a8ef95a0SRussell King #define ARM_INST_LDRH_I		0x015000b0
845bf705b4SNicolas Schichan #define ARM_INST_LDRH_R		0x019000b0
85a8ef95a0SRussell King #define ARM_INST_LDR_I		0x05100000
8639c13c20SShubham Bansal #define ARM_INST_LDR_R		0x07900000
87ddecdfceSMircea Gherzan 
88ddecdfceSMircea Gherzan #define ARM_INST_LDM		0x08900000
8939c13c20SShubham Bansal #define ARM_INST_LDM_IA		0x08b00000
90ddecdfceSMircea Gherzan 
91ddecdfceSMircea Gherzan #define ARM_INST_LSL_I		0x01a00000
92ddecdfceSMircea Gherzan #define ARM_INST_LSL_R		0x01a00010
93ddecdfceSMircea Gherzan 
94ddecdfceSMircea Gherzan #define ARM_INST_LSR_I		0x01a00020
95ddecdfceSMircea Gherzan #define ARM_INST_LSR_R		0x01a00030
96ddecdfceSMircea Gherzan 
97*c648c9c7SLuke Nelson #define ARM_INST_ASR_I		0x01a00040
98*c648c9c7SLuke Nelson #define ARM_INST_ASR_R		0x01a00050
99*c648c9c7SLuke Nelson 
100ddecdfceSMircea Gherzan #define ARM_INST_MOV_R		0x01a00000
10139c13c20SShubham Bansal #define ARM_INST_MOVS_R		0x01b00000
102ddecdfceSMircea Gherzan #define ARM_INST_MOV_I		0x03a00000
103ddecdfceSMircea Gherzan #define ARM_INST_MOVW		0x03000000
104ddecdfceSMircea Gherzan #define ARM_INST_MOVT		0x03400000
105ddecdfceSMircea Gherzan 
106ddecdfceSMircea Gherzan #define ARM_INST_MUL		0x00000090
107ddecdfceSMircea Gherzan 
108ddecdfceSMircea Gherzan #define ARM_INST_POP		0x08bd0000
109ddecdfceSMircea Gherzan #define ARM_INST_PUSH		0x092d0000
110ddecdfceSMircea Gherzan 
111ddecdfceSMircea Gherzan #define ARM_INST_ORR_R		0x01800000
11239c13c20SShubham Bansal #define ARM_INST_ORRS_R		0x01900000
113ddecdfceSMircea Gherzan #define ARM_INST_ORR_I		0x03800000
114ddecdfceSMircea Gherzan 
115ddecdfceSMircea Gherzan #define ARM_INST_REV		0x06bf0f30
116ddecdfceSMircea Gherzan #define ARM_INST_REV16		0x06bf0fb0
117ddecdfceSMircea Gherzan 
118ddecdfceSMircea Gherzan #define ARM_INST_RSB_I		0x02600000
11939c13c20SShubham Bansal #define ARM_INST_RSBS_I		0x02700000
12039c13c20SShubham Bansal #define ARM_INST_RSC_I		0x02e00000
121ddecdfceSMircea Gherzan 
122ddecdfceSMircea Gherzan #define ARM_INST_SUB_R		0x00400000
12339c13c20SShubham Bansal #define ARM_INST_SUBS_R		0x00500000
12439c13c20SShubham Bansal #define ARM_INST_RSB_R		0x00600000
125ddecdfceSMircea Gherzan #define ARM_INST_SUB_I		0x02400000
12639c13c20SShubham Bansal #define ARM_INST_SUBS_I		0x02500000
12739c13c20SShubham Bansal #define ARM_INST_SBC_I		0x02c00000
12839c13c20SShubham Bansal #define ARM_INST_SBC_R		0x00c00000
12939c13c20SShubham Bansal #define ARM_INST_SBCS_R		0x00d00000
130ddecdfceSMircea Gherzan 
131a8ef95a0SRussell King #define ARM_INST_STR_I		0x05000000
132a8ef95a0SRussell King #define ARM_INST_STRB_I		0x05400000
1338c9602d3SRussell King #define ARM_INST_STRD_I		0x014000f0
134a8ef95a0SRussell King #define ARM_INST_STRH_I		0x014000b0
135ddecdfceSMircea Gherzan 
136ddecdfceSMircea Gherzan #define ARM_INST_TST_R		0x01100000
137ddecdfceSMircea Gherzan #define ARM_INST_TST_I		0x03100000
138ddecdfceSMircea Gherzan 
139ddecdfceSMircea Gherzan #define ARM_INST_UDIV		0x0730f010
140ddecdfceSMircea Gherzan 
141ddecdfceSMircea Gherzan #define ARM_INST_UMULL		0x00800090
142ddecdfceSMircea Gherzan 
1434560cdffSNicolas Schichan #define ARM_INST_MLS		0x00600090
1444560cdffSNicolas Schichan 
14539c13c20SShubham Bansal #define ARM_INST_UXTH		0x06ff0070
14639c13c20SShubham Bansal 
147e8b56d55SDaniel Borkmann /*
148e8b56d55SDaniel Borkmann  * Use a suitable undefined instruction to use for ARM/Thumb2 faulting.
149e8b56d55SDaniel Borkmann  * We need to be careful not to conflict with those used by other modules
150e8b56d55SDaniel Borkmann  * (BUG, kprobes, etc) and the register_undef_hook() system.
151e8b56d55SDaniel Borkmann  *
152e8b56d55SDaniel Borkmann  * The ARM architecture reference manual guarantees that the following
153e8b56d55SDaniel Borkmann  * instruction space will produce an undefined instruction exception on
154e8b56d55SDaniel Borkmann  * all CPUs:
155e8b56d55SDaniel Borkmann  *
156e8b56d55SDaniel Borkmann  * ARM:   xxxx 0111 1111 xxxx xxxx xxxx 1111 xxxx	ARMv7-AR, section A5.4
157e8b56d55SDaniel Borkmann  * Thumb: 1101 1110 xxxx xxxx				ARMv7-M, section A5.2.6
158e8b56d55SDaniel Borkmann  */
159e8b56d55SDaniel Borkmann #define ARM_INST_UDF		0xe7fddef1
160e8b56d55SDaniel Borkmann 
161ddecdfceSMircea Gherzan /* register */
162ddecdfceSMircea Gherzan #define _AL3_R(op, rd, rn, rm)	((op ## _R) | (rd) << 12 | (rn) << 16 | (rm))
163ddecdfceSMircea Gherzan /* immediate */
164ddecdfceSMircea Gherzan #define _AL3_I(op, rd, rn, imm)	((op ## _I) | (rd) << 12 | (rn) << 16 | (imm))
16539c13c20SShubham Bansal /* register with register-shift */
16639c13c20SShubham Bansal #define _AL3_SR(inst)	(inst | (1 << 4))
167ddecdfceSMircea Gherzan 
168ddecdfceSMircea Gherzan #define ARM_ADD_R(rd, rn, rm)	_AL3_R(ARM_INST_ADD, rd, rn, rm)
16939c13c20SShubham Bansal #define ARM_ADDS_R(rd, rn, rm)	_AL3_R(ARM_INST_ADDS, rd, rn, rm)
170ddecdfceSMircea Gherzan #define ARM_ADD_I(rd, rn, imm)	_AL3_I(ARM_INST_ADD, rd, rn, imm)
17139c13c20SShubham Bansal #define ARM_ADDS_I(rd, rn, imm)	_AL3_I(ARM_INST_ADDS, rd, rn, imm)
17239c13c20SShubham Bansal #define ARM_ADC_R(rd, rn, rm)	_AL3_R(ARM_INST_ADC, rd, rn, rm)
17339c13c20SShubham Bansal #define ARM_ADC_I(rd, rn, imm)	_AL3_I(ARM_INST_ADC, rd, rn, imm)
174ddecdfceSMircea Gherzan 
175ddecdfceSMircea Gherzan #define ARM_AND_R(rd, rn, rm)	_AL3_R(ARM_INST_AND, rd, rn, rm)
176b85062acSJiong Wang #define ARM_ANDS_R(rd, rn, rm)	_AL3_R(ARM_INST_ANDS, rd, rn, rm)
177ddecdfceSMircea Gherzan #define ARM_AND_I(rd, rn, imm)	_AL3_I(ARM_INST_AND, rd, rn, imm)
178ddecdfceSMircea Gherzan 
179ddecdfceSMircea Gherzan #define ARM_BIC_R(rd, rn, rm)	_AL3_R(ARM_INST_BIC, rd, rn, rm)
180ddecdfceSMircea Gherzan #define ARM_BIC_I(rd, rn, imm)	_AL3_I(ARM_INST_BIC, rd, rn, imm)
181ddecdfceSMircea Gherzan 
182ddecdfceSMircea Gherzan #define ARM_B(imm24)		(ARM_INST_B | ((imm24) & 0xffffff))
183ddecdfceSMircea Gherzan #define ARM_BX(rm)		(ARM_INST_BX | (rm))
184ddecdfceSMircea Gherzan #define ARM_BLX_R(rm)		(ARM_INST_BLX_R | (rm))
185ddecdfceSMircea Gherzan 
186ddecdfceSMircea Gherzan #define ARM_CMP_R(rn, rm)	_AL3_R(ARM_INST_CMP, 0, rn, rm)
187ddecdfceSMircea Gherzan #define ARM_CMP_I(rn, imm)	_AL3_I(ARM_INST_CMP, 0, rn, imm)
188ddecdfceSMircea Gherzan 
1892bea29b7SMircea Gherzan #define ARM_EOR_R(rd, rn, rm)	_AL3_R(ARM_INST_EOR, rd, rn, rm)
1903cbe2041SDaniel Borkmann #define ARM_EOR_I(rd, rn, imm)	_AL3_I(ARM_INST_EOR, rd, rn, imm)
1912bea29b7SMircea Gherzan 
192a8ef95a0SRussell King #define ARM_LDR_R(rt, rn, rm)	(ARM_INST_LDR_R | ARM_INST_LDST__U \
193a8ef95a0SRussell King 				 | (rt) << 12 | (rn) << 16 \
19439c13c20SShubham Bansal 				 | (rm))
1952b6958efSRussell King #define ARM_LDR_R_SI(rt, rn, rm, type, imm) \
1962b6958efSRussell King 				(ARM_INST_LDR_R | ARM_INST_LDST__U \
1972b6958efSRussell King 				 | (rt) << 12 | (rn) << 16 \
1982b6958efSRussell King 				 | (imm) << 7 | (type) << 5 | (rm))
199a8ef95a0SRussell King #define ARM_LDRB_R(rt, rn, rm)	(ARM_INST_LDRB_R | ARM_INST_LDST__U \
200a8ef95a0SRussell King 				 | (rt) << 12 | (rn) << 16 \
201ddecdfceSMircea Gherzan 				 | (rm))
202a8ef95a0SRussell King #define ARM_LDRH_R(rt, rn, rm)	(ARM_INST_LDRH_R | ARM_INST_LDST__U \
203a8ef95a0SRussell King 				 | (rt) << 12 | (rn) << 16 \
2045bf705b4SNicolas Schichan 				 | (rm))
205ddecdfceSMircea Gherzan 
206ddecdfceSMircea Gherzan #define ARM_LDM(rn, regs)	(ARM_INST_LDM | (rn) << 16 | (regs))
20739c13c20SShubham Bansal #define ARM_LDM_IA(rn, regs)	(ARM_INST_LDM_IA | (rn) << 16 | (regs))
208ddecdfceSMircea Gherzan 
209ddecdfceSMircea Gherzan #define ARM_LSL_R(rd, rn, rm)	(_AL3_R(ARM_INST_LSL, rd, 0, rn) | (rm) << 8)
210ddecdfceSMircea Gherzan #define ARM_LSL_I(rd, rn, imm)	(_AL3_I(ARM_INST_LSL, rd, 0, rn) | (imm) << 7)
211ddecdfceSMircea Gherzan 
212ddecdfceSMircea Gherzan #define ARM_LSR_R(rd, rn, rm)	(_AL3_R(ARM_INST_LSR, rd, 0, rn) | (rm) << 8)
213ddecdfceSMircea Gherzan #define ARM_LSR_I(rd, rn, imm)	(_AL3_I(ARM_INST_LSR, rd, 0, rn) | (imm) << 7)
21439c13c20SShubham Bansal #define ARM_ASR_R(rd, rn, rm)   (_AL3_R(ARM_INST_ASR, rd, 0, rn) | (rm) << 8)
21539c13c20SShubham Bansal #define ARM_ASR_I(rd, rn, imm)  (_AL3_I(ARM_INST_ASR, rd, 0, rn) | (imm) << 7)
216ddecdfceSMircea Gherzan 
217ddecdfceSMircea Gherzan #define ARM_MOV_R(rd, rm)	_AL3_R(ARM_INST_MOV, rd, 0, rm)
21839c13c20SShubham Bansal #define ARM_MOVS_R(rd, rm)	_AL3_R(ARM_INST_MOVS, rd, 0, rm)
219ddecdfceSMircea Gherzan #define ARM_MOV_I(rd, imm)	_AL3_I(ARM_INST_MOV, rd, 0, imm)
22039c13c20SShubham Bansal #define ARM_MOV_SR(rd, rm, type, rs)	\
22139c13c20SShubham Bansal 	(_AL3_SR(ARM_MOV_R(rd, rm)) | (type) << 5 | (rs) << 8)
22239c13c20SShubham Bansal #define ARM_MOV_SI(rd, rm, type, imm6)	\
22339c13c20SShubham Bansal 	(ARM_MOV_R(rd, rm) | (type) << 5 | (imm6) << 7)
224ddecdfceSMircea Gherzan 
225ddecdfceSMircea Gherzan #define ARM_MOVW(rd, imm)	\
226ddecdfceSMircea Gherzan 	(ARM_INST_MOVW | ((imm) >> 12) << 16 | (rd) << 12 | ((imm) & 0x0fff))
227ddecdfceSMircea Gherzan 
228ddecdfceSMircea Gherzan #define ARM_MOVT(rd, imm)	\
229ddecdfceSMircea Gherzan 	(ARM_INST_MOVT | ((imm) >> 12) << 16 | (rd) << 12 | ((imm) & 0x0fff))
230ddecdfceSMircea Gherzan 
231ddecdfceSMircea Gherzan #define ARM_MUL(rd, rm, rn)	(ARM_INST_MUL | (rd) << 16 | (rm) << 8 | (rn))
232ddecdfceSMircea Gherzan 
233ddecdfceSMircea Gherzan #define ARM_POP(regs)		(ARM_INST_POP | (regs))
234ddecdfceSMircea Gherzan #define ARM_PUSH(regs)		(ARM_INST_PUSH | (regs))
235ddecdfceSMircea Gherzan 
236ddecdfceSMircea Gherzan #define ARM_ORR_R(rd, rn, rm)	_AL3_R(ARM_INST_ORR, rd, rn, rm)
237ddecdfceSMircea Gherzan #define ARM_ORR_I(rd, rn, imm)	_AL3_I(ARM_INST_ORR, rd, rn, imm)
23839c13c20SShubham Bansal #define ARM_ORR_SR(rd, rn, rm, type, rs)	\
23939c13c20SShubham Bansal 	(_AL3_SR(ARM_ORR_R(rd, rn, rm)) | (type) << 5 | (rs) << 8)
24039c13c20SShubham Bansal #define ARM_ORRS_R(rd, rn, rm)	_AL3_R(ARM_INST_ORRS, rd, rn, rm)
24139c13c20SShubham Bansal #define ARM_ORRS_SR(rd, rn, rm, type, rs)	\
24239c13c20SShubham Bansal 	(_AL3_SR(ARM_ORRS_R(rd, rn, rm)) | (type) << 5 | (rs) << 8)
24339c13c20SShubham Bansal #define ARM_ORR_SI(rd, rn, rm, type, imm6)	\
24439c13c20SShubham Bansal 	(ARM_ORR_R(rd, rn, rm) | (type) << 5 | (imm6) << 7)
24539c13c20SShubham Bansal #define ARM_ORRS_SI(rd, rn, rm, type, imm6)	\
24639c13c20SShubham Bansal 	(ARM_ORRS_R(rd, rn, rm) | (type) << 5 | (imm6) << 7)
247ddecdfceSMircea Gherzan 
248ddecdfceSMircea Gherzan #define ARM_REV(rd, rm)		(ARM_INST_REV | (rd) << 12 | (rm))
249ddecdfceSMircea Gherzan #define ARM_REV16(rd, rm)	(ARM_INST_REV16 | (rd) << 12 | (rm))
250ddecdfceSMircea Gherzan 
251ddecdfceSMircea Gherzan #define ARM_RSB_I(rd, rn, imm)	_AL3_I(ARM_INST_RSB, rd, rn, imm)
25239c13c20SShubham Bansal #define ARM_RSBS_I(rd, rn, imm)	_AL3_I(ARM_INST_RSBS, rd, rn, imm)
25339c13c20SShubham Bansal #define ARM_RSC_I(rd, rn, imm)	_AL3_I(ARM_INST_RSC, rd, rn, imm)
254ddecdfceSMircea Gherzan 
255ddecdfceSMircea Gherzan #define ARM_SUB_R(rd, rn, rm)	_AL3_R(ARM_INST_SUB, rd, rn, rm)
25639c13c20SShubham Bansal #define ARM_SUBS_R(rd, rn, rm)	_AL3_R(ARM_INST_SUBS, rd, rn, rm)
25739c13c20SShubham Bansal #define ARM_RSB_R(rd, rn, rm)	_AL3_R(ARM_INST_RSB, rd, rn, rm)
25839c13c20SShubham Bansal #define ARM_SBC_R(rd, rn, rm)	_AL3_R(ARM_INST_SBC, rd, rn, rm)
25939c13c20SShubham Bansal #define ARM_SBCS_R(rd, rn, rm)	_AL3_R(ARM_INST_SBCS, rd, rn, rm)
260ddecdfceSMircea Gherzan #define ARM_SUB_I(rd, rn, imm)	_AL3_I(ARM_INST_SUB, rd, rn, imm)
26139c13c20SShubham Bansal #define ARM_SUBS_I(rd, rn, imm)	_AL3_I(ARM_INST_SUBS, rd, rn, imm)
26239c13c20SShubham Bansal #define ARM_SBC_I(rd, rn, imm)	_AL3_I(ARM_INST_SBC, rd, rn, imm)
263ddecdfceSMircea Gherzan 
264ddecdfceSMircea Gherzan #define ARM_TST_R(rn, rm)	_AL3_R(ARM_INST_TST, 0, rn, rm)
265ddecdfceSMircea Gherzan #define ARM_TST_I(rn, imm)	_AL3_I(ARM_INST_TST, 0, rn, imm)
266ddecdfceSMircea Gherzan 
267ddecdfceSMircea Gherzan #define ARM_UDIV(rd, rn, rm)	(ARM_INST_UDIV | (rd) << 16 | (rn) | (rm) << 8)
268ddecdfceSMircea Gherzan 
269ddecdfceSMircea Gherzan #define ARM_UMULL(rd_lo, rd_hi, rn, rm)	(ARM_INST_UMULL | (rd_hi) << 16 \
270ddecdfceSMircea Gherzan 					 | (rd_lo) << 12 | (rm) << 8 | rn)
271ddecdfceSMircea Gherzan 
2724560cdffSNicolas Schichan #define ARM_MLS(rd, rn, rm, ra)	(ARM_INST_MLS | (rd) << 16 | (rn) | (rm) << 8 \
2734560cdffSNicolas Schichan 				 | (ra) << 12)
27439c13c20SShubham Bansal #define ARM_UXTH(rd, rm)	(ARM_INST_UXTH | (rd) << 12 | (rm))
2754560cdffSNicolas Schichan 
276ddecdfceSMircea Gherzan #endif /* PFILTER_OPCODES_ARM_H */
277