Go to the documentation of this file.
21 #ifndef SWSCALE_AARCH64_RASM_H
22 #define SWSCALE_AARCH64_RASM_H
75 #define OPN rasm_op_none()
82 op.u32[0] = (uint32_t)
val;
91 #define IMM(val) rasm_op_imm(val)
98 op.u16[0] = (uint16_t)
id;
104 return (
int)
op.u16[0];
318 #define AARCH64_COND_EQ 0x0
319 #define AARCH64_COND_NE 0x1
320 #define AARCH64_COND_HS 0x2
321 #define AARCH64_COND_CS AARCH64_COND_HS
322 #define AARCH64_COND_LO 0x3
323 #define AARCH64_COND_CC AARCH64_COND_LO
324 #define AARCH64_COND_MI 0x4
325 #define AARCH64_COND_PL 0x5
326 #define AARCH64_COND_VS 0x6
327 #define AARCH64_COND_VC 0x7
328 #define AARCH64_COND_HI 0x8
329 #define AARCH64_COND_LS 0x9
330 #define AARCH64_COND_GE 0xa
331 #define AARCH64_COND_LT 0xb
332 #define AARCH64_COND_GT 0xc
333 #define AARCH64_COND_LE 0xd
334 #define AARCH64_COND_AL 0xe
335 #define AARCH64_COND_NV 0xf
400 uint8_t num_regs = 1;
413 op0.
u8[3] = num_regs;
478 #define AARCH64_BASE_OFFSET 0
479 #define AARCH64_BASE_PRE 1
480 #define AARCH64_BASE_POST 2
485 op.u16[0] = (uint16_t) imm;
534 #define i_none(rctx ) rasm_add_insn(rctx, AARCH64_INSN_NONE, OPN, OPN, OPN, OPN)
536 #define i_add(rctx, op0, op1, op2 ) rasm_add_insn(rctx, AARCH64_INSN_ADD, op0, op1, op2, OPN)
537 #define i_addv(rctx, op0, op1 ) rasm_add_insn(rctx, AARCH64_INSN_ADDV, op0, op1, OPN, OPN)
538 #define i_adr(rctx, op0, op1 ) rasm_add_insn(rctx, AARCH64_INSN_ADR, op0, op1, OPN, OPN)
539 #define i_and(rctx, op0, op1, op2 ) rasm_add_insn(rctx, AARCH64_INSN_AND, op0, op1, op2, OPN)
540 #define i_b(rctx, op0, op1 ) rasm_add_insn(rctx, AARCH64_INSN_B, op0, op1, OPN, OPN)
541 #define i_br(rctx, op0 ) rasm_add_insn(rctx, AARCH64_INSN_BR, op0, OPN, OPN, OPN)
542 #define i_cmp(rctx, op0, op1 ) rasm_add_insn(rctx, AARCH64_INSN_CMP, op0, op1, OPN, OPN)
543 #define i_csel(rctx, op0, op1, op2, op3) rasm_add_insn(rctx, AARCH64_INSN_CSEL, op0, op1, op2, op3)
544 #define i_dup(rctx, op0, op1 ) rasm_add_insn(rctx, AARCH64_INSN_DUP, op0, op1, OPN, OPN)
545 #define i_fadd(rctx, op0, op1, op2 ) rasm_add_insn(rctx, AARCH64_INSN_FADD, op0, op1, op2, OPN)
546 #define i_fcvtzu(rctx, op0, op1 ) rasm_add_insn(rctx, AARCH64_INSN_FCVTZU, op0, op1, OPN, OPN)
547 #define i_fmax(rctx, op0, op1, op2 ) rasm_add_insn(rctx, AARCH64_INSN_FMAX, op0, op1, op2, OPN)
548 #define i_fmin(rctx, op0, op1, op2 ) rasm_add_insn(rctx, AARCH64_INSN_FMIN, op0, op1, op2, OPN)
549 #define i_fmla(rctx, op0, op1, op2 ) rasm_add_insn(rctx, AARCH64_INSN_FMLA, op0, op1, op2, OPN)
550 #define i_fmul(rctx, op0, op1, op2 ) rasm_add_insn(rctx, AARCH64_INSN_FMUL, op0, op1, op2, OPN)
551 #define i_ins(rctx, op0, op1 ) rasm_add_insn(rctx, AARCH64_INSN_INS, op0, op1, OPN, OPN)
552 #define i_ld1(rctx, op0, op1 ) rasm_add_insn(rctx, AARCH64_INSN_LD1, op0, op1, OPN, OPN)
553 #define i_ld1r(rctx, op0, op1 ) rasm_add_insn(rctx, AARCH64_INSN_LD1R, op0, op1, OPN, OPN)
554 #define i_ld2(rctx, op0, op1 ) rasm_add_insn(rctx, AARCH64_INSN_LD2, op0, op1, OPN, OPN)
555 #define i_ld3(rctx, op0, op1 ) rasm_add_insn(rctx, AARCH64_INSN_LD3, op0, op1, OPN, OPN)
556 #define i_ld4(rctx, op0, op1 ) rasm_add_insn(rctx, AARCH64_INSN_LD4, op0, op1, OPN, OPN)
557 #define i_ldp(rctx, op0, op1, op2 ) rasm_add_insn(rctx, AARCH64_INSN_LDP, op0, op1, op2, OPN)
558 #define i_ldr(rctx, op0, op1 ) rasm_add_insn(rctx, AARCH64_INSN_LDR, op0, op1, OPN, OPN)
559 #define i_ldrb(rctx, op0, op1 ) rasm_add_insn(rctx, AARCH64_INSN_LDRB, op0, op1, OPN, OPN)
560 #define i_ldrh(rctx, op0, op1 ) rasm_add_insn(rctx, AARCH64_INSN_LDRH, op0, op1, OPN, OPN)
561 #define i_lsr(rctx, op0, op1, op2 ) rasm_add_insn(rctx, AARCH64_INSN_LSR, op0, op1, op2, OPN)
562 #define i_mov(rctx, op0, op1 ) rasm_add_insn(rctx, AARCH64_INSN_MOV, op0, op1, OPN, OPN)
563 #define i_movi(rctx, op0, op1 ) rasm_add_insn(rctx, AARCH64_INSN_MOVI, op0, op1, OPN, OPN)
564 #define i_mul(rctx, op0, op1, op2 ) rasm_add_insn(rctx, AARCH64_INSN_MUL, op0, op1, op2, OPN)
565 #define i_orr(rctx, op0, op1, op2 ) rasm_add_insn(rctx, AARCH64_INSN_ORR, op0, op1, op2, OPN)
566 #define i_ret(rctx ) rasm_add_insn(rctx, AARCH64_INSN_RET, OPN, OPN, OPN, OPN)
567 #define i_rev16(rctx, op0, op1 ) rasm_add_insn(rctx, AARCH64_INSN_REV16, op0, op1, OPN, OPN)
568 #define i_rev32(rctx, op0, op1 ) rasm_add_insn(rctx, AARCH64_INSN_REV32, op0, op1, OPN, OPN)
569 #define i_shl(rctx, op0, op1, op2 ) rasm_add_insn(rctx, AARCH64_INSN_SHL, op0, op1, op2, OPN)
570 #define i_st1(rctx, op0, op1 ) rasm_add_insn(rctx, AARCH64_INSN_ST1, op0, op1, OPN, OPN)
571 #define i_st2(rctx, op0, op1 ) rasm_add_insn(rctx, AARCH64_INSN_ST2, op0, op1, OPN, OPN)
572 #define i_st3(rctx, op0, op1 ) rasm_add_insn(rctx, AARCH64_INSN_ST3, op0, op1, OPN, OPN)
573 #define i_st4(rctx, op0, op1 ) rasm_add_insn(rctx, AARCH64_INSN_ST4, op0, op1, OPN, OPN)
574 #define i_stp(rctx, op0, op1, op2 ) rasm_add_insn(rctx, AARCH64_INSN_STP, op0, op1, op2, OPN)
575 #define i_str(rctx, op0, op1 ) rasm_add_insn(rctx, AARCH64_INSN_STR, op0, op1, OPN, OPN)
576 #define i_sub(rctx, op0, op1, op2 ) rasm_add_insn(rctx, AARCH64_INSN_SUB, op0, op1, op2, OPN)
577 #define i_subs(rctx, op0, op1, op2 ) rasm_add_insn(rctx, AARCH64_INSN_SUBS, op0, op1, op2, OPN)
578 #define i_tbl(rctx, op0, op1, op2 ) rasm_add_insn(rctx, AARCH64_INSN_TBL, op0, op1, op2, OPN)
579 #define i_ubfiz(rctx, op0, op1, op2, op3) rasm_add_insn(rctx, AARCH64_INSN_UBFIZ, op0, op1, op2, op3)
580 #define i_ucvtf(rctx, op0, op1 ) rasm_add_insn(rctx, AARCH64_INSN_UCVTF, op0, op1, OPN, OPN)
581 #define i_umax(rctx, op0, op1, op2 ) rasm_add_insn(rctx, AARCH64_INSN_UMAX, op0, op1, op2, OPN)
582 #define i_umin(rctx, op0, op1, op2 ) rasm_add_insn(rctx, AARCH64_INSN_UMIN, op0, op1, op2, OPN)
583 #define i_uqxtn(rctx, op0, op1 ) rasm_add_insn(rctx, AARCH64_INSN_UQXTN, op0, op1, OPN, OPN)
584 #define i_ushl(rctx, op0, op1, op2 ) rasm_add_insn(rctx, AARCH64_INSN_USHL, op0, op1, op2, OPN)
585 #define i_ushll(rctx, op0, op1, op2 ) rasm_add_insn(rctx, AARCH64_INSN_USHLL, op0, op1, op2, OPN)
586 #define i_ushll2(rctx, op0, op1, op2 ) rasm_add_insn(rctx, AARCH64_INSN_USHLL2, op0, op1, op2, OPN)
587 #define i_ushr(rctx, op0, op1, op2 ) rasm_add_insn(rctx, AARCH64_INSN_USHR, op0, op1, op2, OPN)
588 #define i_uxtl(rctx, op0, op1 ) rasm_add_insn(rctx, AARCH64_INSN_UXTL, op0, op1, OPN, OPN)
589 #define i_uxtl2(rctx, op0, op1 ) rasm_add_insn(rctx, AARCH64_INSN_UXTL2, op0, op1, OPN, OPN)
590 #define i_xtn(rctx, op0, op1 ) rasm_add_insn(rctx, AARCH64_INSN_XTN, op0, op1, OPN, OPN)
591 #define i_zip1(rctx, op0, op1, op2 ) rasm_add_insn(rctx, AARCH64_INSN_ZIP1, op0, op1, op2, OPN)
592 #define i_zip2(rctx, op0, op1, op2 ) rasm_add_insn(rctx, AARCH64_INSN_ZIP2, op0, op1, op2, OPN)
595 #define i_beq(rctx, id) i_b(rctx, a64cond_eq(), rasm_op_label(id))
596 #define i_bne(rctx, id) i_b(rctx, a64cond_ne(), rasm_op_label(id))
597 #define i_bhs(rctx, id) i_b(rctx, a64cond_hs(), rasm_op_label(id))
598 #define i_bcs(rctx, id) i_b(rctx, a64cond_cs(), rasm_op_label(id))
599 #define i_blo(rctx, id) i_b(rctx, a64cond_lo(), rasm_op_label(id))
600 #define i_bcc(rctx, id) i_b(rctx, a64cond_cc(), rasm_op_label(id))
601 #define i_bmi(rctx, id) i_b(rctx, a64cond_mi(), rasm_op_label(id))
602 #define i_bpl(rctx, id) i_b(rctx, a64cond_pl(), rasm_op_label(id))
603 #define i_bvs(rctx, id) i_b(rctx, a64cond_vs(), rasm_op_label(id))
604 #define i_bvc(rctx, id) i_b(rctx, a64cond_vc(), rasm_op_label(id))
605 #define i_bhi(rctx, id) i_b(rctx, a64cond_hi(), rasm_op_label(id))
606 #define i_bls(rctx, id) i_b(rctx, a64cond_ls(), rasm_op_label(id))
607 #define i_bge(rctx, id) i_b(rctx, a64cond_ge(), rasm_op_label(id))
608 #define i_blt(rctx, id) i_b(rctx, a64cond_lt(), rasm_op_label(id))
609 #define i_bgt(rctx, id) i_b(rctx, a64cond_gt(), rasm_op_label(id))
610 #define i_ble(rctx, id) i_b(rctx, a64cond_le(), rasm_op_label(id))
613 #define i_mov16b(rctx, op0, op1) i_mov(rctx, v_16b(op0), v_16b(op1))
static RasmOp a64cond_eq(void)
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
void void rasm_annotate_next(RasmContext *rctx, const char *comment)
static RasmOp v_h(RasmOp op)
static RasmOp a64op_vecd(uint8_t n)
static RasmOp a64op_base(RasmOp op)
static RasmOp a64op_vecq(uint8_t n)
static RasmOp a64cond_cc(void)
static RasmOp a64op_gpx(uint8_t n)
static RasmOp a64op_w(RasmOp op)
static RasmOp a64cond_cs(void)
RasmNode RasmNode * rasm_add_label(RasmContext *rctx, int id)
static RasmOp a64cond_ne(void)
RasmNode * rasm_add_insn(RasmContext *rctx, int id, RasmOp op0, RasmOp op1, RasmOp op2, RasmOp op3)
static RasmOp a64cond_le(void)
This helper structure is used to mimic the assembler syntax for vector register modifiers.
static RasmOp a64op_gpw(uint8_t n)
static RasmOp vv_2(RasmOp op0, RasmOp op1)
static RasmOp vv_3(RasmOp op0, RasmOp op1, RasmOp op2)
RasmNode * rasm_add_func(RasmContext *rctx, int id, bool export, bool jumpable)
static RasmOp a64cond_lt(void)
static uint8_t a64op_vec_idx_p1(RasmOp op)
void int rasm_print(RasmContext *rctx, FILE *fp)
RasmNode * rasm_get_current_node(RasmContext *rctx)
static RasmOp rasm_op_new(int type)
static uint8_t rasm_op_type(RasmOp op)
void rasm_annotatef(RasmContext *rctx, char *s, size_t n, const char *fmt,...) av_printf_format(4
static uint8_t a64op_vec_n(RasmOp op)
Runtime assembler for AArch64.
#define AARCH64_BASE_POST
static double val(void *priv, double ch)
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
static RasmOp v_d(RasmOp op)
int rasm_new_label(RasmContext *rctx, const char *name)
Allocate a new label ID with the given name.
static RasmOp vv_1(RasmOp op0)
static RasmOp a64op_elem(RasmOp op, uint8_t idx)
static int32_t rasm_op_imm_val(RasmOp op)
static RasmOp a64op_vec8b(uint8_t n)
static RasmOp a64op_vec4h(uint8_t n)
static int op(uint8_t **dst, const uint8_t *dst_end, GetByteContext *gb, int pixel, int count, int *x, int width, int linesize)
Perform decode operation.
static RasmOp rasm_op_none(void)
#define av_assert0(cond)
assert() equivalent, that is always enabled.
static RasmOp rasm_op_imm(int32_t val)
static RasmOp a64cond_al(void)
static RasmOp v_8b(RasmOp op)
static int export(AVFilterContext *ctx, StreamContext *sc, int input)
static RasmOp a64cond_nv(void)
static RasmOp a64op_cond(int cond)
static RasmOp a64op_make_vec(uint8_t n, uint8_t el_count, uint8_t el_size)
static int16_t a64op_base_imm(RasmOp op)
RasmNode * rasm_add_commentf(RasmContext *rctx, char *s, size_t n, const char *fmt,...) av_printf_format(4
static RasmOp v_2s(RasmOp op)
static RasmOp a64cond_vs(void)
static RasmOp a64op_vec2d(uint8_t n)
static RasmOp a64op_vecs(uint8_t n)
#define av_printf_format(fmtpos, attrpos)
static RasmOp a64cond_lo(void)
static RasmOp a64op_post(RasmOp op, int16_t imm)
static RasmOp a64op_veclist(RasmOp op0, RasmOp op1, RasmOp op2, RasmOp op3)
Create register-list operand for structured load/store instructions.
static RasmOp a64op_vecb(uint8_t n)
static RasmOp a64op_vech(uint8_t n)
void rasm_free(RasmContext **prctx)
static RasmOp a64op_vec4s(uint8_t n)
static RasmOp a64op_sp(void)
static RasmOp a64cond_mi(void)
RasmNode * rasm_add_comment(RasmContext *rctx, const char *comment)
static uint8_t a64op_base_n(RasmOp op)
static RasmOp a64cond_gt(void)
int void rasm_annotate(RasmContext *rctx, const char *comment)
RasmContext * rasm_alloc(void)
static RasmOp a64op_make_gpr(uint8_t n, uint8_t size)
static RasmOp a64op_vec2s(uint8_t n)
static RasmOp a64op_off(RasmOp op, int16_t imm)
static uint8_t a64op_vec_num_regs(RasmOp op)
static RasmOp v_8h(RasmOp op)
static RasmOp vv_4(RasmOp op0, RasmOp op1, RasmOp op2, RasmOp op3)
static uint8_t a64op_vec_el_count(RasmOp op)
static RasmOp v_s(RasmOp op)
static RasmOp a64op_vec16b(uint8_t n)
static uint8_t a64op_gpr_size(RasmOp op)
static RasmOp v_2d(RasmOp op)
int rasm_func_begin(RasmContext *rctx, const char *name, bool export, bool jumpable)
static uint8_t a64op_cond_val(RasmOp op)
static uint8_t a64op_base_mode(RasmOp op)
static RasmOp a64op_pre(RasmOp op, int16_t imm)
static RasmOp a64cond_ge(void)
static RasmOp a64op_vec(uint8_t n)
static uint8_t a64op_vec_el_size(RasmOp op)
static RasmOp a64op_make_base(uint8_t n, uint8_t mode, int16_t imm)
static RasmOp a64cond_pl(void)
static RasmOp rasm_op_label(int id)
static int FUNC() comment(CodedBitstreamContext *ctx, RWContext *rw, JPEGRawComment *current)
RasmNode * rasm_add_directive(RasmContext *rctx, const char *text)
static RasmOp a64cond_vc(void)
static RasmOp v_b(RasmOp op)
void a64op_vec_views(RasmOp op, AArch64VecViews *out)
static RasmOp v_16b(RasmOp op)
RasmNodeDirective directive
static RasmOp v_4h(RasmOp op)
static RasmOp v_4s(RasmOp op)
RasmNode * rasm_add_endfunc(RasmContext *rctx)
RasmNode * rasm_set_current_node(RasmContext *rctx, RasmNode *node)
#define AARCH64_BASE_OFFSET
static RasmOp a64op_x(RasmOp op)
static RasmOp a64cond_ls(void)
static int rasm_op_label_id(RasmOp op)
static RasmOp a64cond_hs(void)
static RasmOp a64op_vec8h(uint8_t n)
void rasm_annotate_nextf(RasmContext *rctx, char *s, size_t n, const char *fmt,...) av_printf_format(4
int rasm_new_labelf(RasmContext *rctx, char *s, size_t n, const char *fmt,...) av_printf_format(4
int(* cond)(enum AVPixelFormat pix_fmt)
static RasmOp a64cond_hi(void)
static uint8_t a64op_gpr_n(RasmOp op)
static RasmOp v_q(RasmOp op)