Lines Matching refs:rd

229 static inline u32 rv_r_insn(u8 funct7, u8 rs2, u8 rs1, u8 funct3, u8 rd,  in rv_r_insn()  argument
233 (rd << 7) | opcode; in rv_r_insn()
236 static inline u32 rv_i_insn(u16 imm11_0, u8 rs1, u8 funct3, u8 rd, u8 opcode) in rv_i_insn() argument
238 return (imm11_0 << 20) | (rs1 << 15) | (funct3 << 12) | (rd << 7) | in rv_i_insn()
259 static inline u32 rv_u_insn(u32 imm31_12, u8 rd, u8 opcode) in rv_u_insn() argument
261 return (imm31_12 << 12) | (rd << 7) | opcode; in rv_u_insn()
264 static inline u32 rv_j_insn(u32 imm20_1, u8 rd, u8 opcode) in rv_j_insn() argument
271 return (imm << 12) | (rd << 7) | opcode; in rv_j_insn()
275 u8 funct3, u8 rd, u8 opcode) in rv_amo_insn() argument
279 return rv_r_insn(funct7, rs2, rs1, funct3, rd, opcode); in rv_amo_insn()
284 static inline u16 rv_cr_insn(u8 funct4, u8 rd, u8 rs2, u8 op) in rv_cr_insn() argument
286 return (funct4 << 12) | (rd << 7) | (rs2 << 2) | op; in rv_cr_insn()
289 static inline u16 rv_ci_insn(u8 funct3, u32 imm6, u8 rd, u8 op) in rv_ci_insn() argument
294 return (funct3 << 13) | (rd << 7) | op | imm; in rv_ci_insn()
302 static inline u16 rv_ciw_insn(u8 funct3, u32 uimm, u8 rd, u8 op) in rv_ciw_insn() argument
304 return (funct3 << 13) | (uimm << 5) | ((rd & 0x7) << 2) | op; in rv_ciw_insn()
307 static inline u16 rv_cl_insn(u8 funct3, u32 imm_hi, u8 rs1, u32 imm_lo, u8 rd, in rv_cl_insn() argument
311 (imm_lo << 5) | ((rd & 0x7) << 2) | op; in rv_cl_insn()
321 static inline u16 rv_ca_insn(u8 funct6, u8 rd, u8 funct2, u8 rs2, u8 op) in rv_ca_insn() argument
323 return (funct6 << 10) | ((rd & 0x7) << 7) | (funct2 << 5) | in rv_ca_insn()
327 static inline u16 rv_cb_insn(u8 funct3, u32 imm6, u8 funct2, u8 rd, u8 op) in rv_cb_insn() argument
332 return (funct3 << 13) | (funct2 << 10) | ((rd & 0x7) << 7) | op | imm; in rv_cb_insn()
337 static inline u32 rv_addi(u8 rd, u8 rs1, u16 imm11_0) in rv_addi() argument
339 return rv_i_insn(imm11_0, rs1, 0, rd, 0x13); in rv_addi()
342 static inline u32 rv_andi(u8 rd, u8 rs1, u16 imm11_0) in rv_andi() argument
344 return rv_i_insn(imm11_0, rs1, 7, rd, 0x13); in rv_andi()
347 static inline u32 rv_ori(u8 rd, u8 rs1, u16 imm11_0) in rv_ori() argument
349 return rv_i_insn(imm11_0, rs1, 6, rd, 0x13); in rv_ori()
352 static inline u32 rv_xori(u8 rd, u8 rs1, u16 imm11_0) in rv_xori() argument
354 return rv_i_insn(imm11_0, rs1, 4, rd, 0x13); in rv_xori()
357 static inline u32 rv_slli(u8 rd, u8 rs1, u16 imm11_0) in rv_slli() argument
359 return rv_i_insn(imm11_0, rs1, 1, rd, 0x13); in rv_slli()
362 static inline u32 rv_srli(u8 rd, u8 rs1, u16 imm11_0) in rv_srli() argument
364 return rv_i_insn(imm11_0, rs1, 5, rd, 0x13); in rv_srli()
367 static inline u32 rv_srai(u8 rd, u8 rs1, u16 imm11_0) in rv_srai() argument
369 return rv_i_insn(0x400 | imm11_0, rs1, 5, rd, 0x13); in rv_srai()
372 static inline u32 rv_lui(u8 rd, u32 imm31_12) in rv_lui() argument
374 return rv_u_insn(imm31_12, rd, 0x37); in rv_lui()
377 static inline u32 rv_auipc(u8 rd, u32 imm31_12) in rv_auipc() argument
379 return rv_u_insn(imm31_12, rd, 0x17); in rv_auipc()
382 static inline u32 rv_add(u8 rd, u8 rs1, u8 rs2) in rv_add() argument
384 return rv_r_insn(0, rs2, rs1, 0, rd, 0x33); in rv_add()
387 static inline u32 rv_sub(u8 rd, u8 rs1, u8 rs2) in rv_sub() argument
389 return rv_r_insn(0x20, rs2, rs1, 0, rd, 0x33); in rv_sub()
392 static inline u32 rv_sltu(u8 rd, u8 rs1, u8 rs2) in rv_sltu() argument
394 return rv_r_insn(0, rs2, rs1, 3, rd, 0x33); in rv_sltu()
397 static inline u32 rv_and(u8 rd, u8 rs1, u8 rs2) in rv_and() argument
399 return rv_r_insn(0, rs2, rs1, 7, rd, 0x33); in rv_and()
402 static inline u32 rv_or(u8 rd, u8 rs1, u8 rs2) in rv_or() argument
404 return rv_r_insn(0, rs2, rs1, 6, rd, 0x33); in rv_or()
407 static inline u32 rv_xor(u8 rd, u8 rs1, u8 rs2) in rv_xor() argument
409 return rv_r_insn(0, rs2, rs1, 4, rd, 0x33); in rv_xor()
412 static inline u32 rv_sll(u8 rd, u8 rs1, u8 rs2) in rv_sll() argument
414 return rv_r_insn(0, rs2, rs1, 1, rd, 0x33); in rv_sll()
417 static inline u32 rv_srl(u8 rd, u8 rs1, u8 rs2) in rv_srl() argument
419 return rv_r_insn(0, rs2, rs1, 5, rd, 0x33); in rv_srl()
422 static inline u32 rv_sra(u8 rd, u8 rs1, u8 rs2) in rv_sra() argument
424 return rv_r_insn(0x20, rs2, rs1, 5, rd, 0x33); in rv_sra()
427 static inline u32 rv_mul(u8 rd, u8 rs1, u8 rs2) in rv_mul() argument
429 return rv_r_insn(1, rs2, rs1, 0, rd, 0x33); in rv_mul()
432 static inline u32 rv_mulhu(u8 rd, u8 rs1, u8 rs2) in rv_mulhu() argument
434 return rv_r_insn(1, rs2, rs1, 3, rd, 0x33); in rv_mulhu()
437 static inline u32 rv_div(u8 rd, u8 rs1, u8 rs2) in rv_div() argument
439 return rv_r_insn(1, rs2, rs1, 4, rd, 0x33); in rv_div()
442 static inline u32 rv_divu(u8 rd, u8 rs1, u8 rs2) in rv_divu() argument
444 return rv_r_insn(1, rs2, rs1, 5, rd, 0x33); in rv_divu()
447 static inline u32 rv_rem(u8 rd, u8 rs1, u8 rs2) in rv_rem() argument
449 return rv_r_insn(1, rs2, rs1, 6, rd, 0x33); in rv_rem()
452 static inline u32 rv_remu(u8 rd, u8 rs1, u8 rs2) in rv_remu() argument
454 return rv_r_insn(1, rs2, rs1, 7, rd, 0x33); in rv_remu()
457 static inline u32 rv_jal(u8 rd, u32 imm20_1) in rv_jal() argument
459 return rv_j_insn(imm20_1, rd, 0x6f); in rv_jal()
462 static inline u32 rv_jalr(u8 rd, u8 rs1, u16 imm11_0) in rv_jalr() argument
464 return rv_i_insn(imm11_0, rs1, 0, rd, 0x67); in rv_jalr()
517 static inline u32 rv_lb(u8 rd, u16 imm11_0, u8 rs1) in rv_lb() argument
519 return rv_i_insn(imm11_0, rs1, 0, rd, 0x03); in rv_lb()
522 static inline u32 rv_lh(u8 rd, u16 imm11_0, u8 rs1) in rv_lh() argument
524 return rv_i_insn(imm11_0, rs1, 1, rd, 0x03); in rv_lh()
527 static inline u32 rv_lw(u8 rd, u16 imm11_0, u8 rs1) in rv_lw() argument
529 return rv_i_insn(imm11_0, rs1, 2, rd, 0x03); in rv_lw()
532 static inline u32 rv_lbu(u8 rd, u16 imm11_0, u8 rs1) in rv_lbu() argument
534 return rv_i_insn(imm11_0, rs1, 4, rd, 0x03); in rv_lbu()
537 static inline u32 rv_lhu(u8 rd, u16 imm11_0, u8 rs1) in rv_lhu() argument
539 return rv_i_insn(imm11_0, rs1, 5, rd, 0x03); in rv_lhu()
557 static inline u32 rv_amoadd_w(u8 rd, u8 rs2, u8 rs1, u8 aq, u8 rl) in rv_amoadd_w() argument
559 return rv_amo_insn(0, aq, rl, rs2, rs1, 2, rd, 0x2f); in rv_amoadd_w()
562 static inline u32 rv_amoand_w(u8 rd, u8 rs2, u8 rs1, u8 aq, u8 rl) in rv_amoand_w() argument
564 return rv_amo_insn(0xc, aq, rl, rs2, rs1, 2, rd, 0x2f); in rv_amoand_w()
567 static inline u32 rv_amoor_w(u8 rd, u8 rs2, u8 rs1, u8 aq, u8 rl) in rv_amoor_w() argument
569 return rv_amo_insn(0x8, aq, rl, rs2, rs1, 2, rd, 0x2f); in rv_amoor_w()
572 static inline u32 rv_amoxor_w(u8 rd, u8 rs2, u8 rs1, u8 aq, u8 rl) in rv_amoxor_w() argument
574 return rv_amo_insn(0x4, aq, rl, rs2, rs1, 2, rd, 0x2f); in rv_amoxor_w()
577 static inline u32 rv_amoswap_w(u8 rd, u8 rs2, u8 rs1, u8 aq, u8 rl) in rv_amoswap_w() argument
579 return rv_amo_insn(0x1, aq, rl, rs2, rs1, 2, rd, 0x2f); in rv_amoswap_w()
582 static inline u32 rv_lr_w(u8 rd, u8 rs2, u8 rs1, u8 aq, u8 rl) in rv_lr_w() argument
584 return rv_amo_insn(0x2, aq, rl, rs2, rs1, 2, rd, 0x2f); in rv_lr_w()
587 static inline u32 rv_sc_w(u8 rd, u8 rs2, u8 rs1, u8 aq, u8 rl) in rv_sc_w() argument
589 return rv_amo_insn(0x3, aq, rl, rs2, rs1, 2, rd, 0x2f); in rv_sc_w()
606 static inline u16 rvc_addi4spn(u8 rd, u32 imm10) in rvc_addi4spn() argument
612 return rv_ciw_insn(0x0, imm, rd, 0x0); in rvc_addi4spn()
615 static inline u16 rvc_lw(u8 rd, u32 imm7, u8 rs1) in rvc_lw() argument
621 return rv_cl_insn(0x2, imm_hi, rs1, imm_lo, rd, 0x0); in rvc_lw()
633 static inline u16 rvc_addi(u8 rd, u32 imm6) in rvc_addi() argument
635 return rv_ci_insn(0, imm6, rd, 0x1); in rvc_addi()
638 static inline u16 rvc_li(u8 rd, u32 imm6) in rvc_li() argument
640 return rv_ci_insn(0x2, imm6, rd, 0x1); in rvc_li()
652 static inline u16 rvc_lui(u8 rd, u32 imm6) in rvc_lui() argument
654 return rv_ci_insn(0x3, imm6, rd, 0x1); in rvc_lui()
657 static inline u16 rvc_srli(u8 rd, u32 imm6) in rvc_srli() argument
659 return rv_cb_insn(0x4, imm6, 0, rd, 0x1); in rvc_srli()
662 static inline u16 rvc_srai(u8 rd, u32 imm6) in rvc_srai() argument
664 return rv_cb_insn(0x4, imm6, 0x1, rd, 0x1); in rvc_srai()
667 static inline u16 rvc_andi(u8 rd, u32 imm6) in rvc_andi() argument
669 return rv_cb_insn(0x4, imm6, 0x2, rd, 0x1); in rvc_andi()
672 static inline u16 rvc_sub(u8 rd, u8 rs) in rvc_sub() argument
674 return rv_ca_insn(0x23, rd, 0, rs, 0x1); in rvc_sub()
677 static inline u16 rvc_xor(u8 rd, u8 rs) in rvc_xor() argument
679 return rv_ca_insn(0x23, rd, 0x1, rs, 0x1); in rvc_xor()
682 static inline u16 rvc_or(u8 rd, u8 rs) in rvc_or() argument
684 return rv_ca_insn(0x23, rd, 0x2, rs, 0x1); in rvc_or()
687 static inline u16 rvc_and(u8 rd, u8 rs) in rvc_and() argument
689 return rv_ca_insn(0x23, rd, 0x3, rs, 0x1); in rvc_and()
692 static inline u16 rvc_slli(u8 rd, u32 imm6) in rvc_slli() argument
694 return rv_ci_insn(0, imm6, rd, 0x2); in rvc_slli()
697 static inline u16 rvc_lwsp(u8 rd, u32 imm8) in rvc_lwsp() argument
702 return rv_ci_insn(0x2, imm, rd, 0x2); in rvc_lwsp()
710 static inline u16 rvc_mv(u8 rd, u8 rs) in rvc_mv() argument
712 return rv_cr_insn(0x8, rd, rs, 0x2); in rvc_mv()
720 static inline u16 rvc_add(u8 rd, u8 rs) in rvc_add() argument
722 return rv_cr_insn(0x9, rd, rs, 0x2); in rvc_add()
742 static inline u32 rv_addiw(u8 rd, u8 rs1, u16 imm11_0) in rv_addiw() argument
744 return rv_i_insn(imm11_0, rs1, 0, rd, 0x1b); in rv_addiw()
747 static inline u32 rv_slliw(u8 rd, u8 rs1, u16 imm11_0) in rv_slliw() argument
749 return rv_i_insn(imm11_0, rs1, 1, rd, 0x1b); in rv_slliw()
752 static inline u32 rv_srliw(u8 rd, u8 rs1, u16 imm11_0) in rv_srliw() argument
754 return rv_i_insn(imm11_0, rs1, 5, rd, 0x1b); in rv_srliw()
757 static inline u32 rv_sraiw(u8 rd, u8 rs1, u16 imm11_0) in rv_sraiw() argument
759 return rv_i_insn(0x400 | imm11_0, rs1, 5, rd, 0x1b); in rv_sraiw()
762 static inline u32 rv_addw(u8 rd, u8 rs1, u8 rs2) in rv_addw() argument
764 return rv_r_insn(0, rs2, rs1, 0, rd, 0x3b); in rv_addw()
767 static inline u32 rv_subw(u8 rd, u8 rs1, u8 rs2) in rv_subw() argument
769 return rv_r_insn(0x20, rs2, rs1, 0, rd, 0x3b); in rv_subw()
772 static inline u32 rv_sllw(u8 rd, u8 rs1, u8 rs2) in rv_sllw() argument
774 return rv_r_insn(0, rs2, rs1, 1, rd, 0x3b); in rv_sllw()
777 static inline u32 rv_srlw(u8 rd, u8 rs1, u8 rs2) in rv_srlw() argument
779 return rv_r_insn(0, rs2, rs1, 5, rd, 0x3b); in rv_srlw()
782 static inline u32 rv_sraw(u8 rd, u8 rs1, u8 rs2) in rv_sraw() argument
784 return rv_r_insn(0x20, rs2, rs1, 5, rd, 0x3b); in rv_sraw()
787 static inline u32 rv_mulw(u8 rd, u8 rs1, u8 rs2) in rv_mulw() argument
789 return rv_r_insn(1, rs2, rs1, 0, rd, 0x3b); in rv_mulw()
792 static inline u32 rv_divw(u8 rd, u8 rs1, u8 rs2) in rv_divw() argument
794 return rv_r_insn(1, rs2, rs1, 4, rd, 0x3b); in rv_divw()
797 static inline u32 rv_divuw(u8 rd, u8 rs1, u8 rs2) in rv_divuw() argument
799 return rv_r_insn(1, rs2, rs1, 5, rd, 0x3b); in rv_divuw()
802 static inline u32 rv_remw(u8 rd, u8 rs1, u8 rs2) in rv_remw() argument
804 return rv_r_insn(1, rs2, rs1, 6, rd, 0x3b); in rv_remw()
807 static inline u32 rv_remuw(u8 rd, u8 rs1, u8 rs2) in rv_remuw() argument
809 return rv_r_insn(1, rs2, rs1, 7, rd, 0x3b); in rv_remuw()
812 static inline u32 rv_ld(u8 rd, u16 imm11_0, u8 rs1) in rv_ld() argument
814 return rv_i_insn(imm11_0, rs1, 3, rd, 0x03); in rv_ld()
817 static inline u32 rv_lwu(u8 rd, u16 imm11_0, u8 rs1) in rv_lwu() argument
819 return rv_i_insn(imm11_0, rs1, 6, rd, 0x03); in rv_lwu()
827 static inline u32 rv_amoadd_d(u8 rd, u8 rs2, u8 rs1, u8 aq, u8 rl) in rv_amoadd_d() argument
829 return rv_amo_insn(0, aq, rl, rs2, rs1, 3, rd, 0x2f); in rv_amoadd_d()
832 static inline u32 rv_amoand_d(u8 rd, u8 rs2, u8 rs1, u8 aq, u8 rl) in rv_amoand_d() argument
834 return rv_amo_insn(0xc, aq, rl, rs2, rs1, 3, rd, 0x2f); in rv_amoand_d()
837 static inline u32 rv_amoor_d(u8 rd, u8 rs2, u8 rs1, u8 aq, u8 rl) in rv_amoor_d() argument
839 return rv_amo_insn(0x8, aq, rl, rs2, rs1, 3, rd, 0x2f); in rv_amoor_d()
842 static inline u32 rv_amoxor_d(u8 rd, u8 rs2, u8 rs1, u8 aq, u8 rl) in rv_amoxor_d() argument
844 return rv_amo_insn(0x4, aq, rl, rs2, rs1, 3, rd, 0x2f); in rv_amoxor_d()
847 static inline u32 rv_amoswap_d(u8 rd, u8 rs2, u8 rs1, u8 aq, u8 rl) in rv_amoswap_d() argument
849 return rv_amo_insn(0x1, aq, rl, rs2, rs1, 3, rd, 0x2f); in rv_amoswap_d()
852 static inline u32 rv_lr_d(u8 rd, u8 rs2, u8 rs1, u8 aq, u8 rl) in rv_lr_d() argument
854 return rv_amo_insn(0x2, aq, rl, rs2, rs1, 3, rd, 0x2f); in rv_lr_d()
857 static inline u32 rv_sc_d(u8 rd, u8 rs2, u8 rs1, u8 aq, u8 rl) in rv_sc_d() argument
859 return rv_amo_insn(0x3, aq, rl, rs2, rs1, 3, rd, 0x2f); in rv_sc_d()
864 static inline u16 rvc_ld(u8 rd, u32 imm8, u8 rs1) in rvc_ld() argument
870 return rv_cl_insn(0x3, imm_hi, rs1, imm_lo, rd, 0x0); in rvc_ld()
882 static inline u16 rvc_subw(u8 rd, u8 rs) in rvc_subw() argument
884 return rv_ca_insn(0x27, rd, 0, rs, 0x1); in rvc_subw()
887 static inline u16 rvc_addiw(u8 rd, u32 imm6) in rvc_addiw() argument
889 return rv_ci_insn(0x1, imm6, rd, 0x1); in rvc_addiw()
892 static inline u16 rvc_ldsp(u8 rd, u32 imm9) in rvc_ldsp() argument
897 return rv_ci_insn(0x3, imm, rd, 0x2); in rvc_ldsp()
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()
922 static inline void emit_mv(u8 rd, u8 rs, struct rv_jit_context *ctx) in emit_mv() argument
924 if (rvc_enabled() && rd && rs) in emit_mv()
925 emitc(rvc_mv(rd, rs), ctx); in emit_mv()
927 emit(rv_addi(rd, rs, 0), ctx); in emit_mv()
930 static inline void emit_add(u8 rd, u8 rs1, u8 rs2, struct rv_jit_context *ctx) in emit_add() argument
932 if (rvc_enabled() && rd && rd == rs1 && rs2) in emit_add()
933 emitc(rvc_add(rd, rs2), ctx); in emit_add()
935 emit(rv_add(rd, rs1, rs2), ctx); in emit_add()
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()
942 else if (rvc_enabled() && is_creg(rd) && rs == RV_REG_SP && is_10b_uint(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()
999 static inline void emit_sub(u8 rd, u8 rs1, u8 rs2, struct rv_jit_context *ctx) in emit_sub() argument
1001 if (rvc_enabled() && is_creg(rd) && rd == rs1 && is_creg(rs2)) in emit_sub()
1002 emitc(rvc_sub(rd, rs2), ctx); in emit_sub()
1004 emit(rv_sub(rd, rs1, rs2), ctx); in emit_sub()
1007 static inline void emit_or(u8 rd, u8 rs1, u8 rs2, struct rv_jit_context *ctx) in emit_or() argument
1009 if (rvc_enabled() && is_creg(rd) && rd == rs1 && is_creg(rs2)) in emit_or()
1010 emitc(rvc_or(rd, rs2), ctx); in emit_or()
1012 emit(rv_or(rd, rs1, rs2), ctx); in emit_or()
1015 static inline void emit_and(u8 rd, u8 rs1, u8 rs2, struct rv_jit_context *ctx) in emit_and() argument
1017 if (rvc_enabled() && is_creg(rd) && rd == rs1 && is_creg(rs2)) in emit_and()
1018 emitc(rvc_and(rd, rs2), ctx); in emit_and()
1020 emit(rv_and(rd, rs1, rs2), ctx); in emit_and()
1023 static inline void emit_xor(u8 rd, u8 rs1, u8 rs2, struct rv_jit_context *ctx) in emit_xor() argument
1025 if (rvc_enabled() && is_creg(rd) && rd == rs1 && is_creg(rs2)) in emit_xor()
1026 emitc(rvc_xor(rd, rs2), ctx); in emit_xor()
1028 emit(rv_xor(rd, rs1, rs2), ctx); in emit_xor()
1031 static inline void emit_lw(u8 rd, s32 off, u8 rs1, struct rv_jit_context *ctx) in emit_lw() argument
1033 if (rvc_enabled() && rs1 == RV_REG_SP && rd && is_8b_uint(off) && !(off & 0x3)) in emit_lw()
1034 emitc(rvc_lwsp(rd, off), ctx); in emit_lw()
1035 else if (rvc_enabled() && is_creg(rd) && is_creg(rs1) && is_7b_uint(off) && !(off & 0x3)) in emit_lw()
1036 emitc(rvc_lw(rd, off, rs1), ctx); in emit_lw()
1038 emit(rv_lw(rd, off, rs1), ctx); in emit_lw()
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()
1062 static inline void emit_ld(u8 rd, s32 off, u8 rs1, struct rv_jit_context *ctx) in emit_ld() argument
1064 if (rvc_enabled() && rs1 == RV_REG_SP && rd && is_9b_uint(off) && !(off & 0x7)) in emit_ld()
1065 emitc(rvc_ldsp(rd, off), ctx); in emit_ld()
1066 else if (rvc_enabled() && is_creg(rd) && is_creg(rs1) && is_8b_uint(off) && !(off & 0x7)) in emit_ld()
1067 emitc(rvc_ld(rd, off, rs1), ctx); in emit_ld()
1069 emit(rv_ld(rd, off, rs1), ctx); in emit_ld()
1082 static inline void emit_subw(u8 rd, u8 rs1, u8 rs2, struct rv_jit_context *ctx) in emit_subw() argument
1084 if (rvc_enabled() && is_creg(rd) && rd == rs1 && is_creg(rs2)) in emit_subw()
1085 emitc(rvc_subw(rd, rs2), ctx); in emit_subw()
1087 emit(rv_subw(rd, rs1, rs2), ctx); in emit_subw()