Lines Matching refs:rd
469 static inline void emit_mov_i_no8m(const u8 rd, u32 val, struct jit_ctx *ctx) in emit_mov_i_no8m() argument
472 emit(ARM_LDR_I(rd, ARM_PC, imm_offset(val, ctx)), ctx); in emit_mov_i_no8m()
474 emit(ARM_MOVW(rd, val & 0xffff), ctx); in emit_mov_i_no8m()
476 emit(ARM_MOVT(rd, val >> 16), ctx); in emit_mov_i_no8m()
480 static inline void emit_mov_i(const u8 rd, u32 val, struct jit_ctx *ctx) in emit_mov_i() argument
485 emit(ARM_MOV_I(rd, imm12), ctx); in emit_mov_i()
487 emit_mov_i_no8m(rd, val, ctx); in emit_mov_i()
520 static inline void emit_udivmod(u8 rd, u8 rm, u8 rn, struct jit_ctx *ctx, u8 op, u8 sign) in emit_udivmod() argument
529 emit(sign ? ARM_SDIV(rd, rm, rn) : ARM_UDIV(rd, rm, rn), ctx); in emit_udivmod()
532 emit(ARM_MLS(rd, rn, ARM_IP, rm), ctx); in emit_udivmod()
578 if (rd != ARM_R0) in emit_udivmod()
579 emit(ARM_MOV_R(rd, ARM_R0), ctx); in emit_udivmod()
588 static inline void emit_udivmod64(const s8 *rd, const s8 *rm, const s8 *rn, struct jit_ctx *ctx, in emit_udivmod64() argument
643 if (rd[1] != ARM_R0) { in emit_udivmod64()
644 emit(ARM_MOV_R(rd[0], ARM_R1), ctx); in emit_udivmod64()
645 emit(ARM_MOV_R(rd[1], ARM_R0), ctx); in emit_udivmod64()
649 if (rd[1] != ARM_R0 && rd[1] != ARM_R2) { in emit_udivmod64()
651 } else if (rd[1] != ARM_R0) { in emit_udivmod64()
748 const s8 *rd = is_stacked(dst_lo) ? tmp : dst; in emit_a32_mov_i64() local
750 emit_mov_i(rd[1], (u32)val, ctx); in emit_a32_mov_i64()
751 emit_mov_i(rd[0], val >> 32, ctx); in emit_a32_mov_i64()
753 arm_bpf_put_reg64(dst, rd, ctx); in emit_a32_mov_i64()
848 const s8 *rd; in emit_a32_alu_r64() local
850 rd = arm_bpf_get_reg64(dst, tmp, ctx); in emit_a32_alu_r64()
857 emit_alu_r(rd[1], rs[1], true, false, op, ctx); in emit_a32_alu_r64()
858 emit_alu_r(rd[0], rs[0], true, true, op, ctx); in emit_a32_alu_r64()
865 emit_alu_r(rd[1], rs, true, false, op, ctx); in emit_a32_alu_r64()
867 emit_a32_mov_i(rd[0], 0, ctx); in emit_a32_alu_r64()
870 arm_bpf_put_reg64(dst, rd, ctx); in emit_a32_alu_r64()
916 s8 rd; in emit_a32_movsx_r64() local
919 rd = tmp[1]; in emit_a32_movsx_r64()
921 rd = dst_lo; in emit_a32_movsx_r64()
922 rs = arm_bpf_get_reg32(src_lo, rd, ctx); in emit_a32_movsx_r64()
930 emit(ARM_LSL_I(rd, rs, 32 - off), ctx); in emit_a32_movsx_r64()
931 emit(ARM_ASR_I(rd, rd, 32 - off), ctx); in emit_a32_movsx_r64()
933 rd = rs; in emit_a32_movsx_r64()
948 arm_bpf_put_reg32(dst_lo, rd, ctx); in emit_a32_movsx_r64()
956 emit(ARM_ASR_I(tmp[0], rd, 31), ctx); in emit_a32_movsx_r64()
959 emit(ARM_ASR_I(dst_hi, rd, 31), ctx); in emit_a32_movsx_r64()
968 s8 rd; in emit_a32_alu_i() local
970 rd = arm_bpf_get_reg32(dst, tmp[0], ctx); in emit_a32_alu_i()
975 emit(ARM_LSL_I(rd, rd, val), ctx); in emit_a32_alu_i()
978 emit(ARM_LSR_I(rd, rd, val), ctx); in emit_a32_alu_i()
981 emit(ARM_ASR_I(rd, rd, val), ctx); in emit_a32_alu_i()
984 emit(ARM_RSB_I(rd, rd, val), ctx); in emit_a32_alu_i()
988 arm_bpf_put_reg32(dst, rd, ctx); in emit_a32_alu_i()
995 const s8 *rd; in emit_a32_neg64() local
998 rd = arm_bpf_get_reg64(dst, tmp, ctx); in emit_a32_neg64()
1001 emit(ARM_RSBS_I(rd[1], rd[1], 0), ctx); in emit_a32_neg64()
1002 emit(ARM_RSC_I(rd[0], rd[0], 0), ctx); in emit_a32_neg64()
1004 arm_bpf_put_reg64(dst, rd, ctx); in emit_a32_neg64()
1012 const s8 *rd; in emit_a32_lsh_r64() local
1017 rd = arm_bpf_get_reg64(dst, tmp, ctx); in emit_a32_lsh_r64()
1022 emit(ARM_MOV_SR(ARM_LR, rd[0], SRTYPE_ASL, rt), ctx); in emit_a32_lsh_r64()
1023 emit(ARM_ORR_SR(ARM_LR, ARM_LR, rd[1], SRTYPE_ASL, ARM_IP), ctx); in emit_a32_lsh_r64()
1024 emit(ARM_ORR_SR(ARM_IP, ARM_LR, rd[1], SRTYPE_LSR, tmp2[0]), ctx); in emit_a32_lsh_r64()
1025 emit(ARM_MOV_SR(ARM_LR, rd[1], SRTYPE_ASL, rt), ctx); in emit_a32_lsh_r64()
1036 const s8 *rd; in emit_a32_arsh_r64() local
1041 rd = arm_bpf_get_reg64(dst, tmp, ctx); in emit_a32_arsh_r64()
1046 emit(ARM_MOV_SR(ARM_LR, rd[1], SRTYPE_LSR, rt), ctx); in emit_a32_arsh_r64()
1047 emit(ARM_ORR_SR(ARM_LR, ARM_LR, rd[0], SRTYPE_ASL, ARM_IP), ctx); in emit_a32_arsh_r64()
1049 ARM_ORR_SR(ARM_LR, ARM_LR, rd[0], SRTYPE_ASR, tmp2[0]), ctx); in emit_a32_arsh_r64()
1050 emit(ARM_MOV_SR(ARM_IP, rd[0], SRTYPE_ASR, rt), ctx); in emit_a32_arsh_r64()
1061 const s8 *rd; in emit_a32_rsh_r64() local
1066 rd = arm_bpf_get_reg64(dst, tmp, ctx); in emit_a32_rsh_r64()
1071 emit(ARM_MOV_SR(ARM_LR, rd[1], SRTYPE_LSR, rt), ctx); in emit_a32_rsh_r64()
1072 emit(ARM_ORR_SR(ARM_LR, ARM_LR, rd[0], SRTYPE_ASL, ARM_IP), ctx); in emit_a32_rsh_r64()
1073 emit(ARM_ORR_SR(ARM_LR, ARM_LR, rd[0], SRTYPE_LSR, tmp2[0]), ctx); in emit_a32_rsh_r64()
1074 emit(ARM_MOV_SR(ARM_IP, rd[0], SRTYPE_LSR, rt), ctx); in emit_a32_rsh_r64()
1085 const s8 *rd; in emit_a32_lsh_i64() local
1088 rd = arm_bpf_get_reg64(dst, tmp, ctx); in emit_a32_lsh_i64()
1092 emit(ARM_MOV_SI(tmp2[0], rd[0], SRTYPE_ASL, val), ctx); in emit_a32_lsh_i64()
1093 emit(ARM_ORR_SI(rd[0], tmp2[0], rd[1], SRTYPE_LSR, 32 - val), ctx); in emit_a32_lsh_i64()
1094 emit(ARM_MOV_SI(rd[1], rd[1], SRTYPE_ASL, val), ctx); in emit_a32_lsh_i64()
1097 emit(ARM_MOV_R(rd[0], rd[1]), ctx); in emit_a32_lsh_i64()
1099 emit(ARM_MOV_SI(rd[0], rd[1], SRTYPE_ASL, val - 32), ctx); in emit_a32_lsh_i64()
1100 emit(ARM_EOR_R(rd[1], rd[1], rd[1]), ctx); in emit_a32_lsh_i64()
1103 arm_bpf_put_reg64(dst, rd, ctx); in emit_a32_lsh_i64()
1111 const s8 *rd; in emit_a32_rsh_i64() local
1114 rd = arm_bpf_get_reg64(dst, tmp, ctx); in emit_a32_rsh_i64()
1122 emit(ARM_MOV_SI(tmp2[1], rd[1], SRTYPE_LSR, val), ctx); in emit_a32_rsh_i64()
1123 emit(ARM_ORR_SI(rd[1], tmp2[1], rd[0], SRTYPE_ASL, 32 - val), ctx); in emit_a32_rsh_i64()
1124 emit(ARM_MOV_SI(rd[0], rd[0], SRTYPE_LSR, val), ctx); in emit_a32_rsh_i64()
1126 emit(ARM_MOV_R(rd[1], rd[0]), ctx); in emit_a32_rsh_i64()
1127 emit(ARM_MOV_I(rd[0], 0), ctx); in emit_a32_rsh_i64()
1129 emit(ARM_MOV_SI(rd[1], rd[0], SRTYPE_LSR, val - 32), ctx); in emit_a32_rsh_i64()
1130 emit(ARM_MOV_I(rd[0], 0), ctx); in emit_a32_rsh_i64()
1133 arm_bpf_put_reg64(dst, rd, ctx); in emit_a32_rsh_i64()
1141 const s8 *rd; in emit_a32_arsh_i64() local
1144 rd = arm_bpf_get_reg64(dst, tmp, ctx); in emit_a32_arsh_i64()
1152 emit(ARM_MOV_SI(tmp2[1], rd[1], SRTYPE_LSR, val), ctx); in emit_a32_arsh_i64()
1153 emit(ARM_ORR_SI(rd[1], tmp2[1], rd[0], SRTYPE_ASL, 32 - val), ctx); in emit_a32_arsh_i64()
1154 emit(ARM_MOV_SI(rd[0], rd[0], SRTYPE_ASR, val), ctx); in emit_a32_arsh_i64()
1156 emit(ARM_MOV_R(rd[1], rd[0]), ctx); in emit_a32_arsh_i64()
1157 emit(ARM_MOV_SI(rd[0], rd[0], SRTYPE_ASR, 31), ctx); in emit_a32_arsh_i64()
1159 emit(ARM_MOV_SI(rd[1], rd[0], SRTYPE_ASR, val - 32), ctx); in emit_a32_arsh_i64()
1160 emit(ARM_MOV_SI(rd[0], rd[0], SRTYPE_ASR, 31), ctx); in emit_a32_arsh_i64()
1163 arm_bpf_put_reg64(dst, rd, ctx); in emit_a32_arsh_i64()
1170 const s8 *rd, *rt; in emit_a32_mul_r64() local
1173 rd = arm_bpf_get_reg64(dst, tmp, ctx); in emit_a32_mul_r64()
1177 emit(ARM_MUL(ARM_IP, rd[1], rt[0]), ctx); in emit_a32_mul_r64()
1178 emit(ARM_MUL(ARM_LR, rd[0], rt[1]), ctx); in emit_a32_mul_r64()
1181 emit(ARM_UMULL(ARM_IP, rd[0], rd[1], rt[1]), ctx); in emit_a32_mul_r64()
1182 emit(ARM_ADD_R(rd[0], ARM_LR, rd[0]), ctx); in emit_a32_mul_r64()
1185 arm_bpf_put_reg32(dst_hi, rd[0], ctx); in emit_a32_mul_r64()
1230 s8 rd; in emit_str_r() local
1232 rd = arm_bpf_get_reg32(dst, tmp[1], ctx); in emit_str_r()
1236 emit(ARM_ADD_R(tmp[0], tmp[0], rd), ctx); in emit_str_r()
1237 rd = tmp[0]; in emit_str_r()
1243 emit(ARM_STRB_I(src_lo, rd, off), ctx); in emit_str_r()
1247 emit(ARM_STRH_I(src_lo, rd, off), ctx); in emit_str_r()
1251 emit(ARM_STR_I(src_lo, rd, off), ctx); in emit_str_r()
1255 emit(ARM_STR_I(src_lo, rd, off), ctx); in emit_str_r()
1256 emit(ARM_STR_I(src_hi, rd, off + 4), ctx); in emit_str_r()
1265 const s8 *rd = is_stacked(dst_lo) ? tmp : dst; in emit_ldx_r() local
1273 } else if (rd[1] == rm) { in emit_ldx_r()
1280 emit(ARM_LDRB_I(rd[1], rm, off), ctx); in emit_ldx_r()
1282 emit_a32_mov_i(rd[0], 0, ctx); in emit_ldx_r()
1286 emit(ARM_LDRH_I(rd[1], rm, off), ctx); in emit_ldx_r()
1288 emit_a32_mov_i(rd[0], 0, ctx); in emit_ldx_r()
1292 emit(ARM_LDR_I(rd[1], rm, off), ctx); in emit_ldx_r()
1294 emit_a32_mov_i(rd[0], 0, ctx); in emit_ldx_r()
1298 emit(ARM_LDR_I(rd[1], rm, off), ctx); in emit_ldx_r()
1299 emit(ARM_LDR_I(rd[0], rm, off + 4), ctx); in emit_ldx_r()
1302 arm_bpf_put_reg64(dst, rd, ctx); in emit_ldx_r()
1309 const s8 *rd = is_stacked(dst_lo) ? tmp : dst; in emit_ldsx_r() local
1333 emit(ARM_LDRSB_I(rd[1], rm, off), ctx); in emit_ldsx_r()
1337 emit(ARM_LDRSH_I(rd[1], rm, off), ctx); in emit_ldsx_r()
1341 emit(ARM_LDR_I(rd[1], rm, off), ctx); in emit_ldsx_r()
1345 emit(ARM_ASR_I(rd[0], rd[1], 31), ctx); in emit_ldsx_r()
1346 arm_bpf_put_reg64(dst, rd, ctx); in emit_ldsx_r()
1350 static inline void emit_ar_r(const u8 rd, const u8 rt, const u8 rm, in emit_ar_r() argument
1357 emit(ARM_AND_R(ARM_LR, rd, rm), ctx); in emit_ar_r()
1370 emit(ARM_CMP_R(rd, rm), ctx); in emit_ar_r()
1381 emit(ARM_SBCS_R(ARM_IP, rm, rd), ctx); in emit_ar_r()
1387 emit(ARM_SBCS_R(ARM_IP, rd, rm), ctx); in emit_ar_r()
1475 static inline void emit_rev16(const u8 rd, const u8 rn, struct jit_ctx *ctx) in emit_rev16() argument
1483 emit(ARM_ORR_SI(rd, tmp2[0], tmp2[1], SRTYPE_LSL, 8), ctx); in emit_rev16()
1485 emit(ARM_REV16(rd, rn), ctx); in emit_rev16()
1490 static inline void emit_rev32(const u8 rd, const u8 rn, struct jit_ctx *ctx) in emit_rev32() argument
1505 emit(ARM_ORR_R(rd, ARM_IP, tmp2[0]), ctx); in emit_rev32()
1508 emit(ARM_REV(rd, rn), ctx); in emit_rev32()
1600 const s8 *rd, *rs; in build_insn() local
1717 rd = arm_bpf_get_reg64(dst, tmp2, ctx); in build_insn()
1727 emit_udivmod64(rd, rd, rs, ctx, BPF_OP(code), off); in build_insn()
1728 arm_bpf_put_reg64(dst, rd, ctx); in build_insn()
1808 rd = arm_bpf_get_reg64(dst, tmp, ctx); in build_insn()
1813 emit_rev16(rd[1], rd[1], ctx); in build_insn()
1816 emit_rev32(rd[1], rd[1], ctx); in build_insn()
1819 emit_rev32(ARM_LR, rd[1], ctx); in build_insn()
1820 emit_rev32(rd[1], rd[0], ctx); in build_insn()
1821 emit(ARM_MOV_R(rd[0], ARM_LR), ctx); in build_insn()
1831 emit(ARM_AND_R(rd[1], rd[1], tmp2[1]), ctx); in build_insn()
1833 emit(ARM_UXTH(rd[1], rd[1]), ctx); in build_insn()
1836 emit(ARM_EOR_R(rd[0], rd[0], rd[0]), ctx); in build_insn()
1841 emit(ARM_EOR_R(rd[0], rd[0], rd[0]), ctx); in build_insn()
1848 arm_bpf_put_reg64(dst, rd, ctx); in build_insn()
1985 rd = arm_bpf_get_reg64(dst, tmp, ctx); in build_insn()
1988 emit_ar_r(rd[0], rd[1], rm, rn, ctx, BPF_OP(code), in build_insn()