|
1 | 1 | use crate::common::argument::ArgumentList; |
2 | | -use crate::common::indentation::Indentation; |
3 | 2 | use crate::common::intrinsic::{Intrinsic, IntrinsicDefinition}; |
4 | | -use crate::common::intrinsic_helpers::{IntrinsicType, IntrinsicTypeDefinition, Sign, TypeKind}; |
| 3 | +use crate::common::intrinsic_helpers::IntrinsicType; |
5 | 4 | use std::ops::{Deref, DerefMut}; |
6 | 5 |
|
7 | 6 | #[derive(Debug, Clone, PartialEq)] |
@@ -36,78 +35,4 @@ impl IntrinsicDefinition<ArmIntrinsicType> for Intrinsic<ArmIntrinsicType> { |
36 | 35 | fn name(&self) -> String { |
37 | 36 | self.name.clone() |
38 | 37 | } |
39 | | - |
40 | | - /// Generates a std::cout for the intrinsics results that will match the |
41 | | - /// rust debug output format for the return type. The generated line assumes |
42 | | - /// there is an int i in scope which is the current pass number. |
43 | | - fn print_result_c(&self, indentation: Indentation, additional: &str) -> String { |
44 | | - self.results().print_result_c(indentation, additional) |
45 | | - } |
46 | | -} |
47 | | - |
48 | | -impl ArmIntrinsicType { |
49 | | - /// Generates a std::cout for the intrinsics results that will match the |
50 | | - /// rust debug output format for the return type. The generated line assumes |
51 | | - /// there is an int i in scope which is the current pass number. |
52 | | - fn print_result_c(&self, indentation: Indentation, additional: &str) -> String { |
53 | | - let lanes = if self.num_vectors() > 1 { |
54 | | - (0..self.num_vectors()) |
55 | | - .map(|vector| { |
56 | | - format!( |
57 | | - r#""{ty}(" << {lanes} << ")""#, |
58 | | - ty = self.c_single_vector_type(), |
59 | | - lanes = (0..self.num_lanes()) |
60 | | - .map(move |idx| -> std::string::String { |
61 | | - format!( |
62 | | - "{cast}{lane_fn}(__return_value.val[{vector}], {lane})", |
63 | | - cast = self.c_promotion(), |
64 | | - lane_fn = self.get_lane_function(), |
65 | | - lane = idx, |
66 | | - vector = vector, |
67 | | - ) |
68 | | - }) |
69 | | - .collect::<Vec<_>>() |
70 | | - .join(r#" << ", " << "#) |
71 | | - ) |
72 | | - }) |
73 | | - .collect::<Vec<_>>() |
74 | | - .join(r#" << ", " << "#) |
75 | | - } else if self.num_lanes() > 1 { |
76 | | - (0..self.num_lanes()) |
77 | | - .map(|idx| -> std::string::String { |
78 | | - format!( |
79 | | - "{cast}{lane_fn}(__return_value, {lane})", |
80 | | - cast = self.c_promotion(), |
81 | | - lane_fn = self.get_lane_function(), |
82 | | - lane = idx |
83 | | - ) |
84 | | - }) |
85 | | - .collect::<Vec<_>>() |
86 | | - .join(r#" << ", " << "#) |
87 | | - } else { |
88 | | - format!( |
89 | | - "{promote}cast<{cast}>(__return_value)", |
90 | | - cast = match self.kind() { |
91 | | - TypeKind::Float if self.inner_size() == 16 => "float16_t".to_string(), |
92 | | - TypeKind::Float if self.inner_size() == 32 => "float".to_string(), |
93 | | - TypeKind::Float if self.inner_size() == 64 => "double".to_string(), |
94 | | - TypeKind::Int(Sign::Signed) => format!("int{}_t", self.inner_size()), |
95 | | - TypeKind::Int(Sign::Unsigned) => format!("uint{}_t", self.inner_size()), |
96 | | - TypeKind::Poly => format!("poly{}_t", self.inner_size()), |
97 | | - ty => todo!("print_result_c - Unknown type: {:#?}", ty), |
98 | | - }, |
99 | | - promote = self.c_promotion(), |
100 | | - ) |
101 | | - }; |
102 | | - |
103 | | - format!( |
104 | | - r#"{indentation}std::cout << "Result {additional}-" << i+1 << ": {ty}" << std::fixed << std::setprecision(150) << {lanes} << "{close}" << std::endl;"#, |
105 | | - ty = if self.is_simd() { |
106 | | - format!("{}(", self.c_type()) |
107 | | - } else { |
108 | | - String::from("") |
109 | | - }, |
110 | | - close = if self.is_simd() { ")" } else { "" }, |
111 | | - ) |
112 | | - } |
113 | 38 | } |
0 commit comments