jfalcou / eve

Expressive Vector Engine - SIMD in C++ Goes Brrrr
https://jfalcou.github.io/eve/
Boost Software License 1.0
961 stars 58 forks source link

RISCV bit_cast #1961

Closed ita-sc closed 1 month ago

ita-sc commented 1 month ago

Hi

This patch improves bit_cast support for RISC-V Wide types. Now instead of using std::bit_cast, that could lead to std::memcpy, we use pseudo intrinsics, that will result in no real code.

Also I've added some tests for bit_cast to check that expected combination of types will be supported.

DenisYaroshevskiy commented 1 month ago

I'm not sure I want this. compiler should do this one. It guranteed does it on other arches. What's up here.

DenisYaroshevskiy commented 1 month ago

If you can come up with example where bit_cast didn't compile well in optimized mode- let's do a bug report but then yeah - we can put custom code somewhere. Otherwise - let's not.

ita-sc commented 1 month ago

If you can come up with example where bit_cast didn't compile well in optimized mode- let's do a bug report but then yeah - we can put custom code somewhere. Otherwise - let's not.

I've checked asm output with this patch, and with standard std::bit_cast, and it seems they are almost the same (I'll try to minimize the rest case), so dropping for now changes in EVE core code. Patch now consist only in changes in bit_cast test and turning this test in RISCV CI