Lines Matching +full:3 +full:rd

25 	RV_REG_GP =	3,	/* Global pointer */
226 static inline u32 rv_r_insn(u8 funct7, u8 rs2, u8 rs1, u8 funct3, u8 rd, in rv_r_insn() argument
230 (rd << 7) | opcode; in rv_r_insn()
233 static inline u32 rv_i_insn(u16 imm11_0, u8 rs1, u8 funct3, u8 rd, u8 opcode) in rv_i_insn() argument
235 return (imm11_0 << 20) | (rs1 << 15) | (funct3 << 12) | (rd << 7) | in rv_i_insn()
256 static inline u32 rv_u_insn(u32 imm31_12, u8 rd, u8 opcode) in rv_u_insn() argument
258 return (imm31_12 << 12) | (rd << 7) | opcode; in rv_u_insn()
261 static inline u32 rv_j_insn(u32 imm20_1, u8 rd, u8 opcode) in rv_j_insn() argument
268 return (imm << 12) | (rd << 7) | opcode; in rv_j_insn()
272 u8 funct3, u8 rd, u8 opcode) in rv_amo_insn() argument
276 return rv_r_insn(funct7, rs2, rs1, funct3, rd, opcode); in rv_amo_insn()
281 static inline u16 rv_cr_insn(u8 funct4, u8 rd, u8 rs2, u8 op) in rv_cr_insn() argument
283 return (funct4 << 12) | (rd << 7) | (rs2 << 2) | op; in rv_cr_insn()
286 static inline u16 rv_ci_insn(u8 funct3, u32 imm6, u8 rd, u8 op) in rv_ci_insn() argument
291 return (funct3 << 13) | (rd << 7) | op | imm; in rv_ci_insn()
299 static inline u16 rv_ciw_insn(u8 funct3, u32 uimm, u8 rd, u8 op) in rv_ciw_insn() argument
301 return (funct3 << 13) | (uimm << 5) | ((rd & 0x7) << 2) | op; in rv_ciw_insn()
304 static inline u16 rv_cl_insn(u8 funct3, u32 imm_hi, u8 rs1, u32 imm_lo, u8 rd, in rv_cl_insn() argument
308 (imm_lo << 5) | ((rd & 0x7) << 2) | op; in rv_cl_insn()
318 static inline u16 rv_ca_insn(u8 funct6, u8 rd, u8 funct2, u8 rs2, u8 op) in rv_ca_insn() argument
320 return (funct6 << 10) | ((rd & 0x7) << 7) | (funct2 << 5) | in rv_ca_insn()
324 static inline u16 rv_cb_insn(u8 funct3, u32 imm6, u8 funct2, u8 rd, u8 op) in rv_cb_insn() argument
329 return (funct3 << 13) | (funct2 << 10) | ((rd & 0x7) << 7) | op | imm; in rv_cb_insn()
334 static inline u32 rv_addi(u8 rd, u8 rs1, u16 imm11_0) in rv_addi() argument
336 return rv_i_insn(imm11_0, rs1, 0, rd, 0x13); in rv_addi()
339 static inline u32 rv_andi(u8 rd, u8 rs1, u16 imm11_0) in rv_andi() argument
341 return rv_i_insn(imm11_0, rs1, 7, rd, 0x13); in rv_andi()
344 static inline u32 rv_ori(u8 rd, u8 rs1, u16 imm11_0) in rv_ori() argument
346 return rv_i_insn(imm11_0, rs1, 6, rd, 0x13); in rv_ori()
349 static inline u32 rv_xori(u8 rd, u8 rs1, u16 imm11_0) in rv_xori() argument
351 return rv_i_insn(imm11_0, rs1, 4, rd, 0x13); in rv_xori()
354 static inline u32 rv_slli(u8 rd, u8 rs1, u16 imm11_0) in rv_slli() argument
356 return rv_i_insn(imm11_0, rs1, 1, rd, 0x13); in rv_slli()
359 static inline u32 rv_srli(u8 rd, u8 rs1, u16 imm11_0) in rv_srli() argument
361 return rv_i_insn(imm11_0, rs1, 5, rd, 0x13); in rv_srli()
364 static inline u32 rv_srai(u8 rd, u8 rs1, u16 imm11_0) in rv_srai() argument
366 return rv_i_insn(0x400 | imm11_0, rs1, 5, rd, 0x13); in rv_srai()
369 static inline u32 rv_lui(u8 rd, u32 imm31_12) in rv_lui() argument
371 return rv_u_insn(imm31_12, rd, 0x37); in rv_lui()
374 static inline u32 rv_auipc(u8 rd, u32 imm31_12) in rv_auipc() argument
376 return rv_u_insn(imm31_12, rd, 0x17); in rv_auipc()
379 static inline u32 rv_add(u8 rd, u8 rs1, u8 rs2) in rv_add() argument
381 return rv_r_insn(0, rs2, rs1, 0, rd, 0x33); in rv_add()
384 static inline u32 rv_sub(u8 rd, u8 rs1, u8 rs2) in rv_sub() argument
386 return rv_r_insn(0x20, rs2, rs1, 0, rd, 0x33); in rv_sub()
389 static inline u32 rv_sltu(u8 rd, u8 rs1, u8 rs2) in rv_sltu() argument
391 return rv_r_insn(0, rs2, rs1, 3, rd, 0x33); in rv_sltu()
394 static inline u32 rv_and(u8 rd, u8 rs1, u8 rs2) in rv_and() argument
396 return rv_r_insn(0, rs2, rs1, 7, rd, 0x33); in rv_and()
399 static inline u32 rv_or(u8 rd, u8 rs1, u8 rs2) in rv_or() argument
401 return rv_r_insn(0, rs2, rs1, 6, rd, 0x33); in rv_or()
404 static inline u32 rv_xor(u8 rd, u8 rs1, u8 rs2) in rv_xor() argument
406 return rv_r_insn(0, rs2, rs1, 4, rd, 0x33); in rv_xor()
409 static inline u32 rv_sll(u8 rd, u8 rs1, u8 rs2) in rv_sll() argument
411 return rv_r_insn(0, rs2, rs1, 1, rd, 0x33); in rv_sll()
414 static inline u32 rv_srl(u8 rd, u8 rs1, u8 rs2) in rv_srl() argument
416 return rv_r_insn(0, rs2, rs1, 5, rd, 0x33); in rv_srl()
419 static inline u32 rv_sra(u8 rd, u8 rs1, u8 rs2) in rv_sra() argument
421 return rv_r_insn(0x20, rs2, rs1, 5, rd, 0x33); in rv_sra()
424 static inline u32 rv_mul(u8 rd, u8 rs1, u8 rs2) in rv_mul() argument
426 return rv_r_insn(1, rs2, rs1, 0, rd, 0x33); in rv_mul()
429 static inline u32 rv_mulhu(u8 rd, u8 rs1, u8 rs2) in rv_mulhu() argument
431 return rv_r_insn(1, rs2, rs1, 3, rd, 0x33); in rv_mulhu()
434 static inline u32 rv_divu(u8 rd, u8 rs1, u8 rs2) in rv_divu() argument
436 return rv_r_insn(1, rs2, rs1, 5, rd, 0x33); in rv_divu()
439 static inline u32 rv_remu(u8 rd, u8 rs1, u8 rs2) in rv_remu() argument
441 return rv_r_insn(1, rs2, rs1, 7, rd, 0x33); in rv_remu()
444 static inline u32 rv_jal(u8 rd, u32 imm20_1) in rv_jal() argument
446 return rv_j_insn(imm20_1, rd, 0x6f); in rv_jal()
449 static inline u32 rv_jalr(u8 rd, u8 rs1, u16 imm11_0) in rv_jalr() argument
451 return rv_i_insn(imm11_0, rs1, 0, rd, 0x67); in rv_jalr()
504 static inline u32 rv_lw(u8 rd, u16 imm11_0, u8 rs1) in rv_lw() argument
506 return rv_i_insn(imm11_0, rs1, 2, rd, 0x03); in rv_lw()
509 static inline u32 rv_lbu(u8 rd, u16 imm11_0, u8 rs1) in rv_lbu() argument
511 return rv_i_insn(imm11_0, rs1, 4, rd, 0x03); in rv_lbu()
514 static inline u32 rv_lhu(u8 rd, u16 imm11_0, u8 rs1) in rv_lhu() argument
516 return rv_i_insn(imm11_0, rs1, 5, rd, 0x03); in rv_lhu()
534 static inline u32 rv_amoadd_w(u8 rd, u8 rs2, u8 rs1, u8 aq, u8 rl) in rv_amoadd_w() argument
536 return rv_amo_insn(0, aq, rl, rs2, rs1, 2, rd, 0x2f); in rv_amoadd_w()
539 static inline u32 rv_amoand_w(u8 rd, u8 rs2, u8 rs1, u8 aq, u8 rl) in rv_amoand_w() argument
541 return rv_amo_insn(0xc, aq, rl, rs2, rs1, 2, rd, 0x2f); in rv_amoand_w()
544 static inline u32 rv_amoor_w(u8 rd, u8 rs2, u8 rs1, u8 aq, u8 rl) in rv_amoor_w() argument
546 return rv_amo_insn(0x8, aq, rl, rs2, rs1, 2, rd, 0x2f); in rv_amoor_w()
549 static inline u32 rv_amoxor_w(u8 rd, u8 rs2, u8 rs1, u8 aq, u8 rl) in rv_amoxor_w() argument
551 return rv_amo_insn(0x4, aq, rl, rs2, rs1, 2, rd, 0x2f); in rv_amoxor_w()
554 static inline u32 rv_amoswap_w(u8 rd, u8 rs2, u8 rs1, u8 aq, u8 rl) in rv_amoswap_w() argument
556 return rv_amo_insn(0x1, aq, rl, rs2, rs1, 2, rd, 0x2f); in rv_amoswap_w()
559 static inline u32 rv_lr_w(u8 rd, u8 rs2, u8 rs1, u8 aq, u8 rl) in rv_lr_w() argument
561 return rv_amo_insn(0x2, aq, rl, rs2, rs1, 2, rd, 0x2f); in rv_lr_w()
564 static inline u32 rv_sc_w(u8 rd, u8 rs2, u8 rs1, u8 aq, u8 rl) in rv_sc_w() argument
566 return rv_amo_insn(0x3, aq, rl, rs2, rs1, 2, rd, 0x2f); in rv_sc_w()
578 static inline u16 rvc_addi4spn(u8 rd, u32 imm10) in rvc_addi4spn() argument
583 ((imm10 & 0x4) >> 1) | ((imm10 & 0x8) >> 3); in rvc_addi4spn()
584 return rv_ciw_insn(0x0, imm, rd, 0x0); in rvc_addi4spn()
587 static inline u16 rvc_lw(u8 rd, u32 imm7, u8 rs1) in rvc_lw() argument
591 imm_hi = (imm7 & 0x38) >> 3; in rvc_lw()
593 return rv_cl_insn(0x2, imm_hi, rs1, imm_lo, rd, 0x0); in rvc_lw()
600 imm_hi = (imm7 & 0x38) >> 3; in rvc_sw()
605 static inline u16 rvc_addi(u8 rd, u32 imm6) in rvc_addi() argument
607 return rv_ci_insn(0, imm6, rd, 0x1); in rvc_addi()
610 static inline u16 rvc_li(u8 rd, u32 imm6) in rvc_li() argument
612 return rv_ci_insn(0x2, imm6, rd, 0x1); in rvc_li()
619 imm = ((imm10 & 0x200) >> 4) | (imm10 & 0x10) | ((imm10 & 0x40) >> 3) | in rvc_addi16sp()
624 static inline u16 rvc_lui(u8 rd, u32 imm6) in rvc_lui() argument
626 return rv_ci_insn(0x3, imm6, rd, 0x1); in rvc_lui()
629 static inline u16 rvc_srli(u8 rd, u32 imm6) in rvc_srli() argument
631 return rv_cb_insn(0x4, imm6, 0, rd, 0x1); in rvc_srli()
634 static inline u16 rvc_srai(u8 rd, u32 imm6) in rvc_srai() argument
636 return rv_cb_insn(0x4, imm6, 0x1, rd, 0x1); in rvc_srai()
639 static inline u16 rvc_andi(u8 rd, u32 imm6) in rvc_andi() argument
641 return rv_cb_insn(0x4, imm6, 0x2, rd, 0x1); in rvc_andi()
644 static inline u16 rvc_sub(u8 rd, u8 rs) in rvc_sub() argument
646 return rv_ca_insn(0x23, rd, 0, rs, 0x1); in rvc_sub()
649 static inline u16 rvc_xor(u8 rd, u8 rs) in rvc_xor() argument
651 return rv_ca_insn(0x23, rd, 0x1, rs, 0x1); in rvc_xor()
654 static inline u16 rvc_or(u8 rd, u8 rs) in rvc_or() argument
656 return rv_ca_insn(0x23, rd, 0x2, rs, 0x1); in rvc_or()
659 static inline u16 rvc_and(u8 rd, u8 rs) in rvc_and() argument
661 return rv_ca_insn(0x23, rd, 0x3, rs, 0x1); in rvc_and()
664 static inline u16 rvc_slli(u8 rd, u32 imm6) in rvc_slli() argument
666 return rv_ci_insn(0, imm6, rd, 0x2); in rvc_slli()
669 static inline u16 rvc_lwsp(u8 rd, u32 imm8) in rvc_lwsp() argument
674 return rv_ci_insn(0x2, imm, rd, 0x2); in rvc_lwsp()
682 static inline u16 rvc_mv(u8 rd, u8 rs) in rvc_mv() argument
684 return rv_cr_insn(0x8, rd, rs, 0x2); in rvc_mv()
692 static inline u16 rvc_add(u8 rd, u8 rs) in rvc_add() argument
694 return rv_cr_insn(0x9, rd, rs, 0x2); in rvc_add()
714 static inline u32 rv_addiw(u8 rd, u8 rs1, u16 imm11_0) in rv_addiw() argument
716 return rv_i_insn(imm11_0, rs1, 0, rd, 0x1b); in rv_addiw()
719 static inline u32 rv_slliw(u8 rd, u8 rs1, u16 imm11_0) in rv_slliw() argument
721 return rv_i_insn(imm11_0, rs1, 1, rd, 0x1b); in rv_slliw()
724 static inline u32 rv_srliw(u8 rd, u8 rs1, u16 imm11_0) in rv_srliw() argument
726 return rv_i_insn(imm11_0, rs1, 5, rd, 0x1b); in rv_srliw()
729 static inline u32 rv_sraiw(u8 rd, u8 rs1, u16 imm11_0) in rv_sraiw() argument
731 return rv_i_insn(0x400 | imm11_0, rs1, 5, rd, 0x1b); in rv_sraiw()
734 static inline u32 rv_addw(u8 rd, u8 rs1, u8 rs2) in rv_addw() argument
736 return rv_r_insn(0, rs2, rs1, 0, rd, 0x3b); in rv_addw()
739 static inline u32 rv_subw(u8 rd, u8 rs1, u8 rs2) in rv_subw() argument
741 return rv_r_insn(0x20, rs2, rs1, 0, rd, 0x3b); in rv_subw()
744 static inline u32 rv_sllw(u8 rd, u8 rs1, u8 rs2) in rv_sllw() argument
746 return rv_r_insn(0, rs2, rs1, 1, rd, 0x3b); in rv_sllw()
749 static inline u32 rv_srlw(u8 rd, u8 rs1, u8 rs2) in rv_srlw() argument
751 return rv_r_insn(0, rs2, rs1, 5, rd, 0x3b); in rv_srlw()
754 static inline u32 rv_sraw(u8 rd, u8 rs1, u8 rs2) in rv_sraw() argument
756 return rv_r_insn(0x20, rs2, rs1, 5, rd, 0x3b); in rv_sraw()
759 static inline u32 rv_mulw(u8 rd, u8 rs1, u8 rs2) in rv_mulw() argument
761 return rv_r_insn(1, rs2, rs1, 0, rd, 0x3b); in rv_mulw()
764 static inline u32 rv_divuw(u8 rd, u8 rs1, u8 rs2) in rv_divuw() argument
766 return rv_r_insn(1, rs2, rs1, 5, rd, 0x3b); in rv_divuw()
769 static inline u32 rv_remuw(u8 rd, u8 rs1, u8 rs2) in rv_remuw() argument
771 return rv_r_insn(1, rs2, rs1, 7, rd, 0x3b); in rv_remuw()
774 static inline u32 rv_ld(u8 rd, u16 imm11_0, u8 rs1) in rv_ld() argument
776 return rv_i_insn(imm11_0, rs1, 3, rd, 0x03); in rv_ld()
779 static inline u32 rv_lwu(u8 rd, u16 imm11_0, u8 rs1) in rv_lwu() argument
781 return rv_i_insn(imm11_0, rs1, 6, rd, 0x03); in rv_lwu()
786 return rv_s_insn(imm11_0, rs2, rs1, 3, 0x23); in rv_sd()
789 static inline u32 rv_amoadd_d(u8 rd, u8 rs2, u8 rs1, u8 aq, u8 rl) in rv_amoadd_d() argument
791 return rv_amo_insn(0, aq, rl, rs2, rs1, 3, rd, 0x2f); in rv_amoadd_d()
794 static inline u32 rv_amoand_d(u8 rd, u8 rs2, u8 rs1, u8 aq, u8 rl) in rv_amoand_d() argument
796 return rv_amo_insn(0xc, aq, rl, rs2, rs1, 3, rd, 0x2f); in rv_amoand_d()
799 static inline u32 rv_amoor_d(u8 rd, u8 rs2, u8 rs1, u8 aq, u8 rl) in rv_amoor_d() argument
801 return rv_amo_insn(0x8, aq, rl, rs2, rs1, 3, rd, 0x2f); in rv_amoor_d()
804 static inline u32 rv_amoxor_d(u8 rd, u8 rs2, u8 rs1, u8 aq, u8 rl) in rv_amoxor_d() argument
806 return rv_amo_insn(0x4, aq, rl, rs2, rs1, 3, rd, 0x2f); in rv_amoxor_d()
809 static inline u32 rv_amoswap_d(u8 rd, u8 rs2, u8 rs1, u8 aq, u8 rl) in rv_amoswap_d() argument
811 return rv_amo_insn(0x1, aq, rl, rs2, rs1, 3, rd, 0x2f); in rv_amoswap_d()
814 static inline u32 rv_lr_d(u8 rd, u8 rs2, u8 rs1, u8 aq, u8 rl) in rv_lr_d() argument
816 return rv_amo_insn(0x2, aq, rl, rs2, rs1, 3, rd, 0x2f); in rv_lr_d()
819 static inline u32 rv_sc_d(u8 rd, u8 rs2, u8 rs1, u8 aq, u8 rl) in rv_sc_d() argument
821 return rv_amo_insn(0x3, aq, rl, rs2, rs1, 3, rd, 0x2f); in rv_sc_d()
826 static inline u16 rvc_ld(u8 rd, u32 imm8, u8 rs1) in rvc_ld() argument
830 imm_hi = (imm8 & 0x38) >> 3; in rvc_ld()
832 return rv_cl_insn(0x3, imm_hi, rs1, imm_lo, rd, 0x0); in rvc_ld()
839 imm_hi = (imm8 & 0x38) >> 3; in rvc_sd()
844 static inline u16 rvc_subw(u8 rd, u8 rs) in rvc_subw() argument
846 return rv_ca_insn(0x27, rd, 0, rs, 0x1); in rvc_subw()
849 static inline u16 rvc_addiw(u8 rd, u32 imm6) in rvc_addiw() argument
851 return rv_ci_insn(0x1, imm6, rd, 0x1); in rvc_addiw()
854 static inline u16 rvc_ldsp(u8 rd, u32 imm9) in rvc_ldsp() argument
859 return rv_ci_insn(0x3, imm, rd, 0x2); in rvc_ldsp()
874 static inline void emit_jalr(u8 rd, u8 rs, s32 imm, struct rv_jit_context *ctx) in emit_jalr() argument
876 if (rvc_enabled() && rd == RV_REG_RA && rs && !imm) in emit_jalr()
878 else if (rvc_enabled() && !rd && rs && !imm) in emit_jalr()
881 emit(rv_jalr(rd, rs, imm), ctx); in emit_jalr()
884 static inline void emit_mv(u8 rd, u8 rs, struct rv_jit_context *ctx) in emit_mv() argument
886 if (rvc_enabled() && rd && rs) in emit_mv()
887 emitc(rvc_mv(rd, rs), ctx); in emit_mv()
889 emit(rv_addi(rd, rs, 0), ctx); in emit_mv()
892 static inline void emit_add(u8 rd, u8 rs1, u8 rs2, struct rv_jit_context *ctx) in emit_add() argument
894 if (rvc_enabled() && rd && rd == rs1 && rs2) in emit_add()
895 emitc(rvc_add(rd, rs2), ctx); in emit_add()
897 emit(rv_add(rd, rs1, rs2), ctx); in emit_add()
900 static inline void emit_addi(u8 rd, u8 rs, s32 imm, struct rv_jit_context *ctx) in emit_addi() argument
902 if (rvc_enabled() && rd == RV_REG_SP && rd == rs && is_10b_int(imm) && imm && !(imm & 0xf)) in emit_addi()
904 else if (rvc_enabled() && is_creg(rd) && rs == RV_REG_SP && is_10b_uint(imm) && in emit_addi()
906 emitc(rvc_addi4spn(rd, imm), ctx); in emit_addi()
907 else if (rvc_enabled() && rd && rd == rs && imm && is_6b_int(imm)) in emit_addi()
908 emitc(rvc_addi(rd, imm), ctx); in emit_addi()
910 emit(rv_addi(rd, rs, imm), ctx); in emit_addi()
913 static inline void emit_li(u8 rd, s32 imm, struct rv_jit_context *ctx) in emit_li() argument
915 if (rvc_enabled() && rd && is_6b_int(imm)) in emit_li()
916 emitc(rvc_li(rd, imm), ctx); in emit_li()
918 emit(rv_addi(rd, RV_REG_ZERO, imm), ctx); in emit_li()
921 static inline void emit_lui(u8 rd, s32 imm, struct rv_jit_context *ctx) in emit_lui() argument
923 if (rvc_enabled() && rd && rd != RV_REG_SP && is_6b_int(imm) && imm) in emit_lui()
924 emitc(rvc_lui(rd, imm), ctx); in emit_lui()
926 emit(rv_lui(rd, imm), ctx); in emit_lui()
929 static inline void emit_slli(u8 rd, u8 rs, s32 imm, struct rv_jit_context *ctx) in emit_slli() argument
931 if (rvc_enabled() && rd && rd == rs && imm && (u32)imm < __riscv_xlen) in emit_slli()
932 emitc(rvc_slli(rd, imm), ctx); in emit_slli()
934 emit(rv_slli(rd, rs, imm), ctx); in emit_slli()
937 static inline void emit_andi(u8 rd, u8 rs, s32 imm, struct rv_jit_context *ctx) in emit_andi() argument
939 if (rvc_enabled() && is_creg(rd) && rd == rs && is_6b_int(imm)) in emit_andi()
940 emitc(rvc_andi(rd, imm), ctx); in emit_andi()
942 emit(rv_andi(rd, rs, imm), ctx); in emit_andi()
945 static inline void emit_srli(u8 rd, u8 rs, s32 imm, struct rv_jit_context *ctx) in emit_srli() argument
947 if (rvc_enabled() && is_creg(rd) && rd == rs && imm && (u32)imm < __riscv_xlen) in emit_srli()
948 emitc(rvc_srli(rd, imm), ctx); in emit_srli()
950 emit(rv_srli(rd, rs, imm), ctx); in emit_srli()
953 static inline void emit_srai(u8 rd, u8 rs, s32 imm, struct rv_jit_context *ctx) in emit_srai() argument
955 if (rvc_enabled() && is_creg(rd) && rd == rs && imm && (u32)imm < __riscv_xlen) in emit_srai()
956 emitc(rvc_srai(rd, imm), ctx); in emit_srai()
958 emit(rv_srai(rd, rs, imm), ctx); in emit_srai()
961 static inline void emit_sub(u8 rd, u8 rs1, u8 rs2, struct rv_jit_context *ctx) in emit_sub() argument
963 if (rvc_enabled() && is_creg(rd) && rd == rs1 && is_creg(rs2)) in emit_sub()
964 emitc(rvc_sub(rd, rs2), ctx); in emit_sub()
966 emit(rv_sub(rd, rs1, rs2), ctx); in emit_sub()
969 static inline void emit_or(u8 rd, u8 rs1, u8 rs2, struct rv_jit_context *ctx) in emit_or() argument
971 if (rvc_enabled() && is_creg(rd) && rd == rs1 && is_creg(rs2)) in emit_or()
972 emitc(rvc_or(rd, rs2), ctx); in emit_or()
974 emit(rv_or(rd, rs1, rs2), ctx); in emit_or()
977 static inline void emit_and(u8 rd, u8 rs1, u8 rs2, struct rv_jit_context *ctx) in emit_and() argument
979 if (rvc_enabled() && is_creg(rd) && rd == rs1 && is_creg(rs2)) in emit_and()
980 emitc(rvc_and(rd, rs2), ctx); in emit_and()
982 emit(rv_and(rd, rs1, rs2), ctx); in emit_and()
985 static inline void emit_xor(u8 rd, u8 rs1, u8 rs2, struct rv_jit_context *ctx) in emit_xor() argument
987 if (rvc_enabled() && is_creg(rd) && rd == rs1 && is_creg(rs2)) in emit_xor()
988 emitc(rvc_xor(rd, rs2), ctx); in emit_xor()
990 emit(rv_xor(rd, rs1, rs2), ctx); in emit_xor()
993 static inline void emit_lw(u8 rd, s32 off, u8 rs1, struct rv_jit_context *ctx) in emit_lw() argument
995 if (rvc_enabled() && rs1 == RV_REG_SP && rd && is_8b_uint(off) && !(off & 0x3)) in emit_lw()
996 emitc(rvc_lwsp(rd, off), ctx); in emit_lw()
997 else if (rvc_enabled() && is_creg(rd) && is_creg(rs1) && is_7b_uint(off) && !(off & 0x3)) in emit_lw()
998 emitc(rvc_lw(rd, off, rs1), ctx); in emit_lw()
1000 emit(rv_lw(rd, off, rs1), ctx); in emit_lw()
1016 static inline void emit_addiw(u8 rd, u8 rs, s32 imm, struct rv_jit_context *ctx) in emit_addiw() argument
1018 if (rvc_enabled() && rd && rd == rs && is_6b_int(imm)) in emit_addiw()
1019 emitc(rvc_addiw(rd, imm), ctx); in emit_addiw()
1021 emit(rv_addiw(rd, rs, imm), ctx); in emit_addiw()
1024 static inline void emit_ld(u8 rd, s32 off, u8 rs1, struct rv_jit_context *ctx) in emit_ld() argument
1026 if (rvc_enabled() && rs1 == RV_REG_SP && rd && is_9b_uint(off) && !(off & 0x7)) in emit_ld()
1027 emitc(rvc_ldsp(rd, off), ctx); in emit_ld()
1028 else if (rvc_enabled() && is_creg(rd) && is_creg(rs1) && is_8b_uint(off) && !(off & 0x7)) in emit_ld()
1029 emitc(rvc_ld(rd, off, rs1), ctx); in emit_ld()
1031 emit(rv_ld(rd, off, rs1), ctx); in emit_ld()
1044 static inline void emit_subw(u8 rd, u8 rs1, u8 rs2, struct rv_jit_context *ctx) in emit_subw() argument
1046 if (rvc_enabled() && is_creg(rd) && rd == rs1 && is_creg(rs2)) in emit_subw()
1047 emitc(rvc_subw(rd, rs2), ctx); in emit_subw()
1049 emit(rv_subw(rd, rs1, rs2), ctx); in emit_subw()