Lines Matching refs:imm
111 static void emit_imm(const s8 rd, s32 imm, struct rv_jit_context *ctx) in emit_imm() argument
113 u32 upper = (imm + (1 << 11)) >> 12; in emit_imm()
114 u32 lower = imm & 0xfff; in emit_imm()
124 static void emit_imm32(const s8 *rd, s32 imm, struct rv_jit_context *ctx) in emit_imm32() argument
127 emit_imm(lo(rd), imm, ctx); in emit_imm32()
130 if (imm >= 0) in emit_imm32()
243 static void emit_alu_i64(const s8 *dst, s32 imm, in emit_alu_i64() argument
251 emit_imm32(rd, imm, ctx); in emit_alu_i64()
254 if (is_12b_int(imm)) { in emit_alu_i64()
255 emit(rv_andi(lo(rd), lo(rd), imm), ctx); in emit_alu_i64()
257 emit_imm(RV_REG_T0, imm, ctx); in emit_alu_i64()
260 if (imm >= 0) in emit_alu_i64()
264 if (is_12b_int(imm)) { in emit_alu_i64()
265 emit(rv_ori(lo(rd), lo(rd), imm), ctx); in emit_alu_i64()
267 emit_imm(RV_REG_T0, imm, ctx); in emit_alu_i64()
270 if (imm < 0) in emit_alu_i64()
274 if (is_12b_int(imm)) { in emit_alu_i64()
275 emit(rv_xori(lo(rd), lo(rd), imm), ctx); in emit_alu_i64()
277 emit_imm(RV_REG_T0, imm, ctx); in emit_alu_i64()
280 if (imm < 0) in emit_alu_i64()
284 if (imm >= 32) { in emit_alu_i64()
285 emit(rv_slli(hi(rd), lo(rd), imm - 32), ctx); in emit_alu_i64()
287 } else if (imm == 0) { in emit_alu_i64()
290 emit(rv_srli(RV_REG_T0, lo(rd), 32 - imm), ctx); in emit_alu_i64()
291 emit(rv_slli(hi(rd), hi(rd), imm), ctx); in emit_alu_i64()
293 emit(rv_slli(lo(rd), lo(rd), imm), ctx); in emit_alu_i64()
297 if (imm >= 32) { in emit_alu_i64()
298 emit(rv_srli(lo(rd), hi(rd), imm - 32), ctx); in emit_alu_i64()
300 } else if (imm == 0) { in emit_alu_i64()
303 emit(rv_slli(RV_REG_T0, hi(rd), 32 - imm), ctx); in emit_alu_i64()
304 emit(rv_srli(lo(rd), lo(rd), imm), ctx); in emit_alu_i64()
306 emit(rv_srli(hi(rd), hi(rd), imm), ctx); in emit_alu_i64()
310 if (imm >= 32) { in emit_alu_i64()
311 emit(rv_srai(lo(rd), hi(rd), imm - 32), ctx); in emit_alu_i64()
313 } else if (imm == 0) { in emit_alu_i64()
316 emit(rv_slli(RV_REG_T0, hi(rd), 32 - imm), ctx); in emit_alu_i64()
317 emit(rv_srli(lo(rd), lo(rd), imm), ctx); in emit_alu_i64()
319 emit(rv_srai(hi(rd), hi(rd), imm), ctx); in emit_alu_i64()
327 static void emit_alu_i32(const s8 *dst, s32 imm, in emit_alu_i32() argument
335 emit_imm(lo(rd), imm, ctx); in emit_alu_i32()
338 if (is_12b_int(imm)) { in emit_alu_i32()
339 emit(rv_addi(lo(rd), lo(rd), imm), ctx); in emit_alu_i32()
341 emit_imm(RV_REG_T0, imm, ctx); in emit_alu_i32()
346 if (is_12b_int(-imm)) { in emit_alu_i32()
347 emit(rv_addi(lo(rd), lo(rd), -imm), ctx); in emit_alu_i32()
349 emit_imm(RV_REG_T0, imm, ctx); in emit_alu_i32()
354 if (is_12b_int(imm)) { in emit_alu_i32()
355 emit(rv_andi(lo(rd), lo(rd), imm), ctx); in emit_alu_i32()
357 emit_imm(RV_REG_T0, imm, ctx); in emit_alu_i32()
362 if (is_12b_int(imm)) { in emit_alu_i32()
363 emit(rv_ori(lo(rd), lo(rd), imm), ctx); in emit_alu_i32()
365 emit_imm(RV_REG_T0, imm, ctx); in emit_alu_i32()
370 if (is_12b_int(imm)) { in emit_alu_i32()
371 emit(rv_xori(lo(rd), lo(rd), imm), ctx); in emit_alu_i32()
373 emit_imm(RV_REG_T0, imm, ctx); in emit_alu_i32()
378 if (is_12b_int(imm)) { in emit_alu_i32()
379 emit(rv_slli(lo(rd), lo(rd), imm), ctx); in emit_alu_i32()
381 emit_imm(RV_REG_T0, imm, ctx); in emit_alu_i32()
386 if (is_12b_int(imm)) { in emit_alu_i32()
387 emit(rv_srli(lo(rd), lo(rd), imm), ctx); in emit_alu_i32()
389 emit_imm(RV_REG_T0, imm, ctx); in emit_alu_i32()
394 if (is_12b_int(imm)) { in emit_alu_i32()
395 emit(rv_srai(lo(rd), lo(rd), imm), ctx); in emit_alu_i32()
397 emit_imm(RV_REG_T0, imm, ctx); in emit_alu_i32()
964 s32 imm = insn->imm; in bpf_jit_emit_insn() local
991 emit_imm32(tmp2, imm, ctx); in bpf_jit_emit_insn()
1014 emit_alu_i64(dst, imm, ctx, BPF_OP(code)); in bpf_jit_emit_insn()
1018 if (imm == 1) { in bpf_jit_emit_insn()
1044 emit_imm32(tmp2, imm, ctx); in bpf_jit_emit_insn()
1063 emit_alu_i32(dst, imm, ctx, BPF_OP(code)); in bpf_jit_emit_insn()
1078 switch (imm) { in bpf_jit_emit_insn()
1091 pr_err("bpf-jit: BPF_END imm %d invalid\n", imm); in bpf_jit_emit_insn()
1103 switch (imm) { in bpf_jit_emit_insn()
1125 pr_err("bpf-jit: BPF_END imm %d invalid\n", imm); in bpf_jit_emit_insn()
1214 emit_imm32(tmp2, imm, ctx); in bpf_jit_emit_insn()
1237 s32 imm_lo = imm; in bpf_jit_emit_insn()
1238 s32 imm_hi = insn1.imm; in bpf_jit_emit_insn()
1268 emit_imm32(tmp2, imm, ctx); in bpf_jit_emit_insn()
1278 if (insn->imm != BPF_ADD) { in bpf_jit_emit_insn()
1281 insn->imm); in bpf_jit_emit_insn()