qemu-s390x
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [qemu-s390x] [Qemu-devel] [PATCH v1 2/5] s390x/tcg: Implement VECTOR


From: Richard Henderson
Subject: Re: [qemu-s390x] [Qemu-devel] [PATCH v1 2/5] s390x/tcg: Implement VECTOR FIND ELEMENT EQUAL
Date: Fri, 17 May 2019 09:47:59 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1

On 5/15/19 1:31 PM, David Hildenbrand wrote:
> +#define DEF_VFEE(BITS)                                                       
>   

Same comment wrt inline functions applies.

Here, because there's one result, writing to byte 7, I wonder if it isn't
clearer to write the loop

    first_equal = n;
    first_zero = n;
    for (i = n - 1; i >= 0; --i) {
        if (data1 == data2) {
            first_equal = i;
        }
        if (data1 == 0) {
            first_zero = i;
        }
    }

// As an aside, there are bit tricks for the above,
// but let's stay simple(r) for now.

    if (zs) {
        if (first_equal < first_zero) {
            cc = (first_zero < n ? 2 : 1);
        } else {
            first_equal = first_zero;
            cc = (first_zero < n ? 0 : 3);
        }
    } else {
        cc = (first_equal < n ? 1 : 3);
    }
    s390_vec_write_element64(v1, 0, first_equal);
    s390_vec_write_element64(v1, 1, 0);

Note that you don't need S390Vector tmp, since the result is written after all
of the inputs are consumed.


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]