qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v1 09/41] s390x/tcg: Implement VECTOR CHECKSUM


From: Richard Henderson
Subject: Re: [Qemu-devel] [PATCH v1 09/41] s390x/tcg: Implement VECTOR CHECKSUM
Date: Fri, 12 Apr 2019 13:01:51 -1000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1

On 4/11/19 12:08 AM, David Hildenbrand wrote:
> +    read_vec_element_i32(sum, get_field(s->fields, v3), 1, ES_32);
> +    for (i = 0; i < 4; i++) {
> +        read_vec_element_i32(tmp, get_field(s->fields, v2), i, ES_32);
> +        tcg_gen_add_i32(sum, sum, tmp);
> +        tcg_gen_setcond_i32(TCG_COND_LTU, tmp, sum, tmp);
> +        tcg_gen_add_i32(sum, sum, tmp);
> +    }
> +    zero_vec(get_field(s->fields, v1));
> +    write_vec_element_i32(sum, get_field(s->fields, v1), 1, ES_32);

It seems like it should be possible to implement this with i64, and fold the
carry around at the end -- 2 insns instead of 12 for managing carry.  But I
can't quite tell if that produces the same results.

You could use

  tcg_gen_add2_i32(sum, tmp, sum, zero, tmp, zero);
  tcg_gen_add_i32(sum, sum, tmp);

instead of computing carry manually with setcond.

That said, your code exactly matches the language in the manual, so

Reviewed-by: Richard Henderson <address@hidden>


r~



reply via email to

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