@@ -996,7 +996,10 @@ impl<'b> Pattern for &'b str {
996996 return haystack. as_bytes ( ) . contains ( & self . as_bytes ( ) [ 0 ] ) ;
997997 }
998998
999- #[ cfg( all( target_arch = "x86_64" , target_feature = "sse2" ) ) ]
999+ #[ cfg( any(
1000+ all( target_arch = "x86_64" , target_feature = "sse2" ) ,
1001+ all( target_arch = "loongarch64" , target_feature = "lsx" )
1002+ ) ) ]
10001003 if self . len ( ) <= 32 {
10011004 if let Some ( result) = simd_contains ( self , haystack) {
10021005 return result;
@@ -1774,7 +1777,10 @@ impl TwoWayStrategy for RejectAndMatch {
17741777/// a naive O(n*m) search so this implementation should not be called on larger needles.
17751778///
17761779/// [0]: http://0x80.pl/articles/simd-strfind.html#sse-avx2
1777- #[ cfg( all( target_arch = "x86_64" , target_feature = "sse2" ) ) ]
1780+ #[ cfg( any(
1781+ all( target_arch = "x86_64" , target_feature = "sse2" ) ,
1782+ all( target_arch = "loongarch64" , target_feature = "lsx" )
1783+ ) ) ]
17781784#[ inline]
17791785fn simd_contains ( needle : & str , haystack : & str ) -> Option < bool > {
17801786 let needle = needle. as_bytes ( ) ;
@@ -1906,7 +1912,10 @@ fn simd_contains(needle: &str, haystack: &str) -> Option<bool> {
19061912/// # Safety
19071913///
19081914/// Both slices must have the same length.
1909- #[ cfg( all( target_arch = "x86_64" , target_feature = "sse2" ) ) ] // only called on x86
1915+ #[ cfg( any(
1916+ all( target_arch = "x86_64" , target_feature = "sse2" ) ,
1917+ all( target_arch = "loongarch64" , target_feature = "lsx" )
1918+ ) ) ]
19101919#[ inline]
19111920unsafe fn small_slice_eq ( x : & [ u8 ] , y : & [ u8 ] ) -> bool {
19121921 debug_assert_eq ! ( x. len( ) , y. len( ) ) ;
0 commit comments