aboutsummaryrefslogtreecommitdiff
path: root/target/s390x/vec_int_helper.c
diff options
context:
space:
mode:
authorDavid Hildenbrand <david@redhat.com>2019-03-21 10:36:26 +0100
committerDavid Hildenbrand <david@redhat.com>2019-05-17 10:54:13 +0200
commit449a8ac250612d4ce692df584ab105ad098b96af (patch)
treec6356ee73da04e075e9a115f4061ebd5bd2788d9 /target/s390x/vec_int_helper.c
parent28863f1dbda5ef1e7e1e4b75857ac0fdb52424f5 (diff)
s390x/tcg: Implement VECTOR COUNT TRAILING ZEROS
Implement it similar to VECTOR COUNT LEADING ZEROS. 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.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/target/s390x/vec_int_helper.c b/target/s390x/vec_int_helper.c
index 016512547c..d1b1f28509 100644
--- a/target/s390x/vec_int_helper.c
+++ b/target/s390x/vec_int_helper.c
@@ -60,3 +60,17 @@ void HELPER(gvec_vclz##BITS)(void *v1, const void *v2, uint32_t desc) \
}
DEF_VCLZ(8)
DEF_VCLZ(16)
+
+#define DEF_VCTZ(BITS) \
+void HELPER(gvec_vctz##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, a ? ctz32(a) : BITS); \
+ } \
+}
+DEF_VCTZ(8)
+DEF_VCTZ(16)