Skip to content

Commit 2a20b05

Browse files
mrkajetanpAmanieu
authored andcommittedFeb 24, 2025·
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 rust-lang/rust#127013 is merged.
1 parent aae8eb3 commit 2a20b05

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed
 

‎crates/intrinsic-test/missing_aarch64.txt

+3
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,6 @@ vrnd64z_f64
2727

2828
# Broken in Clang
2929
vcvth_s16_f16
30+
# FIXME: Broken output due to missing f16 printing support in Rust, see git blame for this line
31+
vmulh_lane_f16
32+
vmulh_laneq_f16

‎crates/intrinsic-test/src/main.rs

+9
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,15 @@ std::ostream& operator<<(std::ostream& os, poly128_t value) {{
114114
}}
115115
#endif
116116
117+
std::ostream& operator<<(std::ostream& os, float16_t value) {{
118+
uint16_t temp = 0;
119+
memcpy(&temp, &value, sizeof(float16_t));
120+
std::stringstream ss;
121+
ss << "0x" << std::setfill('0') << std::setw(4) << std::hex << temp;
122+
os << ss.str();
123+
return os;
124+
}}
125+
117126
{arglists}
118127
119128
int main(int argc, char **argv) {{

0 commit comments

Comments
 (0)
Please sign in to comment.