From 42bf6ee380939968718bb1098929937ee32de2dd Mon Sep 17 00:00:00 2001 From: Eyck-Alexander Jentzsch Date: Thu, 6 Mar 2025 12:55:47 +0100 Subject: [PATCH] corrects errors w.r.t. floating point dispatch --- src/vm/vector_functions.hpp | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/vm/vector_functions.hpp b/src/vm/vector_functions.hpp index db473f3..609dc62 100644 --- a/src/vm/vector_functions.hpp +++ b/src/vm/vector_functions.hpp @@ -948,17 +948,17 @@ template dest_elem_t widen_float(src template <> inline uint64_t widen_float(uint32_t val) { return f32_to_f64(float32_t{val}).v; } template elem_size_t fp_add(uint8_t, elem_size_t, elem_size_t); -template <> inline uint32_t fp_add(uint8_t mode, uint32_t v2, uint32_t v1) { return fadd_s(v1, v2, mode); } -template <> inline uint64_t fp_add(uint8_t mode, uint64_t v2, uint64_t v1) { return fadd_d(v1, v2, mode); } +template <> inline uint32_t fp_add(uint8_t mode, uint32_t v2, uint32_t v1) { return fadd_s(v2, v1, mode); } +template <> inline uint64_t fp_add(uint8_t mode, uint64_t v2, uint64_t v1) { return fadd_d(v2, v1, mode); } template elem_size_t fp_sub(uint8_t, elem_size_t, elem_size_t); -template <> inline uint32_t fp_sub(uint8_t mode, uint32_t v2, uint32_t v1) { return fsub_s(v1, v2, mode); } -template <> inline uint64_t fp_sub(uint8_t mode, uint64_t v2, uint64_t v1) { return fsub_d(v1, v2, mode); } +template <> inline uint32_t fp_sub(uint8_t mode, uint32_t v2, uint32_t v1) { return fsub_s(v2, v1, mode); } +template <> inline uint64_t fp_sub(uint8_t mode, uint64_t v2, uint64_t v1) { return fsub_d(v2, v1, mode); } template elem_size_t fp_mul(uint8_t, elem_size_t, elem_size_t); -template <> inline uint32_t fp_mul(uint8_t mode, uint32_t v2, uint32_t v1) { return fmul_s(v1, v2, mode); } -template <> inline uint64_t fp_mul(uint8_t mode, uint64_t v2, uint64_t v1) { return fmul_d(v1, v2, mode); } +template <> inline uint32_t fp_mul(uint8_t mode, uint32_t v2, uint32_t v1) { return fmul_s(v2, v1, mode); } +template <> inline uint64_t fp_mul(uint8_t mode, uint64_t v2, uint64_t v1) { return fmul_d(v2, v1, mode); } template elem_size_t fp_div(uint8_t, elem_size_t, elem_size_t); -template <> inline uint32_t fp_div(uint8_t mode, uint32_t v2, uint32_t v1) { return fdiv_s(v1, v2, mode); } -template <> inline uint64_t fp_div(uint8_t mode, uint64_t v2, uint64_t v1) { return fdiv_d(v1, v2, mode); } +template <> inline uint32_t fp_div(uint8_t mode, uint32_t v2, uint32_t v1) { return fdiv_s(v2, v1, mode); } +template <> inline uint64_t fp_div(uint8_t mode, uint64_t v2, uint64_t v1) { return fdiv_d(v2, v1, mode); } template elem_size_t fp_madd(uint8_t, elem_size_t, elem_size_t, elem_size_t); template <> inline uint32_t fp_madd(uint8_t mode, uint32_t v2, uint32_t v1, uint32_t v3) { return fmadd_s(v1, v2, v3, 0, mode); } template <> inline uint64_t fp_madd(uint8_t mode, uint64_t v2, uint64_t v1, uint64_t v3) { return fmadd_d(v1, v2, v3, 0, mode); } @@ -1457,8 +1457,11 @@ std::function get_fp_unary_fn(unsign else if(encoding_space == 0b010010) // VFUNARY0 switch(unary_op) { case 0b00000: // VFCVT.XU.F.V + case 0b00110: // VFCVT.RTZ.XU.F.V case 0b01000: // VFWCVT.XU.F.V + case 0b01110: // VFWCVT.RTZ.XU.F.V case 0b10000: // VFNCVT.XU.F.W + case 0b10110: // VFNCVT.RTZ.XU.F.W return [](uint8_t rm, uint8_t& accrued_flags, src_elem_t vs2) { dest_elem_t val = fp_f_to_ui(rm, vs2); accrued_flags |= softfloat_exceptionFlags; @@ -1476,11 +1479,8 @@ std::function get_fp_unary_fn(unsign return val; }; case 0b00010: // VFCVT.F.XU.V - case 0b00110: // VFCVT.RTZ.XU.F.V case 0b01010: // VFWCVT.F.XU.V - case 0b01110: // VFWCVT.RTZ.XU.F.V case 0b10010: // VFNCVT.F.XU.W - case 0b10110: // VFNCVT.RTZ.XU.F.W return [](uint8_t rm, uint8_t& accrued_flags, src_elem_t vs2) { dest_elem_t val = fp_ui_to_f(vs2); accrued_flags |= softfloat_exceptionFlags; @@ -1703,7 +1703,6 @@ inline std::function get_mask_set_funct(unsigned enc) { } else return 1; }; - case 0b10001: // VID default: throw new std::runtime_error("Unknown enc in get_mask_set_funct"); }