@@ -544,6 +544,91 @@ mod sealed {
544
544
}
545
545
546
546
impl_vec_trait ! { [ VectorXor vec_xor] ~( simd_xor) }
547
+
548
+ #[ inline]
549
+ #[ target_feature( enable = "vector" ) ]
550
+ // FIXME(vector-enhancements-1) #[cfg_attr(test, assert_instr(vno))]
551
+ unsafe fn nor ( a : vector_signed_char , b : vector_signed_char ) -> vector_signed_char {
552
+ let a: u8x16 = transmute ( a) ;
553
+ let b: u8x16 = transmute ( b) ;
554
+ transmute ( simd_xor ( simd_or ( a, b) , u8x16:: splat ( 0xff ) ) )
555
+ }
556
+
557
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
558
+ pub trait VectorNor < Other > {
559
+ type Result ;
560
+ unsafe fn vec_nor ( self , b : Other ) -> Self :: Result ;
561
+ }
562
+
563
+ impl_vec_trait ! { [ VectorNor vec_nor] + 2 c ( nor) }
564
+
565
+ #[ inline]
566
+ #[ target_feature( enable = "vector" ) ]
567
+ // FIXME(vector-enhancements-1) #[cfg_attr(test, assert_instr(vnn))]
568
+ unsafe fn nand ( a : vector_signed_char , b : vector_signed_char ) -> vector_signed_char {
569
+ let a: u8x16 = transmute ( a) ;
570
+ let b: u8x16 = transmute ( b) ;
571
+ transmute ( simd_xor ( simd_and ( a, b) , u8x16:: splat ( 0xff ) ) )
572
+ }
573
+
574
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
575
+ pub trait VectorNand < Other > {
576
+ type Result ;
577
+ unsafe fn vec_nand ( self , b : Other ) -> Self :: Result ;
578
+ }
579
+
580
+ impl_vec_trait ! { [ VectorNand vec_nand] + 2 c ( nand) }
581
+
582
+ #[ inline]
583
+ #[ target_feature( enable = "vector" ) ]
584
+ // FIXME(vector-enhancements-1) #[cfg_attr(test, assert_instr(vnx))]
585
+ unsafe fn eqv ( a : vector_signed_char , b : vector_signed_char ) -> vector_signed_char {
586
+ let a: u8x16 = transmute ( a) ;
587
+ let b: u8x16 = transmute ( b) ;
588
+ transmute ( simd_xor ( simd_xor ( a, b) , u8x16:: splat ( 0xff ) ) )
589
+ }
590
+
591
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
592
+ pub trait VectorEqv < Other > {
593
+ type Result ;
594
+ unsafe fn vec_eqv ( self , b : Other ) -> Self :: Result ;
595
+ }
596
+
597
+ impl_vec_trait ! { [ VectorEqv vec_eqv] + 2 c ( eqv) }
598
+
599
+ #[ inline]
600
+ #[ target_feature( enable = "vector" ) ]
601
+ // FIXME(vector-enhancements-1) #[cfg_attr(test, assert_instr(vnc))]
602
+ unsafe fn andc ( a : vector_signed_char , b : vector_signed_char ) -> vector_signed_char {
603
+ let a = transmute ( a) ;
604
+ let b = transmute ( b) ;
605
+ transmute ( simd_and ( simd_xor ( u8x16:: splat ( 0xff ) , b) , a) )
606
+ }
607
+
608
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
609
+ pub trait VectorAndc < Other > {
610
+ type Result ;
611
+ unsafe fn vec_andc ( self , b : Other ) -> Self :: Result ;
612
+ }
613
+
614
+ impl_vec_trait ! { [ VectorAndc vec_andc] + 2 c ( andc) }
615
+
616
+ #[ inline]
617
+ #[ target_feature( enable = "vector" ) ]
618
+ // FIXME(vector-enhancements-1) #[cfg_attr(test, assert_instr(voc))]
619
+ unsafe fn orc ( a : vector_signed_char , b : vector_signed_char ) -> vector_signed_char {
620
+ let a = transmute ( a) ;
621
+ let b = transmute ( b) ;
622
+ transmute ( simd_or ( simd_xor ( u8x16:: splat ( 0xff ) , b) , a) )
623
+ }
624
+
625
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
626
+ pub trait VectorOrc < Other > {
627
+ type Result ;
628
+ unsafe fn vec_orc ( self , b : Other ) -> Self :: Result ;
629
+ }
630
+
631
+ impl_vec_trait ! { [ VectorOrc vec_orc] + 2 c ( orc) }
547
632
}
548
633
549
634
/// Vector element-wise addition.
@@ -697,6 +782,67 @@ where
697
782
a. vec_xor ( b)
698
783
}
699
784
785
+ /// Vector nor
786
+ #[ inline]
787
+ #[ target_feature( enable = "vector" ) ]
788
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
789
+ pub unsafe fn vec_nor < T , U > ( a : T , b : U ) -> <T as sealed:: VectorNor < U > >:: Result
790
+ where
791
+ T : sealed:: VectorNor < U > ,
792
+ {
793
+ a. vec_nor ( b)
794
+ }
795
+
796
+ /// Vector nand
797
+ #[ inline]
798
+ #[ target_feature( enable = "vector" ) ]
799
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
800
+ pub unsafe fn vec_nand < T , U > ( a : T , b : U ) -> <T as sealed:: VectorNand < U > >:: Result
801
+ where
802
+ T : sealed:: VectorNand < U > ,
803
+ {
804
+ a. vec_nand ( b)
805
+ }
806
+
807
+ /// Vector xnor
808
+ #[ inline]
809
+ #[ target_feature( enable = "vector" ) ]
810
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
811
+ pub unsafe fn vec_eqv < T , U > ( a : T , b : U ) -> <T as sealed:: VectorEqv < U > >:: Result
812
+ where
813
+ T : sealed:: VectorEqv < U > ,
814
+ {
815
+ a. vec_eqv ( b)
816
+ }
817
+
818
+ /// Vector andc.
819
+ #[ inline]
820
+ #[ target_feature( enable = "vector" ) ]
821
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
822
+ pub unsafe fn vec_andc < T , U > ( a : T , b : U ) -> <T as sealed:: VectorAndc < U > >:: Result
823
+ where
824
+ T : sealed:: VectorAndc < U > ,
825
+ {
826
+ a. vec_andc ( b)
827
+ }
828
+
829
+ /// Vector OR with Complement
830
+ ///
831
+ /// ## Purpose
832
+ /// Performs a bitwise OR of the first vector with the bitwise-complemented second vector.
833
+ ///
834
+ /// ## Result value
835
+ /// r is the bitwise OR of a and the bitwise complement of b.
836
+ #[ inline]
837
+ #[ target_feature( enable = "vector" ) ]
838
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
839
+ pub unsafe fn vec_orc < T , U > ( a : T , b : U ) -> <T as sealed:: VectorOrc < U > >:: Result
840
+ where
841
+ T : sealed:: VectorOrc < U > ,
842
+ {
843
+ a. vec_orc ( b)
844
+ }
845
+
700
846
#[ cfg( test) ]
701
847
mod tests {
702
848
use super :: * ;
@@ -873,4 +1019,44 @@ mod tests {
873
1019
test_vec_abs ! { test_vec_abs_i64, i64x2, -42i64 , 42i64 }
874
1020
test_vec_abs ! { test_vec_abs_f32, f32x4, -42f32 , 42f32 }
875
1021
test_vec_abs ! { test_vec_abs_f64, f64x2, -42f64 , 42f64 }
1022
+
1023
+ test_vec_2 ! { test_vec_andc, vec_andc, i32x4,
1024
+ [ 0b11001100 , 0b11001100 , 0b11001100 , 0b11001100 ] ,
1025
+ [ 0b00110011 , 0b11110011 , 0b00001100 , 0b10000000 ] ,
1026
+ [ 0b11001100 , 0b00001100 , 0b11000000 , 0b01001100 ] }
1027
+
1028
+ test_vec_2 ! { test_vec_and, vec_and, i32x4,
1029
+ [ 0b11001100 , 0b11001100 , 0b11001100 , 0b11001100 ] ,
1030
+ [ 0b00110011 , 0b11110011 , 0b00001100 , 0b00000000 ] ,
1031
+ [ 0b00000000 , 0b11000000 , 0b00001100 , 0b00000000 ] }
1032
+
1033
+ test_vec_2 ! { test_vec_nand, vec_nand, i32x4,
1034
+ [ 0b11001100 , 0b11001100 , 0b11001100 , 0b11001100 ] ,
1035
+ [ 0b00110011 , 0b11110011 , 0b00001100 , 0b00000000 ] ,
1036
+ [ !0b00000000 , !0b11000000 , !0b00001100 , !0b00000000 ] }
1037
+
1038
+ test_vec_2 ! { test_vec_orc, vec_orc, u32x4,
1039
+ [ 0b11001100 , 0b11001100 , 0b11001100 , 0b11001100 ] ,
1040
+ [ 0b00110011 , 0b11110011 , 0b00001100 , 0b00000000 ] ,
1041
+ [ 0b11001100 | !0b00110011 , 0b11001100 | !0b11110011 , 0b11001100 | !0b00001100 , 0b11001100 | !0b00000000 ] }
1042
+
1043
+ test_vec_2 ! { test_vec_or, vec_or, i32x4,
1044
+ [ 0b11001100 , 0b11001100 , 0b11001100 , 0b11001100 ] ,
1045
+ [ 0b00110011 , 0b11110011 , 0b00001100 , 0b00000000 ] ,
1046
+ [ 0b11111111 , 0b11111111 , 0b11001100 , 0b11001100 ] }
1047
+
1048
+ test_vec_2 ! { test_vec_nor, vec_nor, i32x4,
1049
+ [ 0b11001100 , 0b11001100 , 0b11001100 , 0b11001100 ] ,
1050
+ [ 0b00110011 , 0b11110011 , 0b00001100 , 0b00000000 ] ,
1051
+ [ !0b11111111 , !0b11111111 , !0b11001100 , !0b11001100 ] }
1052
+
1053
+ test_vec_2 ! { test_vec_xor, vec_xor, i32x4,
1054
+ [ 0b11001100 , 0b11001100 , 0b11001100 , 0b11001100 ] ,
1055
+ [ 0b00110011 , 0b11110011 , 0b00001100 , 0b00000000 ] ,
1056
+ [ 0b11111111 , 0b00111111 , 0b11000000 , 0b11001100 ] }
1057
+
1058
+ test_vec_2 ! { test_vec_eqv, vec_eqv, i32x4,
1059
+ [ 0b11001100 , 0b11001100 , 0b11001100 , 0b11001100 ] ,
1060
+ [ 0b00110011 , 0b11110011 , 0b00001100 , 0b00000000 ] ,
1061
+ [ !0b11111111 , !0b00111111 , !0b11000000 , !0b11001100 ] }
876
1062
}
0 commit comments