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()
236 emit(ctx, ddivu_r6, dst, dst, src); in emit_alu_r64()
238 emit(ctx, ddivu, dst, src); in emit_alu_r64()
239 emit(ctx, mflo, dst); in emit_alu_r64()
245 emit(ctx, dmodu, dst, dst, src); in emit_alu_r64()
247 emit(ctx, ddivu, dst, src); in emit_alu_r64()
248 emit(ctx, mfhi, dst); in emit_alu_r64()
253 emit_alu_r(ctx, dst, src, op); in emit_alu_r64()
255 clobber_reg(ctx, dst); in emit_alu_r64()
259 static void emit_swap_r64(struct jit_context *ctx, u8 dst, u8 mask, u32 bits) in emit_swap_r64() argument
263 emit(ctx, and, tmp, dst, mask); /* tmp = dst & mask */ in emit_swap_r64()
265 emit(ctx, dsrl, dst, dst, bits); /* dst = dst >> bits */ in emit_swap_r64()
266 emit(ctx, and, dst, dst, mask); /* dst = dst & mask */ in emit_swap_r64()
267 emit(ctx, or, dst, dst, tmp); /* dst = dst | tmp */ in emit_swap_r64()
271 static void emit_bswap_r64(struct jit_context *ctx, u8 dst, u32 width) in emit_bswap_r64() argument
277 emit(ctx, dsbh, dst, dst); in emit_bswap_r64()
278 emit(ctx, dshd, dst, dst); in emit_bswap_r64()
283 emit(ctx, dsll32, t2, dst, 0); /* t2 = dst << 32 */ in emit_bswap_r64()
284 emit(ctx, dsrl32, dst, dst, 0); /* dst = dst >> 32 */ in emit_bswap_r64()
285 emit(ctx, or, dst, dst, t2); /* dst = dst | t2 */ in emit_bswap_r64()
290 emit_swap_r64(ctx, dst, t1, 16);/* dst = swap16(dst) */ in emit_bswap_r64()
296 emit_swap_r64(ctx, dst, t1, 8); /* dst = swap8(dst) */ in emit_bswap_r64()
303 emit_sext(ctx, dst, dst); in emit_bswap_r64()
304 emit_bswap_r(ctx, dst, width); in emit_bswap_r64()
306 emit_zext(ctx, dst); in emit_bswap_r64()
309 clobber_reg(ctx, dst); in emit_bswap_r64()
313 static void emit_trunc_r64(struct jit_context *ctx, u8 dst, u32 width) in emit_trunc_r64() argument
320 emit_zext(ctx, dst); in emit_trunc_r64()
324 emit(ctx, andi, dst, dst, 0xffff); in emit_trunc_r64()
327 clobber_reg(ctx, dst); in emit_trunc_r64()
331 static void emit_ldx(struct jit_context *ctx, u8 dst, u8 src, s16 off, u8 size) in emit_ldx() argument
336 emit(ctx, lbu, dst, off, src); in emit_ldx()
340 emit(ctx, lhu, dst, off, src); in emit_ldx()
344 emit(ctx, lwu, dst, off, src); in emit_ldx()
348 emit(ctx, ld, dst, off, src); in emit_ldx()
351 clobber_reg(ctx, dst); in emit_ldx()
355 static void emit_stx(struct jit_context *ctx, u8 dst, u8 src, s16 off, u8 size) in emit_stx() argument
360 emit(ctx, sb, src, off, dst); in emit_stx()
364 emit(ctx, sh, src, off, dst); in emit_stx()
368 emit(ctx, sw, src, off, dst); in emit_stx()
372 emit(ctx, sd, src, off, dst); in emit_stx()
379 u8 dst, u8 src, s16 off, u8 code) in emit_atomic_r64() argument
385 emit(ctx, lld, t1, off, dst); in emit_atomic_r64()
407 emit(ctx, scd, t2, off, dst); in emit_atomic_r64()
418 static void emit_cmpxchg_r64(struct jit_context *ctx, u8 dst, u8 src, s16 off) in emit_cmpxchg_r64() argument
425 emit(ctx, lld, t1, off, dst); in emit_cmpxchg_r64()
428 emit(ctx, scd, t2, off, dst); in emit_cmpxchg_r64()
626 u8 dst = bpf2mips64[insn->dst_reg]; in build_insn() local
639 emit_mov_i(ctx, dst, imm); in build_insn()
640 emit_zext_ver(ctx, dst); in build_insn()
646 emit_zext(ctx, dst); in build_insn()
648 emit_mov_r(ctx, dst, src); in build_insn()
649 emit_zext_ver(ctx, dst); in build_insn()
654 emit_sext(ctx, dst, dst); in build_insn()
655 emit_alu_i(ctx, dst, 0, BPF_NEG); in build_insn()
656 emit_zext_ver(ctx, dst); in build_insn()
668 emit_alu_r(ctx, dst, MIPS_R_T4, BPF_OP(code)); in build_insn()
670 emit_alu_i(ctx, dst, val, alu); in build_insn()
672 emit_zext_ver(ctx, dst); in build_insn()
689 emit_sext(ctx, dst, dst); in build_insn()
691 emit_alu_r(ctx, dst, MIPS_R_T4, BPF_OP(code)); in build_insn()
693 emit_sext(ctx, dst, dst); in build_insn()
694 emit_alu_i(ctx, dst, val, alu); in build_insn()
696 emit_zext_ver(ctx, dst); in build_insn()
706 emit_alu_r(ctx, dst, src, BPF_OP(code)); in build_insn()
707 emit_zext_ver(ctx, dst); in build_insn()
723 emit_sext(ctx, dst, dst); in build_insn()
725 emit_alu_r(ctx, dst, MIPS_R_T4, BPF_OP(code)); in build_insn()
726 emit_zext_ver(ctx, dst); in build_insn()
730 emit_mov_i(ctx, dst, imm); in build_insn()
734 emit_mov_r(ctx, dst, src); in build_insn()
738 emit_alu_i64(ctx, dst, 0, BPF_NEG); in build_insn()
764 emit_alu_r64(ctx, dst, MIPS_R_T4, BPF_OP(code)); in build_insn()
766 emit_alu_i64(ctx, dst, val, alu); in build_insn()
791 emit_alu_r64(ctx, dst, src, BPF_OP(code)); in build_insn()
804 emit_bswap_r64(ctx, dst, imm); in build_insn()
806 emit_trunc_r64(ctx, dst, imm); in build_insn()
810 emit_mov_i64(ctx, dst, (u32)imm | ((u64)insn[1].imm << 32)); in build_insn()
817 emit_ldx(ctx, dst, src, off, BPF_SIZE(code)); in build_insn()
825 emit_stx(ctx, dst, MIPS_R_T4, off, BPF_SIZE(code)); in build_insn()
832 emit_stx(ctx, dst, src, off, BPF_SIZE(code)); in build_insn()
851 emit_atomic_r64(ctx, dst, src, off, imm); in build_insn()
853 u8 tmp = dst; in build_insn()
855 if (src == dst) { /* Don't overwrite dst */ in build_insn()
856 emit_mov_r(ctx, MIPS_R_T4, dst); in build_insn()
864 emit_atomic_r(ctx, dst, MIPS_R_T4, off, imm); in build_insn()
869 emit_cmpxchg_r64(ctx, dst, src, off); in build_insn()
873 if (res == dst) /* Don't overwrite dst */ in build_insn()
877 emit_cmpxchg_r(ctx, dst, MIPS_R_T5, tmp, off); in build_insn()
878 if (res == dst) /* Restore result */ in build_insn()
911 setup_jmp_r(ctx, dst == src, BPF_OP(code), off, &jmp, &rel); in build_insn()
912 emit_sext(ctx, MIPS_R_T4, dst); /* Sign-extended dst */ in build_insn()
943 emit_sext(ctx, MIPS_R_T4, dst); /* Sign-extended dst */ in build_insn()
978 setup_jmp_r(ctx, dst == src, BPF_OP(code), off, &jmp, &rel); in build_insn()
979 emit_jmp_r(ctx, dst, src, rel, jmp); in build_insn()
1009 emit_jmp_i(ctx, dst, imm, rel, jmp); in build_insn()
1013 emit_jmp_r(ctx, dst, MIPS_R_T4, rel, jmp); in build_insn()