From patchwork Tue Mar 19 17:21:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 160590 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp4133953jad; Tue, 19 Mar 2019 10:22:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqw1iad4q/WYUikzuT0rTQK94pL9sURXo3MpN5WF7IQNmD6Svn72zoTz87jsmEZg0NM4xHS7 X-Received: by 2002:a1c:ac87:: with SMTP id v129mr4826977wme.72.1553016127451; Tue, 19 Mar 2019 10:22:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553016127; cv=none; d=google.com; s=arc-20160816; b=jxkHBeZSTgS6y+/oajQvaHA/LmOvlXTdf2Dx01ZLilth3RvVWO96ktrxuJRktZfwmt aoLa2v/HoU/6S0/8d+GLxdsauPjdvjbiXoNr9NwBWwS9x72gWeTD9447iJBbaPch1Yus OhOEDXurjPuMxnybc3ICsyhLjyDSDYjfUiHElV/zm2TEQ6doMGgMpJz2X4jqHEghl5P7 n+q+WwMXFW45OlbLkTa719tHJrqVpIfONHruZ8T/0wkg0v4u3SAcWV7q2MShqG1tzevM +urQWrCnqu0zXPSrkq+1Om18c8ORIg+LKPvLhhliOtT+5IiBZz4g0EGVmUeOUeU8Q6KT zyBg== 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=ABFNmYyNCP6syO1mu5nSz2Tz+pITLo45fd7e4WbBzXqJB6tIiMD6UaIvXDEloERYE5 0wJKxK+mG4IPS1lBt/fxewVlgQrrivV5u5oJ/YJSssOoXffrJNzyPrvxHhZQYYm5GZZ1 bA9OP5akGc0i4CsYmD2zNnrQOpEgW+CNbzv3bLSuC7pMXTLuLtSuJWxS4zvT+2auIc/a l7/tY6P8fDsbxHq9/+eMBypO3GEcr8PlsyUMbomuiFWL5/LRA7/ZCS8ZfDVEzaCXuwSv krhan8Ef6kj+fRFmMSL8ZT4g/6KfV+SuRlsHyZVPIoThWHuvmneCusVHG+8evF9dqXJF 215Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=iUtvwhbo; 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 v12si9962394wra.89.2019.03.19.10.22.07 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 19 Mar 2019 10:22:07 -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=iUtvwhbo; 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]:60665 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6IRC-0004e0-AE for patch@linaro.org; Tue, 19 Mar 2019 13:22:06 -0400 Received: from eggs.gnu.org ([209.51.188.92]:49133) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6IQl-0004Zz-5M for qemu-devel@nongnu.org; Tue, 19 Mar 2019 13:21:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h6IQj-0004Vj-Uz for qemu-devel@nongnu.org; Tue, 19 Mar 2019 13:21:39 -0400 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]:38213) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h6IQj-0004UD-ES for qemu-devel@nongnu.org; Tue, 19 Mar 2019 13:21:37 -0400 Received: by mail-pf1-x433.google.com with SMTP id n125so14163319pfn.5 for ; Tue, 19 Mar 2019 10:21:37 -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=iUtvwhbo3P0H9Z7YwFiFIZsUKx09tXn5AzHSMHE1d2TsfgotI1N0ElcjiN0jF0Gl3C cES5lzgvmyzPOfE78P3EY6SISrqwy0/WmI0F3gnuLGgNrK0xE5NR1B87KJZMbbqdk4v9 wLFnjhzRFj/MsxY6T/f9C6G6Djv4j3q/W3xX+FIsa6VvT5PCS6ORy5Q1KfBIWAozpjOj vfbbqYJpAmjOH/VcxwRJJy0qDDUyWLhl83t7es/A2jhYecXakcYPSM17wRQQ5oIcTzXx cS+VRm0BTtypFzvOVoazWmTHFs8pF2VwCNkQfz/BLfCkFyJihvnKMdNmhu543C2dzk2n KWUQ== 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=IXwio0j8c11SIlgcCvnJSziyZe4zKZSTbU/7wx54IXzQsQEqSNml0DKyFV4Rts6DGt WApUQEURMY2p0VSLrsR4kouLChFquCZpbpTHdeZzO758RaI10PtRuYG/Kl/ypVq8bFuI 2tdq+LiZewuUyr0MaqJImnLc3dq5wGEAGb4z4XLAqqkc8n/RDlzzUpogaD2C3LpDpRJJ glg+A0qQgveORaa8jvTx0z4hxGaIX6jFAZlBjdQug5BtJVZfLDlLxGVM51LlC3LMFL5F rFFNcr0IISFXlU2Pfx/ZPBm766+YGyWfbfGkechhLNWEiQtEDmdmCS9XHc08QouexRB3 H4EA== X-Gm-Message-State: APjAAAVV8vtlFJ+Mtwv9ZkkzDFAfENri5VhZj8rkuO1ZPY+xP3AtQUw8 KyaNvtE0WeYAB7AfmsypyweenZDzt6Q= X-Received: by 2002:a17:902:aa97:: with SMTP id d23mr3027319plr.327.1553016096051; Tue, 19 Mar 2019 10:21:36 -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 w68sm5616666pfb.176.2019.03.19.10.21.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 19 Mar 2019 10:21:35 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 19 Mar 2019 10:21:14 -0700 Message-Id: <20190319172126.7502-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190319172126.7502-1-richard.henderson@linaro.org> References: <20190319172126.7502-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::433 Subject: [Qemu-devel] [PATCH for-4.1 v3 05/17] 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);