From a6f24db83ab23899187830d7defff7c7800b1773 Mon Sep 17 00:00:00 2001 From: Eyck-Alexander Jentzsch Date: Tue, 18 Feb 2025 23:01:00 +0100 Subject: [PATCH] adds vssrl and vssra --- src/vm/vector_functions.hpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/vm/vector_functions.hpp b/src/vm/vector_functions.hpp index 32d3160..d6c496c 100644 --- a/src/vm/vector_functions.hpp +++ b/src/vm/vector_functions.hpp @@ -588,6 +588,8 @@ void carry_vector_imm_op(uint8_t* V, unsigned funct, uint64_t vl, uint64_t vstar return; } template bool get_rounding_increment(T v, uint64_t d, int64_t vxrm) { + if(d == 0) + return 0; switch(vxrm & 0b11) { // Mask to ensure only lower 2 bits are used case 0b00: // rnu: round-to-nearest-up (add +0.5 LSB) return (v >> (d - 1)) & 1; @@ -675,8 +677,16 @@ std::function get return 0; } }; - // case 0b101010: // VSSRL - // case 0b101011: // VSSRA + case 0b101010: // VSSRL + return [](uint64_t vxrm, vtype_t vtype, dest_elem_t& vd, src_elem_t vs2, src_elem_t vs1) { + vd = roundoff(vs2, vs1 & shift_mask(), vxrm); + return 0; + }; + case 0b101011: // VSSRA + return [](uint64_t vxrm, vtype_t vtype, dest_elem_t& vd, src_elem_t vs2, src_elem_t vs1) { + vd = roundoff(static_cast>(vs2), vs1 & shift_mask(), vxrm); + return 0; + }; // case 0b101110: // VNCLIPU // case 0b101111: // VNCLIP default: