From 6774ddfec758ecf2cc64d58392c438dd64660a00 Mon Sep 17 00:00:00 2001 From: Archana R Date: Fri, 28 Oct 2022 02:42:39 -0500 Subject: internal/bytealg: fix bug in index function for ppc64le/power9 The index function was not handling certain corner cases where there were two more bytes to be examined in the tail end of the string to complete the comparison. Fix code to ensure that when the string has to be shifted two more times the correct bytes are examined. Also hoisted vsplat to V10 so that all paths use the correct value. Some comments had incorrect register names and corrected the same. Added the strings that were failing to strings test for verification. Fixes #56457 Change-Id: Idba7cbc802e3d73c8f4fe89309871cc8447792f5 Reviewed-on: https://go-review.googlesource.com/c/go/+/446135 Reviewed-by: Bryan Mills Reviewed-by: Heschi Kreinick Reviewed-by: Lynn Boger TryBot-Result: Gopher Robot Run-TryBot: Archana Ravindar --- src/strings/strings_test.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/strings') diff --git a/src/strings/strings_test.go b/src/strings/strings_test.go index 27489c2d16..3991d12751 100644 --- a/src/strings/strings_test.go +++ b/src/strings/strings_test.go @@ -54,6 +54,11 @@ var indexTests = []IndexTest{ {"foo", "", 0}, {"foo", "o", 1}, {"abcABCabc", "A", 3}, + {"jrzm6jjhorimglljrea4w3rlgosts0w2gia17hno2td4qd1jz", "jz", 47}, + {"ekkuk5oft4eq0ocpacknhwouic1uua46unx12l37nioq9wbpnocqks6", "ks6", 52}, + {"999f2xmimunbuyew5vrkla9cpwhmxan8o98ec", "98ec", 33}, + {"9lpt9r98i04k8bz6c6dsrthb96bhi", "96bhi", 24}, + {"55u558eqfaod2r2gu42xxsu631xf0zobs5840vl", "5840vl", 33}, // cases with one byte strings - test special case in Index() {"", "a", -1}, {"x", "a", -1}, -- cgit v1.3-5-g9baa