Skip to content

Commit 22af7b2

Browse files
committed
Formatting
1 parent 3b225f5 commit 22af7b2

File tree

2 files changed

+71
-63
lines changed

2 files changed

+71
-63
lines changed

src/lib.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,7 @@ mod v16 {
194194
define_ty! { u8x2, u8, u8 }
195195
define_impl! { u8x2, u8, 2, i8x2, x0, x1 }
196196

197-
define_casts!(
198-
(i8x2, i64x2, as_i64x2),
199-
(u8x2, i64x2, as_i64x2)
200-
);
197+
define_casts!((i8x2, i64x2, as_i64x2), (u8x2, i64x2, as_i64x2));
201198
}
202199

203200
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]

src/x86/sse41.rs

+70-59
Original file line numberDiff line numberDiff line change
@@ -334,44 +334,49 @@ pub unsafe fn _mm_cvtepu8_epi64(a: u8x16) -> i64x2 {
334334
simd_shuffle2::<_, ::v16::u8x2>(a, a, [0, 1]).as_i64x2()
335335
}
336336

337-
/// Zero extend packed unsigned 16-bit integers in `a` to packed 32-bit integers
337+
/// Zero extend packed unsigned 16-bit integers in `a`
338+
/// to packed 32-bit integers
338339
#[inline(always)]
339340
#[target_feature = "+sse4.1"]
340341
#[cfg_attr(test, assert_instr(pmovzxwd))]
341342
pub unsafe fn _mm_cvtepu16_epi32(a: u16x8) -> i32x4 {
342343
simd_shuffle4::<_, ::v64::u16x4>(a, a, [0, 1, 2, 3]).as_i32x4()
343344
}
344345

345-
/// Zero extend packed unsigned 16-bit integers in `a` to packed 64-bit integers
346+
/// Zero extend packed unsigned 16-bit integers in `a`
347+
/// to packed 64-bit integers
346348
#[inline(always)]
347349
#[target_feature = "+sse4.1"]
348350
#[cfg_attr(test, assert_instr(pmovzxwq))]
349351
pub unsafe fn _mm_cvtepu16_epi64(a: u16x8) -> i64x2 {
350352
simd_shuffle2::<_, ::v32::u16x2>(a, a, [0, 1]).as_i64x2()
351353
}
352354

353-
/// Zero extend packed unsigned 32-bit integers in `a` to packed 64-bit integers
355+
/// Zero extend packed unsigned 32-bit integers in `a`
356+
/// to packed 64-bit integers
354357
#[inline(always)]
355358
#[target_feature = "+sse4.1"]
356359
#[cfg_attr(test, assert_instr(pmovzxdq))]
357360
pub unsafe fn _mm_cvtepu32_epi64(a: u32x4) -> i64x2 {
358361
simd_shuffle2::<_, ::v64::u32x2>(a, a, [0, 1]).as_i64x2()
359362
}
360363

