All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Miller <dmiller423@gmail.com>
To: Richard Henderson <richard.henderson@linaro.org>
Cc: qemu-s390x@nongnu.org, qemu-devel@nongnu.org,
	David Hildenbrand <david@redhat.com>
Subject: Re: [PATCH v3 03/11] target/s390x: vxeh2: vector string search
Date: Tue, 22 Mar 2022 11:06:20 -0400	[thread overview]
Message-ID: <CAEgyohVutuP3eFr7JfGni=GizSPx=tCRezcyvteZGBEZn4JczQ@mail.gmail.com> (raw)
In-Reply-To: <69878475-d983-3729-255d-09c6de0a2816@linaro.org>

I came to much the same conclusion

On Tue, Mar 22, 2022 at 10:42 AM Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> On 3/21/22 03:31, David Hildenbrand wrote:
> >> +        for (i = 0; i < nelem; i++) {
> >> +            if (s390_vec_read_element(v3, i, es) == 0) {
> >> +                break;
> >> +            }
> >> +        }
> >> +        if (i < substr_elen) {
> >> +            substr_elen = i;
> >> +        }
> >
> > Maybe combine both, I guess there is no need to search beyond substr_elen.
> >
> > substr_elen = MIN(substr_elen, nelem);
> > for (i = 0; i < substr_elen; i++) {
> >      if (s390_vec_read_element(v3, i, es) == 0) {
> >          substr_elen = i;
> >          break;
> >      }
> > }
>
> Yep.
>
> > We should do the MIN(substr_elen, nelem) maybe right when reading it
> > from v4.
>
> No, v4 does not get bounded until zs is set.
>
> >> +    /* If ZS, look for eos in the searched string. */
> >> +    if (zs) {
> >> +        for (k = 0; k < nelem; k++) {
> >> +            if (s390_vec_read_element(v2, k, es) == 0) {
> >> +                eos = true;
> >> +                break;
> >> +            }
> >> +        }
> >
> > I guess we could move that into the main search loop and avoid parsing
> > the string twice. Not sure what's better.
>
> I'd leave it here, so that we only do the strlen once.  There's no obvious place within
> the the search loop that wouldn't wind up doing the strlen more than once.
>
>
> r~


  reply	other threads:[~2022-03-22 15:14 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-08  1:53 [PATCH v3 00/11] s390x/tcg: Implement Vector-Enhancements Facility 2 Richard Henderson
2022-03-08  1:53 ` [PATCH v3 01/11] tcg: Implement tcg_gen_{h,w}swap_{i32,i64} Richard Henderson
2022-03-21  9:32   ` David Hildenbrand
2022-03-08  1:53 ` [PATCH v3 02/11] target/s390x: vxeh2: vector convert short/32b Richard Henderson
2022-03-21  9:33   ` David Hildenbrand
2022-03-08  1:53 ` [PATCH v3 03/11] target/s390x: vxeh2: vector string search Richard Henderson
2022-03-21 10:31   ` David Hildenbrand
2022-03-22 14:42     ` Richard Henderson
2022-03-22 15:06       ` David Miller [this message]
2022-03-08  1:53 ` [PATCH v3 04/11] target/s390x: vxeh2: Update for changes to vector shifts Richard Henderson
2022-03-21 11:15   ` David Hildenbrand
2022-03-08  1:53 ` [PATCH v3 05/11] target/s390x: vxeh2: vector shift double by bit Richard Henderson
2022-03-21 11:23   ` David Hildenbrand
2022-03-08  1:53 ` [PATCH v3 06/11] target/s390x: vxeh2: vector {load, store} elements reversed Richard Henderson
2022-03-21 11:35   ` David Hildenbrand
2022-03-21 15:35     ` Richard Henderson
2022-03-21 15:40       ` David Hildenbrand
2022-03-08  1:53 ` [PATCH v3 07/11] target/s390x: vxeh2: vector {load, store} byte reversed elements Richard Henderson
2022-03-21 11:45   ` David Hildenbrand
2022-03-08  1:53 ` [PATCH v3 08/11] target/s390x: vxeh2: vector {load, store} byte reversed element Richard Henderson
2022-03-21 12:33   ` David Hildenbrand
2022-03-08  1:53 ` [PATCH v3 09/11] target/s390x: add S390_FEAT_VECTOR_ENH2 to cpu max Richard Henderson
2022-03-21 11:28   ` David Hildenbrand
2022-03-08  1:53 ` [PATCH v3 10/11] tests/tcg/s390x: Tests for Vector Enhancements Facility 2 Richard Henderson
2022-03-08  1:53 ` [PATCH v3 11/11] target/s390x: Fix writeback to v1 in helper_vstl Richard Henderson
2022-03-21 11:26   ` David Hildenbrand
2022-03-08  4:09 ` [PATCH v3 00/11] s390x/tcg: Implement Vector-Enhancements Facility 2 David Miller
2022-03-20  1:14   ` David Miller
2022-03-21  9:19     ` David Hildenbrand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAEgyohVutuP3eFr7JfGni=GizSPx=tCRezcyvteZGBEZn4JczQ@mail.gmail.com' \
    --to=dmiller423@gmail.com \
    --cc=david@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.