From dd4416ab15d1aa7d282d69bd235d37981048e0b8 Mon Sep 17 00:00:00 2001 From: Eyck-Alexander Jentzsch Date: Sun, 16 Feb 2025 01:30:08 +0100 Subject: [PATCH] adds min/max instructions --- src/vm/vector_functions.hpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/vm/vector_functions.hpp b/src/vm/vector_functions.hpp index 88de862..9f75b13 100644 --- a/src/vm/vector_functions.hpp +++ b/src/vm/vector_functions.hpp @@ -85,6 +85,20 @@ std::function get_funct(unsigned funct) { return [](src2_elem_t vs2, src1_elem_t vs1) { return vs2 - vs1; }; case 0b000011: // VRSUB return [](src2_elem_t vs2, src1_elem_t vs1) { return vs1 - vs2; }; + case 0b000100: // VMINU + return [](src2_elem_t vs2, src1_elem_t vs1) { return std::min(vs2, static_cast(vs1)); }; + case 0b000101: // VMIN + return [](src2_elem_t vs2, src1_elem_t vs1) { + return std::min(static_cast>(vs2), + static_cast>(vs1)); + }; + case 0b000110: // VMAXU + return [](src2_elem_t vs2, src1_elem_t vs1) { return std::max(vs2, static_cast(vs1)); }; + case 0b000111: // VMAX + return [](src2_elem_t vs2, src1_elem_t vs1) { + return std::max(static_cast>(vs2), + static_cast>(vs1)); + }; case 0b001001: // VAND return [](src2_elem_t vs2, src1_elem_t vs1) { return vs1 & vs2; }; case 0b001010: // VOR