From patchwork Sun Mar 17 09:08:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 160462 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp1406198jad; Sun, 17 Mar 2019 02:12:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqyCpz2YM+7qBwuHraNYWQ1gVXKhLdD1UTJRBuFq1D0y+9RHB+zLOUAQKsP7LrG9x56CmEYW X-Received: by 2002:adf:cd87:: with SMTP id q7mr8749415wrj.92.1552813936449; Sun, 17 Mar 2019 02:12:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552813936; cv=none; d=google.com; s=arc-20160816; b=deglCvWuhrmMP9fB9SQh4UPNNCKgb+x7QYo3lnuTARTcmTCxdQyfiE3jyKJgn1ZwCZ PP6UDSKs4mJUuvyHJb4wCeHeHTMxYL3RdvsklwjIVzvfnwMYkb6X+cSy2Br2jEmK63OB M8CpXMYDD4oGorVQ8f+zVVS5tAfcTKeVH6+QyZPQzR+WtK/4oPLCYdTY1CtNZE6l1sva lBqmd9wN5uVxocfm+g8lGhwBppCXxIW1YFUBRtB0CeF2uBBDU+mJXFByRJI6JWTBTFFF sBkQpoM24xnoDYfKkCyqMQByZSMHrXYw7GONJOYO/ByC09/T1LUHBxUarHeO/vKujtrm cVyQ== 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=GZIJyp4IPrmFxQhN2kp0EgDilGGl6wAJPSZllKgeFTA=; b=bQoMbbjAhUiFOpNgC101An1x3lFSlnX3rcGGSUDAL1GMr8B0heae1KJQkgziAsZr6f ZdQOUU4bYKQQ9l5UjyF1BgjpugPDDOayYMXATANGoQ9+J3Fgb0vDFjzshRrq+zX0t7VX Slw/XiO8aYp+gHIrnZbgg5MpG1NfU6Fy/+ro9DtghdzCiHSRp4jBPpgdXZH3TWJaUTTS tLPrGpJho2LaMmLvMBzQ9e7w3haNYn/EB074auc0qYhE2xevaTOp5qXTzVTsB47k0RjN NqKeP0AMeJqAf3cVTecVwjmxD4DYk0wO3Su71HainQuWhIIWVqq2PQ+3pBoXB3dhHyEb ZcEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Fy9Au7kp; 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 e22si4326539wme.28.2019.03.17.02.12.16 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sun, 17 Mar 2019 02:12:16 -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=Fy9Au7kp; 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]:52123 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h5Rq3-0008NM-A6 for patch@linaro.org; Sun, 17 Mar 2019 05:12:15 -0400 Received: from eggs.gnu.org ([209.51.188.92]:47680) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h5Rmf-0005cZ-Ow for qemu-devel@nongnu.org; Sun, 17 Mar 2019 05:08:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h5Rme-000496-EY for qemu-devel@nongnu.org; Sun, 17 Mar 2019 05:08:45 -0400 Received: from mail-pg1-x533.google.com ([2607:f8b0:4864:20::533]:33020) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h5Rme-00047O-3u for qemu-devel@nongnu.org; Sun, 17 Mar 2019 05:08:44 -0400 Received: by mail-pg1-x533.google.com with SMTP id i7so6118013pgq.0 for ; Sun, 17 Mar 2019 02:08:43 -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=GZIJyp4IPrmFxQhN2kp0EgDilGGl6wAJPSZllKgeFTA=; b=Fy9Au7kpULm9toqhBWajR2v+oa85vBzulSjqe6/0ZOw3ObAPnqLdiBxBnXhyJwZMqq nrUla9ZSXn7HUf4F5hkR4f0aPXTf5VQE/sifl91n/HHFkjgi2F2brfeBplcLV0fNTAMG 4Wlp7RKJuScGOrP81eRK8IeVW6chig2k3h/dmQV/yOTVCkVzkHSAn/b3IFPLHBbuh1/w mUC577JxzU/hYE4q71l9NfBxacNeS16lmmMtokrVz538DFd7rZ/3vmiQtDh1KKySYc8V V1JtKQIpeUT4/jUNp5ckO76m43dYNuReFB390LiimkJ298LjqSBlxMPkdBkR1YPPpBQS ru3Q== 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=GZIJyp4IPrmFxQhN2kp0EgDilGGl6wAJPSZllKgeFTA=; b=lvKb8kkdX32lpdzXyCOqcU8NldTVSS6rFkC/hoakdXhlQscFIiTsODcpTbQZ5W83HT baYtZcMSzMwKC28h6nBwmuwFtV+POuY7392MIwwQgZXqPWWVBod6Z9f93sf1kkhfcaFF Z+o0z+iunCfzjYW62R+ISNYszTOPv8E4eEUh3PDl8571YYdkBvSmw/5qEP9ydDvsdOK4 lshDLPrPoCMtwvnEv1NJinnfhl0Yd/enFUmAHivGsJIhlfKONdXdLxkpcdDv6JMKnJn9 UrmedRbKuHqbF8VlXA7hNMBtJ/jHCjm47P1DG6eEJAFbjhML3B9fhLZlDQ8KyDzdybOq m7OQ== X-Gm-Message-State: APjAAAW9NJOzc/c71wLbt3BeohHZ8m8c56g2mVWPi80TM2bXqy6BW2vd ZyRJkXgX+TezW5ScKcfGk8bzuTuSsmo= X-Received: by 2002:a63:fc64:: with SMTP id r36mr12136191pgk.280.1552813722680; Sun, 17 Mar 2019 02:08:42 -0700 (PDT) Received: from cloudburst.twiddle.net (97-113-188-82.tukw.qwest.net. [97.113.188.82]) by smtp.gmail.com with ESMTPSA id b85sm19378435pfj.56.2019.03.17.02.08.41 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Mar 2019 02:08:42 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sun, 17 Mar 2019 02:08:25 -0700 Message-Id: <20190317090834.5552-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190317090834.5552-1-richard.henderson@linaro.org> References: <20190317090834.5552-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::533 Subject: [Qemu-devel] [PATCH for-4.1 v2 04/13] 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: mark.cave-ayland@ilande.co.uk, david@gibson.dropbear.id.au 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.2 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);