@@ -22,13 +22,18 @@ extern "unadjusted" {
22
22
fn llvm_vcvtps2ph_256 ( a : f32x8 , rounding : i32 ) -> i16x8 ;
23
23
}
24
24
25
+ /// Converts the 4 x 16-bit half-precision float values in the lowest 64-bit of
26
+ /// the 128-bit vector `a` into 4 x 32-bit float values stored in a 128-bit wide
27
+ /// vector.
25
28
#[ inline]
26
29
#[ target_feature( enable = "avx512f" ) ]
27
30
#[ cfg_attr( test, assert_instr( "vcvtph2ps" ) ) ]
28
31
pub unsafe fn _mm_cvtph_ps ( a : __m128i ) -> __m128 {
29
32
transmute ( llvm_vcvtph2ps_128 ( transmute ( a) ) )
30
33
}
31
34
35
+ /// Converts the 8 x 16-bit half-precision float values in the 128-bit vector
36
+ /// `a` into 8 x 32-bit float values stored in a 256-bit wide vector.
32
37
#[ inline]
33
38
#[ target_feature( enable = "avx512f" ) ]
34
39
#[ cfg_attr( test, assert_instr( "vcvtph2ps" ) ) ]
@@ -54,32 +59,53 @@ macro_rules! dispatch_rounding {
54
59
} } ;
55
60
}
56
61
62
+ /// Converts the 4 x 32-bit float values in the 128-bit vector `a` into 4 x
63
+ /// 16-bit half-precision float values stored in the lowest 64-bit of a 128-bit
64
+ /// vector.
65
+ ///
66
+ /// Rounding is done according to the `imm_rounding` parameter, which can be one of:
67
+ ///
68
+ /// * `_MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC`: round to nearest and suppress exceptions,
69
+ /// * `_MM_FROUND_TO_NEG_INF | _MM_FROUND_NO_EXC`: round down and suppress exceptions,
70
+ /// * `_MM_FROUND_TO_POS_INF | _MM_FROUND_NO_EXC`: round up and suppress exceptions,
71
+ /// * `_MM_FROUND_TO_ZERO | _MM_FROUND_NO_EXC`: truncate and suppress exceptions,
72
+ /// * `_MM_FROUND_CUR_DIRECTION`: use `MXCSR.RC` - see [`_MM_SET_ROUNDING_MODE`].
57
73
#[ inline]
58
74
#[ target_feature( enable = "avx512f" ) ]
59
75
#[ rustc_args_required_const( 1 ) ]
60
- #[ cfg_attr( test, assert_instr( "vcvtps2ph" , rounding = 0 ) ) ]
61
- pub unsafe fn _mm_cvtps_ph ( a : __m128 , rounding : i32 ) -> __m128i {
76
+ #[ cfg_attr( test, assert_instr( "vcvtps2ph" , imm_rounding = 0 ) ) ]
77
+ pub unsafe fn _mm_cvtps_ph ( a : __m128 , imm_rounding : i32 ) -> __m128i {
62
78
let a = transmute ( a) ;
63
79
macro_rules! call {
64
80
( $rounding: ident) => {
65
81
llvm_vcvtps2ph_128( a, $rounding)
66
82
} ;
67
83
}
68
- transmute ( dispatch_rounding ! ( rounding , call) )
84
+ transmute ( dispatch_rounding ! ( imm_rounding , call) )
69
85
}
70
86
87
+ /// Converts the 8 x 32-bit float values in the 256-bit vector `a` into 8 x
88
+ /// 16-bit half-precision float values stored in a 128-bit wide vector.
89
+ ///
90
+ /// Rounding is done according to the `imm_rounding` parameter, which can be one of:
91
+ ///
92
+ /// * `_MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC`: round to nearest and suppress exceptions,
93
+ /// * `_MM_FROUND_TO_NEG_INF | _MM_FROUND_NO_EXC`: round down and suppress exceptions,
94
+ /// * `_MM_FROUND_TO_POS_INF | _MM_FROUND_NO_EXC`: round up and suppress exceptions,
95
+ /// * `_MM_FROUND_TO_ZERO | _MM_FROUND_NO_EXC`: truncate and suppress exceptions,
96
+ /// * `_MM_FROUND_CUR_DIRECTION`: use `MXCSR.RC` - see [`_MM_SET_ROUNDING_MODE`].
71
97
#[ inline]
72
98
#[ target_feature( enable = "avx512f" ) ]
73
99
#[ rustc_args_required_const( 1 ) ]
74
- #[ cfg_attr( test, assert_instr( "vcvtps2ph" , rounding = 0 ) ) ]
75
- pub unsafe fn _mm256_cvtps_ph ( a : __m256 , rounding : i32 ) -> __m128i {
100
+ #[ cfg_attr( test, assert_instr( "vcvtps2ph" , imm_rounding = 0 ) ) ]
101
+ pub unsafe fn _mm256_cvtps_ph ( a : __m256 , imm_rounding : i32 ) -> __m128i {
76
102
let a = transmute ( a) ;
77
103
macro_rules! call {
78
104
( $rounding: ident) => {
79
105
llvm_vcvtps2ph_256( a, $rounding)
80
106
} ;
81
107
}
82
- transmute ( dispatch_rounding ! ( rounding , call) )
108
+ transmute ( dispatch_rounding ! ( imm_rounding , call) )
83
109
}
84
110
85
111
#[ cfg( test) ]
0 commit comments