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 <richard.hender...@linaro.org>


r~

Reply via email to