@@ -28,7 +28,32 @@ impl IntrinsicTypeDefinition for X86IntrinsicType {
28
28
29
29
/// Determines the load function for this type.
30
30
fn get_load_function ( & self , _language : Language ) -> String {
31
- todo ! ( "get_load_function for X86IntrinsicType needs to be implemented!" ) ;
31
+ if let Some ( type_value) = self . metadata . get ( "type" ) {
32
+ if type_value. starts_with ( "__mmask" ) {
33
+ // no need of loads, since they work directly
34
+ // with hex constants
35
+ String :: from ( "*" )
36
+ } else if type_value. starts_with ( "__m" ) {
37
+ // the structure is like the follows:
38
+ // if "type" starts with __m<num>{h/i/<null>},
39
+ // then use either _mm_set1_epi64,
40
+ // _mm256_set1_epi64 or _mm512_set1_epi64
41
+ let type_val_filtered = type_value
42
+ . chars ( )
43
+ . filter ( |c| c. is_numeric ( ) )
44
+ . join ( "" )
45
+ . replace ( "128" , "" ) ;
46
+ format ! ( "_mm{type_val_filtered}_set1_epi64" )
47
+ } else {
48
+ // if it is a pointer, then rely on type conversion
49
+ // If it is not any of the above type (__int<num>, __bfloat16, unsigned short, etc)
50
+ // then typecast it.
51
+ format ! ( "({type_value})" )
52
+ }
53
+ // Look for edge cases (constexpr, literal, etc)
54
+ } else {
55
+ unimplemented ! ( "the value for key 'type' is not present!" ) ;
56
+ }
32
57
}
33
58
34
59
/// Determines the get lane function for this type.
0 commit comments