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()
962 s32 imm = insn->imm; in bpf_jit_emit_insn() local
989 emit_imm32(tmp2, imm, ctx); in bpf_jit_emit_insn()
1012 emit_alu_i64(dst, imm, ctx, BPF_OP(code)); in bpf_jit_emit_insn()
1016 if (imm == 1) { in bpf_jit_emit_insn()
1042 emit_imm32(tmp2, imm, ctx); in bpf_jit_emit_insn()
1061 emit_alu_i32(dst, imm, ctx, BPF_OP(code)); in bpf_jit_emit_insn()
1076 switch (imm) { in bpf_jit_emit_insn()
1089 pr_err("bpf-jit: BPF_END imm %d invalid\n", imm); in bpf_jit_emit_insn()
1101 switch (imm) { in bpf_jit_emit_insn()
1123 pr_err("bpf-jit: BPF_END imm %d invalid\n", imm); in bpf_jit_emit_insn()
1212 emit_imm32(tmp2, imm, ctx); in bpf_jit_emit_insn()
1235 s32 imm_lo = imm; in bpf_jit_emit_insn()
1236 s32 imm_hi = insn1.imm; in bpf_jit_emit_insn()
1266 emit_imm32(tmp2, imm, ctx); in bpf_jit_emit_insn()
1276 if (insn->imm != BPF_ADD) { in bpf_jit_emit_insn()
1279 insn->imm); in bpf_jit_emit_insn()