Skip to content

Commit 83c4981

Browse files
veluca93Amanieu
authored andcommitted
Document the layout of x86 SIMD types.
1 parent a3beb09 commit 83c4981

File tree

1 file changed

+45
-0
lines changed
  • crates/core_arch/src/x86

1 file changed

+45
-0
lines changed

crates/core_arch/src/x86/mod.rs

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ types! {
2828
/// internal bits differently, check the documentation of the intrinsic
2929
/// to see how it's being used.
3030
///
31+
/// The memory layout of this type (*not* the ABI!) is the same as the
32+
/// layout of the corresponding array type(s).
33+
///
3134
/// Note that this means that an instance of `__m128i` typically just means
3235
/// a "bag of bits" which is left up to interpretation at the point of use.
3336
///
@@ -66,6 +69,9 @@ types! {
6669
/// of `__m128` always corresponds to `f32x4`, or four `f32` types packed
6770
/// together.
6871
///
72+
/// The memory layout of this type (*not* the ABI!) is the same as the
73+
/// layout of the corresponding array type(s).
74+
///
6975
/// Most intrinsics using `__m128` are prefixed with `_mm_` and are
7076
/// suffixed with "ps" (or otherwise contain "ps"). Not to be confused with
7177
/// "pd" which is used for `__m128d`.
@@ -102,6 +108,9 @@ types! {
102108
/// of `__m128d` always corresponds to `f64x2`, or two `f64` types packed
103109
/// together.
104110
///
111+
/// The memory layout of this type (*not* the ABI!) is the same as the
112+
/// layout of the corresponding array type(s).
113+
///
105114
/// Most intrinsics using `__m128d` are prefixed with `_mm_` and are
106115
/// suffixed with "pd" (or otherwise contain "pd"). Not to be confused with
107116
/// "ps" which is used for `__m128`.
@@ -143,6 +152,9 @@ types! {
143152
/// internal bits differently, check the documentation of the intrinsic
144153
/// to see how it's being used.
145154
///
155+
/// The memory layout of this type (*not* the ABI!) is the same as the
156+
/// layout of the corresponding array type(s).
157+
///
146158
/// Note that this means that an instance of `__m256i` typically just means
147159
/// a "bag of bits" which is left up to interpretation at the point of use.
148160
///
@@ -178,6 +190,9 @@ types! {
178190
/// of `__m256` always corresponds to `f32x8`, or eight `f32` types packed
179191
/// together.
180192
///
193+
/// The memory layout of this type (*not* the ABI!) is the same as the
194+
/// layout of the corresponding array type(s).
195+
///
181196
/// Most intrinsics using `__m256` are prefixed with `_mm256_` and are
182197
/// suffixed with "ps" (or otherwise contain "ps"). Not to be confused with
183198
/// "pd" which is used for `__m256d`.
@@ -214,6 +229,9 @@ types! {
214229
/// of `__m256d` always corresponds to `f64x4`, or four `f64` types packed
215230
/// together.
216231
///
232+
/// The memory layout of this type (*not* the ABI!) is the same as the
233+
/// layout of the corresponding array type(s).
234+
///
217235
/// Most intrinsics using `__m256d` are prefixed with `_mm256_` and are
218236
/// suffixed with "pd" (or otherwise contain "pd"). Not to be confused with
219237
/// "ps" which is used for `__m256`.
@@ -259,6 +277,9 @@ types! {
259277
/// internal bits differently, check the documentation of the intrinsic
260278
/// to see how it's being used.
261279
///
280+
/// The memory layout of this type (*not* the ABI!) is the same as the
281+
/// layout of the corresponding array type(s).
282+
///
262283
/// Note that this means that an instance of `__m512i` typically just means
263284
/// a "bag of bits" which is left up to interpretation at the point of use.
264285
pub struct __m512i(8 x i64);
@@ -275,6 +296,9 @@ types! {
275296
/// of `__m512` always corresponds to `f32x16`, or sixteen `f32` types
276297
/// packed together.
277298
///
299+
/// The memory layout of this type (*not* the ABI!) is the same as the
300+
/// layout of the corresponding array type(s).
301+
///
278302
/// Most intrinsics using `__m512` are prefixed with `_mm512_` and are
279303
/// suffixed with "ps" (or otherwise contain "ps"). Not to be confused with
280304
/// "pd" which is used for `__m512d`.
@@ -292,6 +316,9 @@ types! {
292316
/// of `__m512d` always corresponds to `f64x4`, or eight `f64` types packed
293317
/// together.
294318
///
319+
/// The memory layout of this type (*not* the ABI!) is the same as the
320+
/// layout of the corresponding array type(s).
321+
///
295322
/// Most intrinsics using `__m512d` are prefixed with `_mm512_` and are
296323
/// suffixed with "pd" (or otherwise contain "pd"). Not to be confused with
297324
/// "ps" which is used for `__m512`.
@@ -306,6 +333,9 @@ types! {
306333
/// This type is representing a 128-bit SIMD register which internally is consisted of
307334
/// eight packed `u16` instances. Its purpose is for bf16 related intrinsic
308335
/// implementations.
336+
///
337+
/// The memory layout of this type (*not* the ABI!) is the same as the
338+
/// layout of the corresponding array type(s).
309339
pub struct __m128bh(8 x u16);
310340

311341
/// 256-bit wide set of 16 `u16` types, x86-specific
@@ -314,6 +344,9 @@ types! {
314344
/// representing a 256-bit SIMD register which internally is consisted of
315345
/// 16 packed `u16` instances. Its purpose is for bf16 related intrinsic
316346
/// implementations.
347+
///
348+
/// The memory layout of this type (*not* the ABI!) is the same as the
349+
/// layout of the corresponding array type(s).
317350
pub struct __m256bh(16 x u16);
318351

319352
/// 512-bit wide set of 32 `u16` types, x86-specific
@@ -322,6 +355,9 @@ types! {
322355
/// representing a 512-bit SIMD register which internally is consisted of
323356
/// 32 packed `u16` instances. Its purpose is for bf16 related intrinsic
324357
/// implementations.
358+
///
359+
/// The memory layout of this type (*not* the ABI!) is the same as the
360+
/// layout of the corresponding array type(s).
325361
pub struct __m512bh(32 x u16);
326362
}
327363

@@ -334,6 +370,9 @@ types! {
334370
/// representing a 128-bit SIMD register which internally is consisted of
335371
/// 8 packed `f16` instances. its purpose is for f16 related intrinsic
336372
/// implementations.
373+
///
374+
/// The memory layout of this type (*not* the ABI!) is the same as the
375+
/// layout of the corresponding array type(s).
337376
pub struct __m128h(8 x f16);
338377

339378
/// 256-bit wide set of 16 `f16` types, x86-specific
@@ -342,6 +381,9 @@ types! {
342381
/// representing a 256-bit SIMD register which internally is consisted of
343382
/// 16 packed `f16` instances. its purpose is for f16 related intrinsic
344383
/// implementations.
384+
///
385+
/// The memory layout of this type (*not* the ABI!) is the same as the
386+
/// layout of the corresponding array type(s).
345387
pub struct __m256h(16 x f16);
346388

347389
/// 512-bit wide set of 32 `f16` types, x86-specific
@@ -350,6 +392,9 @@ types! {
350392
/// representing a 512-bit SIMD register which internally is consisted of
351393
/// 32 packed `f16` instances. its purpose is for f16 related intrinsic
352394
/// implementations.
395+
///
396+
/// The memory layout of this type (*not* the ABI!) is the same as the
397+
/// layout of the corresponding array type(s).
353398
pub struct __m512h(32 x f16);
354399
}
355400

0 commit comments

Comments
 (0)