Skip to content

Commit 2d3ec3c

Browse files
committed
Remove LaneCount in favor of #[rustc_simd_monomorphize_lane_limit] attribute
1 parent 32ba8ed commit 2d3ec3c

File tree

26 files changed

+72
-262
lines changed

26 files changed

+72
-262
lines changed

crates/core_simd/src/fmt.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
use crate::simd::{LaneCount, Simd, SimdElement, SupportedLaneCount};
1+
use crate::simd::{Simd, SimdElement};
22
use core::fmt;
33

44
impl<T, const N: usize> fmt::Debug for Simd<T, N>
55
where
6-
LaneCount<N>: SupportedLaneCount,
76
T: SimdElement + fmt::Debug,
87
{
98
/// A `Simd<T, N>` has a debug format like the one for `[T]`:

crates/core_simd/src/iter.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::simd::{LaneCount, Simd, SupportedLaneCount};
1+
use crate::simd::Simd;
22
use core::{
33
iter::{Product, Sum},
44
ops::{Add, Mul},
@@ -8,7 +8,7 @@ macro_rules! impl_traits {
88
{ $type:ty } => {
99
impl<const N: usize> Sum<Self> for Simd<$type, N>
1010
where
11-
LaneCount<N>: SupportedLaneCount,
11+
1212
{
1313
#[inline]
1414
fn sum<I: Iterator<Item = Self>>(iter: I) -> Self {
@@ -18,7 +18,7 @@ macro_rules! impl_traits {
1818

1919
impl<const N: usize> Product<Self> for Simd<$type, N>
2020
where
21-
LaneCount<N>: SupportedLaneCount,
21+
2222
{
2323
#[inline]
2424
fn product<I: Iterator<Item = Self>>(iter: I) -> Self {
@@ -28,7 +28,7 @@ macro_rules! impl_traits {
2828

2929
impl<'a, const N: usize> Sum<&'a Self> for Simd<$type, N>
3030
where
31-
LaneCount<N>: SupportedLaneCount,
31+
3232
{
3333
#[inline]
3434
fn sum<I: Iterator<Item = &'a Self>>(iter: I) -> Self {
@@ -38,7 +38,7 @@ macro_rules! impl_traits {
3838

3939
impl<'a, const N: usize> Product<&'a Self> for Simd<$type, N>
4040
where
41-
LaneCount<N>: SupportedLaneCount,
41+
4242
{
4343
#[inline]
4444
fn product<I: Iterator<Item = &'a Self>>(iter: I) -> Self {

crates/core_simd/src/lane_count.rs

Lines changed: 0 additions & 52 deletions
This file was deleted.

crates/core_simd/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
simd_ffi,
1010
staged_api,
1111
prelude_import,
12-
ptr_metadata
12+
ptr_metadata,
13+
rustc_attrs
1314
)]
1415
#![cfg_attr(
1516
all(

crates/core_simd/src/masks.rs

Lines changed: 3 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//! Types representing
33
#![allow(non_camel_case_types)]
44

5-
use crate::simd::{LaneCount, Select, Simd, SimdCast, SimdElement, SupportedLaneCount};
5+
use crate::simd::{Select, Simd, SimdCast, SimdElement};
66
use core::cmp::Ordering;
77
use core::{fmt, mem};
88

@@ -41,7 +41,6 @@ mod sealed {
4141
pub trait Sealed {
4242
fn valid<const N: usize>(values: Simd<Self, N>) -> bool
4343
where
44-
LaneCount<N>: SupportedLaneCount,
4544
Self: SimdElement;
4645

4746
fn eq(self, other: Self) -> bool;
@@ -69,8 +68,6 @@ macro_rules! impl_element {
6968
impl Sealed for $ty {
7069
#[inline]
7170
fn valid<const N: usize>(value: Simd<Self, N>) -> bool
72-
where
73-
LaneCount<N>: SupportedLaneCount,
7471
{
7572
// We can't use `Simd` directly, because `Simd`'s functions call this function and
7673
// we will end up with an infinite loop.
@@ -124,20 +121,13 @@ impl_element! { isize, usize }
124121
#[repr(transparent)]
125122
pub struct Mask<T, const N: usize>(Simd<T, N>)
126123
where
127-
T: MaskElement,
128-
LaneCount<N>: SupportedLaneCount;
124+
T: MaskElement;
129125

130-
impl<T, const N: usize> Copy for Mask<T, N>
131-
where
132-
T: MaskElement,
133-
LaneCount<N>: SupportedLaneCount,
134-
{
135-
}
126+
impl<T, const N: usize> Copy for Mask<T, N> where T: MaskElement {}
136127

137128
impl<T, const N: usize> Clone for Mask<T, N>
138129
where
139130
T: MaskElement,
140-
LaneCount<N>: SupportedLaneCount,
141131
{
142132
#[inline]
143133
fn clone(&self) -> Self {
@@ -148,7 +138,6 @@ where
148138
impl<T, const N: usize> Mask<T, N>
149139
where
150140
T: MaskElement,
151-
LaneCount<N>: SupportedLaneCount,
152141
{
153142
/// Constructs a mask by setting all elements to the given value.
154143
#[inline]
@@ -315,8 +304,6 @@ where
315304
) -> U
316305
where
317306
T: MaskElement,
318-
LaneCount<M>: SupportedLaneCount,
319-
LaneCount<N>: SupportedLaneCount,
320307
{
321308
let resized = mask.resize::<M>(false);
322309

@@ -421,7 +408,6 @@ where
421408
impl<T, const N: usize> From<[bool; N]> for Mask<T, N>
422409
where
423410
T: MaskElement,
424-
LaneCount<N>: SupportedLaneCount,
425411
{
426412
#[inline]
427413
fn from(array: [bool; N]) -> Self {
@@ -432,7 +418,6 @@ where
432418
impl<T, const N: usize> From<Mask<T, N>> for [bool; N]
433419
where
434420
T: MaskElement,
435-
LaneCount<N>: SupportedLaneCount,
436421
{
437422
#[inline]
438423
fn from(vector: Mask<T, N>) -> Self {
@@ -443,7 +428,6 @@ where
443428
impl<T, const N: usize> Default for Mask<T, N>
444429
where
445430
T: MaskElement,
446-
LaneCount<N>: SupportedLaneCount,
447431
{
448432
#[inline]
449433
fn default() -> Self {
@@ -454,7 +438,6 @@ where
454438
impl<T, const N: usize> PartialEq for Mask<T, N>
455439
where
456440
T: MaskElement + PartialEq,
457-
LaneCount<N>: SupportedLaneCount,
458441
{
459442
#[inline]
460443
fn eq(&self, other: &Self) -> bool {
@@ -465,7 +448,6 @@ where
465448
impl<T, const N: usize> PartialOrd for Mask<T, N>
466449
where
467450
T: MaskElement + PartialOrd,
468-
LaneCount<N>: SupportedLaneCount,
469451
{
470452
#[inline]
471453
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
@@ -476,7 +458,6 @@ where
476458
impl<T, const N: usize> fmt::Debug for Mask<T, N>
477459
where
478460
T: MaskElement + fmt::Debug,
479-
LaneCount<N>: SupportedLaneCount,
480461
{
481462
#[inline]
482463
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
@@ -489,7 +470,6 @@ where
489470
impl<T, const N: usize> core::ops::BitAnd for Mask<T, N>
490471
where
491472
T: MaskElement,
492-
LaneCount<N>: SupportedLaneCount,
493473
{
494474
type Output = Self;
495475
#[inline]
@@ -502,7 +482,6 @@ where
502482
impl<T, const N: usize> core::ops::BitAnd<bool> for Mask<T, N>
503483
where
504484
T: MaskElement,
505-
LaneCount<N>: SupportedLaneCount,
506485
{
507486
type Output = Self;
508487
#[inline]
@@ -514,7 +493,6 @@ where
514493
impl<T, const N: usize> core::ops::BitAnd<Mask<T, N>> for bool
515494
where
516495
T: MaskElement,
517-
LaneCount<N>: SupportedLaneCount,
518496
{
519497
type Output = Mask<T, N>;
520498
#[inline]
@@ -526,7 +504,6 @@ where
526504
impl<T, const N: usize> core::ops::BitOr for Mask<T, N>
527505
where
528506
T: MaskElement,
529-
LaneCount<N>: SupportedLaneCount,
530507
{
531508
type Output = Self;
532509
#[inline]
@@ -539,7 +516,6 @@ where
539516
impl<T, const N: usize> core::ops::BitOr<bool> for Mask<T, N>
540517
where
541518
T: MaskElement,
542-
LaneCount<N>: SupportedLaneCount,
543519
{
544520
type Output = Self;
545521
#[inline]
@@ -551,7 +527,6 @@ where
551527
impl<T, const N: usize> core::ops::BitOr<Mask<T, N>> for bool
552528
where
553529
T: MaskElement,
554-
LaneCount<N>: SupportedLaneCount,
555530
{
556531
type Output = Mask<T, N>;
557532
#[inline]
@@ -563,7 +538,6 @@ where
563538
impl<T, const N: usize> core::ops::BitXor for Mask<T, N>
564539
where
565540
T: MaskElement,
566-
LaneCount<N>: SupportedLaneCount,
567541
{
568542
type Output = Self;
569543
#[inline]
@@ -576,7 +550,6 @@ where
576550
impl<T, const N: usize> core::ops::BitXor<bool> for Mask<T, N>
577551
where
578552
T: MaskElement,
579-
LaneCount<N>: SupportedLaneCount,
580553
{
581554
type Output = Self;
582555
#[inline]
@@ -588,7 +561,6 @@ where
588561
impl<T, const N: usize> core::ops::BitXor<Mask<T, N>> for bool
589562
where
590563
T: MaskElement,
591-
LaneCount<N>: SupportedLaneCount,
592564
{
593565
type Output = Mask<T, N>;
594566
#[inline]
@@ -600,7 +572,6 @@ where
600572
impl<T, const N: usize> core::ops::Not for Mask<T, N>
601573
where
602574
T: MaskElement,
603-
LaneCount<N>: SupportedLaneCount,
604575
{
605576
type Output = Mask<T, N>;
606577
#[inline]
@@ -612,7 +583,6 @@ where
612583
impl<T, const N: usize> core::ops::BitAndAssign for Mask<T, N>
613584
where
614585
T: MaskElement,
615-
LaneCount<N>: SupportedLaneCount,
616586
{
617587
#[inline]
618588
fn bitand_assign(&mut self, rhs: Self) {
@@ -623,7 +593,6 @@ where
623593
impl<T, const N: usize> core::ops::BitAndAssign<bool> for Mask<T, N>
624594
where
625595
T: MaskElement,
626-
LaneCount<N>: SupportedLaneCount,
627596
{
628597
#[inline]
629598
fn bitand_assign(&mut self, rhs: bool) {
@@ -634,7 +603,6 @@ where
634603
impl<T, const N: usize> core::ops::BitOrAssign for Mask<T, N>
635604
where
636605
T: MaskElement,
637-
LaneCount<N>: SupportedLaneCount,
638606
{
639607
#[inline]
640608
fn bitor_assign(&mut self, rhs: Self) {
@@ -645,7 +613,6 @@ where
645613
impl<T, const N: usize> core::ops::BitOrAssign<bool> for Mask<T, N>
646614
where
647615
T: MaskElement,
648-
LaneCount<N>: SupportedLaneCount,
649616
{
650617
#[inline]
651618
fn bitor_assign(&mut self, rhs: bool) {
@@ -656,7 +623,6 @@ where
656623
impl<T, const N: usize> core::ops::BitXorAssign for Mask<T, N>
657624
where
658625
T: MaskElement,
659-
LaneCount<N>: SupportedLaneCount,
660626
{
661627
#[inline]
662628
fn bitxor_assign(&mut self, rhs: Self) {
@@ -667,7 +633,6 @@ where
667633
impl<T, const N: usize> core::ops::BitXorAssign<bool> for Mask<T, N>
668634
where
669635
T: MaskElement,
670-
LaneCount<N>: SupportedLaneCount,
671636
{
672637
#[inline]
673638
fn bitxor_assign(&mut self, rhs: bool) {
@@ -679,8 +644,6 @@ macro_rules! impl_from {
679644
{ $from:ty => $($to:ty),* } => {
680645
$(
681646
impl<const N: usize> From<Mask<$from, N>> for Mask<$to, N>
682-
where
683-
LaneCount<N>: SupportedLaneCount,
684647
{
685648
#[inline]
686649
fn from(value: Mask<$from, N>) -> Self {

crates/core_simd/src/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ mod alias;
55
mod cast;
66
mod fmt;
77
mod iter;
8-
mod lane_count;
98
mod masks;
109
mod ops;
1110
mod select;
@@ -27,7 +26,6 @@ pub mod simd {
2726

2827
pub use crate::core_simd::alias::*;
2928
pub use crate::core_simd::cast::*;
30-
pub use crate::core_simd::lane_count::{LaneCount, SupportedLaneCount};
3129
pub use crate::core_simd::masks::*;
3230
pub use crate::core_simd::select::*;
3331
pub use crate::core_simd::swizzle::*;

0 commit comments

Comments
 (0)