Lines Matching refs:imm
174 static void emit_mov_se_i64(struct jit_context *ctx, const u8 dst[], s32 imm) in emit_mov_se_i64() argument
176 emit_mov_i(ctx, lo(dst), imm); in emit_mov_se_i64()
177 if (imm < 0) in emit_mov_se_i64()
202 const u8 dst[], s32 imm, u8 op) in emit_alu_i64() argument
210 if (imm > S32_MIN && imm < 0) in emit_alu_i64()
214 imm = -imm; in emit_alu_i64()
218 imm = -imm; in emit_alu_i64()
223 emit_mov_i(ctx, src, imm); in emit_alu_i64()
231 if (imm < 0) in emit_alu_i64()
239 if (imm < 0) in emit_alu_i64()
245 if (imm < 0) in emit_alu_i64()
251 if (imm >= 0) in emit_alu_i64()
257 if (imm < 0) { in emit_alu_i64()
322 const u8 dst[], u32 imm, u8 op) in emit_shift_i64() argument
327 if (imm < 32) { in emit_shift_i64()
328 emit(ctx, srl, MIPS_R_T9, lo(dst), 32 - imm); in emit_shift_i64()
329 emit(ctx, sll, lo(dst), lo(dst), imm); in emit_shift_i64()
330 emit(ctx, sll, hi(dst), hi(dst), imm); in emit_shift_i64()
333 emit(ctx, sll, hi(dst), lo(dst), imm - 32); in emit_shift_i64()
339 if (imm < 32) { in emit_shift_i64()
340 emit(ctx, sll, MIPS_R_T9, hi(dst), 32 - imm); in emit_shift_i64()
341 emit(ctx, srl, lo(dst), lo(dst), imm); in emit_shift_i64()
342 emit(ctx, srl, hi(dst), hi(dst), imm); in emit_shift_i64()
345 emit(ctx, srl, lo(dst), hi(dst), imm - 32); in emit_shift_i64()
351 if (imm < 32) { in emit_shift_i64()
352 emit(ctx, sll, MIPS_R_T9, hi(dst), 32 - imm); in emit_shift_i64()
353 emit(ctx, srl, lo(dst), lo(dst), imm); in emit_shift_i64()
354 emit(ctx, sra, hi(dst), hi(dst), imm); in emit_shift_i64()
357 emit(ctx, sra, lo(dst), hi(dst), imm - 32); in emit_shift_i64()
423 static void emit_mul_i64(struct jit_context *ctx, const u8 dst[], s32 imm) in emit_mul_i64() argument
428 switch (imm) { in emit_mul_i64()
443 emit_mov_i(ctx, src, imm); in emit_mul_i64()
452 if (imm < 0) in emit_mul_i64()
991 const u8 rs[], s64 imm) in emit_sltiu_r64() argument
995 if (imm < 0) { in emit_sltiu_r64()
996 emit_mov_i(ctx, rd, imm); /* rd = imm */ in emit_sltiu_r64()
1001 if (imm > 0x7fff) { in emit_sltiu_r64()
1002 emit_mov_i(ctx, rd, (s32)imm); /* rd = imm */ in emit_sltiu_r64()
1005 emit(ctx, sltiu, rd, lo(rs), imm); /* rd = rsl < imm */ in emit_sltiu_r64()
1026 const u8 rs[], s64 imm) in emit_slti_r64() argument
1036 emit_mov_i(ctx, rd, (s32)imm); in emit_slti_r64()
1040 if (imm < 0) in emit_slti_r64()
1049 if (imm < 0) { in emit_slti_r64()
1062 emit(ctx, slti, rd, hi(rs), imm < 0 ? -1 : 0); /* rd = rsh < hi(imm) */ in emit_slti_r64()
1093 const u8 dst[], s32 imm, s32 off, u8 op) in emit_jmp_i64() argument
1105 if (imm >= -0x7fff && imm <= 0x8000) { in emit_jmp_i64()
1106 emit(ctx, addiu, tmp, lo(dst), -imm); in emit_jmp_i64()
1107 } else if ((u32)imm <= 0xffff) { in emit_jmp_i64()
1108 emit(ctx, xori, tmp, lo(dst), imm); in emit_jmp_i64()
1110 emit_mov_i(ctx, tmp, imm); in emit_jmp_i64()
1113 if (imm < 0) { /* Compare sign extension */ in emit_jmp_i64()
1128 if ((u32)imm <= 0xffff) { in emit_jmp_i64()
1129 emit(ctx, andi, tmp, lo(dst), imm); in emit_jmp_i64()
1131 emit_mov_i(ctx, tmp, imm); in emit_jmp_i64()
1134 if (imm < 0) /* Sign-extension pulls in high word */ in emit_jmp_i64()
1143 emit_sltiu_r64(ctx, tmp, dst, (s64)imm + 1); in emit_jmp_i64()
1148 emit_sltiu_r64(ctx, tmp, dst, imm); in emit_jmp_i64()
1153 emit_sltiu_r64(ctx, tmp, dst, imm); in emit_jmp_i64()
1158 emit_sltiu_r64(ctx, tmp, dst, (s64)imm + 1); in emit_jmp_i64()
1163 emit_slti_r64(ctx, tmp, dst, (s64)imm + 1); in emit_jmp_i64()
1168 emit_slti_r64(ctx, tmp, dst, imm); in emit_jmp_i64()
1173 emit_slti_r64(ctx, tmp, dst, imm); in emit_jmp_i64()
1178 emit_slti_r64(ctx, tmp, dst, (s64)imm + 1); in emit_jmp_i64()
1471 s32 imm = insn->imm; in build_insn() local
1479 emit_mov_i(ctx, lo(dst), imm); in build_insn()
1484 if (imm == 1) { in build_insn()
1519 if (!valid_alu_i(BPF_OP(code), imm)) { in build_insn()
1520 emit_mov_i(ctx, MIPS_R_T6, imm); in build_insn()
1522 } else if (rewrite_alu_i(BPF_OP(code), imm, &alu, &val)) { in build_insn()
1554 emit_mov_se_i64(ctx, dst, imm); in build_insn()
1567 emit_alu_i64(ctx, dst, imm, BPF_OP(code)); in build_insn()
1577 if (imm) in build_insn()
1578 emit_alu_i64(ctx, dst, imm, BPF_OP(code)); in build_insn()
1586 if (imm) in build_insn()
1587 emit_shift_i64(ctx, dst, imm, BPF_OP(code)); in build_insn()
1591 emit_mul_i64(ctx, dst, imm); in build_insn()
1601 emit_mov_se_i64(ctx, tmp, imm); in build_insn()
1645 emit_bswap_r64(ctx, dst, imm); in build_insn()
1647 emit_trunc_r64(ctx, dst, imm); in build_insn()
1651 emit_mov_i(ctx, lo(dst), imm); in build_insn()
1652 emit_mov_i(ctx, hi(dst), insn[1].imm); in build_insn()
1669 emit_mov_se_i64(ctx, tmp, imm); in build_insn()
1674 emit_mov_i(ctx, lo(tmp), imm); in build_insn()
1691 switch (imm) { in build_insn()
1702 emit_atomic_r(ctx, lo(dst), lo(src), off, imm); in build_insn()
1705 off, imm); in build_insn()
1706 if (imm & BPF_FETCH) in build_insn()
1723 switch (imm) { in build_insn()
1733 emit_atomic_r64(ctx, lo(dst), src, off, imm); in build_insn()
1795 setup_jmp_i(ctx, imm, 32, BPF_OP(code), off, &jmp, &rel); in build_insn()
1796 if (valid_jmp_i(jmp, imm)) { in build_insn()
1797 emit_jmp_i(ctx, lo(dst), imm, rel, jmp); in build_insn()
1800 emit_mov_i(ctx, MIPS_R_T6, imm); in build_insn()
1859 setup_jmp_i(ctx, imm, 64, BPF_OP(code), off, &jmp, &rel); in build_insn()
1860 emit_jmp_i64(ctx, dst, imm, rel, jmp); in build_insn()