diff --git a/tools/simdstring/generate.go b/tools/simdstring/generate.go index d820181e3..b23c3804e 100644 --- a/tools/simdstring/generate.go +++ b/tools/simdstring/generate.go @@ -1368,7 +1368,7 @@ func (s *State) index_func(f *Function, test_bytes func(bytes_to_test, test_ans f.MaskForCountDestructive(test_ans, mask) f.Comment("We need to shift out the possible extra bytes at the start of the string caused by the unaligned read") f.ShiftMaskRightDestructive(mask, extra_bytes) - f.JumpIfNonZero(mask, "byte_found") + f.JumpIfNonZero(mask, "byte_found_in_mask") }() f.Comment("Now loop over aligned blocks") @@ -1383,12 +1383,13 @@ func (s *State) index_func(f *Function, test_bytes func(bytes_to_test, test_ans f.Label("loop_body") f.LoadPointerAligned(pos, bytes_to_test) test_bytes(bytes_to_test, test_ans) - f.MaskForCountDestructive(test_ans, mask) - f.JumpIfNonZero(mask, "byte_found") + f.JumpIfNonZero(test_ans, "byte_found_in_vec") f.JumpTo("loop_start") + f.Label("byte_found_in_vec") + f.MaskForCountDestructive(test_ans, mask) f.Comment("Get the result from", mask, "and return it") - f.Label("byte_found") + f.Label("byte_found_in_mask") f.CountLeadingZeroBytesInMask(mask, mask) f.AddToSelf(mask, pos) f.JumpIfLessThan(mask, limit, "result_in_bounds")