From 085177678e36d4644346371c29014656b41b54cd Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 25 Sep 2023 08:56:19 +0200 Subject: [PATCH] remove some dead code and add a comment in the AVX test --- src/tools/miri/src/helpers.rs | 2 - src/tools/miri/src/helpers/convert.rs | 49 ------------------- .../miri/tests/pass/intrinsics-x86-avx512.rs | 1 + 3 files changed, 1 insertion(+), 51 deletions(-) delete mode 100644 src/tools/miri/src/helpers/convert.rs diff --git a/src/tools/miri/src/helpers.rs b/src/tools/miri/src/helpers.rs index badd2629388..fd9d57c487c 100644 --- a/src/tools/miri/src/helpers.rs +++ b/src/tools/miri/src/helpers.rs @@ -1,5 +1,3 @@ -pub mod convert; - use std::cmp; use std::iter; use std::num::NonZeroUsize; diff --git a/src/tools/miri/src/helpers/convert.rs b/src/tools/miri/src/helpers/convert.rs deleted file mode 100644 index 4506fe47495..00000000000 --- a/src/tools/miri/src/helpers/convert.rs +++ /dev/null @@ -1,49 +0,0 @@ -use implementations::NarrowerThan; - -/// Replacement for `as` casts going from wide integer to narrower integer. -/// -/// # Example -/// -/// ```ignore -/// let x = 99_u64; -/// let lo = x.truncate::(); -/// // lo is of type u16, equivalent to `x as u16`. -/// ``` -pub(crate) trait Truncate: Sized { - fn truncate(self) -> To - where - To: NarrowerThan, - { - NarrowerThan::truncate_from(self) - } -} - -impl Truncate for u16 {} -impl Truncate for u32 {} -impl Truncate for u64 {} -impl Truncate for u128 {} - -mod implementations { - pub(crate) trait NarrowerThan { - fn truncate_from(wide: T) -> Self; - } - - macro_rules! impl_narrower_than { - ($(NarrowerThan<{$($ty:ty),*}> for $self:ty)*) => { - $($( - impl NarrowerThan<$ty> for $self { - fn truncate_from(wide: $ty) -> Self { - wide as Self - } - } - )*)* - }; - } - - impl_narrower_than! { - NarrowerThan<{u128, u64, u32, u16}> for u8 - NarrowerThan<{u128, u64, u32}> for u16 - NarrowerThan<{u128, u64}> for u32 - NarrowerThan<{u128}> for u64 - } -} diff --git a/src/tools/miri/tests/pass/intrinsics-x86-avx512.rs b/src/tools/miri/tests/pass/intrinsics-x86-avx512.rs index a5615aaa432..c38158dc797 100644 --- a/src/tools/miri/tests/pass/intrinsics-x86-avx512.rs +++ b/src/tools/miri/tests/pass/intrinsics-x86-avx512.rs @@ -1,5 +1,6 @@ // Ignore everything except x86 and x86_64 // Any additional target are added to CI should be ignored here +// (We cannot use `cfg`-based tricks here since the `target-feature` flags below only work on x86.) //@ignore-target-aarch64 //@ignore-target-arm //@ignore-target-avr