Skip to content

Commit bf687fa

Browse files
authored
Remove trailing semicolons from several macro definitions (rust-lang#938)
The x86 code contains several macros that following this pattern: ```rust macro_rules! expr { () => { true; } } fn bar(_val: bool) {} fn main() { bar(expr!()); } ``` Here, we have a macro `expr!` that expands to tokens sequence with a trailing semicolon. Currently, the trailing semicolon is ignored when the macro is invoked in expression position, due to rust-lang#33953 If this behavior is changed, then a large number of macro invocations in `stdarch` will stop compiling. Regardless of whether nor not this change is made, removing the semicolon more clearly expresses the intent of the code - these macros are designed to expand to the result of a function call, not ignore its results (as the `;` would suggest).
1 parent de6d3fc commit bf687fa

File tree

3 files changed

+32
-32
lines changed

3 files changed

+32
-32
lines changed

crates/core_arch/src/x86/avx.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ pub unsafe fn _mm256_shuffle_pd(a: __m256d, b: __m256d, imm8: i32) -> __m256d {
120120
let imm8 = (imm8 & 0xFF) as u8;
121121
macro_rules! shuffle4 {
122122
($a:expr, $b:expr, $c:expr, $d:expr) => {
123-
simd_shuffle4(a, b, [$a, $b, $c, $d]);
123+
simd_shuffle4(a, b, [$a, $b, $c, $d])
124124
};
125125
}
126126
macro_rules! shuffle3 {
@@ -175,7 +175,7 @@ pub unsafe fn _mm256_shuffle_ps(a: __m256, b: __m256, imm8: i32) -> __m256 {
175175
$g:expr,
176176
$h:expr
177177
) => {
178-
simd_shuffle8(a, b, [$a, $b, $c, $d, $e, $f, $g, $h]);
178+
simd_shuffle8(a, b, [$a, $b, $c, $d, $e, $f, $g, $h])
179179
};
180180
}
181181
macro_rules! shuffle3 {
@@ -532,7 +532,7 @@ pub unsafe fn _mm256_blend_pd(a: __m256d, b: __m256d, imm8: i32) -> __m256d {
532532
let imm8 = (imm8 & 0xFF) as u8;
533533
macro_rules! blend4 {
534534
($a:expr, $b:expr, $c:expr, $d:expr) => {
535-
simd_shuffle4(a, b, [$a, $b, $c, $d]);
535+
simd_shuffle4(a, b, [$a, $b, $c, $d])
536536
};
537537
}
538538
macro_rules! blend3 {
@@ -587,7 +587,7 @@ pub unsafe fn _mm256_blend_ps(a: __m256, b: __m256, imm8: i32) -> __m256 {
587587
$g:expr,
588588
$h:expr
589589
) => {
590-
simd_shuffle8(a, b, [$a, $b, $c, $d, $e, $f, $g, $h]);
590+
simd_shuffle8(a, b, [$a, $b, $c, $d, $e, $f, $g, $h])
591591
};
592592
}
593593
macro_rules! blend3 {
@@ -1324,7 +1324,7 @@ pub unsafe fn _mm256_permute_pd(a: __m256d, imm8: i32) -> __m256d {
13241324
let imm8 = (imm8 & 0xFF) as u8;
13251325
macro_rules! shuffle4 {
13261326
($a:expr, $b:expr, $c:expr, $d:expr) => {
1327-
simd_shuffle4(a, _mm256_undefined_pd(), [$a, $b, $c, $d]);
1327+
simd_shuffle4(a, _mm256_undefined_pd(), [$a, $b, $c, $d])
13281328
};
13291329
}
13301330
macro_rules! shuffle3 {
@@ -1370,7 +1370,7 @@ pub unsafe fn _mm_permute_pd(a: __m128d, imm8: i32) -> __m128d {
13701370
let imm8 = (imm8 & 0xFF) as u8;
13711371
macro_rules! shuffle2 {
13721372
($a:expr, $b:expr) => {
1373-
simd_shuffle2(a, _mm_undefined_pd(), [$a, $b]);
1373+
simd_shuffle2(a, _mm_undefined_pd(), [$a, $b])
13741374
};
13751375
}
13761376
macro_rules! shuffle1 {

crates/core_arch/src/x86/avx2.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ pub unsafe fn _mm_blend_epi32(a: __m128i, b: __m128i, imm8: i32) -> __m128i {
372372
let b = b.as_i32x4();
373373
macro_rules! blend2 {
374374
($a:expr, $b:expr, $c:expr, $d:expr) => {
375-
simd_shuffle4(a, b, [$a, $b, $c, $d]);
375+
simd_shuffle4(a, b, [$a, $b, $c, $d])
376376
};
377377
}
378378
macro_rules! blend1 {
@@ -417,7 +417,7 @@ pub unsafe fn _mm256_blend_epi32(a: __m256i, b: __m256i, imm8: i32) -> __m256i {
417417
$g:expr,
418418
$h:expr
419419
) => {
420-
simd_shuffle8(a, b, [$a, $b, $c, $d, $e, $f, $g, $h]);
420+
simd_shuffle8(a, b, [$a, $b, $c, $d, $e, $f, $g, $h])
421421
};
422422
}
423423
macro_rules! blend3 {
@@ -2443,7 +2443,7 @@ pub unsafe fn _mm256_permute4x64_epi64(a: __m256i, imm8: i32) -> __m256i {
24432443
let a = a.as_i64x4();
24442444
macro_rules! permute4 {
24452445
($a:expr, $b:expr, $c:expr, $d:expr) => {
2446-
simd_shuffle4(a, zero, [$a, $b, $c, $d]);
2446+
simd_shuffle4(a, zero, [$a, $b, $c, $d])
24472447
};
24482448
}
24492449
macro_rules! permute3 {
@@ -2746,7 +2746,7 @@ pub unsafe fn _mm256_shufflehi_epi16(a: __m256i, imm8: i32) -> __m256i {
27462746
simd_shuffle16(a, a, [
27472747
0, 1, 2, 3, 4+$x01, 4+$x23, 4+$x45, 4+$x67,
27482748
8, 9, 10, 11, 12+$x01, 12+$x23, 12+$x45, 12+$x67
2749-
]);
2749+
])
27502750
};
27512751
}
27522752
macro_rules! shuffle_x67 {
@@ -2807,7 +2807,7 @@ pub unsafe fn _mm256_shufflelo_epi16(a: __m256i, imm8: i32) -> __m256i {
28072807
simd_shuffle16(a, a, [
28082808
0+$x01, 0+$x23, 0+$x45, 0+$x67, 4, 5, 6, 7,
28092809
8+$x01, 8+$x23, 8+$x45, 8+$x67, 12, 13, 14, 15,
2810-
]);
2810+
])
28112811
};
28122812
}
28132813
macro_rules! shuffle_x67 {

crates/core_arch/src/x86/avx512f.rs

+21-21
Original file line numberDiff line numberDiff line change
@@ -11962,7 +11962,7 @@ pub unsafe fn _mm512_shuffle_epi32(a: __m512i, imm8: _MM_PERM_ENUM) -> __m512i {
1196211962
[
1196311963
$a, $b, $c, $d, $e, $f, $g, $h, $i, $j, $k, $l, $m, $n, $o, $p,
1196411964
],
11965-
);
11965+
)
1196611966
};
1196711967
}
1196811968
macro_rules! shuffle3 {
@@ -12045,7 +12045,7 @@ pub unsafe fn _mm512_mask_shuffle_epi32(
1204512045
[
1204612046
$a, $b, $c, $d, $e, $f, $g, $h, $i, $j, $k, $l, $m, $n, $o, $p,
1204712047
],
12048-
);
12048+
)
1204912049
};
1205012050
}
1205112051
macro_rules! shuffle3 {
@@ -12123,7 +12123,7 @@ pub unsafe fn _mm512_maskz_shuffle_epi32(k: __mmask16, a: __m512i, imm8: _MM_PER
1212312123
[
1212412124
$a, $b, $c, $d, $e, $f, $g, $h, $i, $j, $k, $l, $m, $n, $o, $p,
1212512125
],
12126-
);
12126+
)
1212712127
};
1212812128
}
1212912129
macro_rules! shuffle3 {
@@ -12201,7 +12201,7 @@ pub unsafe fn _mm512_shuffle_ps(a: __m512, b: __m512, imm8: i32) -> __m512 {
1220112201
[
1220212202
$a, $b, $c, $d, $e, $f, $g, $h, $i, $j, $k, $l, $m, $n, $o, $p,
1220312203
],
12204-
);
12204+
)
1220512205
};
1220612206
}
1220712207
macro_rules! shuffle3 {
@@ -12283,7 +12283,7 @@ pub unsafe fn _mm512_mask_shuffle_ps(
1228312283
[
1228412284
$a, $b, $c, $d, $e, $f, $g, $h, $i, $j, $k, $l, $m, $n, $o, $p,
1228512285
],
12286-
);
12286+
)
1228712287
};
1228812288
}
1228912289
macro_rules! shuffle3 {
@@ -12361,7 +12361,7 @@ pub unsafe fn _mm512_maskz_shuffle_ps(k: __mmask16, a: __m512, b: __m512, imm8:
1236112361
[
1236212362
$a, $b, $c, $d, $e, $f, $g, $h, $i, $j, $k, $l, $m, $n, $o, $p,
1236312363
],
12364-
);
12364+
)
1236512365
};
1236612366
}
1236712367
macro_rules! shuffle3 {
@@ -12417,7 +12417,7 @@ pub unsafe fn _mm512_shuffle_pd(a: __m512d, b: __m512d, imm8: i32) -> __m512d {
1241712417
let imm8 = (imm8 & 0xFF) as u8;
1241812418
macro_rules! shuffle8 {
1241912419
($a:expr, $b:expr, $c:expr, $d:expr, $e:expr, $f:expr, $g:expr, $h:expr) => {
12420-
simd_shuffle8(a, b, [$a, $b, $c, $d, $e, $f, $g, $h]);
12420+
simd_shuffle8(a, b, [$a, $b, $c, $d, $e, $f, $g, $h])
1242112421
};
1242212422
}
1242312423
macro_rules! shuffle7 {
@@ -12500,7 +12500,7 @@ pub unsafe fn _mm512_mask_shuffle_pd(
1250012500
let imm8 = (imm8 & 0xFF) as u8;
1250112501
macro_rules! shuffle8 {
1250212502
($a:expr, $b:expr, $c:expr, $d:expr, $e:expr, $f:expr, $g:expr, $h:expr) => {
12503-
simd_shuffle8(a, b, [$a, $b, $c, $d, $e, $f, $g, $h]);
12503+
simd_shuffle8(a, b, [$a, $b, $c, $d, $e, $f, $g, $h])
1250412504
};
1250512505
}
1250612506
macro_rules! shuffle7 {
@@ -12579,7 +12579,7 @@ pub unsafe fn _mm512_maskz_shuffle_pd(k: __mmask8, a: __m512d, b: __m512d, imm8:
1257912579
let imm8 = (imm8 & 0xFF) as u8;
1258012580
macro_rules! shuffle8 {
1258112581
($a:expr, $b:expr, $c:expr, $d:expr, $e:expr, $f:expr, $g:expr, $h:expr) => {
12582-
simd_shuffle8(a, b, [$a, $b, $c, $d, $e, $f, $g, $h]);
12582+
simd_shuffle8(a, b, [$a, $b, $c, $d, $e, $f, $g, $h])
1258312583
};
1258412584
}
1258512585
macro_rules! shuffle7 {
@@ -12684,7 +12684,7 @@ pub unsafe fn _mm512_shuffle_i32x4(a: __m512i, b: __m512i, imm8: i32) -> __m512i
1268412684
[
1268512685
$a, $b, $c, $d, $e, $f, $g, $h, $i, $j, $k, $l, $m, $n, $o, $p,
1268612686
],
12687-
);
12687+
)
1268812688
};
1268912689
}
1269012690
macro_rules! shuffle3 {
@@ -12770,7 +12770,7 @@ pub unsafe fn _mm512_mask_shuffle_i32x4(
1277012770
[
1277112771
$a, $b, $c, $d, $e, $f, $g, $h, $i, $j, $k, $l, $m, $n, $o, $p,
1277212772
],
12773-
);
12773+
)
1277412774
};
1277512775
}
1277612776
macro_rules! shuffle3 {
@@ -12855,7 +12855,7 @@ pub unsafe fn _mm512_maskz_shuffle_i32x4(
1285512855
[
1285612856
$a, $b, $c, $d, $e, $f, $g, $h, $i, $j, $k, $l, $m, $n, $o, $p,
1285712857
],
12858-
);
12858+
)
1285912859
};
1286012860
}
1286112861
macro_rules! shuffle3 {
@@ -12920,7 +12920,7 @@ pub unsafe fn _mm512_shuffle_i64x2(a: __m512i, b: __m512i, imm8: i32) -> __m512i
1292012920
$g:expr,
1292112921
$h:expr
1292212922
) => {
12923-
simd_shuffle8(a, b, [$a, $b, $c, $d, $e, $f, $g, $h]);
12923+
simd_shuffle8(a, b, [$a, $b, $c, $d, $e, $f, $g, $h])
1292412924
};
1292512925
}
1292612926
macro_rules! shuffle3 {
@@ -12988,7 +12988,7 @@ pub unsafe fn _mm512_mask_shuffle_i64x2(
1298812988
$g:expr,
1298912989
$h:expr
1299012990
) => {
12991-
simd_shuffle8(a, b, [$a, $b, $c, $d, $e, $f, $g, $h]);
12991+
simd_shuffle8(a, b, [$a, $b, $c, $d, $e, $f, $g, $h])
1299212992
};
1299312993
}
1299412994
macro_rules! shuffle3 {
@@ -13057,7 +13057,7 @@ pub unsafe fn _mm512_maskz_shuffle_i64x2(
1305713057
$g:expr,
1305813058
$h:expr
1305913059
) => {
13060-
simd_shuffle8(a, b, [$a, $b, $c, $d, $e, $f, $g, $h]);
13060+
simd_shuffle8(a, b, [$a, $b, $c, $d, $e, $f, $g, $h])
1306113061
};
1306213062
}
1306313063
macro_rules! shuffle3 {
@@ -13136,7 +13136,7 @@ pub unsafe fn _mm512_shuffle_f32x4(a: __m512, b: __m512, imm8: i32) -> __m512 {
1313613136
[
1313713137
$a, $b, $c, $d, $e, $f, $g, $h, $i, $j, $k, $l, $m, $n, $o, $p,
1313813138
],
13139-
);
13139+
)
1314013140
};
1314113141
}
1314213142
macro_rules! shuffle3 {
@@ -13218,7 +13218,7 @@ pub unsafe fn _mm512_mask_shuffle_f32x4(
1321813218
[
1321913219
$a, $b, $c, $d, $e, $f, $g, $h, $i, $j, $k, $l, $m, $n, $o, $p,
1322013220
],
13221-
);
13221+
)
1322213222
};
1322313223
}
1322413224
macro_rules! shuffle3 {
@@ -13296,7 +13296,7 @@ pub unsafe fn _mm512_maskz_shuffle_f32x4(k: __mmask16, a: __m512, b: __m512, imm
1329613296
[
1329713297
$a, $b, $c, $d, $e, $f, $g, $h, $i, $j, $k, $l, $m, $n, $o, $p,
1329813298
],
13299-
);
13299+
)
1330013300
};
1330113301
}
1330213302
macro_rules! shuffle3 {
@@ -13361,7 +13361,7 @@ pub unsafe fn _mm512_shuffle_f64x2(a: __m512d, b: __m512d, imm8: i32) -> __m512d
1336113361
$g:expr,
1336213362
$h:expr
1336313363
) => {
13364-
simd_shuffle8(a, b, [$a, $b, $c, $d, $e, $f, $g, $h]);
13364+
simd_shuffle8(a, b, [$a, $b, $c, $d, $e, $f, $g, $h])
1336513365
};
1336613366
}
1336713367
macro_rules! shuffle3 {
@@ -13429,7 +13429,7 @@ pub unsafe fn _mm512_mask_shuffle_f64x2(
1342913429
$g:expr,
1343013430
$h:expr
1343113431
) => {
13432-
simd_shuffle8(a, b, [$a, $b, $c, $d, $e, $f, $g, $h]);
13432+
simd_shuffle8(a, b, [$a, $b, $c, $d, $e, $f, $g, $h])
1343313433
};
1343413434
}
1343513435
macro_rules! shuffle3 {
@@ -13498,7 +13498,7 @@ pub unsafe fn _mm512_maskz_shuffle_f64x2(
1349813498
$g:expr,
1349913499
$h:expr
1350013500
) => {
13501-
simd_shuffle8(a, b, [$a, $b, $c, $d, $e, $f, $g, $h]);
13501+
simd_shuffle8(a, b, [$a, $b, $c, $d, $e, $f, $g, $h])
1350213502
};
1350313503
}
1350413504
macro_rules! shuffle3 {

0 commit comments

Comments
 (0)