adds support for narrowing shifts

This commit is contained in:
2025-02-13 21:05:49 +01:00
parent af3e76cc98
commit feaff8c4a5
2 changed files with 42 additions and 0 deletions

View File

@ -331,6 +331,32 @@ if(vector != null) {%>
throw new std::runtime_error("Unsupported sew bit value");
}
}
void vector_vector_vw(uint8_t* V, uint8_t funct, uint64_t vl, uint64_t vstart, softvector::vtype_t vtype, bool vm, uint8_t vd, uint8_t vs2, uint8_t vs1, uint8_t sew_val){
switch(sew_val){
case 0b000:
return softvector::vector_vector_op<${vlen}, uint8_t, uint16_t, uint8_t>(V, funct, vl, vstart, vtype, vm, vd, vs2, vs1 );
case 0b001:
return softvector::vector_vector_op<${vlen}, uint16_t, uint32_t, uint16_t>(V, funct, vl, vstart, vtype, vm, vd, vs2, vs1 );
case 0b010:
return softvector::vector_vector_op<${vlen}, uint32_t, uint64_t, uint32_t>(V, funct, vl, vstart, vtype, vm, vd, vs2, vs1 );
case 0b011: // would require 128 bits vs2 value
default:
throw new std::runtime_error("Unsupported sew bit value");
}
}
void vector_imm_vw(uint8_t* V, uint8_t funct, uint64_t vl, uint64_t vstart, softvector::vtype_t vtype, bool vm, uint8_t vd, uint8_t vs2, int64_t imm, uint8_t sew_val){
switch(sew_val){
case 0b000:
return softvector::vector_imm_op<${vlen}, uint8_t, uint16_t, uint8_t>(V, funct, vl, vstart, vtype, vm, vd, vs2, imm);
case 0b001:
return softvector::vector_imm_op<${vlen}, uint16_t, uint32_t, uint16_t>(V, funct, vl, vstart, vtype, vm, vd, vs2, imm);
case 0b010:
return softvector::vector_imm_op<${vlen}, uint32_t, uint64_t, uint32_t>(V, funct, vl, vstart, vtype, vm, vd, vs2, imm);
case 0b011: // would require 128 bits vs2 value
default:
throw new std::runtime_error("Unsupported sew bit value");
}
}
<%}%>
uint64_t fetch_count{0};