|
From: | Richard Henderson |
Subject: | Re: [PULL 06/15] target/s390x: vxeh2: vector string search |
Date: | Fri, 13 May 2022 09:16:25 -0700 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 |
On 5/13/22 08:54, Peter Maydell wrote:
+ s390_vec_write_element64(v1, 0, k << es);Specifically here, because k is 32 bit but s390_vec_write_element64() takes a uint64_t argument, we will do the shift as a signed 32 bit value before widening to 64 bits, so if the values of 'k' and 'es' are such that we might shift beyond bit 32 we'll get the wrong value. It looks like 'es' is one of the MO_* values, so generally small, but the upper bound on 'k' is a bit less obvious to me. Is the overflow-of-32-bits case impossible?
No, the upper bound of (k << es) is 16.We perform the operation with k in units of element size, so that indexing works nicely, then convert back to units of bytes at the end to report results. It's a byte index into the vector register, with 16 as an indicator of match not found + eos not found.
r~
[Prev in Thread] | Current Thread | [Next in Thread] |