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> {
127
127
constraints
128
128
} ;
129
129
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 ( ) ;
140
131
let indentation2 = indentation. nested ( ) ;
141
132
let indentation3 = indentation2. nested ( ) ;
142
133
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ use itertools::Itertools;
6
6
use super :: argument:: Argument ;
7
7
use super :: gen_c:: generate_c_program;
8
8
use super :: gen_rust:: generate_rust_program;
9
+ use super :: intrinsic_helpers:: TypeKind ;
9
10
10
11
// The number of times each intrinsic will be called.
11
12
const PASSES : u32 = 20 ;
41
42
/// there is an int i in scope which is the current pass number.
42
43
fn print_result_c ( & self , _indentation : Indentation , _additional : & str ) -> String ;
43
44
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
+
44
59
fn generate_loop_c (
45
60
& self ,
46
61
indentation : Indentation ,
You can’t perform that action at this time.
0 commit comments