@@ -5,6 +5,7 @@ use itertools::Itertools;
55use regex:: Regex ;
66
77use super :: intrinsic:: X86IntrinsicType ;
8+ use crate :: common:: argument:: Argument ;
89use crate :: common:: cli:: Language ;
910use crate :: common:: intrinsic_helpers:: { IntrinsicType , IntrinsicTypeDefinition , Sign , TypeKind } ;
1011use crate :: x86:: xml_parser:: Parameter ;
@@ -18,7 +19,7 @@ impl IntrinsicTypeDefinition for X86IntrinsicType {
1819
1920 fn c_single_vector_type ( & self ) -> String {
2021 // matches __m128, __m256 and similar types
21- let re = Regex :: new ( r"\ __m\d+\ " ) . unwrap ( ) ;
22+ let re = Regex :: new ( r"__m\d+" ) . unwrap ( ) ;
2223 if re. is_match ( self . param . type_data . as_str ( ) ) {
2324 self . param . type_data . clone ( )
2425 } else {
@@ -129,8 +130,6 @@ impl IntrinsicTypeDefinition for X86IntrinsicType {
129130impl X86IntrinsicType {
130131 fn from_c ( s : & str ) -> Result < IntrinsicType , String > {
131132 let mut s_copy = s. to_string ( ) ;
132- let mut metadata: HashMap < String , String > = HashMap :: new ( ) ;
133- metadata. insert ( "type" . to_string ( ) , s. to_string ( ) ) ;
134133 s_copy = s_copy
135134 . replace ( "*" , "" )
136135 . replace ( "_" , "" )
@@ -196,6 +195,9 @@ impl X86IntrinsicType {
196195 let mut etype_processed = param. etype . clone ( ) ;
197196 etype_processed. retain ( |c| c. is_numeric ( ) ) ;
198197
198+ let mut type_processed = param. type_data . clone ( ) ;
199+ type_processed. retain ( |c| c. is_numeric ( ) ) ;
200+
199201 match str:: parse :: < u32 > ( etype_processed. as_str ( ) ) {
200202 Ok ( value) => data. bit_len = Some ( value) ,
201203 Err ( _) => {
@@ -209,14 +211,16 @@ impl X86IntrinsicType {
209211 }
210212 }
211213
214+ if param. type_data . matches ( "__mmask" ) . next ( ) . is_some ( ) {
215+ data. bit_len = str:: parse :: < u32 > ( type_processed. as_str ( ) ) . ok ( ) ;
216+ }
217+
212218 // then check the param.type and extract numeric part if there are double
213219 // underscores. divide this number with bit-len and set this as simd-len.
214220 // Only __m<int> types can have a simd-len.
215221 if param. type_data . matches ( "__m" ) . next ( ) . is_some ( )
216222 && param. type_data . matches ( "__mmask" ) . next ( ) . is_none ( )
217223 {
218- let mut type_processed = param. type_data . clone ( ) ;
219- type_processed. retain ( |c| c. is_numeric ( ) ) ;
220224 data. vec_len = match str:: parse :: < u32 > ( type_processed. as_str ( ) ) {
221225 // If bit_len is None, vec_len will be None.
222226 // Else vec_len will be (num_bits / bit_len).
@@ -235,7 +239,6 @@ impl X86IntrinsicType {
235239 // if param.etype == IMM, then it is a constant.
236240 // else it stays unchanged.
237241 data. constant |= param. etype == "IMM" ;
238-
239242 Ok ( X86IntrinsicType {
240243 data,
241244 param : param. clone ( ) ,
0 commit comments