Skip to content

Commit 6904911

Browse files
committed
Remove trailing semicolons from several macro definitions
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/rust#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 3c36643 commit 6904911

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
@@ -8543,7 +8543,7 @@ pub unsafe fn _mm512_shuffle_epi32(a: __m512i, imm8: _MM_PERM_ENUM) -> __m512i {
85438543
[
85448544
$a, $b, $c, $d, $e, $f, $g, $h, $i, $j, $k, $l, $m, $n, $o, $p,
85458545
],
8546-
);
8546+
)
85478547
};
85488548
}
85498549
macro_rules! shuffle3 {
@@ -8626,7 +8626,7 @@ pub unsafe fn _mm512_mask_shuffle_epi32(
86268626
[
86278627
$a, $b, $c, $d, $e, $f, $g, $h, $i, $j, $k, $l, $m, $n, $o, $p,
86288628
],
8629-
);
8629+
)
86308630
};
86318631
}
86328632
macro_rules! shuffle3 {
@@ -8704,7 +8704,7 @@ pub unsafe fn _mm512_maskz_shuffle_epi32(k: __mmask16, a: __m512i, imm8: _MM_PER
87048704
[
87058705
$a, $b, $c, $d, $e, $f, $g, $h, $i, $j, $k, $l, $m, $n, $o, $p,
87068706
],
8707-
);
8707+
)
87088708
};
87098709
}
87108710
macro_rules! shuffle3 {
@@ -8782,7 +8782,7 @@ pub unsafe fn _mm512_shuffle_ps(a: __m512, b: __m512, imm8: i32) -> __m512 {
87828782
[
87838783
$a, $b, $c, $d, $e, $f, $g, $h, $i, $j, $k, $l, $m, $n, $o, $p,
87848784
],
8785-
);
8785+
)
87868786
};
87878787
}
87888788
macro_rules! shuffle3 {
@@ -8864,7 +8864,7 @@ pub unsafe fn _mm512_mask_shuffle_ps(
88648864
[
88658865
$a, $b, $c, $d, $e, $f, $g, $h, $i, $j, $k, $l, $m, $n, $o, $p,
88668866
],
8867-
);
8867+
)
88688868
};
88698869
}
88708870
macro_rules! shuffle3 {
@@ -8942,7 +8942,7 @@ pub unsafe fn _mm512_maskz_shuffle_ps(k: __mmask16, a: __m512, b: __m512, imm8:
89428942
[
89438943
$a, $b, $c, $d, $e, $f, $g, $h, $i, $j, $k, $l, $m, $n, $o, $p,
89448944
],
8945-
);
8945+
)
89468946
};
89478947
}
89488948
macro_rules! shuffle3 {
@@ -8998,7 +8998,7 @@ pub unsafe fn _mm512_shuffle_pd(a: __m512d, b: __m512d, imm8: i32) -> __m512d {
89988998
let imm8 = (imm8 & 0xFF) as u8;
89998999
macro_rules! shuffle8 {
90009000
($a:expr, $b:expr, $c:expr, $d:expr, $e:expr, $f:expr, $g:expr, $h:expr) => {
9001-
simd_shuffle8(a, b, [$a, $b, $c, $d, $e, $f, $g, $h]);
9001+
simd_shuffle8(a, b, [$a, $b, $c, $d, $e, $f, $g, $h])
90029002
};
90039003
}
90049004
macro_rules! shuffle7 {
@@ -9081,7 +9081,7 @@ pub unsafe fn _mm512_mask_shuffle_pd(
90819081
let imm8 = (imm8 & 0xFF) as u8;
90829082
macro_rules! shuffle8 {
90839083
($a:expr, $b:expr, $c:expr, $d:expr, $e:expr, $f:expr, $g:expr, $h:expr) => {
9084-
simd_shuffle8(a, b, [$a, $b, $c, $d, $e, $f, $g, $h]);
9084+
simd_shuffle8(a, b, [$a, $b, $c, $d, $e, $f, $g, $h])
90859085
};
90869086
}
90879087
macro_rules! shuffle7 {
@@ -9160,7 +9160,7 @@ pub unsafe fn _mm512_maskz_shuffle_pd(k: __mmask8, a: __m512d, b: __m512d, imm8:
91609160
let imm8 = (imm8 & 0xFF) as u8;
91619161
macro_rules! shuffle8 {
91629162
($a:expr, $b:expr, $c:expr, $d:expr, $e:expr, $f:expr, $g:expr, $h:expr) => {
9163-
simd_shuffle8(a, b, [$a, $b, $c, $d, $e, $f, $g, $h]);
9163+
simd_shuffle8(a, b, [$a, $b, $c, $d, $e, $f, $g, $h])
91649164
};
91659165
}
91669166
macro_rules! shuffle7 {
@@ -9265,7 +9265,7 @@ pub unsafe fn _mm512_shuffle_i32x4(a: __m512i, b: __m512i, imm8: i32) -> __m512i
92659265
[
92669266
$a, $b, $c, $d, $e, $f, $g, $h, $i, $j, $k, $l, $m, $n, $o, $p,
92679267
],
9268-
);
9268+
)
92699269
};
92709270
}
92719271
macro_rules! shuffle3 {
@@ -9351,7 +9351,7 @@ pub unsafe fn _mm512_mask_shuffle_i32x4(
93519351
[
93529352
$a, $b, $c, $d, $e, $f, $g, $h, $i, $j, $k, $l, $m, $n, $o, $p,
93539353
],
9354-
);
9354+
)
93559355
};
93569356
}
93579357
macro_rules! shuffle3 {
@@ -9436,7 +9436,7 @@ pub unsafe fn _mm512_maskz_shuffle_i32x4(
94369436
[
94379437
$a, $b, $c, $d, $e, $f, $g, $h, $i, $j, $k, $l, $m, $n, $o, $p,
94389438
],
9439-
);
9439+
)
94409440
};
94419441
}
94429442
macro_rules! shuffle3 {
@@ -9501,7 +9501,7 @@ pub unsafe fn _mm512_shuffle_i64x2(a: __m512i, b: __m512i, imm8: i32) -> __m512i
95019501
$g:expr,
95029502
$h:expr
95039503
) => {
9504-
simd_shuffle8(a, b, [$a, $b, $c, $d, $e, $f, $g, $h]);
9504+
simd_shuffle8(a, b, [$a, $b, $c, $d, $e, $f, $g, $h])
95059505
};
95069506
}
95079507
macro_rules! shuffle3 {
@@ -9569,7 +9569,7 @@ pub unsafe fn _mm512_mask_shuffle_i64x2(
95699569
$g:expr,
95709570
$h:expr
95719571
) => {
9572-
simd_shuffle8(a, b, [$a, $b, $c, $d, $e, $f, $g, $h]);
9572+
simd_shuffle8(a, b, [$a, $b, $c, $d, $e, $f, $g, $h])
95739573
};
95749574
}
95759575
macro_rules! shuffle3 {
@@ -9638,7 +9638,7 @@ pub unsafe fn _mm512_maskz_shuffle_i64x2(
96389638
$g:expr,
96399639
$h:expr
96409640
) => {
9641-
simd_shuffle8(a, b, [$a, $b, $c, $d, $e, $f, $g, $h]);
9641+
simd_shuffle8(a, b, [$a, $b, $c, $d, $e, $f, $g, $h])
96429642
};
96439643
}
96449644
macro_rules! shuffle3 {
@@ -9717,7 +9717,7 @@ pub unsafe fn _mm512_shuffle_f32x4(a: __m512, b: __m512, imm8: i32) -> __m512 {
97179717
[
97189718
$a, $b, $c, $d, $e, $f, $g, $h, $i, $j, $k, $l, $m, $n, $o, $p,
97199719
],
9720-
);
9720+
)
97219721
};
97229722
}
97239723
macro_rules! shuffle3 {
@@ -9799,7 +9799,7 @@ pub unsafe fn _mm512_mask_shuffle_f32x4(
97999799
[
98009800
$a, $b, $c, $d, $e, $f, $g, $h, $i, $j, $k, $l, $m, $n, $o, $p,
98019801
],
9802-
);
9802+
)
98039803
};
98049804
}
98059805
macro_rules! shuffle3 {
@@ -9877,7 +9877,7 @@ pub unsafe fn _mm512_maskz_shuffle_f32x4(k: __mmask16, a: __m512, b: __m512, imm
98779877
[
98789878
$a, $b, $c, $d, $e, $f, $g, $h, $i, $j, $k, $l, $m, $n, $o, $p,
98799879
],
9880-
);
9880+
)
98819881
};
98829882
}
98839883
macro_rules! shuffle3 {
@@ -9942,7 +9942,7 @@ pub unsafe fn _mm512_shuffle_f64x2(a: __m512d, b: __m512d, imm8: i32) -> __m512d
99429942
$g:expr,
99439943
$h:expr
99449944
) => {
9945-
simd_shuffle8(a, b, [$a, $b, $c, $d, $e, $f, $g, $h]);
9945+
simd_shuffle8(a, b, [$a, $b, $c, $d, $e, $f, $g, $h])
99469946
};
99479947
}
99489948
macro_rules! shuffle3 {
@@ -10010,7 +10010,7 @@ pub unsafe fn _mm512_mask_shuffle_f64x2(
1001010010
$g:expr,
1001110011
$h:expr
1001210012
) => {
10013-
simd_shuffle8(a, b, [$a, $b, $c, $d, $e, $f, $g, $h]);
10013+
simd_shuffle8(a, b, [$a, $b, $c, $d, $e, $f, $g, $h])
1001410014
};
1001510015
}
1001610016
macro_rules! shuffle3 {
@@ -10079,7 +10079,7 @@ pub unsafe fn _mm512_maskz_shuffle_f64x2(
1007910079
$g:expr,
1008010080
$h:expr
1008110081
) => {
10082-
simd_shuffle8(a, b, [$a, $b, $c, $d, $e, $f, $g, $h]);
10082+
simd_shuffle8(a, b, [$a, $b, $c, $d, $e, $f, $g, $h])
1008310083
};
1008410084
}
1008510085
macro_rules! shuffle3 {

0 commit comments

Comments
 (0)