@@ -2,6 +2,7 @@ use std::collections::HashMap;
2
2
use std:: str:: FromStr ;
3
3
4
4
use itertools:: Itertools ;
5
+ use regex:: Regex ;
5
6
6
7
use super :: intrinsic:: X86IntrinsicType ;
7
8
use crate :: common:: cli:: Language ;
@@ -19,7 +20,12 @@ impl IntrinsicTypeDefinition for X86IntrinsicType {
19
20
}
20
21
21
22
fn c_single_vector_type ( & self ) -> String {
22
- todo ! ( "c_single_vector_type for X86IntrinsicType needs to be implemented!" ) ;
23
+ // matches __m128, __m256 and similar types
24
+ let re = Regex :: new ( r"\__m\d+\" ) . unwrap ( ) ;
25
+ match self . metadata . get ( "type" ) {
26
+ Some ( type_data) if re. is_match ( type_data) => type_data. to_string ( ) ,
27
+ _ => unreachable ! ( "Shouldn't be called on this type" ) ,
28
+ }
23
29
}
24
30
25
31
fn rust_type ( & self ) -> String {
@@ -150,10 +156,10 @@ impl X86IntrinsicType {
150
156
// then check the param.type and extract numeric part if there are double
151
157
// underscores. divide this number with bit-len and set this as simd-len.
152
158
153
- let mut type_processed = param. etype . clone ( ) ;
159
+ let mut type_processed = param. type_data . clone ( ) ;
154
160
type_processed. retain ( |c| c. is_numeric ( ) ) ;
155
161
156
- ret. vec_len = match str:: parse :: < u32 > ( etype_processed . as_str ( ) ) {
162
+ ret. vec_len = match str:: parse :: < u32 > ( type_processed . as_str ( ) ) {
157
163
// If bit_len is None, vec_len will be None.
158
164
// Else vec_len will be (num_bits / bit_len).
159
165
Ok ( num_bits) => ret. bit_len . and ( Some ( num_bits / ret. bit_len . unwrap ( ) ) ) ,
0 commit comments