From: David Hildenbrand <david@redhat.com> To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Thomas Huth <thuth@redhat.com>, Cornelia Huck <cohuck@redhat.com>, Richard Henderson <rth@twiddle.net>, David Hildenbrand <david@redhat.com>, Richard Henderson <richard.henderson@linaro.org> Subject: [Qemu-devel] [PATCH v3 25/40] s390x/tcg: Implement VECTOR POPULATION COUNT Date: Thu, 2 May 2019 16:10:04 +0200 [thread overview] Message-ID: <20190502141019.6385-26-david@redhat.com> (raw) In-Reply-To: <20190502141019.6385-1-david@redhat.com> Similar to VECTOR COUNT TRAILING ZEROES. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: David Hildenbrand <david@redhat.com> --- target/s390x/helper.h | 2 ++ target/s390x/insn-data.def | 2 ++ target/s390x/translate_vx.inc.c | 19 +++++++++++++++++++ target/s390x/vec_int_helper.c | 14 ++++++++++++++ 4 files changed, 37 insertions(+) diff --git a/target/s390x/helper.h b/target/s390x/helper.h index 1ba1660997..20b677917b 100644 --- a/target/s390x/helper.h +++ b/target/s390x/helper.h @@ -196,6 +196,8 @@ DEF_HELPER_FLAGS_4(gvec_vmo32, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32) DEF_HELPER_FLAGS_4(gvec_vmlo8, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32) DEF_HELPER_FLAGS_4(gvec_vmlo16, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32) DEF_HELPER_FLAGS_4(gvec_vmlo32, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32) +DEF_HELPER_FLAGS_3(gvec_vpopct8, TCG_CALL_NO_RWG, void, ptr, cptr, i32) +DEF_HELPER_FLAGS_3(gvec_vpopct16, TCG_CALL_NO_RWG, void, ptr, cptr, i32) #ifndef CONFIG_USER_ONLY DEF_HELPER_3(servc, i32, env, i64, i64) diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def index 52171252be..0f786d6ab1 100644 --- a/target/s390x/insn-data.def +++ b/target/s390x/insn-data.def @@ -1144,6 +1144,8 @@ F(0xe76a, VO, VRR_c, V, 0, 0, 0, 0, vo, 0, IF_VEC) /* VECTOR OR WITH COMPLEMENT */ F(0xe76f, VOC, VRR_c, VE, 0, 0, 0, 0, voc, 0, IF_VEC) +/* VECTOR POPULATION COUNT */ + F(0xe750, VPOPCT, VRR_a, V, 0, 0, 0, 0, vpopct, 0, IF_VEC) #ifndef CONFIG_USER_ONLY /* COMPARE AND SWAP AND PURGE */ diff --git a/target/s390x/translate_vx.inc.c b/target/s390x/translate_vx.inc.c index a43a1863b6..772ef4f395 100644 --- a/target/s390x/translate_vx.inc.c +++ b/target/s390x/translate_vx.inc.c @@ -1822,3 +1822,22 @@ static DisasJumpType op_voc(DisasContext *s, DisasOps *o) get_field(s->fields, v3)); return DISAS_NEXT; } + +static DisasJumpType op_vpopct(DisasContext *s, DisasOps *o) +{ + const uint8_t es = get_field(s->fields, m3); + static const GVecGen2 g[4] = { + { .fno = gen_helper_gvec_vpopct8, }, + { .fno = gen_helper_gvec_vpopct16, }, + { .fni4 = tcg_gen_ctpop_i32, }, + { .fni8 = tcg_gen_ctpop_i64, }, + }; + + if (es > ES_64 || (es != ES_8 && !s390_has_feat(S390_FEAT_VECTOR_ENH))) { + gen_program_exception(s, PGM_SPECIFICATION); + return DISAS_NORETURN; + } + + gen_gvec_2(get_field(s->fields, v1), get_field(s->fields, v2), &g[es]); + return DISAS_NEXT; +} diff --git a/target/s390x/vec_int_helper.c b/target/s390x/vec_int_helper.c index 2d7d4766c5..fd8162f1f1 100644 --- a/target/s390x/vec_int_helper.c +++ b/target/s390x/vec_int_helper.c @@ -464,3 +464,17 @@ void HELPER(gvec_vmlo##BITS)(void *v1, const void *v2, const void *v3, \ DEF_VMLO(8, 16) DEF_VMLO(16, 32) DEF_VMLO(32, 64) + +#define DEF_VPOPCT(BITS) \ +void HELPER(gvec_vpopct##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, ctpop32(a)); \ + } \ +} +DEF_VPOPCT(8) +DEF_VPOPCT(16) -- 2.20.1
WARNING: multiple messages have this Message-ID (diff)
From: David Hildenbrand <david@redhat.com> To: qemu-devel@nongnu.org Cc: Thomas Huth <thuth@redhat.com>, David Hildenbrand <david@redhat.com>, Cornelia Huck <cohuck@redhat.com>, Richard Henderson <richard.henderson@linaro.org>, qemu-s390x@nongnu.org, Richard Henderson <rth@twiddle.net> Subject: [Qemu-devel] [PATCH v3 25/40] s390x/tcg: Implement VECTOR POPULATION COUNT Date: Thu, 2 May 2019 16:10:04 +0200 [thread overview] Message-ID: <20190502141019.6385-26-david@redhat.com> (raw) Message-ID: <20190502141004.m8KGDmuFlW-DzaQ_hTkoOTbkUMLiZnIh5QYr0gKNoOA@z> (raw) In-Reply-To: <20190502141019.6385-1-david@redhat.com> Similar to VECTOR COUNT TRAILING ZEROES. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: David Hildenbrand <david@redhat.com> --- target/s390x/helper.h | 2 ++ target/s390x/insn-data.def | 2 ++ target/s390x/translate_vx.inc.c | 19 +++++++++++++++++++ target/s390x/vec_int_helper.c | 14 ++++++++++++++ 4 files changed, 37 insertions(+) diff --git a/target/s390x/helper.h b/target/s390x/helper.h index 1ba1660997..20b677917b 100644 --- a/target/s390x/helper.h +++ b/target/s390x/helper.h @@ -196,6 +196,8 @@ DEF_HELPER_FLAGS_4(gvec_vmo32, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32) DEF_HELPER_FLAGS_4(gvec_vmlo8, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32) DEF_HELPER_FLAGS_4(gvec_vmlo16, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32) DEF_HELPER_FLAGS_4(gvec_vmlo32, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32) +DEF_HELPER_FLAGS_3(gvec_vpopct8, TCG_CALL_NO_RWG, void, ptr, cptr, i32) +DEF_HELPER_FLAGS_3(gvec_vpopct16, TCG_CALL_NO_RWG, void, ptr, cptr, i32) #ifndef CONFIG_USER_ONLY DEF_HELPER_3(servc, i32, env, i64, i64) diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def index 52171252be..0f786d6ab1 100644 --- a/target/s390x/insn-data.def +++ b/target/s390x/insn-data.def @@ -1144,6 +1144,8 @@ F(0xe76a, VO, VRR_c, V, 0, 0, 0, 0, vo, 0, IF_VEC) /* VECTOR OR WITH COMPLEMENT */ F(0xe76f, VOC, VRR_c, VE, 0, 0, 0, 0, voc, 0, IF_VEC) +/* VECTOR POPULATION COUNT */ + F(0xe750, VPOPCT, VRR_a, V, 0, 0, 0, 0, vpopct, 0, IF_VEC) #ifndef CONFIG_USER_ONLY /* COMPARE AND SWAP AND PURGE */ diff --git a/target/s390x/translate_vx.inc.c b/target/s390x/translate_vx.inc.c index a43a1863b6..772ef4f395 100644 --- a/target/s390x/translate_vx.inc.c +++ b/target/s390x/translate_vx.inc.c @@ -1822,3 +1822,22 @@ static DisasJumpType op_voc(DisasContext *s, DisasOps *o) get_field(s->fields, v3)); return DISAS_NEXT; } + +static DisasJumpType op_vpopct(DisasContext *s, DisasOps *o) +{ + const uint8_t es = get_field(s->fields, m3); + static const GVecGen2 g[4] = { + { .fno = gen_helper_gvec_vpopct8, }, + { .fno = gen_helper_gvec_vpopct16, }, + { .fni4 = tcg_gen_ctpop_i32, }, + { .fni8 = tcg_gen_ctpop_i64, }, + }; + + if (es > ES_64 || (es != ES_8 && !s390_has_feat(S390_FEAT_VECTOR_ENH))) { + gen_program_exception(s, PGM_SPECIFICATION); + return DISAS_NORETURN; + } + + gen_gvec_2(get_field(s->fields, v1), get_field(s->fields, v2), &g[es]); + return DISAS_NEXT; +} diff --git a/target/s390x/vec_int_helper.c b/target/s390x/vec_int_helper.c index 2d7d4766c5..fd8162f1f1 100644 --- a/target/s390x/vec_int_helper.c +++ b/target/s390x/vec_int_helper.c @@ -464,3 +464,17 @@ void HELPER(gvec_vmlo##BITS)(void *v1, const void *v2, const void *v3, \ DEF_VMLO(8, 16) DEF_VMLO(16, 32) DEF_VMLO(32, 64) + +#define DEF_VPOPCT(BITS) \ +void HELPER(gvec_vpopct##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, ctpop32(a)); \ + } \ +} +DEF_VPOPCT(8) +DEF_VPOPCT(16) -- 2.20.1
next prev parent reply other threads:[~2019-05-02 14:11 UTC|newest] Thread overview: 99+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-05-02 14:09 [Qemu-devel] [PATCH v3 00/40] s390x/tcg: Vector Instruction Support Part 2 David Hildenbrand 2019-05-02 14:09 ` David Hildenbrand 2019-05-02 14:09 ` [Qemu-devel] [PATCH v3 01/40] s390x/tcg: Implement VECTOR ADD David Hildenbrand 2019-05-02 14:09 ` David Hildenbrand 2019-05-02 14:09 ` [Qemu-devel] [PATCH v3 02/40] s390x/tcg: Implement VECTOR ADD COMPUTE CARRY David Hildenbrand 2019-05-02 14:09 ` David Hildenbrand 2019-05-03 3:45 ` Richard Henderson 2019-05-03 3:45 ` Richard Henderson 2019-05-03 12:46 ` David Hildenbrand 2019-05-03 12:46 ` David Hildenbrand 2019-05-02 14:09 ` [Qemu-devel] [PATCH v3 03/40] s390x/tcg: Implement VECTOR ADD WITH CARRY David Hildenbrand 2019-05-02 14:09 ` David Hildenbrand 2019-05-02 14:09 ` [Qemu-devel] [PATCH v3 04/40] s390x/tcg: Implement VECTOR ADD WITH CARRY COMPUTE CARRY David Hildenbrand 2019-05-02 14:09 ` David Hildenbrand 2019-05-03 3:46 ` Richard Henderson 2019-05-03 3:46 ` Richard Henderson 2019-05-02 14:09 ` [Qemu-devel] [PATCH v3 05/40] s390x/tcg: Implement VECTOR AND (WITH COMPLEMENT) David Hildenbrand 2019-05-02 14:09 ` David Hildenbrand 2019-05-02 14:09 ` [Qemu-devel] [PATCH v3 06/40] s390x/tcg: Implement VECTOR AVERAGE David Hildenbrand 2019-05-02 14:09 ` David Hildenbrand 2019-05-02 14:09 ` [Qemu-devel] [PATCH v3 07/40] s390x/tcg: Implement VECTOR AVERAGE LOGICAL David Hildenbrand 2019-05-02 14:09 ` David Hildenbrand 2019-05-02 14:09 ` [Qemu-devel] [PATCH v3 08/40] s390x/tcg: Implement VECTOR CHECKSUM David Hildenbrand 2019-05-02 14:09 ` David Hildenbrand 2019-05-02 14:09 ` [Qemu-devel] [PATCH v3 09/40] s390x/tcg: Implement VECTOR ELEMENT COMPARE * David Hildenbrand 2019-05-02 14:09 ` David Hildenbrand 2019-05-02 14:09 ` [Qemu-devel] [PATCH v3 10/40] s390x/tcg: Implement VECTOR " David Hildenbrand 2019-05-02 14:09 ` David Hildenbrand 2019-05-02 14:09 ` [Qemu-devel] [PATCH v3 11/40] s390x/tcg: Implement VECTOR COUNT LEADING ZEROS David Hildenbrand 2019-05-02 14:09 ` David Hildenbrand 2019-05-02 14:09 ` [Qemu-devel] [PATCH v3 12/40] s390x/tcg: Implement VECTOR COUNT TRAILING ZEROS David Hildenbrand 2019-05-02 14:09 ` David Hildenbrand 2019-05-03 5:18 ` Richard Henderson 2019-05-03 5:18 ` Richard Henderson 2019-05-02 14:09 ` [Qemu-devel] [PATCH v3 13/40] s390x/tcg: Implement VECTOR EXCLUSIVE OR David Hildenbrand 2019-05-02 14:09 ` David Hildenbrand 2019-05-02 14:09 ` [Qemu-devel] [PATCH v3 14/40] s390x/tcg: Implement VECTOR GALOIS FIELD MULTIPLY SUM (AND ACCUMULATE) David Hildenbrand 2019-05-02 14:09 ` David Hildenbrand 2019-05-02 14:09 ` [Qemu-devel] [PATCH v3 15/40] s390x/tcg: Implement VECTOR LOAD COMPLEMENT David Hildenbrand 2019-05-02 14:09 ` David Hildenbrand 2019-05-02 14:09 ` [Qemu-devel] [PATCH v3 16/40] s390x/tcg: Implement VECTOR LOAD POSITIVE David Hildenbrand 2019-05-02 14:09 ` David Hildenbrand 2019-05-02 14:09 ` [Qemu-devel] [PATCH v3 17/40] s390x/tcg: Implement VECTOR (MAXIMUM|MINIMUM) (LOGICAL) David Hildenbrand 2019-05-02 14:09 ` David Hildenbrand 2019-05-02 14:09 ` [Qemu-devel] [PATCH v3 18/40] s390x/tcg: Implement VECTOR MULTIPLY AND ADD * David Hildenbrand 2019-05-02 14:09 ` David Hildenbrand 2019-05-02 14:09 ` [Qemu-devel] [PATCH v3 19/40] s390x/tcg: Implement VECTOR MULTIPLY * David Hildenbrand 2019-05-02 14:09 ` David Hildenbrand 2019-05-02 14:09 ` [Qemu-devel] [PATCH v3 20/40] s390x/tcg: Implement VECTOR NAND David Hildenbrand 2019-05-02 14:09 ` David Hildenbrand 2019-05-02 14:10 ` [Qemu-devel] [PATCH v3 21/40] s390x/tcg: Implement VECTOR NOR David Hildenbrand 2019-05-02 14:10 ` David Hildenbrand 2019-05-02 14:10 ` [Qemu-devel] [PATCH v3 22/40] s390x/tcg: Implement VECTOR NOT EXCLUSIVE OR David Hildenbrand 2019-05-02 14:10 ` David Hildenbrand 2019-05-02 14:10 ` [Qemu-devel] [PATCH v3 23/40] s390x/tcg: Implement VECTOR OR David Hildenbrand 2019-05-02 14:10 ` David Hildenbrand 2019-05-02 14:10 ` [Qemu-devel] [PATCH v3 24/40] s390x/tcg: Implement VECTOR OR WITH COMPLEMENT David Hildenbrand 2019-05-02 14:10 ` David Hildenbrand 2019-05-02 14:10 ` David Hildenbrand [this message] 2019-05-02 14:10 ` [Qemu-devel] [PATCH v3 25/40] s390x/tcg: Implement VECTOR POPULATION COUNT David Hildenbrand 2019-05-02 14:10 ` [Qemu-devel] [PATCH v3 26/40] s390x/tcg: Implement VECTOR ELEMENT ROTATE LEFT LOGICAL David Hildenbrand 2019-05-02 14:10 ` David Hildenbrand 2019-05-02 14:10 ` [Qemu-devel] [PATCH v3 27/40] s390x/tcg: Implement VECTOR ELEMENT ROTATE AND INSERT UNDER MASK David Hildenbrand 2019-05-02 14:10 ` David Hildenbrand 2019-05-03 5:25 ` Richard Henderson 2019-05-03 5:25 ` Richard Henderson 2019-05-02 14:10 ` [Qemu-devel] [PATCH v3 28/40] s390x/tcg: Implement VECTOR ELEMENT SHIFT David Hildenbrand 2019-05-02 14:10 ` David Hildenbrand 2019-05-02 14:10 ` [Qemu-devel] [PATCH v3 29/40] s390x/tcg: Implement VECTOR SHIFT LEFT (BY BYTE) David Hildenbrand 2019-05-02 14:10 ` David Hildenbrand 2019-05-02 14:10 ` [Qemu-devel] [PATCH v3 30/40] s390x/tcg: Implement VECTOR SHIFT LEFT DOUBLE BY BYTE David Hildenbrand 2019-05-02 14:10 ` David Hildenbrand 2019-05-03 5:56 ` Richard Henderson 2019-05-03 5:56 ` Richard Henderson 2019-05-02 14:10 ` [Qemu-devel] [PATCH v3 31/40] s390x/tcg: Implement VECTOR SHIFT RIGHT ARITHMETIC David Hildenbrand 2019-05-02 14:10 ` David Hildenbrand 2019-05-02 14:10 ` [Qemu-devel] [PATCH v3 32/40] s390x/tcg: Implement VECTOR SHIFT RIGHT LOGICAL * David Hildenbrand 2019-05-02 14:10 ` David Hildenbrand 2019-05-02 14:10 ` [Qemu-devel] [PATCH v3 33/40] s390x/tcg: Implement VECTOR SUBTRACT David Hildenbrand 2019-05-02 14:10 ` David Hildenbrand 2019-05-02 14:10 ` [Qemu-devel] [PATCH v3 34/40] s390x/tcg: Implement VECTOR SUBTRACT COMPUTE BORROW INDICATION David Hildenbrand 2019-05-02 14:10 ` David Hildenbrand 2019-05-03 5:57 ` Richard Henderson 2019-05-03 5:57 ` Richard Henderson 2019-05-02 14:10 ` [Qemu-devel] [PATCH v3 35/40] s390x/tcg: Implement VECTOR SUBTRACT WITH " David Hildenbrand 2019-05-02 14:10 ` David Hildenbrand 2019-05-02 14:10 ` [Qemu-devel] [PATCH v3 36/40] s390x/tcg: Implement VECTOR SUBTRACT WITH BORROW COMPUTE " David Hildenbrand 2019-05-02 14:10 ` David Hildenbrand 2019-05-03 18:25 ` Richard Henderson 2019-05-03 18:25 ` Richard Henderson 2019-05-02 14:10 ` [Qemu-devel] [PATCH v3 37/40] s390x/tcg: Implement VECTOR SUM ACROSS DOUBLEWORD David Hildenbrand 2019-05-02 14:10 ` David Hildenbrand 2019-05-02 14:10 ` [Qemu-devel] [PATCH v3 38/40] s390x/tcg: Implement VECTOR SUM ACROSS QUADWORD David Hildenbrand 2019-05-02 14:10 ` David Hildenbrand 2019-05-02 14:10 ` [Qemu-devel] [PATCH v3 39/40] s390x/tcg: Implement VECTOR SUM ACROSS WORD David Hildenbrand 2019-05-02 14:10 ` David Hildenbrand 2019-05-02 14:10 ` [Qemu-devel] [PATCH v3 40/40] s390x/tcg: Implement VECTOR TEST UNDER MASK David Hildenbrand 2019-05-02 14:10 ` David Hildenbrand 2019-05-06 9:42 ` David Hildenbrand
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20190502141019.6385-26-david@redhat.com \ --to=david@redhat.com \ --cc=cohuck@redhat.com \ --cc=qemu-devel@nongnu.org \ --cc=qemu-s390x@nongnu.org \ --cc=richard.henderson@linaro.org \ --cc=rth@twiddle.net \ --cc=thuth@redhat.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).