adds whole register moves
This commit is contained in:
parent
877cad27ba
commit
221d2ee38c
@ -664,6 +664,23 @@ if(vector != null) {%>
|
||||
throw new std::runtime_error("Unsupported sew bit value");
|
||||
}
|
||||
}
|
||||
void vector_compress(uint8_t* V, uint64_t vl, uint64_t vstart, softvector::vtype_t vtype, uint8_t vd, uint8_t vs2, uint8_t vs1, uint8_t sew_val){
|
||||
switch(sew_val){
|
||||
case 0b000:
|
||||
return softvector::vector_compress<${vlen}, uint8_t>(V, vl, vstart, vtype, vd, vs2, vs1);
|
||||
case 0b001:
|
||||
return softvector::vector_compress<${vlen}, uint16_t>(V, vl, vstart, vtype, vd, vs2, vs1);
|
||||
case 0b010:
|
||||
return softvector::vector_compress<${vlen}, uint32_t>(V, vl, vstart, vtype, vd, vs2, vs1);
|
||||
case 0b011:
|
||||
return softvector::vector_compress<${vlen}, uint64_t>(V, vl, vstart, vtype, vd, vs2, vs1);
|
||||
default:
|
||||
throw new std::runtime_error("Unsupported sew bit value");
|
||||
}
|
||||
}
|
||||
void vector_whole_move(uint8_t* V, uint8_t vd, uint8_t vs2, uint8_t count){
|
||||
return softvector::vector_whole_move<${vlen}>(V, vd, vs2, count);
|
||||
}
|
||||
<%}%>
|
||||
uint64_t fetch_count{0};
|
||||
uint64_t tval{0};
|
||||
|
@ -119,6 +119,9 @@ template <unsigned VLEN, typename dest_elem_t, typename scr_elem_t = dest_elem_t
|
||||
void vector_vector_gather(uint8_t* V, uint64_t vl, uint64_t vstart, vtype_t vtype, bool vm, unsigned vd, unsigned vs2, unsigned vs1);
|
||||
template <unsigned VLEN, typename scr_elem_t>
|
||||
void vector_imm_gather(uint8_t* V, uint64_t vl, uint64_t vstart, vtype_t vtype, bool vm, unsigned vd, unsigned vs2, uint64_t imm);
|
||||
template <unsigned VLEN, typename scr_elem_t>
|
||||
void vector_compress(uint8_t* V, uint64_t vl, uint64_t vstart, vtype_t vtype, unsigned vd, unsigned vs2, unsigned vs1);
|
||||
template <unsigned VLEN> void vector_whole_move(uint8_t* V, unsigned vd, unsigned vs2, unsigned count);
|
||||
} // namespace softvector
|
||||
#include "vm/vector_functions.hpp"
|
||||
#endif /* _VM_VECTOR_FUNCTIONS_H_ */
|
||||
|
@ -34,6 +34,7 @@
|
||||
#pragma once
|
||||
#include "vm/vector_functions.h"
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <functional>
|
||||
#include <limits>
|
||||
#include <stdexcept>
|
||||
@ -1107,4 +1108,29 @@ void vector_imm_gather(uint8_t* V, uint64_t vl, uint64_t vstart, vtype_t vtype,
|
||||
}
|
||||
return;
|
||||
}
|
||||
template <unsigned VLEN, typename scr_elem_t>
|
||||
void vector_compress(uint8_t* V, uint64_t vl, uint64_t vstart, vtype_t vtype, unsigned vd, unsigned vs2, unsigned vs1) {
|
||||
uint64_t vlmax = VLEN * vtype.lmul() / vtype.sew();
|
||||
vmask_view mask_reg = read_vmask<VLEN>(V, vlmax, vs1);
|
||||
auto vs2_view = get_vreg<VLEN, scr_elem_t>(V, vs2, vlmax);
|
||||
auto vd_view = get_vreg<VLEN, scr_elem_t>(V, vd, vlmax);
|
||||
unsigned current_pos = 0;
|
||||
for(unsigned idx = vstart; idx < std::min(vlmax, vl); idx++) {
|
||||
if(mask_reg[idx]) {
|
||||
vd_view[current_pos] = vs2_view[idx];
|
||||
current_pos += 1;
|
||||
}
|
||||
}
|
||||
for(unsigned idx = current_pos; idx < vlmax; idx++) {
|
||||
vd_view[idx] = vtype.vta() ? vd_view[idx] : vd_view[idx];
|
||||
}
|
||||
return;
|
||||
}
|
||||
template <unsigned VLEN> void vector_whole_move(uint8_t* V, unsigned vd, unsigned vs2, unsigned count) {
|
||||
auto vd_view = get_vreg<VLEN, uint8_t>(V, vd, 1);
|
||||
auto vs2_view = get_vreg<VLEN, uint8_t>(V, vs2, 1);
|
||||
memcpy(vd_view.start, vs2_view.start, VLEN / 8 * count);
|
||||
return;
|
||||
}
|
||||
|
||||
} // namespace softvector
|
Loading…
x
Reference in New Issue
Block a user