From: Richard Henderson <richard.henderson@linaro.org>
To: David Miller <dmiller423@gmail.com>,
qemu-s390x@nongnu.org, qemu-devel@nongnu.org
Cc: thuth@redhat.com, david@redhat.com, cohuck@redhat.com,
farman@linux.ibm.com, pasic@linux.ibm.com,
borntraeger@linux.ibm.com
Subject: Re: [PATCH v2 2/7] target/s390x: vxeh2: vector string search
Date: Mon, 7 Mar 2022 08:50:56 -1000 [thread overview]
Message-ID: <5993be52-bcda-c6ea-c1f6-954247b93bfb@linaro.org> (raw)
In-Reply-To: <20220307020327.3003-3-dmiller423@gmail.com>
On 3/6/22 16:03, David Miller wrote:
> +static DisasJumpType op_vstrs(DisasContext *s, DisasOps *o)
> +{
> + const uint8_t es = get_field(s, m5);
> + const uint32_t D = get_field(s, m6);
> +
> + if (es > ES_32) {
> + gen_program_exception(s, PGM_SPECIFICATION);
> + return DISAS_NORETURN;
> + }
Missed a check for bits of m6 other than zs must be zero.
> + gen_gvec_4_ptr(get_field(s, v1), get_field(s, v2),
> + get_field(s, v3), get_field(s, v4),
> + cpu_env, (D << 16) | es, gen_helper_vstrs);
Why << 16?
> +void HELPER(vstrs)(void *v1, const void *v2, const void *v3, void *v4,
> + CPUS390XState *env, uint32_t desc) {
> + const bool zs = (desc >> 16);
If this is meant to recover D, it won't. The value that you passed above is had via
simd_data(desc). After that, you could get D via >> 16.
> + const uint8_t es = desc & 16;
I think you clearly meant & 15 here. Or maybe & 3, since ES <= 2?
However!
I think you shouldn't actually pass these values via simd_data(). I think you should have
6 helper functions, which call this as an inline function passing ES and ZS as immediate
arguments. This will allow the compiler to fold away all of the multiple checks vs ES and ZS.
> + uint32_t str_len = 0, eos = 0;
> + uint32_t i = 0, j = 0, k = 0, cc = 0;
> + uint32_t substr_len = ((uint8_t *)v4)[H1(7)] & 31;
> +
> + for (i = 0; i < 16; i += char_size) {
> + if (0 == es && !((uint8_t *)v3)[H1(i >> es)]) { break; }
> + if (1 == es && !((uint16_t *)v3)[H2(i >> es)]) { break; }
> + if (2 == es && !((uint32_t *)v3)[H4(i >> es)]) { break; }
Instead of iterating to 16 by char_size and dividing by es, you should iterate to
element_count by 1. You should use s390_vec_read_element here, and elsewhere.
> + }
> + if (i < substr_len) {
> + substr_len = i;
> + }
This bounding of substr_len is only done when ZS is true.
> + ((uint64_t *)v1)[0] = ((uint64_t *)v1)[1] = 0;
> + ((uint8_t *)v1)[H1(7)] = k;
s390_vec_write_element64(v1, 0, k);
s390_vec_write_element64(v1, 1, 0);
r~
next prev parent reply other threads:[~2022-03-07 18:52 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-07 2:03 [PATCH v2 0/7] s390x/tcg: Implement Vector-Enhancements Facility 2 David Miller
2022-03-07 2:03 ` [PATCH v2 1/7] target/s390x: vxeh2: vector convert short/32b David Miller
2022-03-07 18:10 ` Richard Henderson
2022-03-11 15:37 ` David Hildenbrand
2022-03-07 2:03 ` [PATCH v2 2/7] target/s390x: vxeh2: vector string search David Miller
2022-03-07 18:50 ` Richard Henderson [this message]
2022-03-07 2:03 ` [PATCH v2 3/7] target/s390x: vxeh2: vector shift {double by bit, left, right {logical, arithmetic}} David Miller
2022-03-07 19:38 ` [PATCH v2 3/7] target/s390x: vxeh2: vector shift {double by bit, left, right {logical,arithmetic}} Richard Henderson
2022-03-07 2:03 ` [PATCH v2 4/7] target/s390x: vxeh2: vector {load, store} elements reversed David Miller
2022-03-07 2:03 ` [PATCH v2 5/7] target/s390x: vxeh2: vector {load, store} reversed elements [and {zero, replicate}] David Miller
2022-03-07 2:03 ` [PATCH v2 6/7] target/s390x: add S390_FEAT_VECTOR_ENH2 to cpu max David Miller
2022-03-07 21:34 ` Richard Henderson
2022-03-07 2:03 ` [PATCH v2 7/7] tests/tcg/s390x: Tests for Vector Enhancements Facility 2 David Miller
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=5993be52-bcda-c6ea-c1f6-954247b93bfb@linaro.org \
--to=richard.henderson@linaro.org \
--cc=borntraeger@linux.ibm.com \
--cc=cohuck@redhat.com \
--cc=david@redhat.com \
--cc=dmiller423@gmail.com \
--cc=farman@linux.ibm.com \
--cc=pasic@linux.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=thuth@redhat.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).