Lines Matching refs:imm
305 s32 imm = insn[i].imm; in bpf_jit_build_body() local
315 insn[i - 1].dst_reg == insn[i].dst_reg && insn[i - 1].imm != 1) { in bpf_jit_build_body()
367 imm = -imm; in bpf_jit_build_body()
370 if (!imm) { in bpf_jit_build_body()
372 } else if (IMM_HA(imm) & 0xffff) { in bpf_jit_build_body()
373 EMIT(PPC_RAW_ADDIS(dst_reg, src2_reg, IMM_HA(imm))); in bpf_jit_build_body()
376 if (IMM_L(imm)) in bpf_jit_build_body()
377 EMIT(PPC_RAW_ADDI(dst_reg, src2_reg, IMM_L(imm))); in bpf_jit_build_body()
380 imm = -imm; in bpf_jit_build_body()
383 if (!imm) { in bpf_jit_build_body()
388 if (imm >= -32768 && imm < 32768) { in bpf_jit_build_body()
389 EMIT(PPC_RAW_ADDIC(dst_reg, src2_reg, imm)); in bpf_jit_build_body()
391 PPC_LI32(_R0, imm); in bpf_jit_build_body()
394 if (imm >= 0 || (BPF_OP(code) == BPF_SUB && imm == 0x80000000)) in bpf_jit_build_body()
412 if (imm == 1) { in bpf_jit_build_body()
414 } else if (imm == -1) { in bpf_jit_build_body()
416 } else if (is_power_of_2((u32)imm)) { in bpf_jit_build_body()
417 EMIT(PPC_RAW_SLWI(dst_reg, src2_reg, ilog2(imm))); in bpf_jit_build_body()
418 } else if (imm >= -32768 && imm < 32768) { in bpf_jit_build_body()
419 EMIT(PPC_RAW_MULI(dst_reg, src2_reg, imm)); in bpf_jit_build_body()
421 PPC_LI32(_R0, imm); in bpf_jit_build_body()
426 if (!imm) { in bpf_jit_build_body()
429 } else if (imm == 1) { in bpf_jit_build_body()
432 } else if (imm == -1) { in bpf_jit_build_body()
435 } else if (imm > 0 && is_power_of_2(imm)) { in bpf_jit_build_body()
436 imm = ilog2(imm); in bpf_jit_build_body()
437 EMIT(PPC_RAW_RLWINM(dst_reg_h, src2_reg_h, imm, 0, 31 - imm)); in bpf_jit_build_body()
438 EMIT(PPC_RAW_RLWIMI(dst_reg_h, dst_reg, imm, 32 - imm, 31)); in bpf_jit_build_body()
439 EMIT(PPC_RAW_SLWI(dst_reg, src2_reg, imm)); in bpf_jit_build_body()
442 PPC_LI32(tmp_reg, imm); in bpf_jit_build_body()
444 if (imm < 0) in bpf_jit_build_body()
464 if (!imm) in bpf_jit_build_body()
466 if (imm == 1) { in bpf_jit_build_body()
468 } else if (is_power_of_2((u32)imm)) { in bpf_jit_build_body()
469 EMIT(PPC_RAW_SRWI(dst_reg, src2_reg, ilog2(imm))); in bpf_jit_build_body()
471 PPC_LI32(_R0, imm); in bpf_jit_build_body()
476 if (!imm) in bpf_jit_build_body()
479 if (!is_power_of_2((u32)imm)) { in bpf_jit_build_body()
481 PPC_LI32(tmp_reg, imm); in bpf_jit_build_body()
485 } else if (imm == 1) { in bpf_jit_build_body()
488 imm = ilog2((u32)imm); in bpf_jit_build_body()
489 EMIT(PPC_RAW_RLWINM(dst_reg, src2_reg, 0, 32 - imm, 31)); in bpf_jit_build_body()
493 if (!imm) in bpf_jit_build_body()
495 if (imm < 0) in bpf_jit_build_body()
496 imm = -imm; in bpf_jit_build_body()
497 if (!is_power_of_2(imm)) in bpf_jit_build_body()
499 if (imm == 1) in bpf_jit_build_body()
502 EMIT(PPC_RAW_RLWINM(dst_reg, src2_reg, 0, 32 - ilog2(imm), 31)); in bpf_jit_build_body()
506 if (!imm) in bpf_jit_build_body()
508 if (!is_power_of_2(abs(imm))) in bpf_jit_build_body()
511 if (imm < 0) { in bpf_jit_build_body()
514 imm = -imm; in bpf_jit_build_body()
517 if (imm == 1) { in bpf_jit_build_body()
521 imm = ilog2(imm); in bpf_jit_build_body()
522 EMIT(PPC_RAW_RLWINM(dst_reg, src2_reg, 32 - imm, imm, 31)); in bpf_jit_build_body()
523 EMIT(PPC_RAW_RLWIMI(dst_reg, src2_reg_h, 32 - imm, 0, imm - 1)); in bpf_jit_build_body()
524 EMIT(PPC_RAW_SRAWI(dst_reg_h, src2_reg_h, imm)); in bpf_jit_build_body()
546 if (imm >= 0) in bpf_jit_build_body()
550 if (!IMM_H(imm)) { in bpf_jit_build_body()
551 EMIT(PPC_RAW_ANDI(dst_reg, src2_reg, IMM_L(imm))); in bpf_jit_build_body()
552 } else if (!IMM_L(imm)) { in bpf_jit_build_body()
553 EMIT(PPC_RAW_ANDIS(dst_reg, src2_reg, IMM_H(imm))); in bpf_jit_build_body()
554 } else if (imm == (((1 << fls(imm)) - 1) ^ ((1 << (ffs(i) - 1)) - 1))) { in bpf_jit_build_body()
556 32 - fls(imm), 32 - ffs(imm))); in bpf_jit_build_body()
558 PPC_LI32(_R0, imm); in bpf_jit_build_body()
571 if (imm < 0) in bpf_jit_build_body()
575 if (IMM_L(imm)) { in bpf_jit_build_body()
576 EMIT(PPC_RAW_ORI(dst_reg, src2_reg, IMM_L(imm))); in bpf_jit_build_body()
579 if (IMM_H(imm)) in bpf_jit_build_body()
580 EMIT(PPC_RAW_ORIS(dst_reg, src2_reg, IMM_H(imm))); in bpf_jit_build_body()
598 if (imm < 0) in bpf_jit_build_body()
602 if (IMM_L(imm)) { in bpf_jit_build_body()
603 EMIT(PPC_RAW_XORI(dst_reg, src2_reg, IMM_L(imm))); in bpf_jit_build_body()
606 if (IMM_H(imm)) in bpf_jit_build_body()
607 EMIT(PPC_RAW_XORIS(dst_reg, src2_reg, IMM_H(imm))); in bpf_jit_build_body()
624 if (imm) in bpf_jit_build_body()
625 EMIT(PPC_RAW_SLWI(dst_reg, src2_reg, imm)); in bpf_jit_build_body()
630 if (imm < 0) in bpf_jit_build_body()
632 if (!imm) { in bpf_jit_build_body()
634 } else if (imm < 32) { in bpf_jit_build_body()
635 EMIT(PPC_RAW_RLWINM(dst_reg_h, src2_reg_h, imm, 0, 31 - imm)); in bpf_jit_build_body()
636 EMIT(PPC_RAW_RLWIMI(dst_reg_h, src2_reg, imm, 32 - imm, 31)); in bpf_jit_build_body()
637 EMIT(PPC_RAW_RLWINM(dst_reg, src2_reg, imm, 0, 31 - imm)); in bpf_jit_build_body()
638 } else if (imm < 64) { in bpf_jit_build_body()
639 EMIT(PPC_RAW_RLWINM(dst_reg_h, src2_reg, imm, 0, 31 - imm)); in bpf_jit_build_body()
661 if (imm) in bpf_jit_build_body()
662 EMIT(PPC_RAW_SRWI(dst_reg, src2_reg, imm)); in bpf_jit_build_body()
667 if (imm < 0) in bpf_jit_build_body()
669 if (!imm) { in bpf_jit_build_body()
672 } else if (imm < 32) { in bpf_jit_build_body()
673 EMIT(PPC_RAW_RLWINM(dst_reg, src2_reg, 32 - imm, imm, 31)); in bpf_jit_build_body()
674 EMIT(PPC_RAW_RLWIMI(dst_reg, src2_reg_h, 32 - imm, 0, imm - 1)); in bpf_jit_build_body()
675 EMIT(PPC_RAW_RLWINM(dst_reg_h, src2_reg_h, 32 - imm, imm, 31)); in bpf_jit_build_body()
676 } else if (imm < 64) { in bpf_jit_build_body()
677 EMIT(PPC_RAW_RLWINM(dst_reg, src2_reg_h, 64 - imm, imm - 32, 31)); in bpf_jit_build_body()
701 if (imm) in bpf_jit_build_body()
702 EMIT(PPC_RAW_SRAWI(dst_reg, src2_reg, imm)); in bpf_jit_build_body()
707 if (imm < 0) in bpf_jit_build_body()
709 if (!imm) { in bpf_jit_build_body()
712 } else if (imm < 32) { in bpf_jit_build_body()
713 EMIT(PPC_RAW_RLWINM(dst_reg, src2_reg, 32 - imm, imm, 31)); in bpf_jit_build_body()
714 EMIT(PPC_RAW_RLWIMI(dst_reg, src2_reg_h, 32 - imm, 0, imm - 1)); in bpf_jit_build_body()
715 EMIT(PPC_RAW_SRAWI(dst_reg_h, src2_reg_h, imm)); in bpf_jit_build_body()
716 } else if (imm < 64) { in bpf_jit_build_body()
717 EMIT(PPC_RAW_SRAWI(dst_reg, src2_reg_h, imm - 32)); in bpf_jit_build_body()
736 if (imm == 1) in bpf_jit_build_body()
742 PPC_LI32(dst_reg, imm); in bpf_jit_build_body()
743 PPC_EX32(dst_reg_h, imm); in bpf_jit_build_body()
746 PPC_LI32(dst_reg, imm); in bpf_jit_build_body()
753 switch (imm) { in bpf_jit_build_body()
789 switch (imm) { in bpf_jit_build_body()
814 PPC_LI32(_R0, imm); in bpf_jit_build_body()
821 PPC_LI32(_R0, imm); in bpf_jit_build_body()
828 PPC_LI32(_R0, imm); in bpf_jit_build_body()
836 PPC_LI32(_R0, imm); in bpf_jit_build_body()
838 PPC_EX32(_R0, imm); in bpf_jit_build_body()
861 if ((imm & BPF_FETCH) && IS_ENABLED(CONFIG_SMP)) in bpf_jit_build_body()
868 if (imm & BPF_FETCH) in bpf_jit_build_body()
871 switch (imm) { in bpf_jit_build_body()
915 if (imm & BPF_FETCH) { in bpf_jit_build_body()
1025 PPC_LI32(dst_reg_h, (u32)insn[i + 1].imm); in bpf_jit_build_body()
1026 PPC_LI32(dst_reg, (u32)insn[i].imm); in bpf_jit_build_body()
1198 if (imm >= 0 && imm < 32768) { in bpf_jit_build_body()
1201 EMIT(PPC_RAW_CMPLWI(dst_reg, imm)); in bpf_jit_build_body()
1204 PPC_EX32(_R0, imm); in bpf_jit_build_body()
1206 PPC_LI32(_R0, imm); in bpf_jit_build_body()
1217 if (imm >= 0 && imm < 65536) { in bpf_jit_build_body()
1218 EMIT(PPC_RAW_CMPLWI(dst_reg, imm)); in bpf_jit_build_body()
1220 PPC_LI32(_R0, imm); in bpf_jit_build_body()
1229 if (imm >= 0 && imm < 65536) { in bpf_jit_build_body()
1230 EMIT(PPC_RAW_CMPWI(dst_reg_h, imm < 0 ? -1 : 0)); in bpf_jit_build_body()
1232 EMIT(PPC_RAW_CMPLWI(dst_reg, imm)); in bpf_jit_build_body()
1235 EMIT(PPC_RAW_CMPWI(dst_reg_h, imm < 0 ? -1 : 0)); in bpf_jit_build_body()
1236 PPC_LI32(_R0, imm); in bpf_jit_build_body()
1249 if (imm >= -32768 && imm < 32768) { in bpf_jit_build_body()
1250 EMIT(PPC_RAW_CMPWI(dst_reg, imm)); in bpf_jit_build_body()
1253 PPC_LI32(_R0, imm); in bpf_jit_build_body()
1259 if (imm >= 0 && imm < 32768) { in bpf_jit_build_body()
1261 EMIT(PPC_RAW_ANDI(_R0, dst_reg, imm)); in bpf_jit_build_body()
1263 PPC_LI32(_R0, imm); in bpf_jit_build_body()
1264 if (imm < 0) { in bpf_jit_build_body()
1273 if (imm >= 0 && imm < 32768) { in bpf_jit_build_body()
1275 EMIT(PPC_RAW_ANDI(_R0, dst_reg, imm)); in bpf_jit_build_body()
1277 PPC_LI32(_R0, imm); in bpf_jit_build_body()
1305 !insn_is_zext(&insn[i + 1]) && !(BPF_OP(code) == BPF_END && imm == 64)) in bpf_jit_build_body()