From patchwork Wed May 1 05:05:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 163185 Delivered-To: patch@linaro.org Received: by 2002:a92:7e86:0:0:0:0:0 with SMTP id q6csp4124158ill; Tue, 30 Apr 2019 22:11:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqxO3c1GX71D2GItKrPqQcsf3aQuvEZajDGutlhJJUwFJWRyFY3U8dVSMdFX2nFYoGvekimt X-Received: by 2002:adf:db82:: with SMTP id u2mr33696328wri.316.1556687514051; Tue, 30 Apr 2019 22:11:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556687514; cv=none; d=google.com; s=arc-20160816; b=WVfdA9kSh0FwWsV83dlXfmTgduZV4JcjY7C84BagofO+rzFmqQQhExMCEwHxvuAXTN GlughJfC+vpoMO0X/36sisuphD7GKroTUlgMsCmJ5nrvq7uUU9ojIXnvCnMqhfkAnUuK vP9DVf6lHlI/TvmFYVI9QfKO80EuWkK2utXECJrqu9b3x+za8XoeC2bg8cySiaf5g/6R dYlmA90WHBRkZaiSeMid0EO+RtMch4KVR8fjVjRmrwXXzEEHEsR+BssFeiS2P5xA5p08 EX0svXlcXKRDDoedazkMrFCh6x7mfACK/A8lOcFZfFG+cKcrbww22FAVj+RZvNpTJe2f 7QQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=tE6uzAjTMyTfJHn+9O8Wl99P1LuOsbUfHnL5seHXmm4=; b=U2GlIgNIb76/3AKdyWwS4aFY2zfi/wN5wMyqXdV6rfHEXi8/hSK1q3KCzwY++0pJkt m2YNVB/crbeo9I+orCtozNGKpK412ITUOkBsFbrxWtOD2q4Wbsuy3Nocaa77+uJCoiTW 4z0wnRqmLEW/DDPg0iEoAdnCGbt80H1RM8BBo+GErhBG5InfVYXSmip40/Q2hGemV8mR pg1rG+tG/AE8yaGtMScM0BQXARsV4Ko2QK4IORypnQq0gs2nrOGTyrl8Bn4VjQXFKg0T HknrakQ9Dlgt4ZJzJSU/tPFmc6jmsuGQsOyxF3n1a/07lTCLL4YAhy8HGJDE5EMuUUMM KxAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=JtHBnm60; 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 z11si2637117wmf.41.2019.04.30.22.11.53 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 30 Apr 2019 22:11:54 -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=JtHBnm60; 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]:36291 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hLhX7-0002tj-0F for patch@linaro.org; Wed, 01 May 2019 01:11:53 -0400 Received: from eggs.gnu.org ([209.51.188.92]:38235) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hLhRJ-0006L9-Ks for qemu-devel@nongnu.org; Wed, 01 May 2019 01:05:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hLhRG-0002p9-Iy for qemu-devel@nongnu.org; Wed, 01 May 2019 01:05:53 -0400 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]:43619) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hLhRG-0002oK-D4 for qemu-devel@nongnu.org; Wed, 01 May 2019 01:05:50 -0400 Received: by mail-pg1-x543.google.com with SMTP id t22so4853901pgi.10 for ; Tue, 30 Apr 2019 22:05:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=tE6uzAjTMyTfJHn+9O8Wl99P1LuOsbUfHnL5seHXmm4=; b=JtHBnm60A8xlwcfxVU6lpag4oCwZ7r4A8kowmdEna3MhBbwSUfgCrbmqfxd35zIIKj +dTlyxefKoZNUq+//44t06S5ExTDfDny9KZmbG0rUVuD+H/BgFJBHDZySzXWbzzSx8+V QYp2aj+bkrsOleWG/djZncL//U4z8j3JXzMeuhxlqypuS0KJ/73ES6zkuQnulXaWGnYM BINEHtkQTcXhRzWeZoVfuI7RNLsM/Ed6Ba4D6U+0lQf6zCBtLnMk7dq+8+9RjUgMrk5m P0Mgw1PfZOkDAlGNFcXZ5YsCt+livroZn+JgN8cxbTNGVmNOqWpT3MAhFs1rMVh4R07P UVew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=tE6uzAjTMyTfJHn+9O8Wl99P1LuOsbUfHnL5seHXmm4=; b=MIP4rPDrf6jOlMIXxoHCoNN2P2+GIdEqEKyTpT03+lj7LsHOeX/ICd9k/VXsmYc6vT HzwO72jFdlCsPbxsdQELj9TcU7Il8GtgVsjrEBXfcANUaWeJFXArQjetkKG2YYsc9yUp zROfLrcYeRqBGJ88UBiWGgoMmP32sQUKdPh5oVD6Q/c2TKKGt8FDcqGgF5rLfxAziMqS xe2hse2LDStjLO22UGab8CKm/lGoRCSF60+yBEKs2w2LVeleGVr1IOBHAU45MdqBR0x4 +4VEa/pphWyTfI4z5O894le4SbVF0WWfY9HIl+1pPy2UPOAEM60pIsLErF62dK517zbw 2S+w== X-Gm-Message-State: APjAAAWglVQ+LD34Au5BvQVRgmuMACNtCKXqOtK/z3sSKw+NgtvbyKCQ EZ2PWt1YDzvB4BXzZeYMf3fd1peS8/s= X-Received: by 2002:a62:480d:: with SMTP id v13mr77874034pfa.125.1556687147454; Tue, 30 Apr 2019 22:05:47 -0700 (PDT) Received: from localhost.localdomain (97-113-189-189.tukw.qwest.net. [97.113.189.189]) by smtp.gmail.com with ESMTPSA id t127sm9687251pfb.106.2019.04.30.22.05.46 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Apr 2019 22:05:46 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 30 Apr 2019 22:05:10 -0700 Message-Id: <20190501050536.15580-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190501050536.15580-1-richard.henderson@linaro.org> References: <20190501050536.15580-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::543 Subject: [Qemu-devel] [PATCH v2 03/29] 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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: David Hildenbrand Signed-off-by: Richard Henderson --- tcg/tcg-op-vec.c | 49 ++++++++++++++++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 16 deletions(-) -- 2.17.1 Reviewed-by: Alex Bennée 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);