@@ -349,12 +349,15 @@ fn simd_mask() {
349
349
// Non-power-of-2 multi-byte mask.
350
350
#[ repr( simd, packed) ]
351
351
#[ allow( non_camel_case_types) ]
352
- #[ derive( Copy , Clone , Debug , PartialEq ) ]
352
+ #[ derive( Copy , Clone ) ]
353
353
struct i32x10 ( [ i32 ; 10 ] ) ;
354
354
impl i32x10 {
355
355
fn splat ( x : i32 ) -> Self {
356
356
Self ( [ x; 10 ] )
357
357
}
358
+ fn into_array ( self ) -> [ i32 ; 10 ] {
359
+ unsafe { std:: mem:: transmute ( self ) }
360
+ }
358
361
}
359
362
unsafe {
360
363
let mask = i32x10 ( [ !0 , !0 , 0 , !0 , 0 , 0 , !0 , 0 , !0 , 0 ] ) ;
@@ -377,19 +380,22 @@ fn simd_mask() {
377
380
i32x10:: splat ( !0 ) , // yes
378
381
i32x10:: splat ( 0 ) , // no
379
382
) ;
380
- assert_eq ! ( selected1, mask) ;
381
- assert_eq ! ( selected2, mask) ;
383
+ assert_eq ! ( selected1. into_array ( ) , mask. into_array ( ) ) ;
384
+ assert_eq ! ( selected2. into_array ( ) , mask. into_array ( ) ) ;
382
385
}
383
386
384
387
// Test for a mask where the next multiple of 8 is not a power of two.
385
388
#[ repr( simd, packed) ]
386
389
#[ allow( non_camel_case_types) ]
387
- #[ derive( Copy , Clone , Debug , PartialEq ) ]
390
+ #[ derive( Copy , Clone ) ]
388
391
struct i32x20 ( [ i32 ; 20 ] ) ;
389
392
impl i32x20 {
390
393
fn splat ( x : i32 ) -> Self {
391
394
Self ( [ x; 20 ] )
392
395
}
396
+ fn into_array ( self ) -> [ i32 ; 20 ] {
397
+ unsafe { std:: mem:: transmute ( self ) }
398
+ }
393
399
}
394
400
unsafe {
395
401
let mask = i32x20 ( [ !0 , !0 , 0 , !0 , 0 , 0 , !0 , 0 , !0 , 0 , 0 , 0 , 0 , !0 , !0 , !0 , !0 , !0 , !0 , !0 ] ) ;
@@ -419,8 +425,8 @@ fn simd_mask() {
419
425
i32x20:: splat ( !0 ) , // yes
420
426
i32x20:: splat ( 0 ) , // no
421
427
) ;
422
- assert_eq ! ( selected1, mask) ;
423
- assert_eq ! ( selected2, mask) ;
428
+ assert_eq ! ( selected1. into_array ( ) , mask. into_array ( ) ) ;
429
+ assert_eq ! ( selected2. into_array ( ) , mask. into_array ( ) ) ;
424
430
}
425
431
}
426
432
@@ -708,12 +714,12 @@ fn simd_ops_non_pow2() {
708
714
let x = SimdPacked ( [ 1u32 ; 3 ] ) ;
709
715
let y = SimdPacked ( [ 2u32 ; 3 ] ) ;
710
716
let z = unsafe { intrinsics:: simd_add ( x, y) } ;
711
- assert_eq ! ( { z . 0 } , [ 3u32 ; 3 ] ) ;
717
+ assert_eq ! ( unsafe { * ( & raw const z ) . cast :: < [ u32 ; 3 ] > ( ) } , [ 3u32 ; 3 ] ) ;
712
718
713
719
let x = SimdPadded ( [ 1u32 ; 3 ] ) ;
714
720
let y = SimdPadded ( [ 2u32 ; 3 ] ) ;
715
721
let z = unsafe { intrinsics:: simd_add ( x, y) } ;
716
- assert_eq ! ( z . 0 , [ 3u32 ; 3 ] ) ;
722
+ assert_eq ! ( unsafe { * ( & raw const z ) . cast :: < [ u32 ; 3 ] > ( ) } , [ 3u32 ; 3 ] ) ;
717
723
}
718
724
719
725
fn main ( ) {
0 commit comments