From patchwork Sat Apr 20 07:34:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 162551 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp296749jan; Sat, 20 Apr 2019 00:35:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqzEpszCmFJIXWmfMDZgrhaHDDvLvnVOy8/xe1+Wa89eP/Lnrsh1OpLnIvA8VKF1ydO9dHNF X-Received: by 2002:adf:9c91:: with SMTP id d17mr6249366wre.285.1555745731282; Sat, 20 Apr 2019 00:35:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555745731; cv=none; d=google.com; s=arc-20160816; b=0EhOsDaJJbiPvmo8Voow/YTDEX602dmJs5xH6C+v2foNbJzsIRVRfSkPq13XenOhS0 cB/Zrq8cGKFhMcF61Frcs47tlQTlslrvfRomVT4Pk8zS6IPfOVZ05JYuE6YxR1fTt/fw EEmV896x0XgoA1ycbavxz3MtJviM8AfH9W4ZuydQfDJCLspxCPMtD+Fxq0ZHcUb/QjKN WNUIBy4P7UOlq5qiTMBtvpH7PvZtdh76lnpC3OnrrH2PHnvdA+4tOHAUt8eaoJXllki3 IaMp/rCeXVJV4bSZfoT1TPJsVovCdt3Lv11KA2j++7Nfo3zgb6kRsweeHk9dGl8Fe06I 1D+w== 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=TM1gXfRu5rNa8H31jQ9LQek5zgysMvrWVqkLd98KzZU=; b=tL7/RbwP8QGnaruEnrVZ9jM1DUgX3YIjRl7swgIOiMRj5t5r8dnxrTnTaAPPA13hVL ZS+QyB82TGUdwARfE0jHKeSgodA9SdhBwyNCtE/g2WYH9g43Kd5FgMXrYcelJ38gJJg7 uJEl44Ec8MIyf0hkMXioMPv1R1IzU4ffo4K0edY1WS/ZgDVrQG3lSfoRCew9JadTzpDi zOSR5KhKPJ8zjy4OBxGkbQOWnU94TDjpsPjhy7UWZqDr0StaAVYWRj3UpEpxUxeU0Gkk auQlLxbuM/P3UM0N+esLxs2CPTitxQdG5PrPYu9FhN60phlgyqsD8JB0GRiUL7G662Da lCEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=AJfzaWwT; 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 w7si5573756wrv.200.2019.04.20.00.35.30 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 20 Apr 2019 00:35:31 -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=AJfzaWwT; 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]:38039 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hHkX4-0008Qz-3o for patch@linaro.org; Sat, 20 Apr 2019 03:35:30 -0400 Received: from eggs.gnu.org ([209.51.188.92]:40111) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hHkWW-0008Og-P6 for qemu-devel@nongnu.org; Sat, 20 Apr 2019 03:34:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hHkWV-0007mj-LP for qemu-devel@nongnu.org; Sat, 20 Apr 2019 03:34:56 -0400 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]:45262) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hHkWV-0007kM-FN for qemu-devel@nongnu.org; Sat, 20 Apr 2019 03:34:55 -0400 Received: by mail-pl1-x642.google.com with SMTP id bf11so3528508plb.12 for ; Sat, 20 Apr 2019 00:34:55 -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=TM1gXfRu5rNa8H31jQ9LQek5zgysMvrWVqkLd98KzZU=; b=AJfzaWwT/c1toDadjaTeZ2pixHROHU4oc3oo4/BGxbvxkiyGuLmXOL0++OHt+hPyCb By3Lkz4pkSy2Y1ONCf8ssYxoILb8SXkqZG2iqMhYsAlYLhcWDK7ypWDHiAQsJf22/LXd XyC+NBZcPJymFFhTJo6peA2gCq/4FuxbnB0o4UovjM3W/ptssLVwdcekT4KWRJQSxDz2 emLga+LETqVrGRy7610NoPOwTC8hb+phxZ/EnvOwVmbSg/U3YjJvD1l1/oSl5VDXy9Og fPRZz2RZCdLx8OWnKc6Fgjr5tzRHiFj4tA3pZmysfAEjSnAwc6cUc21jSCl4kc8+aeGQ W6vg== 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=TM1gXfRu5rNa8H31jQ9LQek5zgysMvrWVqkLd98KzZU=; b=gslMYHa2/W7KWNDswUAJsl7IMLdic+Nd+k0N37efbIxrLTvLbSRPrJtGTrjsTO9YnF xk28oKQ8BXisZaFL5SOY3IgSNu+M+tZrMCHWCqNSx+qPzPNYUZ8/RUkanawimwJow48a zhrbHS7qP/MJYUuu4wjembp5E4BHwE6/sHJWyHB9dZh6W2wvJXs5L7G/g3B0XsYAmr7P 2NpWeVBIC/Yd/mB667IZWqnkCFYB/n+yei3NWCci8flemwGewY7i5BmXO2X66gHhM8Jh LgCEPf1f17OQDYq8IJ+BBHLFLvHdzzTlcllyGNM+0XXhzndTQl4456tbZ0toiWsjsGxJ heIA== X-Gm-Message-State: APjAAAUcPNezzs37VSA8+TstEgPSi2otViBxfAWII4oxzyRH1sTwOLFA w1ymAs/hQRiE7gP1hA/rUUu0LL42B4Q= X-Received: by 2002:a17:902:3e5:: with SMTP id d92mr8124255pld.11.1555745694257; Sat, 20 Apr 2019 00:34:54 -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.34.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 20 Apr 2019 00:34:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 19 Apr 2019 21:34:09 -1000 Message-Id: <20190420073442.7488-6-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::642 Subject: [Qemu-devel] [PATCH 05/38] tcg: Allow add_vec, sub_vec, neg_vec, not_vec to be expanded 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" Signed-off-by: Richard Henderson --- tcg/tcg-op-vec.c | 49 ++++++++++++++++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 16 deletions(-) -- 2.17.1 Reviewed-by: David Hildenbrand diff --git a/tcg/tcg-op-vec.c b/tcg/tcg-op-vec.c index 27f65600c3..cfb18682b1 100644 --- a/tcg/tcg-op-vec.c +++ b/tcg/tcg-op-vec.c @@ -226,16 +226,6 @@ void tcg_gen_stl_vec(TCGv_vec r, TCGv_ptr b, TCGArg o, TCGType low_type) vec_gen_3(INDEX_op_st_vec, low_type, 0, ri, bi, o); } -void tcg_gen_add_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b) -{ - vec_gen_op3(INDEX_op_add_vec, vece, r, a, b); -} - -void tcg_gen_sub_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b) -{ - vec_gen_op3(INDEX_op_sub_vec, vece, r, a, b); -} - void tcg_gen_and_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b) { vec_gen_op3(INDEX_op_and_vec, 0, r, a, b); @@ -296,11 +286,30 @@ void tcg_gen_eqv_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b) tcg_gen_not_vec(0, r, r); } +static bool do_op2(unsigned vece, TCGv_vec r, TCGv_vec a, TCGOpcode opc) +{ + TCGTemp *rt = tcgv_vec_temp(r); + TCGTemp *at = tcgv_vec_temp(a); + TCGArg ri = temp_arg(rt); + TCGArg ai = temp_arg(at); + TCGType type = rt->base_type; + int can; + + tcg_debug_assert(at->base_type >= type); + can = tcg_can_emit_vec_op(opc, type, vece); + if (can > 0) { + vec_gen_2(opc, type, vece, ri, ai); + } else if (can < 0) { + tcg_expand_vec_op(opc, type, vece, ri, ai); + } else { + return false; + } + return true; +} + void tcg_gen_not_vec(unsigned vece, TCGv_vec r, TCGv_vec a) { - if (TCG_TARGET_HAS_not_vec) { - vec_gen_op2(INDEX_op_not_vec, 0, r, a); - } else { + if (!TCG_TARGET_HAS_not_vec || !do_op2(vece, r, a, INDEX_op_not_vec)) { TCGv_vec t = tcg_const_ones_vec_matching(r); tcg_gen_xor_vec(0, r, a, t); tcg_temp_free_vec(t); @@ -309,9 +318,7 @@ void tcg_gen_not_vec(unsigned vece, TCGv_vec r, TCGv_vec a) void tcg_gen_neg_vec(unsigned vece, TCGv_vec r, TCGv_vec a) { - if (TCG_TARGET_HAS_neg_vec) { - vec_gen_op2(INDEX_op_neg_vec, vece, r, a); - } else { + if (!TCG_TARGET_HAS_neg_vec || !do_op2(vece, r, a, INDEX_op_neg_vec)) { TCGv_vec t = tcg_const_zeros_vec_matching(r); tcg_gen_sub_vec(vece, r, t, a); tcg_temp_free_vec(t); @@ -409,6 +416,16 @@ static void do_op3(unsigned vece, TCGv_vec r, TCGv_vec a, } } +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); +} + +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); +} + 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);