@@ -43,7 +43,6 @@ pub unsafe fn prefix_xor(bitmask: u64) -> u64 {
4343// just for minification (or just to identify the structural characters),
4444// there is a small untaken optimization opportunity here. We deliberately
4545// do not pick it up.
46- #[ cfg( not( target_feature = "sve2" ) ) ]
4746#[ inline( always) ]
4847pub unsafe fn get_nonspace_bits ( data : & [ u8 ; 64 ] ) -> u64 {
4948 use std:: arch:: aarch64:: * ;
@@ -75,39 +74,3 @@ pub unsafe fn get_nonspace_bits(data: &[u8; 64]) -> u64 {
7574 chunk_nonspace_bits ( vld1q_u8 ( data. as_ptr ( ) . offset ( 48 ) ) ) ,
7675 )
7776}
78-
79- #[ cfg( target_feature = "sve2" ) ]
80- #[ inline( always) ]
81- pub unsafe fn get_nonspace_bits ( data : & [ u8 ; 16 ] ) -> u64 {
82- let mut index: u64 ;
83- // 空白符集合: 0x09 (Tab), 0x0A (LF), 0x0D (CR), 0x20 (Space)
84- let tokens: u32 = 0x090a0d20 ;
85-
86- core:: arch:: asm!(
87- "ptrue p0.b, vl16" ,
88- "ld1b {{z0.b}}, p0/z, [{ptr}]" ,
89- "mov z1.s, {t:w}" , // 广播 4 个空白符到 z1
90-
91- // nmatch 寻找不属于 {09, 0a, 0d, 20} 的字符
92- // 结果存入 p1,p1 中 true 的位置表示“非空白符”
93- "nmatch p1.b, p0/z, z0.b, z1.b" ,
94-
95- // 定位第一个非空白符的位置
96- "brkb p1.b, p0/z, p1.b" , // 截断,只保留第一个 true 之前的位为 true
97- "cntp {idx}, p0, p1.b" , // 统计数量,得到第一个非空白符的 index
98-
99- ptr = in( reg) data. as_ptr( ) ,
100- t = in( reg) tokens,
101- idx = out( reg) index,
102- out( "z0" ) _, out( "z1" ) _,
103- out( "p0" ) _, out( "p1" ) _,
104- ) ;
105-
106- // 如果 index < 16,返回 1 << index,使外部 trailing_zeros() 拿到正确偏移
107- // 如果 index == 16,返回 0,触发外部 skip_space 的“全空白”跳过逻辑
108- if index < 16 {
109- 1u64 << index
110- } else {
111- 0
112- }
113- }
0 commit comments