22
33#![ allow( non_camel_case_types) ]
44
5- trait SimdLookup < const N : usize > {
6- type Vector ;
7- }
8- macro_rules! as_signed {
9- ( i8 ) => { i8 } ;
10- ( i16 ) => { i16 } ;
11- ( i32 ) => { i32 } ;
12- ( i64 ) => { i64 } ;
13- ( i128 ) => { i128 } ;
14-
15- ( u8 ) => { i8 } ;
16- ( u16 ) => { i16 } ;
17- ( u32 ) => { i32 } ;
18- ( u64 ) => { i64 } ;
19- ( u128 ) => { i128 } ;
20-
21- ( f8) => { i8 } ;
22- ( f16) => { i16 } ;
23- ( f32 ) => { i32 } ;
24- ( f64 ) => { i64 } ;
25- ( f128) => { i128 } ;
26- }
27-
285macro_rules! simd_ty {
29- ( $id: ident [ $elem_type: ident ; $len: literal] : $( $param_name: ident) ,* ) => {
6+ ( $id: ident [ $elem_type: ty ; $len: literal] : $( $param_name: ident) ,* ) => {
307 #[ repr( simd) ]
318 #[ derive( Copy , Clone ) ]
329 pub ( crate ) struct $id( [ $elem_type; $len] ) ;
@@ -79,11 +56,7 @@ macro_rules! simd_ty {
7956 impl core:: cmp:: PartialEq for $id {
8057 #[ inline]
8158 fn eq( & self , other: & Self ) -> bool {
82- type Mask = <as_signed!( $elem_type) as SimdLookup <$len>>:: Vector ;
83- unsafe {
84- let mask = core:: intrinsics:: simd:: simd_eq:: <Self , Mask >( * self , * other) ;
85- core:: intrinsics:: simd:: simd_reduce_all( mask)
86- }
59+ self . as_array( ) == other. as_array( )
8760 }
8861 }
8962
@@ -93,10 +66,6 @@ macro_rules! simd_ty {
9366 debug_simd_finish( f, stringify!( $id) , self . as_array( ) )
9467 }
9568 }
96-
97- impl SimdLookup <$len> for $elem_type {
98- type Vector = $id;
99- }
10069 }
10170}
10271
@@ -144,10 +113,7 @@ macro_rules! simd_m_ty {
144113 impl core:: cmp:: PartialEq for $id {
145114 #[ inline]
146115 fn eq( & self , other: & Self ) -> bool {
147- unsafe {
148- let mask = core:: intrinsics:: simd:: simd_eq:: <Self , Self >( * self , * other) ;
149- core:: intrinsics:: simd:: simd_reduce_all( mask)
150- }
116+ self . as_array( ) == other. as_array( )
151117 }
152118 }
153119
@@ -901,73 +867,6 @@ simd_ty!(
901867) ;
902868
903869// 1024-bit wide types:
904- simd_ty ! (
905- i16x64[ i16 ; 64 ] :
906- x0,
907- x1,
908- x2,
909- x3,
910- x4,
911- x5,
912- x6,
913- x7,
914- x8,
915- x9,
916- x10,
917- x11,
918- x12,
919- x13,
920- x14,
921- x15,
922- x16,
923- x17,
924- x18,
925- x19,
926- x20,
927- x21,
928- x22,
929- x23,
930- x24,
931- x25,
932- x26,
933- x27,
934- x28,
935- x29,
936- x30,
937- x31,
938- x32,
939- x33,
940- x34,
941- x35,
942- x36,
943- x37,
944- x38,
945- x39,
946- x40,
947- x41,
948- x42,
949- x43,
950- x44,
951- x45,
952- x46,
953- x47,
954- x48,
955- x49,
956- x50,
957- x51,
958- x52,
959- x53,
960- x54,
961- x55,
962- x56,
963- x57,
964- x58,
965- x59,
966- x60,
967- x61,
968- x62,
969- x63
970- ) ;
971870simd_ty ! (
972871 u16x64[ u16 ; 64 ] :
973872 x0,
0 commit comments