diff options
author | David Hildenbrand <david@redhat.com> | 2019-04-04 14:37:17 +0200 |
---|---|---|
committer | David Hildenbrand <david@redhat.com> | 2019-05-17 10:54:13 +0200 |
commit | 28863f1dbda5ef1e7e1e4b75857ac0fdb52424f5 (patch) | |
tree | eba2dbdc887ec0443b3e80f11bd2339566a7e5fe /target/s390x/vec_int_helper.c | |
parent | ff825c6d6408cc1deae408821b6fd9d1127cc70b (diff) |
s390x/tcg: Implement VECTOR COUNT LEADING ZEROS
For 8/16, use the 32 bit variant and properly subtract the added
leading zero bits.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Diffstat (limited to 'target/s390x/vec_int_helper.c')
-rw-r--r-- | target/s390x/vec_int_helper.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/target/s390x/vec_int_helper.c b/target/s390x/vec_int_helper.c index 8f97d3f466..016512547c 100644 --- a/target/s390x/vec_int_helper.c +++ b/target/s390x/vec_int_helper.c @@ -46,3 +46,17 @@ void HELPER(gvec_vavgl##BITS)(void *v1, const void *v2, const void *v3, \ } DEF_VAVGL(8) DEF_VAVGL(16) + +#define DEF_VCLZ(BITS) \ +void HELPER(gvec_vclz##BITS)(void *v1, const void *v2, uint32_t desc) \ +{ \ + int i; \ + \ + for (i = 0; i < (128 / BITS); i++) { \ + const uint##BITS##_t a = s390_vec_read_element##BITS(v2, i); \ + \ + s390_vec_write_element##BITS(v1, i, clz32(a) - 32 + BITS); \ + } \ +} +DEF_VCLZ(8) +DEF_VCLZ(16) |