adds more functions, up to slide

This commit is contained in:
2025-02-21 14:59:33 +01:00
parent c1277b6528
commit a26505cb5c
3 changed files with 317 additions and 16 deletions

View File

@ -497,6 +497,131 @@ if(vector != null) {%>
void mask_mask_op(uint8_t* V, unsigned funct6, unsigned funct3, uint64_t vl, uint64_t vstart, unsigned vd, unsigned vs2, unsigned vs1){
return softvector::mask_mask_op<${vlen}>(V, funct6, funct3, vl, vstart, vd, vs2, vs1);
}
uint64_t vcpop(uint8_t* V, uint64_t vl, uint64_t vstart, bool vm, unsigned vs2){
return softvector::vcpop<${vlen}>(V, vl, vstart, vm, vs2);
}
int64_t vfirst(uint8_t* V, uint64_t vl, uint64_t vstart, bool vm, unsigned vs2){
return softvector::vfirst<${vlen}>(V, vl, vstart, vm, vs2);
}
void mask_set_op(uint8_t* V, unsigned enc, uint64_t vl, uint64_t vstart, bool vm, unsigned vd, unsigned vs2){
return softvector::mask_set_op<${vlen}>(V, enc, vl, vstart, vm, vd, vs2);
}
void viota(uint8_t* V, uint64_t vl, uint64_t vstart, softvector::vtype_t vtype, bool vm, uint8_t vd, uint8_t vs2, uint8_t sew_val){
switch(sew_val){
case 0b000:
return softvector::viota<${vlen}, uint8_t>(V, vl, vstart, vtype, vm, vd, vs2);
case 0b001:
return softvector::viota<${vlen}, uint16_t>(V, vl, vstart, vtype, vm, vd, vs2);
case 0b010:
return softvector::viota<${vlen}, uint32_t>(V, vl, vstart, vtype, vm, vd, vs2);
case 0b011:
return softvector::viota<${vlen}, uint64_t>(V, vl, vstart, vtype, vm, vd, vs2);
default:
throw new std::runtime_error("Unsupported sew bit value");
}
}
void vid(uint8_t* V, uint64_t vl, uint64_t vstart, softvector::vtype_t vtype, bool vm, uint8_t vd, uint8_t sew_val){
switch(sew_val){
case 0b000:
return softvector::vid<${vlen}, uint8_t>(V, vl, vstart, vtype, vm, vd);
case 0b001:
return softvector::vid<${vlen}, uint16_t>(V, vl, vstart, vtype, vm, vd);
case 0b010:
return softvector::vid<${vlen}, uint32_t>(V, vl, vstart, vtype, vm, vd);
case 0b011:
return softvector::vid<${vlen}, uint64_t>(V, vl, vstart, vtype, vm, vd);
default:
throw new std::runtime_error("Unsupported sew bit value");
}
}
void scalar_to_vector(uint8_t* V, softvector::vtype_t vtype, unsigned vd, uint64_t val, uint8_t sew_val){
switch(sew_val){
case 0b000:
softvector::scalar_move<${vlen}, uint8_t>(V, vtype, vd, val, true);
break;
case 0b001:
softvector::scalar_move<${vlen}, uint16_t>(V, vtype, vd, val, true);
break;
case 0b010:
softvector::scalar_move<${vlen}, uint32_t>(V, vtype, vd, val, true);
break;
case 0b011:
softvector::scalar_move<${vlen}, uint64_t>(V, vtype, vd, val, true);
break;
default:
throw new std::runtime_error("Unsupported sew bit value");
}
}
uint64_t scalar_from_vector(uint8_t* V, softvector::vtype_t vtype, unsigned vd, uint8_t sew_val){
switch(sew_val){
case 0b000:
return softvector::scalar_move<${vlen}, uint8_t>(V, vtype, vd, 0, false);
case 0b001:
return softvector::scalar_move<${vlen}, uint16_t>(V, vtype, vd, 0, false);
case 0b010:
return softvector::scalar_move<${vlen}, uint32_t>(V, vtype, vd, 0, false);
case 0b011:
return softvector::scalar_move<${vlen}, uint64_t>(V, vtype, vd, 0, false);
default:
throw new std::runtime_error("Unsupported sew bit value");
}
}
void vector_slideup(uint8_t* V, uint64_t vl, uint64_t vstart, softvector::vtype_t vtype, bool vm, unsigned vd, unsigned vs2, uint64_t imm, uint8_t sew_val) {
switch(sew_val){
case 0b000:
return softvector::vector_slide<${vlen}, uint8_t>(V, vl, vstart, vtype, vm, vd, vs2, imm);
case 0b001:
return softvector::vector_slide<${vlen}, uint16_t>(V, vl, vstart, vtype, vm, vd, vs2, imm);
case 0b010:
return softvector::vector_slide<${vlen}, uint32_t>(V, vl, vstart, vtype, vm, vd, vs2, imm);
case 0b011:
return softvector::vector_slide<${vlen}, uint64_t>(V, vl, vstart, vtype, vm, vd, vs2, imm);
default:
throw new std::runtime_error("Unsupported sew bit value");
}
}
void vector_slidedown(uint8_t* V, uint64_t vl, uint64_t vstart, softvector::vtype_t vtype, bool vm, unsigned vd, unsigned vs2, uint64_t imm, uint8_t sew_val) {
switch(sew_val){
case 0b000:
return softvector::vector_slide<${vlen}, uint8_t>(V, vl, vstart, vtype, vm, vd, vs2, -imm);
case 0b001:
return softvector::vector_slide<${vlen}, uint16_t>(V, vl, vstart, vtype, vm, vd, vs2, -imm);
case 0b010:
return softvector::vector_slide<${vlen}, uint32_t>(V, vl, vstart, vtype, vm, vd, vs2, -imm);
case 0b011:
return softvector::vector_slide<${vlen}, uint64_t>(V, vl, vstart, vtype, vm, vd, vs2, -imm);
default:
throw new std::runtime_error("Unsupported sew bit value");
}
}
void vector_slide1up(uint8_t* V, uint64_t vl, uint64_t vstart, softvector::vtype_t vtype, bool vm, unsigned vd, unsigned vs2, int64_t imm, uint8_t sew_val) {
switch(sew_val){
case 0b000:
return softvector::vector_slide1up<${vlen}, uint8_t>(V, vl, vstart, vtype, vm, vd, vs2, imm);
case 0b001:
return softvector::vector_slide1up<${vlen}, uint16_t>(V, vl, vstart, vtype, vm, vd, vs2, imm);
case 0b010:
return softvector::vector_slide1up<${vlen}, uint32_t>(V, vl, vstart, vtype, vm, vd, vs2, imm);
case 0b011:
return softvector::vector_slide1up<${vlen}, uint64_t>(V, vl, vstart, vtype, vm, vd, vs2, imm);
default:
throw new std::runtime_error("Unsupported sew bit value");
}
}
void vector_slide1down(uint8_t* V, uint64_t vl, uint64_t vstart, softvector::vtype_t vtype, bool vm, unsigned vd, unsigned vs2, int64_t imm, uint8_t sew_val) {
switch(sew_val){
case 0b000:
return softvector::vector_slide1down<${vlen}, uint8_t>(V, vl, vstart, vtype, vm, vd, vs2, imm);
case 0b001:
return softvector::vector_slide1down<${vlen}, uint16_t>(V, vl, vstart, vtype, vm, vd, vs2, imm);
case 0b010:
return softvector::vector_slide1down<${vlen}, uint32_t>(V, vl, vstart, vtype, vm, vd, vs2, imm);
case 0b011:
return softvector::vector_slide1down<${vlen}, uint64_t>(V, vl, vstart, vtype, vm, vd, vs2, imm);
default:
throw new std::runtime_error("Unsupported sew bit value");
}
}
<%}%>
uint64_t fetch_count{0};
uint64_t tval{0};