@@ -996,7 +996,10 @@ impl<'b> Pattern for &'b str {
996
996
return haystack. as_bytes ( ) . contains ( & self . as_bytes ( ) [ 0 ] ) ;
997
997
}
998
998
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
+ ) ) ]
1000
1003
if self . len ( ) <= 32 {
1001
1004
if let Some ( result) = simd_contains ( self , haystack) {
1002
1005
return result;
@@ -1774,7 +1777,10 @@ impl TwoWayStrategy for RejectAndMatch {
1774
1777
/// a naive O(n*m) search so this implementation should not be called on larger needles.
1775
1778
///
1776
1779
/// [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
+ ) ) ]
1778
1784
#[ inline]
1779
1785
fn simd_contains ( needle : & str , haystack : & str ) -> Option < bool > {
1780
1786
let needle = needle. as_bytes ( ) ;
@@ -1906,7 +1912,10 @@ fn simd_contains(needle: &str, haystack: &str) -> Option<bool> {
1906
1912
/// # Safety
1907
1913
///
1908
1914
/// 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
+ ) ) ]
1910
1919
#[ inline]
1911
1920
unsafe fn small_slice_eq ( x : & [ u8 ] , y : & [ u8 ] ) -> bool {
1912
1921
debug_assert_eq ! ( x. len( ) , y. len( ) ) ;
0 commit comments