@@ -2,6 +2,7 @@ use std::collections::HashMap;
22use std:: str:: FromStr ;
33
44use itertools:: Itertools ;
5+ use regex:: Regex ;
56
67use super :: intrinsic:: X86IntrinsicType ;
78use crate :: common:: cli:: Language ;
@@ -19,7 +20,12 @@ impl IntrinsicTypeDefinition for X86IntrinsicType {
1920 }
2021
2122 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+ }
2329 }
2430
2531 fn rust_type ( & self ) -> String {
@@ -150,10 +156,10 @@ impl X86IntrinsicType {
150156 // then check the param.type and extract numeric part if there are double
151157 // underscores. divide this number with bit-len and set this as simd-len.
152158
153- let mut type_processed = param. etype . clone ( ) ;
159+ let mut type_processed = param. type_data . clone ( ) ;
154160 type_processed. retain ( |c| c. is_numeric ( ) ) ;
155161
156- ret. vec_len = match str:: parse :: < u32 > ( etype_processed . as_str ( ) ) {
162+ ret. vec_len = match str:: parse :: < u32 > ( type_processed . as_str ( ) ) {
157163 // If bit_len is None, vec_len will be None.
158164 // Else vec_len will be (num_bits / bit_len).
159165 Ok ( num_bits) => ret. bit_len . and ( Some ( num_bits / ret. bit_len . unwrap ( ) ) ) ,
0 commit comments