18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Just-In-Time compiler for BPF filters on 32bit ARM
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (c) 2011 Mircea Gherzan <mgherzan@gmail.com>
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#ifndef PFILTER_OPCODES_ARM_H
98c2ecf20Sopenharmony_ci#define PFILTER_OPCODES_ARM_H
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci/* ARM 32bit Registers */
128c2ecf20Sopenharmony_ci#define ARM_R0	0
138c2ecf20Sopenharmony_ci#define ARM_R1	1
148c2ecf20Sopenharmony_ci#define ARM_R2	2
158c2ecf20Sopenharmony_ci#define ARM_R3	3
168c2ecf20Sopenharmony_ci#define ARM_R4	4
178c2ecf20Sopenharmony_ci#define ARM_R5	5
188c2ecf20Sopenharmony_ci#define ARM_R6	6
198c2ecf20Sopenharmony_ci#define ARM_R7	7
208c2ecf20Sopenharmony_ci#define ARM_R8	8
218c2ecf20Sopenharmony_ci#define ARM_R9	9
228c2ecf20Sopenharmony_ci#define ARM_R10	10
238c2ecf20Sopenharmony_ci#define ARM_FP	11	/* Frame Pointer */
248c2ecf20Sopenharmony_ci#define ARM_IP	12	/* Intra-procedure scratch register */
258c2ecf20Sopenharmony_ci#define ARM_SP	13	/* Stack pointer: as load/store base reg */
268c2ecf20Sopenharmony_ci#define ARM_LR	14	/* Link Register */
278c2ecf20Sopenharmony_ci#define ARM_PC	15	/* Program counter */
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci#define ARM_COND_EQ		0x0	/* == */
308c2ecf20Sopenharmony_ci#define ARM_COND_NE		0x1	/* != */
318c2ecf20Sopenharmony_ci#define ARM_COND_CS		0x2	/* unsigned >= */
328c2ecf20Sopenharmony_ci#define ARM_COND_HS		ARM_COND_CS
338c2ecf20Sopenharmony_ci#define ARM_COND_CC		0x3	/* unsigned < */
348c2ecf20Sopenharmony_ci#define ARM_COND_LO		ARM_COND_CC
358c2ecf20Sopenharmony_ci#define ARM_COND_MI		0x4	/* < 0 */
368c2ecf20Sopenharmony_ci#define ARM_COND_PL		0x5	/* >= 0 */
378c2ecf20Sopenharmony_ci#define ARM_COND_VS		0x6	/* Signed Overflow */
388c2ecf20Sopenharmony_ci#define ARM_COND_VC		0x7	/* No Signed Overflow */
398c2ecf20Sopenharmony_ci#define ARM_COND_HI		0x8	/* unsigned > */
408c2ecf20Sopenharmony_ci#define ARM_COND_LS		0x9	/* unsigned <= */
418c2ecf20Sopenharmony_ci#define ARM_COND_GE		0xa	/* Signed >= */
428c2ecf20Sopenharmony_ci#define ARM_COND_LT		0xb	/* Signed < */
438c2ecf20Sopenharmony_ci#define ARM_COND_GT		0xc	/* Signed > */
448c2ecf20Sopenharmony_ci#define ARM_COND_LE		0xd	/* Signed <= */
458c2ecf20Sopenharmony_ci#define ARM_COND_AL		0xe	/* None */
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci/* register shift types */
488c2ecf20Sopenharmony_ci#define SRTYPE_LSL		0
498c2ecf20Sopenharmony_ci#define SRTYPE_LSR		1
508c2ecf20Sopenharmony_ci#define SRTYPE_ASR		2
518c2ecf20Sopenharmony_ci#define SRTYPE_ROR		3
528c2ecf20Sopenharmony_ci#define SRTYPE_ASL		(SRTYPE_LSL)
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci#define ARM_INST_ADD_R		0x00800000
558c2ecf20Sopenharmony_ci#define ARM_INST_ADDS_R		0x00900000
568c2ecf20Sopenharmony_ci#define ARM_INST_ADC_R		0x00a00000
578c2ecf20Sopenharmony_ci#define ARM_INST_ADC_I		0x02a00000
588c2ecf20Sopenharmony_ci#define ARM_INST_ADD_I		0x02800000
598c2ecf20Sopenharmony_ci#define ARM_INST_ADDS_I		0x02900000
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ci#define ARM_INST_AND_R		0x00000000
628c2ecf20Sopenharmony_ci#define ARM_INST_ANDS_R		0x00100000
638c2ecf20Sopenharmony_ci#define ARM_INST_AND_I		0x02000000
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_ci#define ARM_INST_BIC_R		0x01c00000
668c2ecf20Sopenharmony_ci#define ARM_INST_BIC_I		0x03c00000
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_ci#define ARM_INST_B		0x0a000000
698c2ecf20Sopenharmony_ci#define ARM_INST_BX		0x012FFF10
708c2ecf20Sopenharmony_ci#define ARM_INST_BLX_R		0x012fff30
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_ci#define ARM_INST_CMP_R		0x01500000
738c2ecf20Sopenharmony_ci#define ARM_INST_CMP_I		0x03500000
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ci#define ARM_INST_EOR_R		0x00200000
768c2ecf20Sopenharmony_ci#define ARM_INST_EOR_I		0x02200000
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_ci#define ARM_INST_LDST__U	0x00800000
798c2ecf20Sopenharmony_ci#define ARM_INST_LDST__IMM12	0x00000fff
808c2ecf20Sopenharmony_ci#define ARM_INST_LDRB_I		0x05500000
818c2ecf20Sopenharmony_ci#define ARM_INST_LDRB_R		0x07d00000
828c2ecf20Sopenharmony_ci#define ARM_INST_LDRD_I		0x014000d0
838c2ecf20Sopenharmony_ci#define ARM_INST_LDRH_I		0x015000b0
848c2ecf20Sopenharmony_ci#define ARM_INST_LDRH_R		0x019000b0
858c2ecf20Sopenharmony_ci#define ARM_INST_LDR_I		0x05100000
868c2ecf20Sopenharmony_ci#define ARM_INST_LDR_R		0x07900000
878c2ecf20Sopenharmony_ci
888c2ecf20Sopenharmony_ci#define ARM_INST_LDM		0x08900000
898c2ecf20Sopenharmony_ci#define ARM_INST_LDM_IA		0x08b00000
908c2ecf20Sopenharmony_ci
918c2ecf20Sopenharmony_ci#define ARM_INST_LSL_I		0x01a00000
928c2ecf20Sopenharmony_ci#define ARM_INST_LSL_R		0x01a00010
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_ci#define ARM_INST_LSR_I		0x01a00020
958c2ecf20Sopenharmony_ci#define ARM_INST_LSR_R		0x01a00030
968c2ecf20Sopenharmony_ci
978c2ecf20Sopenharmony_ci#define ARM_INST_ASR_I		0x01a00040
988c2ecf20Sopenharmony_ci#define ARM_INST_ASR_R		0x01a00050
998c2ecf20Sopenharmony_ci
1008c2ecf20Sopenharmony_ci#define ARM_INST_MOV_R		0x01a00000
1018c2ecf20Sopenharmony_ci#define ARM_INST_MOVS_R		0x01b00000
1028c2ecf20Sopenharmony_ci#define ARM_INST_MOV_I		0x03a00000
1038c2ecf20Sopenharmony_ci#define ARM_INST_MOVW		0x03000000
1048c2ecf20Sopenharmony_ci#define ARM_INST_MOVT		0x03400000
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ci#define ARM_INST_MUL		0x00000090
1078c2ecf20Sopenharmony_ci
1088c2ecf20Sopenharmony_ci#define ARM_INST_POP		0x08bd0000
1098c2ecf20Sopenharmony_ci#define ARM_INST_PUSH		0x092d0000
1108c2ecf20Sopenharmony_ci
1118c2ecf20Sopenharmony_ci#define ARM_INST_ORR_R		0x01800000
1128c2ecf20Sopenharmony_ci#define ARM_INST_ORRS_R		0x01900000
1138c2ecf20Sopenharmony_ci#define ARM_INST_ORR_I		0x03800000
1148c2ecf20Sopenharmony_ci
1158c2ecf20Sopenharmony_ci#define ARM_INST_REV		0x06bf0f30
1168c2ecf20Sopenharmony_ci#define ARM_INST_REV16		0x06bf0fb0
1178c2ecf20Sopenharmony_ci
1188c2ecf20Sopenharmony_ci#define ARM_INST_RSB_I		0x02600000
1198c2ecf20Sopenharmony_ci#define ARM_INST_RSBS_I		0x02700000
1208c2ecf20Sopenharmony_ci#define ARM_INST_RSC_I		0x02e00000
1218c2ecf20Sopenharmony_ci
1228c2ecf20Sopenharmony_ci#define ARM_INST_SUB_R		0x00400000
1238c2ecf20Sopenharmony_ci#define ARM_INST_SUBS_R		0x00500000
1248c2ecf20Sopenharmony_ci#define ARM_INST_RSB_R		0x00600000
1258c2ecf20Sopenharmony_ci#define ARM_INST_SUB_I		0x02400000
1268c2ecf20Sopenharmony_ci#define ARM_INST_SUBS_I		0x02500000
1278c2ecf20Sopenharmony_ci#define ARM_INST_SBC_I		0x02c00000
1288c2ecf20Sopenharmony_ci#define ARM_INST_SBC_R		0x00c00000
1298c2ecf20Sopenharmony_ci#define ARM_INST_SBCS_R		0x00d00000
1308c2ecf20Sopenharmony_ci
1318c2ecf20Sopenharmony_ci#define ARM_INST_STR_I		0x05000000
1328c2ecf20Sopenharmony_ci#define ARM_INST_STRB_I		0x05400000
1338c2ecf20Sopenharmony_ci#define ARM_INST_STRD_I		0x014000f0
1348c2ecf20Sopenharmony_ci#define ARM_INST_STRH_I		0x014000b0
1358c2ecf20Sopenharmony_ci
1368c2ecf20Sopenharmony_ci#define ARM_INST_TST_R		0x01100000
1378c2ecf20Sopenharmony_ci#define ARM_INST_TST_I		0x03100000
1388c2ecf20Sopenharmony_ci
1398c2ecf20Sopenharmony_ci#define ARM_INST_UDIV		0x0730f010
1408c2ecf20Sopenharmony_ci
1418c2ecf20Sopenharmony_ci#define ARM_INST_UMULL		0x00800090
1428c2ecf20Sopenharmony_ci
1438c2ecf20Sopenharmony_ci#define ARM_INST_MLS		0x00600090
1448c2ecf20Sopenharmony_ci
1458c2ecf20Sopenharmony_ci#define ARM_INST_UXTH		0x06ff0070
1468c2ecf20Sopenharmony_ci
1478c2ecf20Sopenharmony_ci/*
1488c2ecf20Sopenharmony_ci * Use a suitable undefined instruction to use for ARM/Thumb2 faulting.
1498c2ecf20Sopenharmony_ci * We need to be careful not to conflict with those used by other modules
1508c2ecf20Sopenharmony_ci * (BUG, kprobes, etc) and the register_undef_hook() system.
1518c2ecf20Sopenharmony_ci *
1528c2ecf20Sopenharmony_ci * The ARM architecture reference manual guarantees that the following
1538c2ecf20Sopenharmony_ci * instruction space will produce an undefined instruction exception on
1548c2ecf20Sopenharmony_ci * all CPUs:
1558c2ecf20Sopenharmony_ci *
1568c2ecf20Sopenharmony_ci * ARM:   xxxx 0111 1111 xxxx xxxx xxxx 1111 xxxx	ARMv7-AR, section A5.4
1578c2ecf20Sopenharmony_ci * Thumb: 1101 1110 xxxx xxxx				ARMv7-M, section A5.2.6
1588c2ecf20Sopenharmony_ci */
1598c2ecf20Sopenharmony_ci#define ARM_INST_UDF		0xe7fddef1
1608c2ecf20Sopenharmony_ci
1618c2ecf20Sopenharmony_ci/* register */
1628c2ecf20Sopenharmony_ci#define _AL3_R(op, rd, rn, rm)	((op ## _R) | (rd) << 12 | (rn) << 16 | (rm))
1638c2ecf20Sopenharmony_ci/* immediate */
1648c2ecf20Sopenharmony_ci#define _AL3_I(op, rd, rn, imm)	((op ## _I) | (rd) << 12 | (rn) << 16 | (imm))
1658c2ecf20Sopenharmony_ci/* register with register-shift */
1668c2ecf20Sopenharmony_ci#define _AL3_SR(inst)	(inst | (1 << 4))
1678c2ecf20Sopenharmony_ci
1688c2ecf20Sopenharmony_ci#define ARM_ADD_R(rd, rn, rm)	_AL3_R(ARM_INST_ADD, rd, rn, rm)
1698c2ecf20Sopenharmony_ci#define ARM_ADDS_R(rd, rn, rm)	_AL3_R(ARM_INST_ADDS, rd, rn, rm)
1708c2ecf20Sopenharmony_ci#define ARM_ADD_I(rd, rn, imm)	_AL3_I(ARM_INST_ADD, rd, rn, imm)
1718c2ecf20Sopenharmony_ci#define ARM_ADDS_I(rd, rn, imm)	_AL3_I(ARM_INST_ADDS, rd, rn, imm)
1728c2ecf20Sopenharmony_ci#define ARM_ADC_R(rd, rn, rm)	_AL3_R(ARM_INST_ADC, rd, rn, rm)
1738c2ecf20Sopenharmony_ci#define ARM_ADC_I(rd, rn, imm)	_AL3_I(ARM_INST_ADC, rd, rn, imm)
1748c2ecf20Sopenharmony_ci
1758c2ecf20Sopenharmony_ci#define ARM_AND_R(rd, rn, rm)	_AL3_R(ARM_INST_AND, rd, rn, rm)
1768c2ecf20Sopenharmony_ci#define ARM_ANDS_R(rd, rn, rm)	_AL3_R(ARM_INST_ANDS, rd, rn, rm)
1778c2ecf20Sopenharmony_ci#define ARM_AND_I(rd, rn, imm)	_AL3_I(ARM_INST_AND, rd, rn, imm)
1788c2ecf20Sopenharmony_ci
1798c2ecf20Sopenharmony_ci#define ARM_BIC_R(rd, rn, rm)	_AL3_R(ARM_INST_BIC, rd, rn, rm)
1808c2ecf20Sopenharmony_ci#define ARM_BIC_I(rd, rn, imm)	_AL3_I(ARM_INST_BIC, rd, rn, imm)
1818c2ecf20Sopenharmony_ci
1828c2ecf20Sopenharmony_ci#define ARM_B(imm24)		(ARM_INST_B | ((imm24) & 0xffffff))
1838c2ecf20Sopenharmony_ci#define ARM_BX(rm)		(ARM_INST_BX | (rm))
1848c2ecf20Sopenharmony_ci#define ARM_BLX_R(rm)		(ARM_INST_BLX_R | (rm))
1858c2ecf20Sopenharmony_ci
1868c2ecf20Sopenharmony_ci#define ARM_CMP_R(rn, rm)	_AL3_R(ARM_INST_CMP, 0, rn, rm)
1878c2ecf20Sopenharmony_ci#define ARM_CMP_I(rn, imm)	_AL3_I(ARM_INST_CMP, 0, rn, imm)
1888c2ecf20Sopenharmony_ci
1898c2ecf20Sopenharmony_ci#define ARM_EOR_R(rd, rn, rm)	_AL3_R(ARM_INST_EOR, rd, rn, rm)
1908c2ecf20Sopenharmony_ci#define ARM_EOR_I(rd, rn, imm)	_AL3_I(ARM_INST_EOR, rd, rn, imm)
1918c2ecf20Sopenharmony_ci
1928c2ecf20Sopenharmony_ci#define ARM_LDR_R(rt, rn, rm)	(ARM_INST_LDR_R | ARM_INST_LDST__U \
1938c2ecf20Sopenharmony_ci				 | (rt) << 12 | (rn) << 16 \
1948c2ecf20Sopenharmony_ci				 | (rm))
1958c2ecf20Sopenharmony_ci#define ARM_LDR_R_SI(rt, rn, rm, type, imm) \
1968c2ecf20Sopenharmony_ci				(ARM_INST_LDR_R | ARM_INST_LDST__U \
1978c2ecf20Sopenharmony_ci				 | (rt) << 12 | (rn) << 16 \
1988c2ecf20Sopenharmony_ci				 | (imm) << 7 | (type) << 5 | (rm))
1998c2ecf20Sopenharmony_ci#define ARM_LDRB_R(rt, rn, rm)	(ARM_INST_LDRB_R | ARM_INST_LDST__U \
2008c2ecf20Sopenharmony_ci				 | (rt) << 12 | (rn) << 16 \
2018c2ecf20Sopenharmony_ci				 | (rm))
2028c2ecf20Sopenharmony_ci#define ARM_LDRH_R(rt, rn, rm)	(ARM_INST_LDRH_R | ARM_INST_LDST__U \
2038c2ecf20Sopenharmony_ci				 | (rt) << 12 | (rn) << 16 \
2048c2ecf20Sopenharmony_ci				 | (rm))
2058c2ecf20Sopenharmony_ci
2068c2ecf20Sopenharmony_ci#define ARM_LDM(rn, regs)	(ARM_INST_LDM | (rn) << 16 | (regs))
2078c2ecf20Sopenharmony_ci#define ARM_LDM_IA(rn, regs)	(ARM_INST_LDM_IA | (rn) << 16 | (regs))
2088c2ecf20Sopenharmony_ci
2098c2ecf20Sopenharmony_ci#define ARM_LSL_R(rd, rn, rm)	(_AL3_R(ARM_INST_LSL, rd, 0, rn) | (rm) << 8)
2108c2ecf20Sopenharmony_ci#define ARM_LSL_I(rd, rn, imm)	(_AL3_I(ARM_INST_LSL, rd, 0, rn) | (imm) << 7)
2118c2ecf20Sopenharmony_ci
2128c2ecf20Sopenharmony_ci#define ARM_LSR_R(rd, rn, rm)	(_AL3_R(ARM_INST_LSR, rd, 0, rn) | (rm) << 8)
2138c2ecf20Sopenharmony_ci#define ARM_LSR_I(rd, rn, imm)	(_AL3_I(ARM_INST_LSR, rd, 0, rn) | (imm) << 7)
2148c2ecf20Sopenharmony_ci#define ARM_ASR_R(rd, rn, rm)   (_AL3_R(ARM_INST_ASR, rd, 0, rn) | (rm) << 8)
2158c2ecf20Sopenharmony_ci#define ARM_ASR_I(rd, rn, imm)  (_AL3_I(ARM_INST_ASR, rd, 0, rn) | (imm) << 7)
2168c2ecf20Sopenharmony_ci
2178c2ecf20Sopenharmony_ci#define ARM_MOV_R(rd, rm)	_AL3_R(ARM_INST_MOV, rd, 0, rm)
2188c2ecf20Sopenharmony_ci#define ARM_MOVS_R(rd, rm)	_AL3_R(ARM_INST_MOVS, rd, 0, rm)
2198c2ecf20Sopenharmony_ci#define ARM_MOV_I(rd, imm)	_AL3_I(ARM_INST_MOV, rd, 0, imm)
2208c2ecf20Sopenharmony_ci#define ARM_MOV_SR(rd, rm, type, rs)	\
2218c2ecf20Sopenharmony_ci	(_AL3_SR(ARM_MOV_R(rd, rm)) | (type) << 5 | (rs) << 8)
2228c2ecf20Sopenharmony_ci#define ARM_MOV_SI(rd, rm, type, imm6)	\
2238c2ecf20Sopenharmony_ci	(ARM_MOV_R(rd, rm) | (type) << 5 | (imm6) << 7)
2248c2ecf20Sopenharmony_ci
2258c2ecf20Sopenharmony_ci#define ARM_MOVW(rd, imm)	\
2268c2ecf20Sopenharmony_ci	(ARM_INST_MOVW | ((imm) >> 12) << 16 | (rd) << 12 | ((imm) & 0x0fff))
2278c2ecf20Sopenharmony_ci
2288c2ecf20Sopenharmony_ci#define ARM_MOVT(rd, imm)	\
2298c2ecf20Sopenharmony_ci	(ARM_INST_MOVT | ((imm) >> 12) << 16 | (rd) << 12 | ((imm) & 0x0fff))
2308c2ecf20Sopenharmony_ci
2318c2ecf20Sopenharmony_ci#define ARM_MUL(rd, rm, rn)	(ARM_INST_MUL | (rd) << 16 | (rm) << 8 | (rn))
2328c2ecf20Sopenharmony_ci
2338c2ecf20Sopenharmony_ci#define ARM_POP(regs)		(ARM_INST_POP | (regs))
2348c2ecf20Sopenharmony_ci#define ARM_PUSH(regs)		(ARM_INST_PUSH | (regs))
2358c2ecf20Sopenharmony_ci
2368c2ecf20Sopenharmony_ci#define ARM_ORR_R(rd, rn, rm)	_AL3_R(ARM_INST_ORR, rd, rn, rm)
2378c2ecf20Sopenharmony_ci#define ARM_ORR_I(rd, rn, imm)	_AL3_I(ARM_INST_ORR, rd, rn, imm)
2388c2ecf20Sopenharmony_ci#define ARM_ORR_SR(rd, rn, rm, type, rs)	\
2398c2ecf20Sopenharmony_ci	(_AL3_SR(ARM_ORR_R(rd, rn, rm)) | (type) << 5 | (rs) << 8)
2408c2ecf20Sopenharmony_ci#define ARM_ORRS_R(rd, rn, rm)	_AL3_R(ARM_INST_ORRS, rd, rn, rm)
2418c2ecf20Sopenharmony_ci#define ARM_ORRS_SR(rd, rn, rm, type, rs)	\
2428c2ecf20Sopenharmony_ci	(_AL3_SR(ARM_ORRS_R(rd, rn, rm)) | (type) << 5 | (rs) << 8)
2438c2ecf20Sopenharmony_ci#define ARM_ORR_SI(rd, rn, rm, type, imm6)	\
2448c2ecf20Sopenharmony_ci	(ARM_ORR_R(rd, rn, rm) | (type) << 5 | (imm6) << 7)
2458c2ecf20Sopenharmony_ci#define ARM_ORRS_SI(rd, rn, rm, type, imm6)	\
2468c2ecf20Sopenharmony_ci	(ARM_ORRS_R(rd, rn, rm) | (type) << 5 | (imm6) << 7)
2478c2ecf20Sopenharmony_ci
2488c2ecf20Sopenharmony_ci#define ARM_REV(rd, rm)		(ARM_INST_REV | (rd) << 12 | (rm))
2498c2ecf20Sopenharmony_ci#define ARM_REV16(rd, rm)	(ARM_INST_REV16 | (rd) << 12 | (rm))
2508c2ecf20Sopenharmony_ci
2518c2ecf20Sopenharmony_ci#define ARM_RSB_I(rd, rn, imm)	_AL3_I(ARM_INST_RSB, rd, rn, imm)
2528c2ecf20Sopenharmony_ci#define ARM_RSBS_I(rd, rn, imm)	_AL3_I(ARM_INST_RSBS, rd, rn, imm)
2538c2ecf20Sopenharmony_ci#define ARM_RSC_I(rd, rn, imm)	_AL3_I(ARM_INST_RSC, rd, rn, imm)
2548c2ecf20Sopenharmony_ci
2558c2ecf20Sopenharmony_ci#define ARM_SUB_R(rd, rn, rm)	_AL3_R(ARM_INST_SUB, rd, rn, rm)
2568c2ecf20Sopenharmony_ci#define ARM_SUBS_R(rd, rn, rm)	_AL3_R(ARM_INST_SUBS, rd, rn, rm)
2578c2ecf20Sopenharmony_ci#define ARM_RSB_R(rd, rn, rm)	_AL3_R(ARM_INST_RSB, rd, rn, rm)
2588c2ecf20Sopenharmony_ci#define ARM_SBC_R(rd, rn, rm)	_AL3_R(ARM_INST_SBC, rd, rn, rm)
2598c2ecf20Sopenharmony_ci#define ARM_SBCS_R(rd, rn, rm)	_AL3_R(ARM_INST_SBCS, rd, rn, rm)
2608c2ecf20Sopenharmony_ci#define ARM_SUB_I(rd, rn, imm)	_AL3_I(ARM_INST_SUB, rd, rn, imm)
2618c2ecf20Sopenharmony_ci#define ARM_SUBS_I(rd, rn, imm)	_AL3_I(ARM_INST_SUBS, rd, rn, imm)
2628c2ecf20Sopenharmony_ci#define ARM_SBC_I(rd, rn, imm)	_AL3_I(ARM_INST_SBC, rd, rn, imm)
2638c2ecf20Sopenharmony_ci
2648c2ecf20Sopenharmony_ci#define ARM_TST_R(rn, rm)	_AL3_R(ARM_INST_TST, 0, rn, rm)
2658c2ecf20Sopenharmony_ci#define ARM_TST_I(rn, imm)	_AL3_I(ARM_INST_TST, 0, rn, imm)
2668c2ecf20Sopenharmony_ci
2678c2ecf20Sopenharmony_ci#define ARM_UDIV(rd, rn, rm)	(ARM_INST_UDIV | (rd) << 16 | (rn) | (rm) << 8)
2688c2ecf20Sopenharmony_ci
2698c2ecf20Sopenharmony_ci#define ARM_UMULL(rd_lo, rd_hi, rn, rm)	(ARM_INST_UMULL | (rd_hi) << 16 \
2708c2ecf20Sopenharmony_ci					 | (rd_lo) << 12 | (rm) << 8 | rn)
2718c2ecf20Sopenharmony_ci
2728c2ecf20Sopenharmony_ci#define ARM_MLS(rd, rn, rm, ra)	(ARM_INST_MLS | (rd) << 16 | (rn) | (rm) << 8 \
2738c2ecf20Sopenharmony_ci				 | (ra) << 12)
2748c2ecf20Sopenharmony_ci#define ARM_UXTH(rd, rm)	(ARM_INST_UXTH | (rd) << 12 | (rm))
2758c2ecf20Sopenharmony_ci
2768c2ecf20Sopenharmony_ci#endif /* PFILTER_OPCODES_ARM_H */
277