File tree Expand file tree Collapse file tree 2 files changed +16
-10
lines changed
crates/intrinsic-test/src Expand file tree Collapse file tree 2 files changed +16
-10
lines changed Original file line number Diff line number Diff line change @@ -127,16 +127,7 @@ impl IntrinsicDefinition<ArmIntrinsicType> for Intrinsic<ArmIntrinsicType> {
127127 constraints
128128 } ;
129129
130- // the `intrinsic-test` crate compares the output of C and Rust intrinsics. Currently, It uses
131- // a string representation of the output value to compare. In C, f16 values are currently printed
132- // as hexadecimal integers. Since https://github.com/rust-lang/rust/pull/127013, rust does print
133- // them as decimal floating point values. To keep the intrinsics tests working, for now, format
134- // vectors containing f16 values like C prints them.
135- let return_value = match self . results . kind ( ) {
136- TypeKind :: Float if self . results . inner_size ( ) == 16 => "debug_f16(__return_value)" ,
137- _ => "format_args!(\" {__return_value:.150?}\" )" ,
138- } ;
139-
130+ let return_value = self . format_f16_return_value ( ) ;
140131 let indentation2 = indentation. nested ( ) ;
141132 let indentation3 = indentation2. nested ( ) ;
142133
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ use itertools::Itertools;
66use super :: argument:: Argument ;
77use super :: gen_c:: generate_c_program;
88use super :: gen_rust:: generate_rust_program;
9+ use super :: intrinsic_helpers:: TypeKind ;
910
1011// The number of times each intrinsic will be called.
1112const PASSES : u32 = 20 ;
4142 /// there is an int i in scope which is the current pass number.
4243 fn print_result_c ( & self , _indentation : Indentation , _additional : & str ) -> String ;
4344
45+ fn format_f16_return_value ( & self ) -> String {
46+ // the `intrinsic-test` crate compares the output of C and Rust intrinsics. Currently, It uses
47+ // a string representation of the output value to compare. In C, f16 values are currently printed
48+ // as hexadecimal integers. Since https://github.com/rust-lang/rust/pull/127013, rust does print
49+ // them as decimal floating point values. To keep the intrinsics tests working, for now, format
50+ // vectors containing f16 values like C prints them.
51+ let return_value = match self . results ( ) . kind ( ) {
52+ TypeKind :: Float if self . results ( ) . inner_size ( ) == 16 => "debug_f16(__return_value)" ,
53+ _ => "format_args!(\" {__return_value:.150?}\" )" ,
54+ } ;
55+
56+ String :: from ( return_value)
57+ }
58+
4459 fn generate_loop_c (
4560 & self ,
4661 indentation : Indentation ,
You can’t perform that action at this time.
0 commit comments