@@ -1865,6 +1865,47 @@ mod sealed {
18651865 vector_mladd ! { vector_unsigned_short, vector_signed_short, vector_signed_short }
18661866 vector_mladd ! { vector_signed_short, vector_unsigned_short, vector_signed_short }
18671867 vector_mladd ! { vector_signed_short, vector_signed_short, vector_signed_short }
1868+
1869+ pub trait VectorOr < Other > {
1870+ type Result ;
1871+ unsafe fn vec_or ( self , b : Other ) -> Self :: Result ;
1872+ }
1873+
1874+ impl_vec_trait ! { [ VectorOr vec_or] ~( simd_or) }
1875+
1876+ pub trait VectorXor < Other > {
1877+ type Result ;
1878+ unsafe fn vec_xor ( self , b : Other ) -> Self :: Result ;
1879+ }
1880+
1881+ impl_vec_trait ! { [ VectorXor vec_xor] ~( simd_xor) }
1882+
1883+ macro_rules! vector_vnor {
1884+ ( $fun: ident $ty: ident) => {
1885+ #[ inline]
1886+ #[ target_feature( enable = "altivec" ) ]
1887+ #[ cfg_attr( all( test, not( target_feature = "vsx" ) ) , assert_instr( vnor) ) ]
1888+ #[ cfg_attr( all( test, target_feature = "vsx" ) , assert_instr( xxlnor) ) ]
1889+ pub unsafe fn $fun( a: t_t_l!( $ty) , b: t_t_l!( $ty) ) -> t_t_l!( $ty) {
1890+ let o = vec_splats( !0 as $ty) ;
1891+ vec_xor( vec_or( a, b) , o)
1892+ }
1893+ } ;
1894+ }
1895+
1896+ vector_vnor ! { vec_vnorsb i8 }
1897+ vector_vnor ! { vec_vnorsh i16 }
1898+ vector_vnor ! { vec_vnorsw i32 }
1899+ vector_vnor ! { vec_vnorub u8 }
1900+ vector_vnor ! { vec_vnoruh u16 }
1901+ vector_vnor ! { vec_vnoruw u32 }
1902+
1903+ pub trait VectorNor < Other > {
1904+ type Result ;
1905+ unsafe fn vec_nor ( self , b : Other ) -> Self :: Result ;
1906+ }
1907+
1908+ impl_vec_trait ! { [ VectorNor vec_nor] 2 ( vec_vnorub, vec_vnorsb, vec_vnoruh, vec_vnorsh, vec_vnoruw, vec_vnorsw) }
18681909}
18691910
18701911/// Vector ld.
@@ -1979,6 +2020,36 @@ where
19792020 a. vec_and ( b)
19802021}
19812022
2023+ /// Vector or.
2024+ #[ inline]
2025+ #[ target_feature( enable = "altivec" ) ]
2026+ pub unsafe fn vec_or < T , U > ( a : T , b : U ) -> <T as sealed:: VectorOr < U > >:: Result
2027+ where
2028+ T : sealed:: VectorOr < U > ,
2029+ {
2030+ a. vec_or ( b)
2031+ }
2032+
2033+ /// Vector nor.
2034+ #[ inline]
2035+ #[ target_feature( enable = "altivec" ) ]
2036+ pub unsafe fn vec_nor < T , U > ( a : T , b : U ) -> <T as sealed:: VectorNor < U > >:: Result
2037+ where
2038+ T : sealed:: VectorNor < U > ,
2039+ {
2040+ a. vec_nor ( b)
2041+ }
2042+
2043+ /// Vector xor.
2044+ #[ inline]
2045+ #[ target_feature( enable = "altivec" ) ]
2046+ pub unsafe fn vec_xor < T , U > ( a : T , b : U ) -> <T as sealed:: VectorXor < U > >:: Result
2047+ where
2048+ T : sealed:: VectorXor < U > ,
2049+ {
2050+ a. vec_xor ( b)
2051+ }
2052+
19822053/// Vector adds.
19832054#[ inline]
19842055#[ target_feature( enable = "altivec" ) ]
0 commit comments