Skip to content

Commit 2568bfa

Browse files
committed
fix remaining clippy issues
1 parent ce3afbf commit 2568bfa

File tree

10 files changed

+86
-9
lines changed

10 files changed

+86
-9
lines changed

coresimd/src/x86/i686/sse.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
//! `i686` Streaming SIMD Extensions (SSE)
22
3-
use core::mem;
43
use x86::*;
54

65
#[cfg(test)]
@@ -204,7 +203,7 @@ pub unsafe fn _m_psadbw(a: __m64, b: __m64) -> __m64 {
204203
#[target_feature(enable = "sse,mmx")]
205204
#[cfg_attr(test, assert_instr(cvtpi2ps))]
206205
pub unsafe fn _mm_cvtpi32_ps(a: __m128, b: __m64) -> __m128 {
207-
cvtpi2ps(a, mem::transmute(b))
206+
cvtpi2ps(a, b)
208207
}
209208

210209
/// Converts two elements of a 64-bit vector of [2 x i32] into two
@@ -315,7 +314,7 @@ pub unsafe fn _m_maskmovq(a: __m64, mask: __m64, mem_addr: *mut i8) {
315314
#[cfg_attr(test, assert_instr(pextrw, imm2 = 0))]
316315
pub unsafe fn _mm_extract_pi16(a: __m64, imm2: i32) -> i16 {
317316
macro_rules! call {
318-
($imm2:expr) => { pextrw(mem::transmute(a), $imm2) as i16 }
317+
($imm2:expr) => { pextrw(a, $imm2) as i16 }
319318
}
320319
constify_imm2!(imm2, call)
321320
}
@@ -359,7 +358,7 @@ pub unsafe fn _m_pinsrw(a: __m64, d: i32, imm2: i32) -> __m64 {
359358
#[target_feature(enable = "sse,mmx")]
360359
#[cfg_attr(test, assert_instr(pmovmskb))]
361360
pub unsafe fn _mm_movemask_pi8(a: __m64) -> i32 {
362-
pmovmskb(mem::transmute(a))
361+
pmovmskb(a)
363362
}
364363

365364
/// Takes the most significant bit from each 8-bit element in a 64-bit
@@ -399,7 +398,7 @@ pub unsafe fn _m_pshufw(a: __m64, imm8: i32) -> __m64 {
399398
#[target_feature(enable = "sse,mmx")]
400399
#[cfg_attr(test, assert_instr(cvttps2pi))]
401400
pub unsafe fn _mm_cvttps_pi32(a: __m128) -> __m64 {
402-
mem::transmute(cvttps2pi(a))
401+
cvttps2pi(a)
403402
}
404403

405404
/// Convert the two lower packed single-precision (32-bit) floating-point

coresimd/src/x86/i686/sse2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub unsafe fn _mm_add_si64(a: __m64, b: __m64) -> __m64 {
2424
#[target_feature(enable = "sse2,mmx")]
2525
#[cfg_attr(test, assert_instr(pmuludq))]
2626
pub unsafe fn _mm_mul_su32(a: __m64, b: __m64) -> __m64 {
27-
pmuludq(mem::transmute(a), mem::transmute(b))
27+
pmuludq(a, b)
2828
}
2929

3030
/// Subtracts signed or unsigned 64-bit integer values and writes the

coresimd/src/x86/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ macro_rules! types {
1616
#[repr(simd)]
1717
pub struct $name($($fields)*);
1818

19+
#[cfg_attr(feature = "cargo-clippy", allow(expl_impl_clone_on_copy))]
1920
impl Clone for $name {
2021
#[inline] // currently needed for correctness
2122
fn clone(&self) -> $name {

coresimd/src/x86/x86_64/abm.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
//! Advanced Bit Manipulation (ABM) instructions
2+
//!
3+
//! The POPCNT and LZCNT have their own CPUID bits to indicate support.
4+
//!
5+
//! The references are:
6+
//!
7+
//! - [Intel 64 and IA-32 Architectures Software Developer's Manual Volume 2:
8+
//! Instruction Set Reference, A-Z][intel64_ref].
9+
//! - [AMD64 Architecture Programmer's Manual, Volume 3: General-Purpose and
10+
//! System Instructions][amd64_ref].
11+
//!
12+
//! [Uncyclopedia][wikipedia_bmi] provides a quick overview of the instructions
13+
//! available.
14+
//!
15+
//! [intel64_ref]: http://www.intel.de/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-instruction-set-reference-manual-325383.pdf
16+
//! [amd64_ref]: http://support.amd.com/TechDocs/24594.pdf
17+
//! [wikipedia_bmi]:
18+
//! https://en.wikipedia.org/wiki/Bit_Manipulation_Instruction_Sets#ABM_.28Advanced_Bit_Manipulation.29
19+
120
#[cfg(test)]
221
use stdsimd_test::assert_instr;
322

coresimd/src/x86/x86_64/avx.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
//! Advanced Vector Extensions (AVX)
2+
//!
3+
//! The references are:
4+
//!
5+
//! - [Intel 64 and IA-32 Architectures Software Developer's Manual Volume 2:
6+
//! Instruction Set Reference, A-Z][intel64_ref]. - [AMD64 Architecture
7+
//! Programmer's Manual, Volume 3: General-Purpose and System
8+
//! Instructions][amd64_ref].
9+
//!
10+
//! [Uncyclopedia][wiki] provides a quick overview of the instructions available.
11+
//!
12+
//! [intel64_ref]: http://www.intel.de/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-instruction-set-reference-manual-325383.pdf
13+
//! [amd64_ref]: http://support.amd.com/TechDocs/24594.pdf
14+
//! [wiki]: https://en.wikipedia.org/wiki/Advanced_Vector_Extensions
15+
116
use core::mem;
217

318
use simd_llvm::*;

coresimd/src/x86/x86_64/avx2.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
//! Advanced Vector Extensions 2 (AVX)
2+
//!
3+
//! AVX2 expands most AVX commands to 256-bit wide vector registers and
4+
//! adds [FMA](https://en.wikipedia.org/wiki/Fused_multiply-accumulate).
5+
//!
6+
//! The references are:
7+
//!
8+
//! - [Intel 64 and IA-32 Architectures Software Developer's Manual Volume 2:
9+
//! Instruction Set Reference, A-Z][intel64_ref].
10+
//! - [AMD64 Architecture Programmer's Manual, Volume 3: General-Purpose and
11+
//! System Instructions][amd64_ref].
12+
//!
13+
//! Uncyclopedia's [AVX][wiki_avx] and [FMA][wiki_fma] pages provide a quick
14+
//! overview of the instructions available.
15+
//!
16+
//! [intel64_ref]: http://www.intel.de/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-instruction-set-reference-manual-325383.pdf
17+
//! [amd64_ref]: http://support.amd.com/TechDocs/24594.pdf
18+
//! [wiki_avx]: https://en.wikipedia.org/wiki/Advanced_Vector_Extensions
19+
//! [wiki_fma]: https://en.wikipedia.org/wiki/Fused_multiply-accumulate
20+
121
use simd_llvm::*;
222
use x86::*;
323

coresimd/src/x86/x86_64/bmi.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
//! Bit Manipulation Instruction (BMI) Set 1.0.
2+
//!
3+
//! The reference is [Intel 64 and IA-32 Architectures Software Developer's
4+
//! Manual Volume 2: Instruction Set Reference, A-Z][intel64_ref].
5+
//!
6+
//! [Uncyclopedia][wikipedia_bmi] provides a quick overview of the instructions
7+
//! available.
8+
//!
9+
//! [intel64_ref]: http://www.intel.de/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-instruction-set-reference-manual-325383.pdf
10+
//! [wikipedia_bmi]: https://en.wikipedia.org/wiki/Bit_Manipulation_Instruction_Sets#ABM_.28Advanced_Bit_Manipulation.29
11+
112
#[cfg(test)]
213
use stdsimd_test::assert_instr;
314

coresimd/src/x86/x86_64/bmi2.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
//! Bit Manipulation Instruction (BMI) Set 2.0.
2+
//!
3+
//! The reference is [Intel 64 and IA-32 Architectures Software Developer's
4+
//! Manual Volume 2: Instruction Set Reference, A-Z][intel64_ref].
5+
//!
6+
//! [Uncyclopedia][wikipedia_bmi] provides a quick overview of the instructions
7+
//! available.
8+
//!
9+
//! [intel64_ref]: http://www.intel.de/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-instruction-set-reference-manual-325383.pdf
10+
//! [wikipedia_bmi]:
11+
//! https://en.wikipedia.org/wiki/Bit_Manipulation_Instruction_Sets#ABM_.28Advanced_Bit_Manipulation.29
12+
113
#[cfg(test)]
214
use stdsimd_test::assert_instr;
315

examples/hex.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ unsafe fn hex_encode_avx2<'a>(
106106
}
107107

108108
let i = i as usize;
109-
drop(hex_encode_sse41(src, &mut dst[i * 2..]));
109+
let _ = hex_encode_sse41(src, &mut dst[i * 2..]);
110110

111111
Ok(str::from_utf8_unchecked(&dst[..src.len() * 2 + i * 2]))
112112
}
@@ -154,7 +154,7 @@ unsafe fn hex_encode_sse41<'a>(
154154
}
155155

156156
let i = i as usize;
157-
drop(hex_encode_fallback(src, &mut dst[i * 2..]));
157+
let _ = hex_encode_fallback(src, &mut dst[i * 2..]);
158158

159159
Ok(str::from_utf8_unchecked(&dst[..src.len() * 2 + i * 2]))
160160
}

stdsimd-test/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ pub fn assert(fnptr: usize, fnname: &str, expected: &str) {
279279
let function = &functions[0];
280280

281281
let mut instrs = &function.instrs[..];
282-
while instrs.last().map(|s| s.parts == ["nop"]).unwrap_or(false) {
282+
while instrs.last().map_or(false, |s| s.parts == ["nop"]) {
283283
instrs = &instrs[..instrs.len() - 1];
284284
}
285285

0 commit comments

Comments
 (0)