[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [qemu-s390x] [Qemu-devel] [PATCH v1 09/41] s390x/tcg: Implement VECT
From: |
Richard Henderson |
Subject: |
Re: [qemu-s390x] [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~
- Re: [qemu-s390x] [Qemu-devel] [PATCH v1 10/41] s390x/tcg: Implement VECTOR ELEMENT COMPARE *, (continued)
- [qemu-s390x] [PATCH v1 01/41] tcg: Implement tcg_gen_gvec_3i(), David Hildenbrand, 2019/04/11
- [qemu-s390x] [PATCH v1 11/41] s390x/tcg: Implement VECTOR COMPARE *, David Hildenbrand, 2019/04/11
- [qemu-s390x] [PATCH v1 05/41] s390x/tcg: Implement VECTOR ADD WITH CARRY COMPUTE CARRY, David Hildenbrand, 2019/04/11
- [qemu-s390x] [PATCH v1 08/41] s390x/tcg: Implement VECTOR AVERAGE LOGICAL, David Hildenbrand, 2019/04/11
- [qemu-s390x] [PATCH v1 09/41] s390x/tcg: Implement VECTOR CHECKSUM, David Hildenbrand, 2019/04/11
- Re: [qemu-s390x] [Qemu-devel] [PATCH v1 09/41] s390x/tcg: Implement VECTOR CHECKSUM,
Richard Henderson <=
[qemu-s390x] [PATCH v1 07/41] s390x/tcg: Implement VECTOR AVERAGE, David Hildenbrand, 2019/04/11
[qemu-s390x] [PATCH v1 04/41] s390x/tcg: Implement VECTOR ADD WITH CARRY, David Hildenbrand, 2019/04/11
[qemu-s390x] [PATCH v1 03/41] s390x/tcg: Implement VECTOR ADD COMPUTE CARRY, David Hildenbrand, 2019/04/11