intrinsic-test: Print C++ float16_t in hex

Upstream Rust currently does not support printing f16s in decimal.
For the intrinsics tests to work, make C++ print float16_t in the same
format.

Can be droppen once https://github.com/rust-lang/rust/pull/127013
is merged.
This commit is contained in:
Kajetan Puchalski 2025-02-05 15:24:53 +00:00 committed by Amanieu d'Antras
parent f4a31fd609
commit 3b58340073
2 changed files with 12 additions and 0 deletions

View file

@ -27,3 +27,6 @@ vrnd64z_f64
# Broken in Clang
vcvth_s16_f16
# FIXME: Broken output due to missing f16 printing support in Rust, see git blame for this line
vmulh_lane_f16
vmulh_laneq_f16

View file

@ -114,6 +114,15 @@ std::ostream& operator<<(std::ostream& os, poly128_t value) {{
}}
#endif
std::ostream& operator<<(std::ostream& os, float16_t value) {{
uint16_t temp = 0;
memcpy(&temp, &value, sizeof(float16_t));
std::stringstream ss;
ss << "0x" << std::setfill('0') << std::setw(4) << std::hex << temp;
os << ss.str();
return os;
}}
{arglists}
int main(int argc, char **argv) {{