From nobody Mon Feb 9 22:20:07 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1601408255; cv=none; d=zohomail.com; s=zohoarc; b=lVPNbflHPmbhIUOP5hh7AEGHd7kvIra3Jy2mfFyZAHJrK+5RGqcvWm/Ov9JGG9z+qX+GjtvMfBXwP1gPrfdOxg1mevsTe67cHKZP2gJZpzBAScGQStlio7Z1qmPWEJxwLQYB8dWtFIKg5sHRz7m1bj9krPEwsNEQ7D+5vy/3BGg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601408255; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=yJS4K15UZPAfxiL0IVaDXJg0LPOYm3qt5WbjBEK5dcg=; b=mSkdUvarufuP31IM9cpRKgOo4mcH/s57Yp4mFFQbzBbJ2+tr3so5FDNmXyJyroaTHYH4Z3h1NmsWUbzB5NzwQ3egsmpCEj5E2o3ccurcyFBrAs42/9ywiiV6zhvca+EsctJP8r1H4quZHA9hzvlWhRUWIYGjS7PRgGZsNvTBoiE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1601408255343706.6547741179276; Tue, 29 Sep 2020 12:37:35 -0700 (PDT) Received: from localhost ([::1]:60132 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kNLRN-0005IK-Ud for importer@patchew.org; Tue, 29 Sep 2020 15:37:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44644) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kNKye-0006NZ-HQ for qemu-devel@nongnu.org; Tue, 29 Sep 2020 15:07:52 -0400 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]:42012) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kNKyb-0002Jr-IP for qemu-devel@nongnu.org; Tue, 29 Sep 2020 15:07:52 -0400 Received: by mail-pf1-x444.google.com with SMTP id d6so5520076pfn.9 for ; Tue, 29 Sep 2020 12:07:48 -0700 (PDT) Received: from localhost.localdomain (122-116-72-36.HINET-IP.hinet.net. [122.116.72.36]) by smtp.gmail.com with ESMTPSA id v8sm6003950pgg.58.2020.09.29.12.07.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Sep 2020 12:07:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=yJS4K15UZPAfxiL0IVaDXJg0LPOYm3qt5WbjBEK5dcg=; b=ReE0i+miJwuA7wTMTmqSy8MGmbll9ZVOjQOIHjMk5PqFymP9wz/eFNoaU9hW4ohKli Jr5uecR5ivIUdgpJlGPsfPcR+G9ui2o6d27LWk1fi1Rt2qDWUYP9KnIHqVxt2iIOEAmc uChcpTgQpIc5VDUq3vSoHtzpD0frw5bnDeU8TzirwaOXO3zIeVnP4FQwoGOOgVlY9bic 5MgvkbMLvPgeMlMb/NlWKit8of19J8NUJgPfBrSPEzmAOJkUTBrlewSXUB7tqxHx5fHe eBt+RTgstFbXTGYoGZ5rEpd1DMtU7jKVIoZh5WzRcDBDdewvAu8IzP4+xkTcFncbnzxF 3IuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=yJS4K15UZPAfxiL0IVaDXJg0LPOYm3qt5WbjBEK5dcg=; b=qFv0ax/x10lKrFE7guX0IiEPqE4ehnAI++JXX9vYIzADTqry3MkARGzDAgwIhLk5sb qL1KFPwP67b97tA9nfhW5X1jANJaiAkv3Ej1YQi0/L47eQcqaVG8xZGlO0BFm95tBrwi o3h0dlyPhaXbRDbfw34aqVj7KKM/P1NmtVB3Vrw0XgN6n0phpxbSxjX19Nu+Kd4bbKjB GW8FUJ+tFHoz202jODufBt2sYmHYzdF5gM2QG8Ez4kbf1/upF+96/caVGqAzO8Z0XCnp Xrn5ghD7BDYHViUFF6BgaQfrsnUB/1lJ9frGSItSZqg696jYEySz8nLyi7V1Z/IoVPly JToA== X-Gm-Message-State: AOAM5335/MZSReIySWCx8d3XwvR8Pxk1PGJ5iPzRRurPVcfBbLOuoK3q sHPGyAQsrGKHybeE7INamwRhomXOrlMbEw== X-Google-Smtp-Source: ABdhPJxDSdG2WDDrtevmmiBXxJst1lponkolWN/JOab40xYTTSkvzrmmd+qW2dnwg5jnXCEhRXVUAA== X-Received: by 2002:a63:1414:: with SMTP id u20mr4116929pgl.297.1601406467659; Tue, 29 Sep 2020 12:07:47 -0700 (PDT) From: frank.chang@sifive.com To: qemu-devel@nongnu.org, qemu-riscv@nongnu.org Subject: [RFC v5 42/68] target/riscv: rvv-1.0: integer add-with-carry/subtract-with-borrow Date: Wed, 30 Sep 2020 03:04:17 +0800 Message-Id: <20200929190448.31116-43-frank.chang@sifive.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200929190448.31116-1-frank.chang@sifive.com> References: <20200929190448.31116-1-frank.chang@sifive.com> Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::444; envelope-from=frank.chang@sifive.com; helo=mail-pf1-x444.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sagar Karandikar , Frank Chang , Bastian Koppelmann , Richard Henderson , Alistair Francis , Palmer Dabbelt , LIU Zhiwei Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Frank Chang * Only do carry-in or borrow-in if is masked (vm=3D0). * Remove clear function from helper functions as the tail elements are unchanged in RVV 1.0. Signed-off-by: Frank Chang --- target/riscv/insn32.decode | 20 ++++++++++---------- target/riscv/insn_trans/trans_rvv.c.inc | 2 +- target/riscv/vector_helper.c | 20 ++++++-------------- 3 files changed, 17 insertions(+), 25 deletions(-) diff --git a/target/riscv/insn32.decode b/target/riscv/insn32.decode index 9fcb985e9f..c67c6cb010 100644 --- a/target/riscv/insn32.decode +++ b/target/riscv/insn32.decode @@ -353,16 +353,16 @@ vwsubu_wv 110110 . ..... ..... 010 ..... 101011= 1 @r_vm vwsubu_wx 110110 . ..... ..... 110 ..... 1010111 @r_vm vwsub_wv 110111 . ..... ..... 010 ..... 1010111 @r_vm vwsub_wx 110111 . ..... ..... 110 ..... 1010111 @r_vm -vadc_vvm 010000 1 ..... ..... 000 ..... 1010111 @r_vm_1 -vadc_vxm 010000 1 ..... ..... 100 ..... 1010111 @r_vm_1 -vadc_vim 010000 1 ..... ..... 011 ..... 1010111 @r_vm_1 -vmadc_vvm 010001 1 ..... ..... 000 ..... 1010111 @r_vm_1 -vmadc_vxm 010001 1 ..... ..... 100 ..... 1010111 @r_vm_1 -vmadc_vim 010001 1 ..... ..... 011 ..... 1010111 @r_vm_1 -vsbc_vvm 010010 1 ..... ..... 000 ..... 1010111 @r_vm_1 -vsbc_vxm 010010 1 ..... ..... 100 ..... 1010111 @r_vm_1 -vmsbc_vvm 010011 1 ..... ..... 000 ..... 1010111 @r_vm_1 -vmsbc_vxm 010011 1 ..... ..... 100 ..... 1010111 @r_vm_1 +vadc_vvm 010000 0 ..... ..... 000 ..... 1010111 @r_vm_1 +vadc_vxm 010000 0 ..... ..... 100 ..... 1010111 @r_vm_1 +vadc_vim 010000 0 ..... ..... 011 ..... 1010111 @r_vm_1 +vmadc_vvm 010001 . ..... ..... 000 ..... 1010111 @r_vm +vmadc_vxm 010001 . ..... ..... 100 ..... 1010111 @r_vm +vmadc_vim 010001 . ..... ..... 011 ..... 1010111 @r_vm +vsbc_vvm 010010 0 ..... ..... 000 ..... 1010111 @r_vm_1 +vsbc_vxm 010010 0 ..... ..... 100 ..... 1010111 @r_vm_1 +vmsbc_vvm 010011 . ..... ..... 000 ..... 1010111 @r_vm +vmsbc_vxm 010011 . ..... ..... 100 ..... 1010111 @r_vm vand_vv 001001 . ..... ..... 000 ..... 1010111 @r_vm vand_vx 001001 . ..... ..... 100 ..... 1010111 @r_vm vand_vi 001001 . ..... ..... 011 ..... 1010111 @r_vm diff --git a/target/riscv/insn_trans/trans_rvv.c.inc b/target/riscv/insn_tr= ans/trans_rvv.c.inc index 20b104527c..7d590bd6a0 100644 --- a/target/riscv/insn_trans/trans_rvv.c.inc +++ b/target/riscv/insn_trans/trans_rvv.c.inc @@ -1791,7 +1791,7 @@ static bool trans_##NAME(DisasContext *s, arg_rmrr *a= ) \ =20 /* * For vadc and vsbc, an illegal instruction exception is raised if the - * destination vector register is v0 and LMUL > 1. (Section 12.3) + * destination vector register is v0 and LMUL > 1. (Section 12.4) */ static bool opivv_vadc_check(DisasContext *s, arg_rmrr *a) { diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c index c37d040411..8e122ba41d 100644 --- a/target/riscv/vector_helper.c +++ b/target/riscv/vector_helper.c @@ -1153,7 +1153,7 @@ void HELPER(NAME)(void *vd, void *v0, void *vs1, void= *vs2, \ for (i =3D 0; i < vl; i++) { \ ETYPE s1 =3D *((ETYPE *)vs1 + H(i)); \ ETYPE s2 =3D *((ETYPE *)vs2 + H(i)); \ - uint8_t carry =3D vext_elem_mask(v0, i); \ + ETYPE carry =3D vext_elem_mask(v0, i); \ \ *((ETYPE *)vd + H(i)) =3D DO_OP(s2, s1, carry); \ } \ @@ -1178,7 +1178,7 @@ void HELPER(NAME)(void *vd, void *v0, target_ulong s1= , void *vs2, \ \ for (i =3D 0; i < vl; i++) { = \ ETYPE s2 =3D *((ETYPE *)vs2 + H(i)); = \ - uint8_t carry =3D vext_elem_mask(v0, i); = \ + ETYPE carry =3D vext_elem_mask(v0, i); = \ \ *((ETYPE *)vd + H(i)) =3D DO_OP(s2, (ETYPE)(target_long)s1, carry)= ;\ } \ @@ -1203,19 +1203,15 @@ void HELPER(NAME)(void *vd, void *v0, void *vs1, vo= id *vs2, \ CPURISCVState *env, uint32_t desc) \ { \ uint32_t vl =3D env->vl; \ - uint32_t vlmax =3D vext_maxsz(desc) / sizeof(ETYPE); \ + uint32_t vm =3D vext_vm(desc); \ uint32_t i; \ \ for (i =3D 0; i < vl; i++) { \ ETYPE s1 =3D *((ETYPE *)vs1 + H(i)); \ ETYPE s2 =3D *((ETYPE *)vs2 + H(i)); \ - uint8_t carry =3D vext_elem_mask(v0, i); \ - \ + ETYPE carry =3D !vm && vext_elem_mask(v0, i); \ vext_set_elem_mask(vd, i, DO_OP(s2, s1, carry)); \ } \ - for (; i < vlmax; i++) { \ - vext_set_elem_mask(vd, i, 0); \ - } \ } =20 GEN_VEXT_VMADC_VVM(vmadc_vvm_b, uint8_t, H1, DO_MADC) @@ -1233,19 +1229,15 @@ void HELPER(NAME)(void *vd, void *v0, target_ulong = s1, \ void *vs2, CPURISCVState *env, uint32_t desc) \ { \ uint32_t vl =3D env->vl; \ - uint32_t vlmax =3D vext_max_elems(desc, ctzl(sizeof(ETYPE))); \ + uint32_t vm =3D vext_vm(desc); \ uint32_t i; \ \ for (i =3D 0; i < vl; i++) { \ ETYPE s2 =3D *((ETYPE *)vs2 + H(i)); \ - uint8_t carry =3D vext_elem_mask(v0, i); \ - \ + ETYPE carry =3D !vm && vext_elem_mask(v0, i); \ vext_set_elem_mask(vd, i, \ DO_OP(s2, (ETYPE)(target_long)s1, carry)); \ } \ - for (; i < vlmax; i++) { \ - vext_set_elem_mask(vd, i, 0); \ - } \ } =20 GEN_VEXT_VMADC_VXM(vmadc_vxm_b, uint8_t, H1, DO_MADC) --=20 2.17.1