Lines Matching refs:dst

98 static void emit_sext(struct jit_context *ctx, u8 dst, u8 src)  in emit_sext()  argument
100 emit(ctx, sll, dst, src, 0); in emit_sext()
101 clobber_reg(ctx, dst); in emit_sext()
105 static void emit_zext(struct jit_context *ctx, u8 dst) in emit_zext() argument
108 emit(ctx, dinsu, dst, MIPS_R_ZERO, 32, 32); in emit_zext()
110 emit(ctx, and, dst, dst, bpf2mips64[JIT_REG_ZX]); in emit_zext()
113 clobber_reg(ctx, dst); in emit_zext()
117 static void emit_zext_ver(struct jit_context *ctx, u8 dst) in emit_zext_ver() argument
120 emit_zext(ctx, dst); in emit_zext_ver()
124 static void emit_mov_i64(struct jit_context *ctx, u8 dst, u64 imm64) in emit_mov_i64() argument
127 emit(ctx, daddiu, dst, MIPS_R_ZERO, (s16)imm64); in emit_mov_i64()
130 emit(ctx, lui, dst, (s16)(imm64 >> 16)); in emit_mov_i64()
131 emit(ctx, ori, dst, dst, (u16)imm64 & 0xffff); in emit_mov_i64()
140 if (acc == dst) in emit_mov_i64()
145 emit(ctx, dsll_safe, dst, dst, shift); in emit_mov_i64()
146 emit(ctx, ori, dst, acc, half); in emit_mov_i64()
147 acc = dst; in emit_mov_i64()
152 emit(ctx, dsll_safe, dst, dst, shift); in emit_mov_i64()
154 clobber_reg(ctx, dst); in emit_mov_i64()
158 static void emit_alu_i64(struct jit_context *ctx, u8 dst, s32 imm, u8 op) in emit_alu_i64() argument
163 emit(ctx, ori, dst, dst, (u16)imm); in emit_alu_i64()
167 emit(ctx, xori, dst, dst, (u16)imm); in emit_alu_i64()
171 emit(ctx, dsubu, dst, MIPS_R_ZERO, dst); in emit_alu_i64()
175 emit(ctx, dsll_safe, dst, dst, imm); in emit_alu_i64()
179 emit(ctx, dsrl_safe, dst, dst, imm); in emit_alu_i64()
183 emit(ctx, dsra_safe, dst, dst, imm); in emit_alu_i64()
187 emit(ctx, daddiu, dst, dst, imm); in emit_alu_i64()
191 emit(ctx, daddiu, dst, dst, -imm); in emit_alu_i64()
195 emit_alu_i(ctx, dst, imm, op); in emit_alu_i64()
197 clobber_reg(ctx, dst); in emit_alu_i64()
201 static void emit_alu_r64(struct jit_context *ctx, u8 dst, u8 src, u8 op) in emit_alu_r64() argument
206 emit(ctx, dsllv, dst, dst, src); in emit_alu_r64()
210 emit(ctx, dsrlv, dst, dst, src); in emit_alu_r64()
214 emit(ctx, dsrav, dst, dst, src); in emit_alu_r64()
218 emit(ctx, daddu, dst, dst, src); in emit_alu_r64()
222 emit(ctx, dsubu, dst, dst, src); in emit_alu_r64()
227 emit(ctx, dmulu, dst, dst, src); in emit_alu_r64()
229 emit(ctx, dmultu, dst, src); in emit_alu_r64()
230 emit(ctx, mflo, dst); in emit_alu_r64()
239 emit(ctx, ddivu_r6, dst, dst, src); in emit_alu_r64()
241 emit(ctx, ddivu, dst, src); in emit_alu_r64()
242 emit(ctx, mflo, dst); in emit_alu_r64()
248 emit(ctx, dmodu, dst, dst, src); in emit_alu_r64()
250 emit(ctx, ddivu, dst, src); in emit_alu_r64()
251 emit(ctx, mfhi, dst); in emit_alu_r64()
256 emit_alu_r(ctx, dst, src, op); in emit_alu_r64()
258 clobber_reg(ctx, dst); in emit_alu_r64()
262 static void emit_swap_r64(struct jit_context *ctx, u8 dst, u8 mask, u32 bits) in emit_swap_r64() argument
266 emit(ctx, and, tmp, dst, mask); /* tmp = dst & mask */ in emit_swap_r64()
268 emit(ctx, dsrl, dst, dst, bits); /* dst = dst >> bits */ in emit_swap_r64()
269 emit(ctx, and, dst, dst, mask); /* dst = dst & mask */ in emit_swap_r64()
270 emit(ctx, or, dst, dst, tmp); /* dst = dst | tmp */ in emit_swap_r64()
274 static void emit_bswap_r64(struct jit_context *ctx, u8 dst, u32 width) in emit_bswap_r64() argument
280 emit(ctx, dsbh, dst, dst); in emit_bswap_r64()
281 emit(ctx, dshd, dst, dst); in emit_bswap_r64()
286 emit(ctx, dsll32, t2, dst, 0); /* t2 = dst << 32 */ in emit_bswap_r64()
287 emit(ctx, dsrl32, dst, dst, 0); /* dst = dst >> 32 */ in emit_bswap_r64()
288 emit(ctx, or, dst, dst, t2); /* dst = dst | t2 */ in emit_bswap_r64()
293 emit_swap_r64(ctx, dst, t1, 16);/* dst = swap16(dst) */ in emit_bswap_r64()
299 emit_swap_r64(ctx, dst, t1, 8); /* dst = swap8(dst) */ in emit_bswap_r64()
306 emit_sext(ctx, dst, dst); in emit_bswap_r64()
307 emit_bswap_r(ctx, dst, width); in emit_bswap_r64()
309 emit_zext(ctx, dst); in emit_bswap_r64()
312 clobber_reg(ctx, dst); in emit_bswap_r64()
316 static void emit_trunc_r64(struct jit_context *ctx, u8 dst, u32 width) in emit_trunc_r64() argument
323 emit_zext(ctx, dst); in emit_trunc_r64()
327 emit(ctx, andi, dst, dst, 0xffff); in emit_trunc_r64()
330 clobber_reg(ctx, dst); in emit_trunc_r64()
334 static void emit_ldx(struct jit_context *ctx, u8 dst, u8 src, s16 off, u8 size) in emit_ldx() argument
339 emit(ctx, lbu, dst, off, src); in emit_ldx()
343 emit(ctx, lhu, dst, off, src); in emit_ldx()
347 emit(ctx, lwu, dst, off, src); in emit_ldx()
351 emit(ctx, ld, dst, off, src); in emit_ldx()
354 clobber_reg(ctx, dst); in emit_ldx()
358 static void emit_stx(struct jit_context *ctx, u8 dst, u8 src, s16 off, u8 size) in emit_stx() argument
363 emit(ctx, sb, src, off, dst); in emit_stx()
367 emit(ctx, sh, src, off, dst); in emit_stx()
371 emit(ctx, sw, src, off, dst); in emit_stx()
375 emit(ctx, sd, src, off, dst); in emit_stx()
382 u8 dst, u8 src, s16 off, u8 code) in emit_atomic_r64() argument
388 emit(ctx, lld, t1, off, dst); in emit_atomic_r64()
410 emit(ctx, scd, t2, off, dst); in emit_atomic_r64()
421 static void emit_cmpxchg_r64(struct jit_context *ctx, u8 dst, u8 src, s16 off) in emit_cmpxchg_r64() argument
428 emit(ctx, lld, t1, off, dst); in emit_cmpxchg_r64()
431 emit(ctx, scd, t2, off, dst); in emit_cmpxchg_r64()
637 u8 dst = bpf2mips64[insn->dst_reg]; in build_insn() local
650 emit_mov_i(ctx, dst, imm); in build_insn()
651 emit_zext_ver(ctx, dst); in build_insn()
657 emit_zext(ctx, dst); in build_insn()
659 emit_mov_r(ctx, dst, src); in build_insn()
660 emit_zext_ver(ctx, dst); in build_insn()
665 emit_sext(ctx, dst, dst); in build_insn()
666 emit_alu_i(ctx, dst, 0, BPF_NEG); in build_insn()
667 emit_zext_ver(ctx, dst); in build_insn()
679 emit_alu_r(ctx, dst, MIPS_R_T4, BPF_OP(code)); in build_insn()
681 emit_alu_i(ctx, dst, val, alu); in build_insn()
683 emit_zext_ver(ctx, dst); in build_insn()
700 emit_sext(ctx, dst, dst); in build_insn()
702 emit_alu_r(ctx, dst, MIPS_R_T4, BPF_OP(code)); in build_insn()
704 emit_sext(ctx, dst, dst); in build_insn()
705 emit_alu_i(ctx, dst, val, alu); in build_insn()
707 emit_zext_ver(ctx, dst); in build_insn()
717 emit_alu_r(ctx, dst, src, BPF_OP(code)); in build_insn()
718 emit_zext_ver(ctx, dst); in build_insn()
734 emit_sext(ctx, dst, dst); in build_insn()
736 emit_alu_r(ctx, dst, MIPS_R_T4, BPF_OP(code)); in build_insn()
737 emit_zext_ver(ctx, dst); in build_insn()
741 emit_mov_i(ctx, dst, imm); in build_insn()
745 emit_mov_r(ctx, dst, src); in build_insn()
749 emit_alu_i64(ctx, dst, 0, BPF_NEG); in build_insn()
775 emit_alu_r64(ctx, dst, MIPS_R_T4, BPF_OP(code)); in build_insn()
777 emit_alu_i64(ctx, dst, val, alu); in build_insn()
802 emit_alu_r64(ctx, dst, src, BPF_OP(code)); in build_insn()
815 emit_bswap_r64(ctx, dst, imm); in build_insn()
817 emit_trunc_r64(ctx, dst, imm); in build_insn()
821 emit_mov_i64(ctx, dst, (u32)imm | ((u64)insn[1].imm << 32)); in build_insn()
828 emit_ldx(ctx, dst, src, off, BPF_SIZE(code)); in build_insn()
836 emit_stx(ctx, dst, MIPS_R_T4, off, BPF_SIZE(code)); in build_insn()
843 emit_stx(ctx, dst, src, off, BPF_SIZE(code)); in build_insn()
862 emit_atomic_r64(ctx, dst, src, off, imm); in build_insn()
864 u8 tmp = dst; in build_insn()
866 if (src == dst) { /* Don't overwrite dst */ in build_insn()
867 emit_mov_r(ctx, MIPS_R_T4, dst); in build_insn()
875 emit_atomic_r(ctx, dst, MIPS_R_T4, off, imm); in build_insn()
880 emit_cmpxchg_r64(ctx, dst, src, off); in build_insn()
884 if (res == dst) /* Don't overwrite dst */ in build_insn()
888 emit_cmpxchg_r(ctx, dst, MIPS_R_T5, tmp, off); in build_insn()
889 if (res == dst) /* Restore result */ in build_insn()
922 setup_jmp_r(ctx, dst == src, BPF_OP(code), off, &jmp, &rel); in build_insn()
923 emit_sext(ctx, MIPS_R_T4, dst); /* Sign-extended dst */ in build_insn()
954 emit_sext(ctx, MIPS_R_T4, dst); /* Sign-extended dst */ in build_insn()
989 setup_jmp_r(ctx, dst == src, BPF_OP(code), off, &jmp, &rel); in build_insn()
990 emit_jmp_r(ctx, dst, src, rel, jmp); in build_insn()
1020 emit_jmp_i(ctx, dst, imm, rel, jmp); in build_insn()
1024 emit_jmp_r(ctx, dst, MIPS_R_T4, rel, jmp); in build_insn()