@@ -64,34 +64,46 @@ pub unsafe fn _mm_blend_ps(a: f32x4, b: f32x4, imm4: u8) -> f32x4 {
64
64
/// Extract a single-precision (32-bit) floating-point element from `a`, selected with `imm8`
65
65
#[ inline( always) ]
66
66
#[ target_feature = "+sse4.1" ]
67
- #[ cfg_attr( test, assert_instr( extractps, imm8=0 ) ) ]
68
- pub unsafe fn _mm_extract_ps ( a : f32x4 , imm8 : u8 ) -> i32 {
69
- mem:: transmute ( a. extract ( imm8 as u32 & 0b11 ) )
67
+ #[ cfg_attr( test, assert_instr( extractps, imm2=0 ) ) ]
68
+ pub unsafe fn _mm_extract_ps ( a : f32x4 , imm2 : u8 ) -> i32 {
69
+ macro_rules! call {
70
+ ( $imm2: expr) => { mem:: transmute( a. extract( $imm2) ) }
71
+ }
72
+ constify_imm2 ! ( imm2, call)
70
73
}
71
74
72
75
/// Extract an 8-bit integer from `a` selected with `imm8`
73
76
#[ inline( always) ]
74
77
#[ target_feature = "+sse4.1" ]
75
- #[ cfg_attr( test, assert_instr( pextrb, imm8=0 ) ) ]
76
- pub unsafe fn _mm_extract_epi8 ( a : i8x16 , imm8 : u8 ) -> i8 {
77
- a. extract ( ( imm8 & 0b1111 ) as u32 )
78
+ #[ cfg_attr( test, assert_instr( pextrb, imm4=0 ) ) ]
79
+ pub unsafe fn _mm_extract_epi8 ( a : i8x16 , imm4 : u8 ) -> i8 {
80
+ macro_rules! call {
81
+ ( $imm4: expr) => { a. extract( $imm4) }
82
+ }
83
+ constify_imm4 ! ( imm4, call)
78
84
}
79
85
80
86
/// Extract an 32-bit integer from `a` selected with `imm8`
81
87
#[ inline( always) ]
82
88
#[ target_feature = "+sse4.1" ]
83
- #[ cfg_attr( test, assert_instr( pextrd, imm8=1 ) ) ]
84
- pub unsafe fn _mm_extract_epi32 ( a : i32x4 , imm8 : u8 ) -> i32 {
85
- a. extract ( ( imm8 & 0b11 ) as u32 )
89
+ #[ cfg_attr( test, assert_instr( pextrd, imm2=1 ) ) ]
90
+ pub unsafe fn _mm_extract_epi32 ( a : i32x4 , imm2 : u8 ) -> i32 {
91
+ macro_rules! call {
92
+ ( $imm2: expr) => { a. extract( $imm2) }
93
+ }
94
+ constify_imm2 ! ( imm2, call)
86
95
}
87
96
88
97
/// Extract an 64-bit integer from `a` selected with `imm8`
89
98
#[ cfg( target_arch = "x86_64" ) ]
90
99
#[ inline( always) ]
91
100
#[ target_feature = "+sse4.1" ]
92
- #[ cfg_attr( test, assert_instr( pextrq, imm8=1 ) ) ]
93
- pub unsafe fn _mm_extract_epi64 ( a : i64x2 , imm8 : u8 ) -> i64 {
94
- a. extract ( ( imm8 & 0b1 ) as u32 )
101
+ #[ cfg_attr( test, assert_instr( pextrq, imm1=1 ) ) ]
102
+ pub unsafe fn _mm_extract_epi64 ( a : i64x2 , imm1 : u8 ) -> i64 {
103
+ macro_rules! call {
104
+ ( $imm1: expr) => { a. extract( $imm1) }
105
+ }
106
+ constify_imm1 ! ( imm1, call)
95
107
}
96
108
97
109
/// Select a single value in `a` to store at some position in `b`,
0 commit comments