From patchwork Wed May 22 22:28:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 164907 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp1413686ili; Wed, 22 May 2019 15:32:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqyDsusMonLfl8wwTFvU6wvdUtSoPONoP6oKK8ZJTdShPBIH4vN1ieeh/IP8usGY2ZaKlVvH X-Received: by 2002:a17:906:2498:: with SMTP id e24mr3403583ejb.42.1558564323958; Wed, 22 May 2019 15:32:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558564323; cv=none; d=google.com; s=arc-20160816; b=FGC9TPOBcc4hzNpGDIbmGIeRmO748C+Ozu3zqu2zzfXgniCu1vR1gpunBkan5HPqgA oeihMkLcGjya8poApaLOzGTZYueWOSy1LkwlK/Dt5xgP54znycBu1jLS7FfXkDZUGhPn UAKlPobqz1evKKblj0z+bS9KopWG1kOuV8DJKmRclK1rgs4uGccUWr5Yyq3KozkPgNOr bJy/KFGeDUkhQaJxKwepDt+JN3B4wp9WMdn+6am+ssoul4ORZQFli9iA3NHKmv8w+G9l 6tEWwa86ahJz+BM3BpFW9ht8CrMAMf5HoKCBVeTyp1Jr4baHrWKZQTn8YuGf4X+ZgDyZ AWGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=IHzD/cFhgds3vlWGOoqI0eCnewZUJpWI1Gh0PD14SRs=; b=Yu3BMk+UfFRVj2llvOF3HydqqR6ROPp8eZrESOzy6SDe3SYjhFLyRN5HMcFInoQzY8 tDMqXZ9fDNAThx7imraFJj0Kumj265swSNS08CvkO1/PB0oms27yCmShOLmtP1+FDjgy dgZfCXLPfbFpc5/wYj5RuXF2C0YvLT/37BY5mbjo/22Qp8Sho/PxWLNEODmg7a8oHkiM 7tcwMAFu6/pkCpG3lodEBr0WukRv3XyYqelglCytnnR305aaySN+KnZMxh46d/7AwiuN Bt94O8N5MlVKUl+RwWqPENf7+3FcVObqmWO3bEGwC741nwT0H4RnYwZT/uuweOB1xAqN hapw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=r3PiTJIY; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b38si7243673edc.267.2019.05.22.15.32.03 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 22 May 2019 15:32:03 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=r3PiTJIY; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1]:52549 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTZmE-0005tb-O0 for patch@linaro.org; Wed, 22 May 2019 18:32:02 -0400 Received: from eggs.gnu.org ([209.51.188.92]:49785) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTZiv-00031X-PC for qemu-devel@nongnu.org; Wed, 22 May 2019 18:28:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hTZir-0007M3-Ve for qemu-devel@nongnu.org; Wed, 22 May 2019 18:28:35 -0400 Received: from mail-yb1-xb2b.google.com ([2607:f8b0:4864:20::b2b]:46056) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hTZiq-0007KH-1X for qemu-devel@nongnu.org; Wed, 22 May 2019 18:28:33 -0400 Received: by mail-yb1-xb2b.google.com with SMTP id e128so1480127ybc.12 for ; Wed, 22 May 2019 15:28:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=IHzD/cFhgds3vlWGOoqI0eCnewZUJpWI1Gh0PD14SRs=; b=r3PiTJIYGw6Qs7AjLyAsPGTd64/vPXH9IOtnr5MlPytOjoetK9dxpS3cgnAzqP+nZp imN36oAEOka/Ld0rteneJ81sNTxmgnQfnjlbcX3U4GeD2PIPmVVpUo4Iv2iumpBiy8VK vjMbnYTCY+JzY6vYjU/HIE2AjGDAhCPxjHzHcSjYfq//3AC8MPmunp5tdTq7tkiAC/F2 NT3U5y97EDAeB+QxGELztQ95aIGyTYE/lOgvroc4MEDKdNGa9E7FM8+73n9YkQ63Pc4U 6bT7n3KnS5lp+UDtATlcHcwg4AsnTEyiBekXUvaGsPqql68UOpMqm/GDpT+OFQzr9qdm cR+g== 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=IHzD/cFhgds3vlWGOoqI0eCnewZUJpWI1Gh0PD14SRs=; b=YS8g7zKvyX/gmPcoaJyKRf4q31lO36p+1dbT1J/CZhcJYUFUGIUB39FHKFhAZpJ/G7 e/nzJVQau8GCCHIvfpNC9qKoHdNQeZU3C+owv6SJ5xe/IDBAlS7UV4WoDKROsAKQjD65 qdOHdffQwhc7V4o+CekFV5MBpXXtOI16LOsSf+s1pORhHIyeGQ/QxM8XUV5TkQfMwTfx CkpbnMSkXH0n0ILRGX9UjZGbB9hbghlPg7YGk9JDOZTyubmFZ5LqfAhMShb3fi0KO/Mo uYIRdFiZg05eaztGu0ufYMEuyLc1zWFJxYCp9PYgTt7+TDjwhEFRU1eWUIEitzRCN24E 7nhA== X-Gm-Message-State: APjAAAXQ2PPKk6hO9lj130bBylq7CZJA9ttLYHgakU41KaD7KO+u8Y8v dWK8VenHMnJ/DIK+ikpjrkWY0rNDC/M= X-Received: by 2002:a25:f20e:: with SMTP id i14mr41568617ybe.122.1558564109512; Wed, 22 May 2019 15:28:29 -0700 (PDT) Received: from localhost.localdomain ([71.46.56.17]) by smtp.gmail.com with ESMTPSA id q11sm2276453ywg.7.2019.05.22.15.28.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 May 2019 15:28:28 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 22 May 2019 18:28:10 -0400 Message-Id: <20190522222821.23850-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190522222821.23850-1-richard.henderson@linaro.org> References: <20190522222821.23850-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::b2b Subject: [Qemu-devel] [PULL 05/16] tcg: Introduce do_op3_nofail for vector expansion X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This makes do_op3 match do_op2 in allowing for failure, and thus fall back expansions. Signed-off-by: Richard Henderson --- tcg/tcg-op-vec.c | 45 +++++++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 18 deletions(-) -- 2.17.1 diff --git a/tcg/tcg-op-vec.c b/tcg/tcg-op-vec.c index a888c02df8..004a34935b 100644 --- a/tcg/tcg-op-vec.c +++ b/tcg/tcg-op-vec.c @@ -562,7 +562,7 @@ void tcg_gen_cmp_vec(TCGCond cond, unsigned vece, } } -static void do_op3(unsigned vece, TCGv_vec r, TCGv_vec a, +static bool do_op3(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b, TCGOpcode opc) { TCGTemp *rt = tcgv_vec_temp(r); @@ -580,82 +580,91 @@ static void do_op3(unsigned vece, TCGv_vec r, TCGv_vec a, can = tcg_can_emit_vec_op(opc, type, vece); if (can > 0) { vec_gen_3(opc, type, vece, ri, ai, bi); - } else { + } else if (can < 0) { const TCGOpcode *hold_list = tcg_swap_vecop_list(NULL); - tcg_debug_assert(can < 0); tcg_expand_vec_op(opc, type, vece, ri, ai, bi); tcg_swap_vecop_list(hold_list); + } else { + return false; } + return true; +} + +static void do_op3_nofail(unsigned vece, TCGv_vec r, TCGv_vec a, + TCGv_vec b, TCGOpcode opc) +{ + bool ok = do_op3(vece, r, a, b, opc); + tcg_debug_assert(ok); } void tcg_gen_add_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b) { - do_op3(vece, r, a, b, INDEX_op_add_vec); + do_op3_nofail(vece, r, a, b, INDEX_op_add_vec); } void tcg_gen_sub_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b) { - do_op3(vece, r, a, b, INDEX_op_sub_vec); + do_op3_nofail(vece, r, a, b, INDEX_op_sub_vec); } void tcg_gen_mul_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b) { - do_op3(vece, r, a, b, INDEX_op_mul_vec); + do_op3_nofail(vece, r, a, b, INDEX_op_mul_vec); } void tcg_gen_ssadd_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b) { - do_op3(vece, r, a, b, INDEX_op_ssadd_vec); + do_op3_nofail(vece, r, a, b, INDEX_op_ssadd_vec); } void tcg_gen_usadd_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b) { - do_op3(vece, r, a, b, INDEX_op_usadd_vec); + do_op3_nofail(vece, r, a, b, INDEX_op_usadd_vec); } void tcg_gen_sssub_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b) { - do_op3(vece, r, a, b, INDEX_op_sssub_vec); + do_op3_nofail(vece, r, a, b, INDEX_op_sssub_vec); } void tcg_gen_ussub_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b) { - do_op3(vece, r, a, b, INDEX_op_ussub_vec); + do_op3_nofail(vece, r, a, b, INDEX_op_ussub_vec); } void tcg_gen_smin_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b) { - do_op3(vece, r, a, b, INDEX_op_smin_vec); + do_op3_nofail(vece, r, a, b, INDEX_op_smin_vec); } void tcg_gen_umin_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b) { - do_op3(vece, r, a, b, INDEX_op_umin_vec); + do_op3_nofail(vece, r, a, b, INDEX_op_umin_vec); } void tcg_gen_smax_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b) { - do_op3(vece, r, a, b, INDEX_op_smax_vec); + do_op3_nofail(vece, r, a, b, INDEX_op_smax_vec); } void tcg_gen_umax_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b) { - do_op3(vece, r, a, b, INDEX_op_umax_vec); + do_op3_nofail(vece, r, a, b, INDEX_op_umax_vec); } void tcg_gen_shlv_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b) { - do_op3(vece, r, a, b, INDEX_op_shlv_vec); + do_op3_nofail(vece, r, a, b, INDEX_op_shlv_vec); } void tcg_gen_shrv_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b) { - do_op3(vece, r, a, b, INDEX_op_shrv_vec); + do_op3_nofail(vece, r, a, b, INDEX_op_shrv_vec); } void tcg_gen_sarv_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b) { - do_op3(vece, r, a, b, INDEX_op_sarv_vec); + do_op3_nofail(vece, r, a, b, INDEX_op_sarv_vec); } static void do_shifts(unsigned vece, TCGv_vec r, TCGv_vec a, @@ -691,7 +700,7 @@ static void do_shifts(unsigned vece, TCGv_vec r, TCGv_vec a, } else { tcg_gen_dup_i32_vec(vece, vec_s, s); } - do_op3(vece, r, a, vec_s, opc_v); + do_op3_nofail(vece, r, a, vec_s, opc_v); tcg_temp_free_vec(vec_s); } tcg_swap_vecop_list(hold_list);