Lines Matching refs:imm

266 	u32 imm;  in rv_j_insn()  local
268 imm = (imm20_1 & 0x80000) | ((imm20_1 & 0x3ff) << 9) | in rv_j_insn()
271 return (imm << 12) | (rd << 7) | opcode; in rv_j_insn()
291 u32 imm; in rv_ci_insn() local
293 imm = ((imm6 & 0x20) << 7) | ((imm6 & 0x1f) << 2); in rv_ci_insn()
294 return (funct3 << 13) | (rd << 7) | op | imm; in rv_ci_insn()
329 u32 imm; in rv_cb_insn() local
331 imm = ((imm6 & 0x20) << 7) | ((imm6 & 0x1f) << 2); in rv_cb_insn()
332 return (funct3 << 13) | (funct2 << 10) | ((rd & 0x7) << 7) | op | imm; in rv_cb_insn()
608 u32 imm; in rvc_addi4spn() local
610 imm = ((imm10 & 0x30) << 2) | ((imm10 & 0x3c0) >> 4) | in rvc_addi4spn()
612 return rv_ciw_insn(0x0, imm, rd, 0x0); in rvc_addi4spn()
645 u32 imm; in rvc_addi16sp() local
647 imm = ((imm10 & 0x200) >> 4) | (imm10 & 0x10) | ((imm10 & 0x40) >> 3) | in rvc_addi16sp()
649 return rv_ci_insn(0x3, imm, RV_REG_SP, 0x1); in rvc_addi16sp()
699 u32 imm; in rvc_lwsp() local
701 imm = ((imm8 & 0xc0) >> 6) | (imm8 & 0x3c); in rvc_lwsp()
702 return rv_ci_insn(0x2, imm, rd, 0x2); in rvc_lwsp()
727 u32 imm; in rvc_swsp() local
729 imm = (imm8 & 0x3c) | ((imm8 & 0xc0) >> 6); in rvc_swsp()
730 return rv_css_insn(0x6, imm, rs2, 0x2); in rvc_swsp()
894 u32 imm; in rvc_ldsp() local
896 imm = ((imm9 & 0x1c0) >> 6) | (imm9 & 0x38); in rvc_ldsp()
897 return rv_ci_insn(0x3, imm, rd, 0x2); in rvc_ldsp()
902 u32 imm; in rvc_sdsp() local
904 imm = (imm9 & 0x38) | ((imm9 & 0x1c0) >> 6); in rvc_sdsp()
905 return rv_css_insn(0x7, imm, rs2, 0x2); in rvc_sdsp()
912 static inline void emit_jalr(u8 rd, u8 rs, s32 imm, struct rv_jit_context *ctx) in emit_jalr() argument
914 if (rvc_enabled() && rd == RV_REG_RA && rs && !imm) in emit_jalr()
916 else if (rvc_enabled() && !rd && rs && !imm) in emit_jalr()
919 emit(rv_jalr(rd, rs, imm), ctx); in emit_jalr()
938 static inline void emit_addi(u8 rd, u8 rs, s32 imm, struct rv_jit_context *ctx) in emit_addi() argument
940 if (rvc_enabled() && rd == RV_REG_SP && rd == rs && is_10b_int(imm) && imm && !(imm & 0xf)) in emit_addi()
941 emitc(rvc_addi16sp(imm), ctx); in emit_addi()
942 else if (rvc_enabled() && is_creg(rd) && rs == RV_REG_SP && is_10b_uint(imm) && in emit_addi()
943 !(imm & 0x3) && imm) in emit_addi()
944 emitc(rvc_addi4spn(rd, imm), ctx); in emit_addi()
945 else if (rvc_enabled() && rd && rd == rs && imm && is_6b_int(imm)) in emit_addi()
946 emitc(rvc_addi(rd, imm), ctx); in emit_addi()
948 emit(rv_addi(rd, rs, imm), ctx); in emit_addi()
951 static inline void emit_li(u8 rd, s32 imm, struct rv_jit_context *ctx) in emit_li() argument
953 if (rvc_enabled() && rd && is_6b_int(imm)) in emit_li()
954 emitc(rvc_li(rd, imm), ctx); in emit_li()
956 emit(rv_addi(rd, RV_REG_ZERO, imm), ctx); in emit_li()
959 static inline void emit_lui(u8 rd, s32 imm, struct rv_jit_context *ctx) in emit_lui() argument
961 if (rvc_enabled() && rd && rd != RV_REG_SP && is_6b_int(imm) && imm) in emit_lui()
962 emitc(rvc_lui(rd, imm), ctx); in emit_lui()
964 emit(rv_lui(rd, imm), ctx); in emit_lui()
967 static inline void emit_slli(u8 rd, u8 rs, s32 imm, struct rv_jit_context *ctx) in emit_slli() argument
969 if (rvc_enabled() && rd && rd == rs && imm && (u32)imm < __riscv_xlen) in emit_slli()
970 emitc(rvc_slli(rd, imm), ctx); in emit_slli()
972 emit(rv_slli(rd, rs, imm), ctx); in emit_slli()
975 static inline void emit_andi(u8 rd, u8 rs, s32 imm, struct rv_jit_context *ctx) in emit_andi() argument
977 if (rvc_enabled() && is_creg(rd) && rd == rs && is_6b_int(imm)) in emit_andi()
978 emitc(rvc_andi(rd, imm), ctx); in emit_andi()
980 emit(rv_andi(rd, rs, imm), ctx); in emit_andi()
983 static inline void emit_srli(u8 rd, u8 rs, s32 imm, struct rv_jit_context *ctx) in emit_srli() argument
985 if (rvc_enabled() && is_creg(rd) && rd == rs && imm && (u32)imm < __riscv_xlen) in emit_srli()
986 emitc(rvc_srli(rd, imm), ctx); in emit_srli()
988 emit(rv_srli(rd, rs, imm), ctx); in emit_srli()
991 static inline void emit_srai(u8 rd, u8 rs, s32 imm, struct rv_jit_context *ctx) in emit_srai() argument
993 if (rvc_enabled() && is_creg(rd) && rd == rs && imm && (u32)imm < __riscv_xlen) in emit_srai()
994 emitc(rvc_srai(rd, imm), ctx); in emit_srai()
996 emit(rv_srai(rd, rs, imm), ctx); in emit_srai()
1054 static inline void emit_addiw(u8 rd, u8 rs, s32 imm, struct rv_jit_context *ctx) in emit_addiw() argument
1056 if (rvc_enabled() && rd && rd == rs && is_6b_int(imm)) in emit_addiw()
1057 emitc(rvc_addiw(rd, imm), ctx); in emit_addiw()
1059 emit(rv_addiw(rd, rs, imm), ctx); in emit_addiw()