361-
/// Multiply the low 32-bit integers from each packed 64-bit element in `a` and `b`
364+
/// Multiply the low 32-bit integers from each packed 64-bit
365+
/// element in `a` and `b`
362366
#[inline(always)]
363367
#[target_feature = "+sse4.1"]
364368
#[cfg_attr(test, assert_instr(pmuldq))]
365-
pub unsafe fn _mm_mul_epi32(a: i32x4, b:i32x4) -> i64x2 {
369+
pub unsafe fn _mm_mul_epi32(a: i32x4, b: i32x4) -> i64x2 {
366370
pmuldq(a, b)
367371
}
368372

369-
/// Multiply the packed 32-bit integers in `a` and `b`, producing intermediate 64-bit integers,
370-
/// and return the low 32 bits of the intermediate integers.
373+
/// Multiply the packed 32-bit integers in `a` and `b`,
374+
/// producing intermediate 64-bit integers, and return
375+
/// the low 32 bits of the intermediate integers.
371376
#[inline(always)]
372377
#[target_feature = "+sse4.1"]
373378
#[cfg_attr(test, assert_instr(pmulld))]
374-
pub unsafe fn _mm_mullo_epi32 (a: i32x4, b:i32x4) -> i32x4 {
379+
pub unsafe fn _mm_mullo_epi32(a: i32x4, b: i32x4) -> i32x4 {
375380
a * b
376381
}
377382

@@ -381,7 +386,8 @@ pub unsafe fn _mm_mullo_epi32 (a: i32x4, b:i32x4) -> i32x4 {
381386
/// Arguments:
382387
///
383388
/// * `a` - A 128-bit integer vector containing the bits to be tested.
384-
/// * `mask` - A 128-bit integer vector selecting which bits to test in operand `a`.
389+
/// * `mask` - A 128-bit integer vector selecting which bits to test in
390+
/// operand `a`.
385391
///
386392
/// Returns:
387393
///
@@ -400,7 +406,8 @@ pub unsafe fn _mm_testz_si128(a: __m128i, mask: __m128i) -> i32 {
400406
/// Arguments:
401407
///
402408
/// * `a` - A 128-bit integer vector containing the bits to be tested.
403-
/// * `mask` - A 128-bit integer vector selecting which bits to test in operand `a`.
409+
/// * `mask` - A 128-bit integer vector selecting which bits to test in
410+
/// operand `a`.
404411
///
405412
/// Returns:
406413
///
@@ -419,7 +426,8 @@ pub unsafe fn _mm_testc_si128(a: __m128i, mask: __m128i) -> i32 {
419426
/// Arguments:
420427
///
421428
/// * `a` - A 128-bit integer vector containing the bits to be tested.
422-
/// * `mask` - A 128-bit integer vector selecting which bits to test in operand `a`.
429+
/// * `mask` - A 128-bit integer vector selecting which bits to test in
430+
/// operand `a`.
423431
///
424432
/// Returns:
425433
///
@@ -438,7 +446,8 @@ pub unsafe fn _mm_testnzc_si128(a: __m128i, mask: __m128i) -> i32 {
438446
/// Arguments:
439447
///
440448
/// * `a` - A 128-bit integer vector containing the bits to be tested.
441-
/// * `mask` - A 128-bit integer vector selecting which bits to test in operand `a`.
449+
/// * `mask` - A 128-bit integer vector selecting which bits to test in
450+
/// operand `a`.
442451
///
443452
/// Returns:
444453
///
@@ -476,7 +485,8 @@ pub unsafe fn _mm_test_all_ones(a: __m128i) -> i32 {
476485
/// Arguments:
477486
///
478487
/// * `a` - A 128-bit integer vector containing the bits to be tested.
479-
/// * `mask` - A 128-bit integer vector selecting which bits to test in operand `a`.
488+
/// * `mask` - A 128-bit integer vector selecting which bits to test in
489+
/// operand `a`.
480490
///
481491
/// Returns:
482492
///
@@ -758,7 +768,7 @@ pub unsafe fn _mm_minpos_epu16(a: u16x8) -> u16x8 {
758768
/// fields in the immediate operand.
759769
///
760770
/// The following algorithm is performed:
761-
///
771+
///
762772
/// ```ignore
763773
/// i = imm8[2] * 4
764774
/// j = imm8[1:0] * 4
@@ -769,13 +779,13 @@ pub unsafe fn _mm_minpos_epu16(a: u16x8) -> u16x8 {
769779
/// d3 = abs(a[i + k + 3] - b[j + 3])
770780
/// r[k] = d0 + d1 + d2 + d3
771781
/// ```
772-
///
782+
///
773783
/// Arguments:
774784
///
775785
/// * `a` - A 128-bit vector of type `i8x16`.
776786
/// * `b` - A 128-bit vector of type `i8x16`.
777-
/// * `imm8` - An 8-bit immediate operand specifying how the absolute differences are to
778-
/// be calculated
787+
/// * `imm8` - An 8-bit immediate operand specifying how the absolute
788+
/// differences are to be calculated
779789
/// * Bit `[2]` specify the offset for operand `a`
780790
/// * Bits `[1:0]` specify the offset for operand `b`
781791
///
@@ -785,7 +795,7 @@ pub unsafe fn _mm_minpos_epu16(a: u16x8) -> u16x8 {
785795
/// absolute differences between both operands.
786796
#[inline(always)]
787797
#[target_feature = "+sse4.1"]
788-
#[cfg_attr(test, assert_instr(mpsadbw, imm8=0))]
798+
#[cfg_attr(test, assert_instr(mpsadbw, imm8 = 0))]
789799
pub unsafe fn _mm_mpsadbw_epu8(a: u8x16, b: u8x16, imm8: u8) -> u16x8 {
790800
macro_rules! call {
791801
($imm8:expr) => { mpsadbw(a, b, $imm8) }
@@ -1130,7 +1140,7 @@ mod tests {
11301140
let r = sse41::_mm_cvtepi32_epi64(a);
11311141
let e = i64x2::splat(10);
11321142
assert_eq!(r, e);
1133-
let a = i32x4::splat(-10);
1143+
let a = i32x4::splat(-10);
11341144
let r = sse41::_mm_cvtepi32_epi64(a);
11351145
let e = i64x2::splat(-10);
11361146
assert_eq!(r, e);
@@ -1204,99 +1214,99 @@ mod tests {
12041214

12051215
#[simd_test = "sse4.1"]
12061216
unsafe fn _mm_testz_si128() {
1207-
let a = __m128i::splat(1);
1217+
let a = __m128i::splat(1);
12081218
let mask = __m128i::splat(0);
1209-
let r = sse41::_mm_testz_si128(a, mask);
1219+
let r = sse41::_mm_testz_si128(a, mask);
12101220
assert_eq!(r, 1);
1211-
let a = __m128i::splat(0b101);
1221+
let a = __m128i::splat(0b101);
12121222
let mask = __m128i::splat(0b110);
1213-
let r = sse41::_mm_testz_si128(a, mask);
1223+
let r = sse41::_mm_testz_si128(a, mask);
12141224
assert_eq!(r, 0);
1215-
let a = __m128i::splat(0b011);
1225+
let a = __m128i::splat(0b011);
12161226
let mask = __m128i::splat(0b100);
1217-
let r = sse41::_mm_testz_si128(a, mask);
1227+
let r = sse41::_mm_testz_si128(a, mask);
12181228
assert_eq!(r, 1);
12191229
}
12201230

12211231
#[simd_test = "sse4.1"]
12221232
unsafe fn _mm_testc_si128() {
1223-
let a = __m128i::splat(-1);
1233+
let a = __m128i::splat(-1);
12241234
let mask = __m128i::splat(0);
1225-
let r = sse41::_mm_testc_si128(a, mask);
1235+
let r = sse41::_mm_testc_si128(a, mask);
12261236
assert_eq!(r, 1);
1227-
let a = __m128i::splat(0b101);
1237+
let a = __m128i::splat(0b101);
12281238
let mask = __m128i::splat(0b110);
1229-
let r = sse41::_mm_testc_si128(a, mask);
1239+
let r = sse41::_mm_testc_si128(a, mask);
12301240
assert_eq!(r, 0);
1231-
let a = __m128i::splat(0b101);
1241+
let a = __m128i::splat(0b101);
12321242
let mask = __m128i::splat(0b100);
1233-
let r = sse41::_mm_testc_si128(a, mask);
1243+
let r = sse41::_mm_testc_si128(a, mask);
12341244
assert_eq!(r, 1);
12351245
}
12361246

12371247
#[simd_test = "sse4.1"]
12381248
unsafe fn _mm_testnzc_si128() {
1239-
let a = __m128i::splat(0);
1249+
let a = __m128i::splat(0);
12401250
let mask = __m128i::splat(1);
1241-
let r = sse41::_mm_testnzc_si128(a, mask);
1251+
let r = sse41::_mm_testnzc_si128(a, mask);
12421252
assert_eq!(r, 0);
1243-
let a = __m128i::splat(-1);
1253+
let a = __m128i::splat(-1);
12441254
let mask = __m128i::splat(0);
1245-
let r = sse41::_mm_testnzc_si128(a, mask);
1255+
let r = sse41::_mm_testnzc_si128(a, mask);
12461256
assert_eq!(r, 0);
1247-
let a = __m128i::splat(0b101);
1257+
let a = __m128i::splat(0b101);
12481258
let mask = __m128i::splat(0b110);
1249-
let r = sse41::_mm_testnzc_si128(a, mask);
1259+
let r = sse41::_mm_testnzc_si128(a, mask);
12501260
assert_eq!(r, 1);
1251-
let a = __m128i::splat(0b101);
1261+
let a = __m128i::splat(0b101);
12521262
let mask = __m128i::splat(0b101);
1253-
let r = sse41::_mm_testnzc_si128(a, mask);
1263+
let r = sse41::_mm_testnzc_si128(a, mask);
12541264
assert_eq!(r, 0);
12551265
}
12561266

12571267
#[simd_test = "sse4.1"]
12581268
unsafe fn _mm_test_all_zeros() {
1259-
let a = __m128i::splat(1);
1269+
let a = __m128i::splat(1);
12601270
let mask = __m128i::splat(0);
1261-
let r = sse41::_mm_test_all_zeros(a, mask);
1271+
let r = sse41::_mm_test_all_zeros(a, mask);
12621272
assert_eq!(r, 1);
1263-
let a = __m128i::splat(0b101);
1273+
let a = __m128i::splat(0b101);
12641274
let mask = __m128i::splat(0b110);
1265-
let r = sse41::_mm_test_all_zeros(a, mask);
1275+
let r = sse41::_mm_test_all_zeros(a, mask);
12661276
assert_eq!(r, 0);
1267-
let a = __m128i::splat(0b011);
1277+
let a = __m128i::splat(0b011);
12681278
let mask = __m128i::splat(0b100);
1269-
let r = sse41::_mm_test_all_zeros(a, mask);
1279+
let r = sse41::_mm_test_all_zeros(a, mask);
12701280
assert_eq!(r, 1);
12711281
}
12721282

12731283
#[simd_test = "sse4.1"]
12741284
unsafe fn _mm_test_all_ones() {
1275-
let a = __m128i::splat(-1);
1276-
let r = sse41::_mm_test_all_ones(a);
1285+
let a = __m128i::splat(-1);
1286+
let r = sse41::_mm_test_all_ones(a);
12771287
assert_eq!(r, 1);
1278-
let a = __m128i::splat(0b101);
1279-
let r = sse41::_mm_test_all_ones(a);
1288+
let a = __m128i::splat(0b101);
1289+
let r = sse41::_mm_test_all_ones(a);
12801290
assert_eq!(r, 0);
12811291
}
12821292

12831293
#[simd_test = "sse4.1"]
12841294
unsafe fn _mm_test_mix_ones_zeros() {
1285-
let a = __m128i::splat(0);
1295+
let a = __m128i::splat(0);
12861296
let mask = __m128i::splat(1);
1287-
let r = sse41::_mm_test_mix_ones_zeros(a, mask);
1297+
let r = sse41::_mm_test_mix_ones_zeros(a, mask);
12881298
assert_eq!(r, 0);
1289-
let a = __m128i::splat(-1);
1299+
let a = __m128i::splat(-1);
12901300
let mask = __m128i::splat(0);
1291-
let r = sse41::_mm_test_mix_ones_zeros(a, mask);
1301+
let r = sse41::_mm_test_mix_ones_zeros(a, mask);
12921302
assert_eq!(r, 0);
1293-
let a = __m128i::splat(0b101);
1303+
let a = __m128i::splat(0b101);
12941304
let mask = __m128i::splat(0b110);
1295-
let r = sse41::_mm_test_mix_ones_zeros(a, mask);
1305+
let r = sse41::_mm_test_mix_ones_zeros(a, mask);
12961306
assert_eq!(r, 1);
1297-
let a = __m128i::splat(0b101);
1307+
let a = __m128i::splat(0b101);
12981308
let mask = __m128i::splat(0b101);
1299-
let r = sse41::_mm_test_mix_ones_zeros(a, mask);
1309+
let r = sse41::_mm_test_mix_ones_zeros(a, mask);
13001310
assert_eq!(r, 0);
13011311
}
13021312

@@ -1436,7 +1446,8 @@ mod tests {
14361446

14371447
#[simd_test = "sse4.1"]
14381448
unsafe fn _mm_mpsadbw_epu8() {
1439-
let a = u8x16::new(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
1449+
let a =
1450+
u8x16::new(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
14401451

14411452
let r = sse41::_mm_mpsadbw_epu8(a, a, 0b000);
14421453
let e = u16x8::new(0, 4, 8, 12, 16, 20, 24, 28);
@@ -1445,7 +1456,7 @@ mod tests {
14451456
let r = sse41::_mm_mpsadbw_epu8(a, a, 0b001);
14461457
let e = u16x8::new(16, 12, 8, 4, 0, 4, 8, 12);
14471458
assert_eq!(r, e);
1448-
1459+
14491460
let r = sse41::_mm_mpsadbw_epu8(a, a, 0b100);
14501461
let e = u16x8::new(16, 20, 24, 28, 32, 36, 40, 44);
14511462
assert_eq!(r, e);

0 commit comments

Comments
 (0)