From patchwork Sat Apr 20 07:34:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 162582 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp313853jan; Sat, 20 Apr 2019 01:00:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqwnh4uwBFT4E5o1hHgKq1JsX+ammR9mK2XbV2RWB7TtTIIlMWh06joKwiJdfsPq1uOuuwNq X-Received: by 2002:adf:f30a:: with SMTP id i10mr5784132wro.111.1555747233977; Sat, 20 Apr 2019 01:00:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555747233; cv=none; d=google.com; s=arc-20160816; b=hp/oc6791Cp6lwY0GUgnrMWaaO+kyk6w9HEVLJGpXanLTtgTxWpCfnuTYB4YB4cU0w YrmraRdXq9Og2Tz//jS/rDfdzrQF3s4jrS9MUka41GmJtusnqDpSl75UraU7m/1bFAgG XtXQeuRVaYJooBwYMc8PiLFUeCpFZcm3pYVhndoKyOe5JULHrFLUNN5YPoFXaCqatQ8k x9Vcmh3rIaIxmfFaYE4odO9VNPt1VVgx8uHUj0Q5CUFd8BK345l3q5TS7hWbXArrPTQ1 NK8yCy4H6lfGBleEYIuv1ClRLWKLg3xAIq8srpa9A3Qp5WdisyB8+2scGQArQOemGxB9 rPpw== 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=lRGQ2wNmavOUPa4H3gsQKIdLCd5xhIibGFq5wA+mFqQ=; b=X7fl82Wpt9BTrotBKh4pBuol3zYHfaRiiPBsxucJmUTlL6IYJv34Sx8FsTI31E8AB4 vYWWeiBpiWrbFyHvQB2tso1fnS00tuPiAzC9Rgr5vnCuQYlULqWcJNo0Hub3Q+5lOcwd CmDELzop8KXCSVGuX7gmw34q+4DSqxeqw2DGOu+Q5w+2xEAGfPUv7PD4TNhe7Rh3L1EH VZNZglqni6+XzIjAgTizC1EdE34ILs4okgXJ1lCi8FFXUwZVDitCXxrW4X/32cnUrwvK u3eTywe/J7qwI80MvjE+fopMfDEih0YPf8fQwuJgPwpuefsATnkr7nj+q8xsArZNY6xC yiYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=eEyK3olj; 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 b64si5235702wmc.60.2019.04.20.01.00.33 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 20 Apr 2019 01:00:33 -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=eEyK3olj; 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]:38434 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hHkvI-0004xZ-OQ for patch@linaro.org; Sat, 20 Apr 2019 04:00:32 -0400 Received: from eggs.gnu.org ([209.51.188.92]:40508) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hHkXX-00011Q-8W for qemu-devel@nongnu.org; Sat, 20 Apr 2019 03:36:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hHkXV-0000mF-V1 for qemu-devel@nongnu.org; Sat, 20 Apr 2019 03:35:59 -0400 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]:38608) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hHkXU-0000Mw-AD for qemu-devel@nongnu.org; Sat, 20 Apr 2019 03:35:56 -0400 Received: by mail-pl1-x644.google.com with SMTP id f36so3539289plb.5 for ; Sat, 20 Apr 2019 00:35:42 -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=lRGQ2wNmavOUPa4H3gsQKIdLCd5xhIibGFq5wA+mFqQ=; b=eEyK3olj9pgynR5TsnKROTz1B68RnDbqagojfxN7iUkdy4rws/aE7WVVKHbudPeCF/ yHmO5C3IBVDeT5gndOlpTnr0fonX9PfseZqbJtoDAT0/Oojpjh7xBQP63jDDQubBae6+ 6ZBRdKtRPfjRCvvuhqiwFX56DLFBCQvYNi7eoJWLVN1CLmYEOHjLlWlF7UFGCOmajcqu 3J1AQ7GbUScp5qX+FL+bWUVS5XfV5Bt9KuGPIPzSgnqc80TSJUPJfBMSB6PuZmKiowBf G9PPcbWR558Tbi1wEsPmUOnoTE5IJ5u1AFhwtIfPbFP9qdJIIYhAE9Q+S4MDxKLtPY+g yeKw== 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=lRGQ2wNmavOUPa4H3gsQKIdLCd5xhIibGFq5wA+mFqQ=; b=BzjYEFlmWw+uQx+gfLTgajQ32EmLlP70M2/aJrX9NZ1WtYSZsbGZnfEvNhYQCeiPcF OeNMGwtCHs/nqE5I+/pjUQ3ayF1DkZTObVj3VjGufV7sTTYkltqJ6KVx4rpo4Easv2yh /ql8+qeM+7tGziaTgdMwiiBCxxaxxZ3pk96y/an3Kp+UDia217ET3DEYdPJxN69lJ26A gNB0glutsqi/5VW1pCAu646EiYrJr7zQSgB1OMLGy2NA9JSTAfLpUSLBy8dZIxFhc6+H S6x7+LNHLL/oSV9Xhszfu+cWe9N5n2vOeQBeKxX/S1QakESlsHod8dtlDCcx/+g7KJMd GwxA== X-Gm-Message-State: APjAAAWN5IYHaJl5d639jzJDQJNwajIliP5eApPXrgFQLjnPyC+KPFfd RW3oE+bXTngGv2W7YkzHQA9WgyJhFts= X-Received: by 2002:a17:902:2b88:: with SMTP id l8mr8225061plb.262.1555745741032; Sat, 20 Apr 2019 00:35:41 -0700 (PDT) Received: from localhost.localdomain (rrcs-66-91-136-155.west.biz.rr.com. [66.91.136.155]) by smtp.gmail.com with ESMTPSA id z22sm7025492pgv.23.2019.04.20.00.35.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 20 Apr 2019 00:35:40 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 19 Apr 2019 21:34:39 -1000 Message-Id: <20190420073442.7488-36-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190420073442.7488-1-richard.henderson@linaro.org> References: <20190420073442.7488-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::644 Subject: [Qemu-devel] [PATCH 35/38] 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: david@redhat.com 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 7d8f7b490a..5868a51270 100644 --- a/tcg/tcg-op-vec.c +++ b/tcg/tcg-op-vec.c @@ -450,7 +450,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); @@ -468,82 +468,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, @@ -579,7 +588,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);