@@ -5,6 +5,7 @@ use itertools::Itertools;
5
5
use regex:: Regex ;
6
6
7
7
use super :: intrinsic:: X86IntrinsicType ;
8
+ use crate :: common:: argument:: Argument ;
8
9
use crate :: common:: cli:: Language ;
9
10
use crate :: common:: intrinsic_helpers:: { IntrinsicType , IntrinsicTypeDefinition , Sign , TypeKind } ;
10
11
use crate :: x86:: xml_parser:: Parameter ;
@@ -18,7 +19,7 @@ impl IntrinsicTypeDefinition for X86IntrinsicType {
18
19
19
20
fn c_single_vector_type ( & self ) -> String {
20
21
// matches __m128, __m256 and similar types
21
- let re = Regex :: new ( r"\ __m\d+\ " ) . unwrap ( ) ;
22
+ let re = Regex :: new ( r"__m\d+" ) . unwrap ( ) ;
22
23
if re. is_match ( self . param . type_data . as_str ( ) ) {
23
24
self . param . type_data . clone ( )
24
25
} else {
@@ -129,8 +130,6 @@ impl IntrinsicTypeDefinition for X86IntrinsicType {
129
130
impl X86IntrinsicType {
130
131
fn from_c ( s : & str ) -> Result < IntrinsicType , String > {
131
132
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 ( ) ) ;
134
133
s_copy = s_copy
135
134
. replace ( "*" , "" )
136
135
. replace ( "_" , "" )
@@ -196,6 +195,9 @@ impl X86IntrinsicType {
196
195
let mut etype_processed = param. etype . clone ( ) ;
197
196
etype_processed. retain ( |c| c. is_numeric ( ) ) ;
198
197
198
+ let mut type_processed = param. type_data . clone ( ) ;
199
+ type_processed. retain ( |c| c. is_numeric ( ) ) ;
200
+
199
201
match str:: parse :: < u32 > ( etype_processed. as_str ( ) ) {
200
202
Ok ( value) => data. bit_len = Some ( value) ,
201
203
Err ( _) => {
@@ -209,14 +211,16 @@ impl X86IntrinsicType {
209
211
}
210
212
}
211
213
214
+ if param. type_data . matches ( "__mmask" ) . next ( ) . is_some ( ) {
215
+ data. bit_len = str:: parse :: < u32 > ( type_processed. as_str ( ) ) . ok ( ) ;
216
+ }
217
+
212
218
// then check the param.type and extract numeric part if there are double
213
219
// underscores. divide this number with bit-len and set this as simd-len.
214
220
// Only __m<int> types can have a simd-len.
215
221
if param. type_data . matches ( "__m" ) . next ( ) . is_some ( )
216
222
&& param. type_data . matches ( "__mmask" ) . next ( ) . is_none ( )
217
223
{
218
- let mut type_processed = param. type_data . clone ( ) ;
219
- type_processed. retain ( |c| c. is_numeric ( ) ) ;
220
224
data. vec_len = match str:: parse :: < u32 > ( type_processed. as_str ( ) ) {
221
225
// If bit_len is None, vec_len will be None.
222
226
// Else vec_len will be (num_bits / bit_len).
@@ -235,7 +239,6 @@ impl X86IntrinsicType {
235
239
// if param.etype == IMM, then it is a constant.
236
240
// else it stays unchanged.
237
241
data. constant |= param. etype == "IMM" ;
238
-
239
242
Ok ( X86IntrinsicType {
240
243
data,
241
244
param : param. clone ( ) ,
0 commit comments