Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
PaoloS02 committed Dec 6, 2024
1 parent e473afe commit 0d3b861
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 7 deletions.
5 changes: 5 additions & 0 deletions include/tcg/tcg-op-gvec-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,11 @@ void tcg_gen_gvec_4i(uint32_t dofs, uint32_t aofs, uint32_t bofs, uint32_t cofs,

/* Expand a specific vector operation. */


void tcg_gen_gvec_ld_v128(TCGv_ptr env, uint32_t o,
TCGv_ptr addr, TCGArg idx, MemOp memop);
void tcg_gen_gvec_st_v128(TCGv_ptr env, uint32_t o,
TCGv_ptr addr, TCGArg idx, MemOp memop);
void tcg_gen_gvec_mov(unsigned vece, uint32_t dofs, uint32_t aofs,
uint32_t oprsz, uint32_t maxsz);
void tcg_gen_gvec_not(unsigned vece, uint32_t dofs, uint32_t aofs,
Expand Down
20 changes: 13 additions & 7 deletions target/riscv/insn_trans/trans_rvv.c.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1106,19 +1106,25 @@ static bool ldst_whole_trans(uint32_t vd, uint32_t rs1, uint32_t nf,
TCGv addr;
addr = get_address(s, rs1, 0);

TCGv_i128 t16 = tcg_temp_new_i128();
//TCGv_i128 t16 = tcg_temp_new_i128();
// TCGv_vec t16 = tcg_temp_new_vec(TCG_TYPE_V128);


for (int i=0; i < s->cfg_ptr->vlenb; i+=16) {
addr = get_address(s, rs1, i);
if (is_load) {
tcg_gen_qemu_ld_i128(t16, addr, s->mem_idx,
MO_LE | MO_128 | MO_ATOM_NONE);
tcg_gen_st_i128(t16, tcg_env, vreg_ofs(s, vd) + i);
// tcg_gen_qemu_ld_i128(t16, addr, s->mem_idx,
// MO_LE | MO_128 | MO_ALIGN_16);
tcg_gen_gvec_ld_v128(tcg_env, vreg_ofs(s, vd), (TCGv_ptr)addr, s->mem_idx, MO_LE | MO_128 | MO_ALIGN_16);
// tcg_gen_st_i128(t16, tcg_env, vreg_ofs(s, vd) + i);
// tcg_gen_op3(INDEX_op_ld_vec, tcgv_vec_arg(t16), addr, s->mem_idx);
// tcg_gen_st_vec(t16, tcg_env, vreg_ofs(s, vd));
} else {
tcg_gen_ld_i128(t16, tcg_env, vreg_ofs(s, vd) + i);
tcg_gen_qemu_st_i128(t16, addr, s->mem_idx,
MO_LE | MO_128 | MO_ATOM_NONE);
// tcg_gen_ld_i128(t16, tcg_env, vreg_ofs(s, vd) + i);
// tcg_gen_gvec_ldst_v128(INDEX_op_st_vec, t16, addr, s->mem_idx);
tcg_gen_gvec_st_v128(tcg_env, vreg_ofs(s, vd), (TCGv_ptr)addr, s->mem_idx, MO_LE | MO_128 | MO_ALIGN_16);
// tcg_gen_qemu_st_i128(t16, addr, s->mem_idx,
// MO_LE | MO_128 | MO_ALIGN_16);
}
}
mark_vs_dirty(s);
Expand Down
41 changes: 41 additions & 0 deletions tcg/tcg-op-gvec.c
Original file line number Diff line number Diff line change
Expand Up @@ -1194,6 +1194,47 @@ static void expand_4i_vec(unsigned vece, uint32_t dofs, uint32_t aofs,
}
}

void tcg_gen_gvec_ld_v128(TCGv_ptr env, uint32_t o,
TCGv_ptr addr, TCGArg idx, MemOp memop)
{
MemOpIdx orig_oi = make_memop_idx(memop, idx);
// check_max_alignment(memop_alignment_bits(memop));

TCGv_vec t0 = tcg_temp_new_vec(TCG_TYPE_V128);
//// static void vec_gen_ldst(TCGOpcode opc, TCGv_vec r, TCGv_ptr b, TCGArg o)
////{
// TCGArg ri = tcgv_vec_arg(t0);
// //TCGArg bi = tcgv_ptr_arg(b);
// TCGTemp *rt = arg_temp(ri);
// TCGType type = rt->base_type;
////
//// vec_gen_3(INDEX_op_ld_vec, type, 0, ri, addr, orig_oi);
tcg_gen_ld_vec(t0, addr, orig_oi);
// tcg_gen_op3(INDEX_op_ld_vec, tcgv_vec_arg(t0), addr, o);
tcg_gen_st_vec(t0, env, o);
//}
}

void tcg_gen_gvec_st_v128(TCGv_ptr env, uint32_t o,
TCGv_ptr addr, TCGArg idx, MemOp memop)
{
MemOpIdx orig_oi = make_memop_idx(memop, idx);
// check_max_alignment(memop_alignment_bits(memop));

TCGv_vec t0 = tcg_temp_new_vec(TCG_TYPE_V128);
//// static void vec_gen_ldst(TCGOpcode opc, TCGv_vec r, TCGv_ptr b, TCGArg o)
////{
// TCGArg ri = tcgv_vec_arg(val);
// //TCGArg bi = tcgv_ptr_arg(b);
// TCGTemp *rt = arg_temp(ri);
// TCGType type = rt->base_type;

tcg_gen_ld_vec(t0, env, o);
tcg_gen_st_vec(t0, addr, orig_oi);
// vec_gen_3(INDEX_op_st_vec, type, 0, ri, addr, origin_oi);
////}
}

/* Expand a vector two-operand operation. */
void tcg_gen_gvec_2(uint32_t dofs, uint32_t aofs,
uint32_t oprsz, uint32_t maxsz, const GVecGen2 *g)
Expand Down

0 comments on commit 0d3b861

Please sign in to comment.