From patchwork Wed Apr 22 01:17:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 185645 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp173781ilf; Tue, 21 Apr 2020 18:36:26 -0700 (PDT) X-Google-Smtp-Source: APiQypLYoIDrcs1EkbymqCGwB7ge7jB2yrdtJwlEEkRHDuiTb+QZRkZM68Yo1qJ9CQUZ785vvRq+ X-Received: by 2002:a0c:a986:: with SMTP id a6mr3923266qvb.79.1587519386448; Tue, 21 Apr 2020 18:36:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587519386; cv=none; d=google.com; s=arc-20160816; b=nEQqV+gBFuhwcMwXqxgOW+4323VSu8xrc4bnZJSSi3WGV1KqqDlHgvMnY7SM/8GFFv nT2DGpxyxHhPI/IrclOuhQ+Lp85U6foCerGMg4+bo64v8+Ai5s4Jl4Uxs0Cu0MkBJJ6N QvQOGA/oSfEVSqxMp3yU7VNfIWWuS3UDIBJhbtxML5y/BcG//iKpWhq/7M1gzXQsjWJ3 5oVTJTAIZy6TtXoCtVPYG9mxAbSZ285d+XP11MthKsP/EbksUUfiCo2UKmpBEEpdAURJ 5tFdjp/NmYyeq/lzSXrEVlwDAfD6bI08jxQxHYpoZ7cnzuZ6FhN2Y2qdgvRRUjTpJDEj IFpQ== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=NursXVv/HRRUgUycsc5QQiTW037ba/6j60CDRbihF7Q=; b=Rs3ng/b5zHjqdAT96yDmg2KE3EIxlJACS0cMDJJmwCpinuYzqpltFz/oqMOrLiIEzQ Tt/HVElKh2eoi0lJ8krrLllEwKa/kQL2/OEO8/XUotgTlO9LRbgoAL6EkC/T12NpnyIF kz0j77Dwb4jXYnNtg86s+fUievDfmZSg8c5tWeXLj18WSWtYotI/W5Ig44FQnYd2ayRR WMt4MiToarc0g1eP1/TZvjWQXHS/Slp6aTBZP6Wm0QIvEG1jSGYNeG0PRX1pRlgetXO6 YxILtRLYVQyEGLLLNDSM/N7338+D323cf9tBDpE5S3kQwyj5QihKfdaOqNhNzMp3fwB7 IAww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gtgDWTWJ; 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=pass (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 a4si2465469qkn.238.2020.04.21.18.36.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Apr 2020 18:36:26 -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=pass header.i=@linaro.org header.s=google header.b=gtgDWTWJ; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:39052 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR4JN-0007TW-SY for patch@linaro.org; Tue, 21 Apr 2020 21:36:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36014) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR41b-00025d-Ey for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:18:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jR41X-0002ai-Gv for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:18:03 -0400 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]:38856) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jR41X-0002VM-1U for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:59 -0400 Received: by mail-pg1-x531.google.com with SMTP id p8so256976pgi.5 for ; Tue, 21 Apr 2020 18:17:58 -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 :mime-version:content-transfer-encoding; bh=NursXVv/HRRUgUycsc5QQiTW037ba/6j60CDRbihF7Q=; b=gtgDWTWJlOgzElJupIxbf9un4Z+mXaj1ZGxWE5Sh1VwraFzKz+/kvncsm879RVoXh3 owJ+FqlQba97vwLcWQhMuBW8BeJAcYDlwzW2RBdSdzlfd9CmbC6MVsnMnTp4ZiAwsDVY oDGNlR2hhIECCEXh9/DycwPc5MvgNABSHTU8LSPfBacoF6Jfk6BS93C+9BHFAQJGNAVJ 8D8kPfnFnTKAvF3K+7457fookMjJalZ5zxc9PtCVvtdpzXCy94fICXkP/l/F9SmJ4E1H 9UFclPVoegLy8ipx00tRA/AznOHE1oXJBT4+WJz03iBUnFPNlBj32JiEdyvdtcNQeS8u yMXQ== 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:mime-version:content-transfer-encoding; bh=NursXVv/HRRUgUycsc5QQiTW037ba/6j60CDRbihF7Q=; b=rmfDfnjNDNCWkWZFk8868U4hZSOs7wF/jhs+YZKn8TQbU7L1G9oaeyfdJbvpRfLa1D 9SWJF3dDm1cpfO3dG2J+uFLOtGKcUSxr2WwLJdMHNdSXxUVfqQ8cwFdd+CBxzekfOGou bppBCxyDlUB7ohQzB2WipA7m+EzBeTGf2Y3MSGugDWG/B8LVy3ZwrXt0qPVoiHYUQOKH J1kZhg6uN/dUoQTT/cR97M2T4ih6rhTd1aEA8F6nS7Mr404ID8kxuHyDoD36GMSaRQA6 HIuOfchlaoIBRJwRrz/pah2+NIwilGq+yA9/YAFaVHfC6/p8NKoQKfZZIFtc50wJ8sfn Cd4Q== X-Gm-Message-State: AGi0PubgvHpxbcHnQPgEmE2T1h32diU3/VBItYgJqxLwQRn8cdPOldH7 SQKytUZifJAV4vWp+px+qJapCnjEdxU= X-Received: by 2002:a63:2b42:: with SMTP id r63mr13265329pgr.227.1587518276981; Tue, 21 Apr 2020 18:17:56 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id m4sm3673561pfm.26.2020.04.21.18.17.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 18:17:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 26/36] tcg: Add load_dest parameter to GVecGen2 Date: Tue, 21 Apr 2020 18:17:12 -0700 Message-Id: <20200422011722.13287-27-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200422011722.13287-1-richard.henderson@linaro.org> References: <20200422011722.13287-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::531; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x531.google.com X-detected-operating-system: by eggs.gnu.org: Error: [-] PROGRAM ABORT : Malformed IPv6 address (bad octet value). Location : parse_addr6(), p0f-client.c:67 X-Received-From: 2607:f8b0:4864:20::531 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We have this same parameter for GVecGen2i, GVecGen3, and GVecGen3i. This will make some SVE2 insns easier to parameterize. Signed-off-by: Richard Henderson --- include/tcg/tcg-op-gvec.h | 2 ++ tcg/tcg-op-gvec.c | 45 ++++++++++++++++++++++++++++----------- 2 files changed, 34 insertions(+), 13 deletions(-) -- 2.20.1 Reviewed-by: Alex Bennée diff --git a/include/tcg/tcg-op-gvec.h b/include/tcg/tcg-op-gvec.h index d89f91f40e..cea6497341 100644 --- a/include/tcg/tcg-op-gvec.h +++ b/include/tcg/tcg-op-gvec.h @@ -109,6 +109,8 @@ typedef struct { uint8_t vece; /* Prefer i64 to v64. */ bool prefer_i64; + /* Load dest as a 2nd source operand. */ + bool load_dest; } GVecGen2; typedef struct { diff --git a/tcg/tcg-op-gvec.c b/tcg/tcg-op-gvec.c index 43cac1a0bf..049a55e700 100644 --- a/tcg/tcg-op-gvec.c +++ b/tcg/tcg-op-gvec.c @@ -663,17 +663,22 @@ static void expand_clr(uint32_t dofs, uint32_t maxsz) /* Expand OPSZ bytes worth of two-operand operations using i32 elements. */ static void expand_2_i32(uint32_t dofs, uint32_t aofs, uint32_t oprsz, - void (*fni)(TCGv_i32, TCGv_i32)) + bool load_dest, void (*fni)(TCGv_i32, TCGv_i32)) { TCGv_i32 t0 = tcg_temp_new_i32(); + TCGv_i32 t1 = tcg_temp_new_i32(); uint32_t i; for (i = 0; i < oprsz; i += 4) { tcg_gen_ld_i32(t0, cpu_env, aofs + i); - fni(t0, t0); - tcg_gen_st_i32(t0, cpu_env, dofs + i); + if (load_dest) { + tcg_gen_ld_i32(t1, cpu_env, dofs + i); + } + fni(t1, t0); + tcg_gen_st_i32(t1, cpu_env, dofs + i); } tcg_temp_free_i32(t0); + tcg_temp_free_i32(t1); } static void expand_2i_i32(uint32_t dofs, uint32_t aofs, uint32_t oprsz, @@ -793,17 +798,22 @@ static void expand_4_i32(uint32_t dofs, uint32_t aofs, uint32_t bofs, /* Expand OPSZ bytes worth of two-operand operations using i64 elements. */ static void expand_2_i64(uint32_t dofs, uint32_t aofs, uint32_t oprsz, - void (*fni)(TCGv_i64, TCGv_i64)) + bool load_dest, void (*fni)(TCGv_i64, TCGv_i64)) { TCGv_i64 t0 = tcg_temp_new_i64(); + TCGv_i64 t1 = tcg_temp_new_i64(); uint32_t i; for (i = 0; i < oprsz; i += 8) { tcg_gen_ld_i64(t0, cpu_env, aofs + i); - fni(t0, t0); - tcg_gen_st_i64(t0, cpu_env, dofs + i); + if (load_dest) { + tcg_gen_ld_i64(t1, cpu_env, dofs + i); + } + fni(t1, t0); + tcg_gen_st_i64(t1, cpu_env, dofs + i); } tcg_temp_free_i64(t0); + tcg_temp_free_i64(t1); } static void expand_2i_i64(uint32_t dofs, uint32_t aofs, uint32_t oprsz, @@ -924,17 +934,23 @@ static void expand_4_i64(uint32_t dofs, uint32_t aofs, uint32_t bofs, /* Expand OPSZ bytes worth of two-operand operations using host vectors. */ static void expand_2_vec(unsigned vece, uint32_t dofs, uint32_t aofs, uint32_t oprsz, uint32_t tysz, TCGType type, + bool load_dest, void (*fni)(unsigned, TCGv_vec, TCGv_vec)) { TCGv_vec t0 = tcg_temp_new_vec(type); + TCGv_vec t1 = tcg_temp_new_vec(type); uint32_t i; for (i = 0; i < oprsz; i += tysz) { tcg_gen_ld_vec(t0, cpu_env, aofs + i); - fni(vece, t0, t0); - tcg_gen_st_vec(t0, cpu_env, dofs + i); + if (load_dest) { + tcg_gen_ld_vec(t1, cpu_env, dofs + i); + } + fni(vece, t1, t0); + tcg_gen_st_vec(t1, cpu_env, dofs + i); } tcg_temp_free_vec(t0); + tcg_temp_free_vec(t1); } /* Expand OPSZ bytes worth of two-vector operands and an immediate operand @@ -1088,7 +1104,8 @@ void tcg_gen_gvec_2(uint32_t dofs, uint32_t aofs, * that e.g. size == 80 would be expanded with 2x32 + 1x16. */ some = QEMU_ALIGN_DOWN(oprsz, 32); - expand_2_vec(g->vece, dofs, aofs, some, 32, TCG_TYPE_V256, g->fniv); + expand_2_vec(g->vece, dofs, aofs, some, 32, TCG_TYPE_V256, + g->load_dest, g->fniv); if (some == oprsz) { break; } @@ -1098,17 +1115,19 @@ void tcg_gen_gvec_2(uint32_t dofs, uint32_t aofs, maxsz -= some; /* fallthru */ case TCG_TYPE_V128: - expand_2_vec(g->vece, dofs, aofs, oprsz, 16, TCG_TYPE_V128, g->fniv); + expand_2_vec(g->vece, dofs, aofs, oprsz, 16, TCG_TYPE_V128, + g->load_dest, g->fniv); break; case TCG_TYPE_V64: - expand_2_vec(g->vece, dofs, aofs, oprsz, 8, TCG_TYPE_V64, g->fniv); + expand_2_vec(g->vece, dofs, aofs, oprsz, 8, TCG_TYPE_V64, + g->load_dest, g->fniv); break; case 0: if (g->fni8 && check_size_impl(oprsz, 8)) { - expand_2_i64(dofs, aofs, oprsz, g->fni8); + expand_2_i64(dofs, aofs, oprsz, g->load_dest, g->fni8); } else if (g->fni4 && check_size_impl(oprsz, 4)) { - expand_2_i32(dofs, aofs, oprsz, g->fni4); + expand_2_i32(dofs, aofs, oprsz, g->load_dest, g->fni4); } else { assert(g->fno != NULL); tcg_gen_gvec_2_ool(dofs, aofs, oprsz, maxsz, g->data, g->fno);