@@ -459,6 +459,62 @@ impl u8x16 {
459
459
}
460
460
}
461
461
462
+ /// Unpack and interleave low lanes of two u8x16
463
+ pub fn unpack_low ( lhs : u8x16 , rhs : u8x16 ) -> u8x16 {
464
+ pick ! {
465
+ if #[ cfg( target_feature = "sse2" ) ] {
466
+ u8x16 { sse: unpack_low_i8_m128i( lhs. sse, rhs. sse) }
467
+ } else if #[ cfg( target_feature = "simd128" ) ] {
468
+ u8x16 { simd: u8x16_shuffle:: <0 , 16 , 1 , 17 , 2 , 18 , 3 , 19 , 4 , 20 , 5 , 21 , 6 , 22 , 7 , 23 >( lhs. simd, rhs. simd) }
469
+ } else if #[ cfg( all( target_feature = "neon" , target_arch = "aarch64" ) ) ] {
470
+ let lhs = unsafe { vget_low_u8( lhs. neon) } ;
471
+ let rhs = unsafe { vget_low_u8( rhs. neon) } ;
472
+
473
+ let zipped = unsafe { vzip_u8( lhs, rhs) } ;
474
+ u8x16 { neon: unsafe { vcombine_u8( zipped. 0 , zipped. 1 ) } }
475
+ } else {
476
+ u8x16:: new( [
477
+ lhs. as_array_ref( ) [ 0 ] , rhs. as_array_ref( ) [ 0 ] ,
478
+ lhs. as_array_ref( ) [ 1 ] , rhs. as_array_ref( ) [ 1 ] ,
479
+ lhs. as_array_ref( ) [ 2 ] , rhs. as_array_ref( ) [ 2 ] ,
480
+ lhs. as_array_ref( ) [ 3 ] , rhs. as_array_ref( ) [ 3 ] ,
481
+ lhs. as_array_ref( ) [ 4 ] , rhs. as_array_ref( ) [ 4 ] ,
482
+ lhs. as_array_ref( ) [ 5 ] , rhs. as_array_ref( ) [ 5 ] ,
483
+ lhs. as_array_ref( ) [ 6 ] , rhs. as_array_ref( ) [ 6 ] ,
484
+ lhs. as_array_ref( ) [ 7 ] , rhs. as_array_ref( ) [ 7 ] ,
485
+ ] )
486
+ }
487
+ }
488
+ }
489
+
490
+ /// Unpack and interleave high lanes of two u8x16
491
+ pub fn unpack_high ( lhs : u8x16 , rhs : u8x16 ) -> u8x16 {
492
+ pick ! {
493
+ if #[ cfg( target_feature = "sse2" ) ] {
494
+ u8x16 { sse: unpack_high_i8_m128i( lhs. sse, rhs. sse) }
495
+ } else if #[ cfg( target_feature = "simd128" ) ] {
496
+ u8x16 { simd: u8x16_shuffle:: <8 , 24 , 9 , 25 , 10 , 26 , 11 , 27 , 12 , 28 , 13 , 29 , 14 , 30 , 15 , 31 >( lhs. simd, rhs. simd) }
497
+ } else if #[ cfg( all( target_feature = "neon" , target_arch = "aarch64" ) ) ] {
498
+ let lhs = unsafe { vget_high_u8( lhs. neon) } ;
499
+ let rhs = unsafe { vget_high_u8( rhs. neon) } ;
500
+
501
+ let zipped = unsafe { vzip_u8( lhs, rhs) } ;
502
+ u8x16 { neon: unsafe { vcombine_u8( zipped. 0 , zipped. 1 ) } }
503
+ } else {
504
+ u8x16:: new( [
505
+ lhs. as_array_ref( ) [ 8 ] , rhs. as_array_ref( ) [ 8 ] ,
506
+ lhs. as_array_ref( ) [ 9 ] , rhs. as_array_ref( ) [ 9 ] ,
507
+ lhs. as_array_ref( ) [ 10 ] , rhs. as_array_ref( ) [ 10 ] ,
508
+ lhs. as_array_ref( ) [ 11 ] , rhs. as_array_ref( ) [ 11 ] ,
509
+ lhs. as_array_ref( ) [ 12 ] , rhs. as_array_ref( ) [ 12 ] ,
510
+ lhs. as_array_ref( ) [ 13 ] , rhs. as_array_ref( ) [ 13 ] ,
511
+ lhs. as_array_ref( ) [ 14 ] , rhs. as_array_ref( ) [ 14 ] ,
512
+ lhs. as_array_ref( ) [ 15 ] , rhs. as_array_ref( ) [ 15 ] ,
513
+ ] )
514
+ }
515
+ }
516
+ }
517
+
462
518
#[ inline]
463
519
pub fn to_array ( self ) -> [ u8 ; 16 ] {
464
520
cast ( self )
0 commit comments