Lines Matching refs:imm

262 	u32 imm;  in rv_j_insn()  local
264 imm = (imm20_1 & 0x80000) | ((imm20_1 & 0x3ff) << 9) | in rv_j_insn()
267 return (imm << 12) | (rd << 7) | opcode; in rv_j_insn()
287 u32 imm; in rv_ci_insn() local
289 imm = ((imm6 & 0x20) << 7) | ((imm6 & 0x1f) << 2); in rv_ci_insn()
290 return (funct3 << 13) | (rd << 7) | op | imm; in rv_ci_insn()
325 u32 imm; in rv_cb_insn() local
327 imm = ((imm6 & 0x20) << 7) | ((imm6 & 0x1f) << 2); in rv_cb_insn()
328 return (funct3 << 13) | (funct2 << 10) | ((rd & 0x7) << 7) | op | imm; in rv_cb_insn()
542 u32 imm; in rvc_addi4spn() local
544 imm = ((imm10 & 0x30) << 2) | ((imm10 & 0x3c0) >> 4) | in rvc_addi4spn()
546 return rv_ciw_insn(0x0, imm, rd, 0x0); in rvc_addi4spn()
579 u32 imm; in rvc_addi16sp() local
581 imm = ((imm10 & 0x200) >> 4) | (imm10 & 0x10) | ((imm10 & 0x40) >> 3) | in rvc_addi16sp()
583 return rv_ci_insn(0x3, imm, RV_REG_SP, 0x1); in rvc_addi16sp()
633 u32 imm; in rvc_lwsp() local
635 imm = ((imm8 & 0xc0) >> 6) | (imm8 & 0x3c); in rvc_lwsp()
636 return rv_ci_insn(0x2, imm, rd, 0x2); in rvc_lwsp()
661 u32 imm; in rvc_swsp() local
663 imm = (imm8 & 0x3c) | ((imm8 & 0xc0) >> 6); in rvc_swsp()
664 return rv_css_insn(0x6, imm, rs2, 0x2); in rvc_swsp()
788 u32 imm; in rvc_ldsp() local
790 imm = ((imm9 & 0x1c0) >> 6) | (imm9 & 0x38); in rvc_ldsp()
791 return rv_ci_insn(0x3, imm, rd, 0x2); in rvc_ldsp()
796 u32 imm; in rvc_sdsp() local
798 imm = (imm9 & 0x38) | ((imm9 & 0x1c0) >> 6); in rvc_sdsp()
799 return rv_css_insn(0x7, imm, rs2, 0x2); in rvc_sdsp()
806 static inline void emit_jalr(u8 rd, u8 rs, s32 imm, struct rv_jit_context *ctx) in emit_jalr() argument
808 if (rvc_enabled() && rd == RV_REG_RA && rs && !imm) in emit_jalr()
810 else if (rvc_enabled() && !rd && rs && !imm) in emit_jalr()
813 emit(rv_jalr(rd, rs, imm), ctx); in emit_jalr()
832 static inline void emit_addi(u8 rd, u8 rs, s32 imm, struct rv_jit_context *ctx) in emit_addi() argument
834 if (rvc_enabled() && rd == RV_REG_SP && rd == rs && is_10b_int(imm) && imm && !(imm & 0xf)) in emit_addi()
835 emitc(rvc_addi16sp(imm), ctx); in emit_addi()
836 else if (rvc_enabled() && is_creg(rd) && rs == RV_REG_SP && is_10b_uint(imm) && in emit_addi()
837 !(imm & 0x3) && imm) in emit_addi()
838 emitc(rvc_addi4spn(rd, imm), ctx); in emit_addi()
839 else if (rvc_enabled() && rd && rd == rs && imm && is_6b_int(imm)) in emit_addi()
840 emitc(rvc_addi(rd, imm), ctx); in emit_addi()
842 emit(rv_addi(rd, rs, imm), ctx); in emit_addi()
845 static inline void emit_li(u8 rd, s32 imm, struct rv_jit_context *ctx) in emit_li() argument
847 if (rvc_enabled() && rd && is_6b_int(imm)) in emit_li()
848 emitc(rvc_li(rd, imm), ctx); in emit_li()
850 emit(rv_addi(rd, RV_REG_ZERO, imm), ctx); in emit_li()
853 static inline void emit_lui(u8 rd, s32 imm, struct rv_jit_context *ctx) in emit_lui() argument
855 if (rvc_enabled() && rd && rd != RV_REG_SP && is_6b_int(imm) && imm) in emit_lui()
856 emitc(rvc_lui(rd, imm), ctx); in emit_lui()
858 emit(rv_lui(rd, imm), ctx); in emit_lui()
861 static inline void emit_slli(u8 rd, u8 rs, s32 imm, struct rv_jit_context *ctx) in emit_slli() argument
863 if (rvc_enabled() && rd && rd == rs && imm && (u32)imm < __riscv_xlen) in emit_slli()
864 emitc(rvc_slli(rd, imm), ctx); in emit_slli()
866 emit(rv_slli(rd, rs, imm), ctx); in emit_slli()
869 static inline void emit_andi(u8 rd, u8 rs, s32 imm, struct rv_jit_context *ctx) in emit_andi() argument
871 if (rvc_enabled() && is_creg(rd) && rd == rs && is_6b_int(imm)) in emit_andi()
872 emitc(rvc_andi(rd, imm), ctx); in emit_andi()
874 emit(rv_andi(rd, rs, imm), ctx); in emit_andi()
877 static inline void emit_srli(u8 rd, u8 rs, s32 imm, struct rv_jit_context *ctx) in emit_srli() argument
879 if (rvc_enabled() && is_creg(rd) && rd == rs && imm && (u32)imm < __riscv_xlen) in emit_srli()
880 emitc(rvc_srli(rd, imm), ctx); in emit_srli()
882 emit(rv_srli(rd, rs, imm), ctx); in emit_srli()
885 static inline void emit_srai(u8 rd, u8 rs, s32 imm, struct rv_jit_context *ctx) in emit_srai() argument
887 if (rvc_enabled() && is_creg(rd) && rd == rs && imm && (u32)imm < __riscv_xlen) in emit_srai()
888 emitc(rvc_srai(rd, imm), ctx); in emit_srai()
890 emit(rv_srai(rd, rs, imm), ctx); in emit_srai()
948 static inline void emit_addiw(u8 rd, u8 rs, s32 imm, struct rv_jit_context *ctx) in emit_addiw() argument
950 if (rvc_enabled() && rd && rd == rs && is_6b_int(imm)) in emit_addiw()
951 emitc(rvc_addiw(rd, imm), ctx); in emit_addiw()
953 emit(rv_addiw(rd, rs, imm), ctx); in emit_addiw()