@@ -2568,7 +2568,8 @@ class StubGenerator: public StubCodeGenerator {
25682568 // Find the first different characters in the longwords and
25692569 // compute their difference.
25702570 __ bind (CALCULATE_DIFFERENCE);
2571- __ ctzc_bit (tmp4, tmp3);
2571+ // count bits of trailing zero chars
2572+ __ ctzc_bits (tmp4, tmp3);
25722573 __ srl (tmp1, tmp1, tmp4);
25732574 __ srl (tmp2, tmp2, tmp4);
25742575 __ zext (tmp1, tmp1, 16 );
@@ -2703,7 +2704,8 @@ class StubGenerator: public StubCodeGenerator {
27032704 // Find the first different characters in the longwords and
27042705 // compute their difference.
27052706 __ bind (DIFF2);
2706- __ ctzc_bit (tmp3, tmp4, isLL); // count zero from lsb to msb
2707+ // count bits of trailing zero chars
2708+ __ ctzc_bits (tmp3, tmp4, isLL);
27072709 __ srl (tmp5, tmp5, tmp3);
27082710 __ srl (cnt1, cnt1, tmp3);
27092711 if (isLL) {
@@ -2716,7 +2718,8 @@ class StubGenerator: public StubCodeGenerator {
27162718 __ sub (result, tmp5, cnt1);
27172719 __ j (LENGTH_DIFF);
27182720 __ bind (DIFF);
2719- __ ctzc_bit (tmp3, tmp4, isLL); // count zero from lsb to msb
2721+ // count bits of trailing zero chars
2722+ __ ctzc_bits (tmp3, tmp4, isLL);
27202723 __ srl (tmp1, tmp1, tmp3);
27212724 __ srl (tmp2, tmp2, tmp3);
27222725 if (isLL) {
@@ -2862,7 +2865,8 @@ class StubGenerator: public StubCodeGenerator {
28622865 __ beqz (match_mask, NOMATCH);
28632866
28642867 __ bind (L_SMALL_HAS_ZERO_LOOP);
2865- __ ctzc_bit (trailing_zeros, match_mask, haystack_isL, ch2, tmp); // count trailing zeros
2868+ // count bits of trailing zero chars
2869+ __ ctzc_bits (trailing_zeros, match_mask, haystack_isL, ch2, tmp);
28662870 __ addi (trailing_zeros, trailing_zeros, haystack_isL ? 7 : 15 );
28672871 __ mv (ch2, wordSize / haystack_chr_size);
28682872 __ ble (needle_len, ch2, L_SMALL_CMP_LOOP_LAST_CMP2);
@@ -2881,7 +2885,8 @@ class StubGenerator: public StubCodeGenerator {
28812885
28822886 __ bind (L_SMALL_CMP_LOOP_NOMATCH);
28832887 __ beqz (match_mask, NOMATCH);
2884- __ ctzc_bit (trailing_zeros, match_mask, haystack_isL, tmp, ch2);
2888+ // count bits of trailing zero chars
2889+ __ ctzc_bits (trailing_zeros, match_mask, haystack_isL, tmp, ch2);
28852890 __ addi (trailing_zeros, trailing_zeros, haystack_isL ? 7 : 15 );
28862891 __ add (result, result, 1 );
28872892 __ add (haystack, haystack, haystack_chr_size);
@@ -2900,7 +2905,8 @@ class StubGenerator: public StubCodeGenerator {
29002905
29012906 __ align (OptoLoopAlignment);
29022907 __ bind (L_HAS_ZERO);
2903- __ ctzc_bit (trailing_zeros, match_mask, haystack_isL, tmp, ch2);
2908+ // count bits of trailing zero chars
2909+ __ ctzc_bits (trailing_zeros, match_mask, haystack_isL, tmp, ch2);
29042910 __ addi (trailing_zeros, trailing_zeros, haystack_isL ? 7 : 15 );
29052911 __ slli (needle_len, needle_len, BitsPerByte * wordSize / 2 );
29062912 __ orr (haystack_len, haystack_len, needle_len); // restore needle_len(32bits)
@@ -2929,7 +2935,8 @@ class StubGenerator: public StubCodeGenerator {
29292935
29302936 __ bind (L_CMP_LOOP_NOMATCH);
29312937 __ beqz (match_mask, L_HAS_ZERO_LOOP_NOMATCH);
2932- __ ctzc_bit (trailing_zeros, match_mask, haystack_isL, needle_len, ch2); // find next "first" char index
2938+ // count bits of trailing zero chars
2939+ __ ctzc_bits (trailing_zeros, match_mask, haystack_isL, needle_len, ch2);
29332940 __ addi (trailing_zeros, trailing_zeros, haystack_isL ? 7 : 15 );
29342941 __ add (haystack, haystack, haystack_chr_size);
29352942 __ j (L_HAS_ZERO_LOOP);
0 commit comments