From nobody Sat May 18 21:45:31 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1608248990; cv=none; d=zohomail.com; s=zohoarc; b=mK/oqeS3BLErEnHhfXQLErV4SNfga80xbdiYWrEdjuyZ7Lo2Uoh19HQDIHYDvBqqk4CORqK8vIFqOAVdDKV3KfN+Z/aLcyf0rwACWQJs0ehvg1FKZ6XbO7pgINUHV3FIc7ioWCztDsYRBR3hGpcaEPix7thCtGmbQyfG2J2anz0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608248990; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=YGucInyAES/FALajn2SavFzpCSIvxxGGLM0CVJ4If5M=; b=YAbvNcbveUZBDaq7nqE9DXdrh9Tqf+ECZJtunDNVDjYpFU0Ay1Wq+m+ver+oeUnvi1ETNJMK1K7+xBYSHh7ZBhvumEL6CcMdzFylj1aQV6Np1U4qLHkiTDFPvx17gT8LCv2l2Yuiq8LTQ1tmuvGu//jV+GYSvF0EoM7tClh3kAo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1608248990039748.9199221505721; Thu, 17 Dec 2020 15:49:50 -0800 (PST) Received: from localhost ([::1]:40182 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpun0-00043G-4M for importer@patchew.org; Thu, 17 Dec 2020 10:01:58 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33154) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpuds-0003NP-5v for qemu-devel@nongnu.org; Thu, 17 Dec 2020 09:52:33 -0500 Received: from mail-oo1-xc33.google.com ([2607:f8b0:4864:20::c33]:40538) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kpudh-0004rV-8w for qemu-devel@nongnu.org; Thu, 17 Dec 2020 09:52:31 -0500 Received: by mail-oo1-xc33.google.com with SMTP id 9so6871967ooy.7 for ; Thu, 17 Dec 2020 06:52:19 -0800 (PST) Received: from localhost.localdomain (fixed-187-189-51-144.totalplay.net. [187.189.51.144]) by smtp.gmail.com with ESMTPSA id x130sm1136342oif.3.2020.12.17.06.52.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Dec 2020 06:52:17 -0800 (PST) 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=YGucInyAES/FALajn2SavFzpCSIvxxGGLM0CVJ4If5M=; b=I+6Az6UwuEETCx3bXIgFBoUI3ZNEU43AOqXjpf8alNmJE2p+KHl5ZAym1MoG1KCW1k 4FRtIrTKNAZ7Y0NhSsQTjc++P16jSprR5hjtNUu5GIN8/ygqPpFbPHd7jxmUOGs68Wf6 wWrHm2ueYuCjsgLeMLIXBBAQ2jjJCNvX6FrtvtSTnlNzkyLLUe9frRpMU6CrdezLvPO/ /bdyg5i6xx7TeE5Fy29zuqLJdWOigJi8N3HhCFF3GlI9+yIomdNud/6O0R4wmySZg55j PLl+fojF4cKEuz46YlNwZ0PlTEGqGNruTnQEZ9nKx1A6OpFh5zvYVncO72V6u1RSp2dZ uW+A== 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=YGucInyAES/FALajn2SavFzpCSIvxxGGLM0CVJ4If5M=; b=XiUE22ui2QrU8iL6RtK1YK2axqFGAciHogMtLXj07cIKO/qTniFmuwUBHQR9DPx+RB KQAuDGn4ta7/8LfAJJ85dwZzHtSntKwznZI2RJhYXN+YPnyORugGLsUQTm4mU6yUIqki NotnmROzz8HJsvoockYPTpzJ9hESQUMJAguJkT2j87fDMNvu4ZuiMxh3yGyh5r5sHLCt uYYG6m4E3F4gS9zjl1rnwoWEW1YluQgB2g5eBm/txKVqqwTlfTBkqDL8p3vqZGydOxe2 iL7ki+jpH6tdFZzz1lXx6UuhtRwpE+5YuSp+Nv6JTK8rcIQuFNwqZbTNM2kh0sciHznQ h/Kg== X-Gm-Message-State: AOAM532Ubq+5kWwyf+iCfFIA16bw7UtjmxVnbz2EGTphUOrm9F1zePXV Jzcp4wTRAtSTp1uQ6IiOcrDvmUwcvG/tqSLB X-Google-Smtp-Source: ABdhPJzvuBU2hQTIrtaeICxjiwIauRiOtPl4Rc20jJZDhI5MDD9MycoqDoJoQH8pa/n7JZPRFZtQcA== X-Received: by 2002:a4a:b043:: with SMTP id g3mr28864038oon.69.1608216738175; Thu, 17 Dec 2020 06:52:18 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 01/23] tcg: Use tcg_out_dupi_vec from temp_load Date: Thu, 17 Dec 2020 08:51:53 -0600 Message-Id: <20201217145215.534637-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201217145215.534637-1-richard.henderson@linaro.org> References: <20201217145215.534637-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::c33; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc33.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Having dupi pass though movi is confusing and arguably wrong. Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Richard Henderson --- tcg/tcg.c | 6 +++- tcg/aarch64/tcg-target.c.inc | 7 ---- tcg/i386/tcg-target.c.inc | 63 ++++++++++++++++++++++++------------ tcg/ppc/tcg-target.c.inc | 6 ---- 4 files changed, 47 insertions(+), 35 deletions(-) diff --git a/tcg/tcg.c b/tcg/tcg.c index 43c6cf8f52..ef55c23c20 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -3333,7 +3333,11 @@ static void temp_load(TCGContext *s, TCGTemp *ts, TC= GRegSet desired_regs, case TEMP_VAL_CONST: reg =3D tcg_reg_alloc(s, desired_regs, allocated_regs, preferred_regs, ts->indirect_base); - tcg_out_movi(s, ts->type, reg, ts->val); + if (ts->type <=3D TCG_TYPE_I64) { + tcg_out_movi(s, ts->type, reg, ts->val); + } else { + tcg_out_dupi_vec(s, ts->type, reg, ts->val); + } ts->mem_coherent =3D 0; break; case TEMP_VAL_MEM: diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc index 26f71cb599..695f53b125 100644 --- a/tcg/aarch64/tcg-target.c.inc +++ b/tcg/aarch64/tcg-target.c.inc @@ -1007,13 +1007,6 @@ static void tcg_out_movi(TCGContext *s, TCGType type= , TCGReg rd, case TCG_TYPE_I64: tcg_debug_assert(rd < 32); break; - - case TCG_TYPE_V64: - case TCG_TYPE_V128: - tcg_debug_assert(rd >=3D 32); - tcg_out_dupi_vec(s, type, rd, value); - return; - default: g_assert_not_reached(); } diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc index d8797ed398..e2852cbb09 100644 --- a/tcg/i386/tcg-target.c.inc +++ b/tcg/i386/tcg-target.c.inc @@ -966,30 +966,32 @@ static void tcg_out_dupi_vec(TCGContext *s, TCGType t= ype, } } =20 -static void tcg_out_movi(TCGContext *s, TCGType type, - TCGReg ret, tcg_target_long arg) +static void tcg_out_movi_vec(TCGContext *s, TCGType type, + TCGReg ret, tcg_target_long arg) +{ + if (arg =3D=3D 0) { + tcg_out_vex_modrm(s, OPC_PXOR, ret, ret, ret); + return; + } + if (arg =3D=3D -1) { + tcg_out_vex_modrm(s, OPC_PCMPEQB, ret, ret, ret); + return; + } + + int rexw =3D (type =3D=3D TCG_TYPE_I32 ? 0 : P_REXW); + tcg_out_vex_modrm_pool(s, OPC_MOVD_VyEy + rexw, ret); + if (TCG_TARGET_REG_BITS =3D=3D 64) { + new_pool_label(s, arg, R_386_PC32, s->code_ptr - 4, -4); + } else { + new_pool_label(s, arg, R_386_32, s->code_ptr - 4, 0); + } +} + +static void tcg_out_movi_int(TCGContext *s, TCGType type, + TCGReg ret, tcg_target_long arg) { tcg_target_long diff; =20 - switch (type) { - case TCG_TYPE_I32: -#if TCG_TARGET_REG_BITS =3D=3D 64 - case TCG_TYPE_I64: -#endif - if (ret < 16) { - break; - } - /* fallthru */ - case TCG_TYPE_V64: - case TCG_TYPE_V128: - case TCG_TYPE_V256: - tcg_debug_assert(ret >=3D 16); - tcg_out_dupi_vec(s, type, ret, arg); - return; - default: - g_assert_not_reached(); - } - if (arg =3D=3D 0) { tgen_arithr(s, ARITH_XOR, ret, ret); return; @@ -1018,6 +1020,25 @@ static void tcg_out_movi(TCGContext *s, TCGType type, tcg_out64(s, arg); } =20 +static void tcg_out_movi(TCGContext *s, TCGType type, + TCGReg ret, tcg_target_long arg) +{ + switch (type) { + case TCG_TYPE_I32: +#if TCG_TARGET_REG_BITS =3D=3D 64 + case TCG_TYPE_I64: +#endif + if (ret < 16) { + tcg_out_movi_int(s, type, ret, arg); + } else { + tcg_out_movi_vec(s, type, ret, arg); + } + break; + default: + g_assert_not_reached(); + } +} + static inline void tcg_out_pushi(TCGContext *s, tcg_target_long val) { if (val =3D=3D (int8_t)val) { diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index 18ee989f95..df18d694f3 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -983,12 +983,6 @@ static void tcg_out_movi(TCGContext *s, TCGType type, = TCGReg ret, tcg_out_movi_int(s, type, ret, arg, false); break; =20 - case TCG_TYPE_V64: - case TCG_TYPE_V128: - tcg_debug_assert(ret >=3D TCG_REG_V0); - tcg_out_dupi_vec(s, type, ret, arg); - break; - default: g_assert_not_reached(); } --=20 2.25.1 From nobody Sat May 18 21:45:31 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1608217082; cv=none; d=zohomail.com; s=zohoarc; b=gt132/NOngx2A4kccWjx3swsFUzDMbap4azfDdbc3KjJsldO2weeg3kh/i0rIuI9R3ypceLlh7L0m+Y6BEFEHpVs/LdREEM4/fid7H0/QuYeymqjrFel6o+NAdRRl/YiSVoxP/5/vFnfYkuAWbpFVWlCUodVij2tj5Q1CgVUDPs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608217082; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=BN996J7U0Obk/NuvmIQte+lnV+dtpzifIKeaJMGxzjc=; b=mXh681pELcgOXYC3vk5HSupUJH70hEYfOaZB+Mlr6oMALc4Jb5RODSxbEbOY6c1UHP+o//G00H/upg1A23Fx+ctaSZYLBMkrOqCQcDBIukl7gHqVSiJaRSbyEO0ojEKgXUtjZEbHwGp9DoFfa0yt29IMgw35BP/eVYF1YHO3DZ4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1608217082074364.4950362426058; Thu, 17 Dec 2020 06:58:02 -0800 (PST) Received: from localhost ([::1]:60044 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpujA-0000Yt-Fk for importer@patchew.org; Thu, 17 Dec 2020 09:58:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33128) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpudr-0003MS-6Q for qemu-devel@nongnu.org; Thu, 17 Dec 2020 09:52:31 -0500 Received: from mail-oo1-xc30.google.com ([2607:f8b0:4864:20::c30]:43316) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kpudi-0004sj-9K for qemu-devel@nongnu.org; Thu, 17 Dec 2020 09:52:29 -0500 Received: by mail-oo1-xc30.google.com with SMTP id y14so3556280oom.10 for ; Thu, 17 Dec 2020 06:52:20 -0800 (PST) Received: from localhost.localdomain (fixed-187-189-51-144.totalplay.net. [187.189.51.144]) by smtp.gmail.com with ESMTPSA id x130sm1136342oif.3.2020.12.17.06.52.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Dec 2020 06:52:18 -0800 (PST) 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:mime-version :content-transfer-encoding; bh=BN996J7U0Obk/NuvmIQte+lnV+dtpzifIKeaJMGxzjc=; b=V8wi757A5rskuW5UZt0yB7bo6xdougTB9cxPfNPVLWkKGRkF7w5f5r6VG0HJE2YE4r or6oB/vKhmJfnaeqBmcE6Izdrwq8ikwToWjj3/QN1PnOzw9e2YxDJu+mQAW4hIY3T2Mn kldCLwvBy4FDC9gZJTWBHMZ3uO4gY556jtwqZhfbsqtzSPmnVL/zr9lbJanPdO/ylcAz uUzc1VGPRbnToL2FZk+KwlJNWOYwo3GhTc+pREf2D4Znqa+wFujmHEZj/IqsxnK4AyU4 RH7pU5NKxX/IKgegGF7p8ulknJ/YtoiIeQq6kAFVQFAh8EUGm5AjtrFHOVWZ5q9FBntQ 4q6Q== 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:mime-version:content-transfer-encoding; bh=BN996J7U0Obk/NuvmIQte+lnV+dtpzifIKeaJMGxzjc=; b=uKo6qSZvjfFW1NlK+OyoxY1rwkjx5MDSnN2sWBjBvlvqdCmjmNiRuAxrw9h0loTV8c SMnbCQ6UL00eX+Ya3D1vpYLJ4oJuN28XTL38UB5dHz4Z8MknNpq60y4CAGKv3DfJLZ/+ scIJuMCxxBA9W/vz33/0JMzn21knEYqXaJKt4K1c337JOALLDt8AuarKBrYo1nCQUv87 Sh2mfv/VEGaAbriErHjJ3aJ6n2Yt3LM7Ptl3J2wEHAxWLhlgkvyTp+4tGqk2qAUnKUP3 8tKxBpYRa58tAjuApaf+17F0BF82ccZoIRVQGqy8qEeiPKzpsrH2sipwqenT4xC5EwSJ 3hdw== X-Gm-Message-State: AOAM5304sE0osAG+LAD/5wdKWz6lVJEtI1+EM8Ms21pzN3BZy1fUcK5R ji6HbsrKL1NSrcuOVmYbadBm/My6XmMiQgeI X-Google-Smtp-Source: ABdhPJzN+897bN9bpYkVNAxA9m+rO8RkcVLwdOlH8kRd4JbKkvT0hIv6e1lfIEKxH2uzuLcMjBck8Q== X-Received: by 2002:a4a:ca14:: with SMTP id w20mr28888403ooq.11.1608216739351; Thu, 17 Dec 2020 06:52:19 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 02/23] tcg: Increase tcg_out_dupi_vec immediate to int64_t Date: Thu, 17 Dec 2020 08:51:54 -0600 Message-Id: <20201217145215.534637-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201217145215.534637-1-richard.henderson@linaro.org> References: <20201217145215.534637-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::c30; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc30.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" While we don't store more than tcg_target_long in TCGTemp, we shouldn't be limited to that for code generation. We will be able to use this for INDEX_op_dup2_vec with 2 constants. Also pass along the minimal vece that may be said to apply to the constant. This allows some simplification in the various backends. Signed-off-by: Richard Henderson --- tcg/tcg.c | 31 +++++++++++++++++++++++++----- tcg/aarch64/tcg-target.c.inc | 12 ++++++------ tcg/i386/tcg-target.c.inc | 22 ++++++++++++--------- tcg/ppc/tcg-target.c.inc | 37 +++++++++++++++++++++++------------- 4 files changed, 69 insertions(+), 33 deletions(-) diff --git a/tcg/tcg.c b/tcg/tcg.c index ef55c23c20..2326e61b51 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -116,8 +116,8 @@ static bool tcg_out_dup_vec(TCGContext *s, TCGType type= , unsigned vece, TCGReg dst, TCGReg src); static bool tcg_out_dupm_vec(TCGContext *s, TCGType type, unsigned vece, TCGReg dst, TCGReg base, intptr_t offset); -static void tcg_out_dupi_vec(TCGContext *s, TCGType type, - TCGReg dst, tcg_target_long arg); +static void tcg_out_dupi_vec(TCGContext *s, TCGType type, unsigned vece, + TCGReg dst, int64_t arg); static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, unsigned vecl, unsigned vece, const TCGArg *args, const int *const_args); @@ -132,8 +132,8 @@ static inline bool tcg_out_dupm_vec(TCGContext *s, TCGT= ype type, unsigned vece, { g_assert_not_reached(); } -static inline void tcg_out_dupi_vec(TCGContext *s, TCGType type, - TCGReg dst, tcg_target_long arg) +static inline void tcg_out_dupi_vec(TCGContext *s, TCGType type, unsigned = vece, + TCGReg dst, int64_t arg) { g_assert_not_reached(); } @@ -3336,7 +3336,28 @@ static void temp_load(TCGContext *s, TCGTemp *ts, TC= GRegSet desired_regs, if (ts->type <=3D TCG_TYPE_I64) { tcg_out_movi(s, ts->type, reg, ts->val); } else { - tcg_out_dupi_vec(s, ts->type, reg, ts->val); + uint64_t val =3D ts->val; + MemOp vece =3D MO_64; + + /* + * Find the minimal vector element that matches the constant. + * The targets will, in general, have to do this search anyway, + * do this generically. + */ + if (TCG_TARGET_REG_BITS =3D=3D 32) { + val =3D dup_const(MO_32, val); + vece =3D MO_32; + } + if (val =3D=3D dup_const(MO_8, val)) { + vece =3D MO_8; + } else if (val =3D=3D dup_const(MO_16, val)) { + vece =3D MO_16; + } else if (TCG_TARGET_REG_BITS =3D=3D 64 && + val =3D=3D dup_const(MO_32, val)) { + vece =3D MO_32; + } + + tcg_out_dupi_vec(s, ts->type, vece, reg, ts->val); } ts->mem_coherent =3D 0; break; diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc index 695f53b125..56056be74b 100644 --- a/tcg/aarch64/tcg-target.c.inc +++ b/tcg/aarch64/tcg-target.c.inc @@ -853,14 +853,14 @@ static void tcg_out_logicali(TCGContext *s, AArch64In= sn insn, TCGType ext, tcg_out_insn_3404(s, insn, ext, rd, rn, ext, r, c); } =20 -static void tcg_out_dupi_vec(TCGContext *s, TCGType type, - TCGReg rd, tcg_target_long v64) +static void tcg_out_dupi_vec(TCGContext *s, TCGType type, unsigned vece, + TCGReg rd, int64_t v64) { bool q =3D type =3D=3D TCG_TYPE_V128; int cmode, imm8, i; =20 /* Test all bytes equal first. */ - if (v64 =3D=3D dup_const(MO_8, v64)) { + if (vece =3D=3D MO_8) { imm8 =3D (uint8_t)v64; tcg_out_insn(s, 3606, MOVI, q, rd, 0, 0xe, imm8); return; @@ -887,7 +887,7 @@ static void tcg_out_dupi_vec(TCGContext *s, TCGType typ= e, * cannot find an expansion there's no point checking a larger * width because we already know by replication it cannot match. */ - if (v64 =3D=3D dup_const(MO_16, v64)) { + if (vece =3D=3D MO_16) { uint16_t v16 =3D v64; =20 if (is_shimm16(v16, &cmode, &imm8)) { @@ -906,7 +906,7 @@ static void tcg_out_dupi_vec(TCGContext *s, TCGType typ= e, tcg_out_insn(s, 3606, MOVI, q, rd, 0, 0x8, v16 & 0xff); tcg_out_insn(s, 3606, ORR, q, rd, 0, 0xa, v16 >> 8); return; - } else if (v64 =3D=3D dup_const(MO_32, v64)) { + } else if (vece =3D=3D MO_32) { uint32_t v32 =3D v64; uint32_t n32 =3D ~v32; =20 @@ -2430,7 +2430,7 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode o= pc, tcg_out_insn_3617(s, insn, is_q, vece, a0, a1); break; } - tcg_out_dupi_vec(s, type, TCG_VEC_TMP, 0); + tcg_out_dupi_vec(s, type, MO_8, TCG_VEC_TMP, 0); a2 =3D TCG_VEC_TMP; } insn =3D cmp_insn[cond]; diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc index e2852cbb09..6b7cbaa47a 100644 --- a/tcg/i386/tcg-target.c.inc +++ b/tcg/i386/tcg-target.c.inc @@ -933,8 +933,8 @@ static bool tcg_out_dupm_vec(TCGContext *s, TCGType typ= e, unsigned vece, return true; } =20 -static void tcg_out_dupi_vec(TCGContext *s, TCGType type, - TCGReg ret, tcg_target_long arg) +static void tcg_out_dupi_vec(TCGContext *s, TCGType type, unsigned vece, + TCGReg ret, int64_t arg) { int vex_l =3D (type =3D=3D TCG_TYPE_V256 ? P_VEXL : 0); =20 @@ -947,7 +947,14 @@ static void tcg_out_dupi_vec(TCGContext *s, TCGType ty= pe, return; } =20 - if (TCG_TARGET_REG_BITS =3D=3D 64) { + if (TCG_TARGET_REG_BITS =3D=3D 32 && vece < MO_64) { + if (have_avx2) { + tcg_out_vex_modrm_pool(s, OPC_VPBROADCASTD + vex_l, ret); + } else { + tcg_out_vex_modrm_pool(s, OPC_VBROADCASTSS, ret); + } + new_pool_label(s, arg, R_386_32, s->code_ptr - 4, 0); + } else { if (type =3D=3D TCG_TYPE_V64) { tcg_out_vex_modrm_pool(s, OPC_MOVQ_VqWq, ret); } else if (have_avx2) { @@ -955,14 +962,11 @@ static void tcg_out_dupi_vec(TCGContext *s, TCGType t= ype, } else { tcg_out_vex_modrm_pool(s, OPC_MOVDDUP, ret); } - new_pool_label(s, arg, R_386_PC32, s->code_ptr - 4, -4); - } else { - if (have_avx2) { - tcg_out_vex_modrm_pool(s, OPC_VPBROADCASTD + vex_l, ret); + if (TCG_TARGET_REG_BITS =3D=3D 64) { + new_pool_label(s, arg, R_386_PC32, s->code_ptr - 4, -4); } else { - tcg_out_vex_modrm_pool(s, OPC_VBROADCASTSS, ret); + new_pool_l2(s, R_386_32, s->code_ptr - 4, 0, arg, arg >> 32); } - new_pool_label(s, arg, R_386_32, s->code_ptr - 4, 0); } } =20 diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index df18d694f3..2428faeabd 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -908,31 +908,41 @@ static void tcg_out_movi_int(TCGContext *s, TCGType t= ype, TCGReg ret, } } =20 -static void tcg_out_dupi_vec(TCGContext *s, TCGType type, TCGReg ret, - tcg_target_long val) +static void tcg_out_dupi_vec(TCGContext *s, TCGType type, unsigned vece, + TCGReg ret, int64_t val) { uint32_t load_insn; int rel, low; intptr_t add; =20 - low =3D (int8_t)val; - if (low >=3D -16 && low < 16) { - if (val =3D=3D (tcg_target_long)dup_const(MO_8, low)) { + switch (vece) { + case MO_8: + low =3D (int8_t)val; + if (low >=3D -16 && low < 16) { tcg_out32(s, VSPLTISB | VRT(ret) | ((val & 31) << 16)); return; } - if (val =3D=3D (tcg_target_long)dup_const(MO_16, low)) { + if (have_isa_3_00) { + tcg_out32(s, XXSPLTIB | VRT(ret) | ((val & 0xff) << 11)); + return; + } + break; + + case MO_16: + low =3D (int16_t)val; + if (low >=3D -16 && low < 16) { tcg_out32(s, VSPLTISH | VRT(ret) | ((val & 31) << 16)); return; } - if (val =3D=3D (tcg_target_long)dup_const(MO_32, low)) { + break; + + case MO_32: + low =3D (int32_t)val; + if (low >=3D -16 && low < 16) { tcg_out32(s, VSPLTISW | VRT(ret) | ((val & 31) << 16)); return; } - } - if (have_isa_3_00 && val =3D=3D (tcg_target_long)dup_const(MO_8, val))= { - tcg_out32(s, XXSPLTIB | VRT(ret) | ((val & 0xff) << 11)); - return; + break; } =20 /* @@ -952,14 +962,15 @@ static void tcg_out_dupi_vec(TCGContext *s, TCGType t= ype, TCGReg ret, if (TCG_TARGET_REG_BITS =3D=3D 64) { new_pool_label(s, val, rel, s->code_ptr, add); } else { - new_pool_l2(s, rel, s->code_ptr, add, val, val); + new_pool_l2(s, rel, s->code_ptr, add, val >> 32, val); } } else { load_insn =3D LVX | VRT(ret) | RB(TCG_REG_TMP1); if (TCG_TARGET_REG_BITS =3D=3D 64) { new_pool_l2(s, rel, s->code_ptr, add, val, val); } else { - new_pool_l4(s, rel, s->code_ptr, add, val, val, val, val); + new_pool_l4(s, rel, s->code_ptr, add, + val >> 32, val, val >> 32, val); } } =20 --=20 2.25.1 From nobody Sat May 18 21:45:31 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1608248033; cv=none; d=zohomail.com; s=zohoarc; b=AyMLFHuNIaR8AiP2nW/fOIjy8DhWoq1qqXK3ET2XHccvIo8PnG0Gjx1ex/888sfcCAz6EAOkxllDmlhjARsY7pm4K7nC9SDTJwqMaTL+WHm2B2pDvUhXuOefjSoQ/66WpcpCzzWlPAg/aig/3CbbP3uVOluHRZE3VYYWzWwPI/I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608248033; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Vh2RnCqJKW0Iq3hPKx9Bhx7AqkcecpFuZuzmVLuxCys=; b=WiFus3gOba1yaWolJuRBQKt//Q3IEJ0UbGCFYOWOlQAtfc2yYwyBIpX/Wdht9dlt4xSO4zzIyDuvLURFYkd0OM5qTQrPZ5/sGixzc+0XWsWUqNFMX68X5ZENguuOYcfRCj8O2xyvoyuQHJRB/sNhlV5T3mukQsnZ7a0UiyWOFts= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1608248033527872.5305609262256; Thu, 17 Dec 2020 15:33:53 -0800 (PST) Received: from localhost ([::1]:47958 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpuq7-0007Py-Pg for importer@patchew.org; Thu, 17 Dec 2020 10:05:11 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33304) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpue0-0003TP-3y for qemu-devel@nongnu.org; Thu, 17 Dec 2020 09:52:40 -0500 Received: from mail-oo1-xc2e.google.com ([2607:f8b0:4864:20::c2e]:38747) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kpudo-0004tB-4G for qemu-devel@nongnu.org; Thu, 17 Dec 2020 09:52:39 -0500 Received: by mail-oo1-xc2e.google.com with SMTP id i18so6863696ooh.5 for ; Thu, 17 Dec 2020 06:52:23 -0800 (PST) Received: from localhost.localdomain (fixed-187-189-51-144.totalplay.net. [187.189.51.144]) by smtp.gmail.com with ESMTPSA id x130sm1136342oif.3.2020.12.17.06.52.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Dec 2020 06:52:20 -0800 (PST) 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=Vh2RnCqJKW0Iq3hPKx9Bhx7AqkcecpFuZuzmVLuxCys=; b=tS3CEdkon8NIiJepJL2rNAkGHaZL5zDbSMApw2Fe9YvTHI+LLhExfCtb/65XCzLuuB YuROhcV9hpyZSnTyN48h6TO5hSBuALMDfTMWUJL5Evj8ybovlk+IcOtmdv6UeTEXv57w +fejKMgquLHCLI8pSNRLK42XzcKfOo9AlXM5etJvh3u2e2VWyMNQpZRhCEHa+NHYvzpf DhauU+WHEeOXiRYvLApnKUit2uu5lSSGtiu+uwWiSHoL9NpVdqxb2DQCRHQRLgVyZMif K0iQ5gIkpTMZ3CesCjtFypL7nVe6VVhjcQwL9bobxDmWZNhbC41P9VH55cMbroaEhkYI 6XjQ== 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=Vh2RnCqJKW0Iq3hPKx9Bhx7AqkcecpFuZuzmVLuxCys=; b=nAqRj2iLk2JoOJ6CDzWMKtJ49OnSM3tCb8u2b4zucTxL8DBBNqRCdFT+AcUf4Wthje wPoVflFvbWXFB8xo7vmGndz7hQ1ZGvWJcZ9xZEg9HsqpFd6jYOes5JCZ8tJZ84SaoroY WpGnNvflPIHpGlotyGmWZ3a3cOV1jGTB2L5wZkYg8UEaB5VHLJxUKLDRO3U9KshGKuFL mKF90hn4weidiRrNPlUmV41SujmPw65H1lfX0AlFLYZP/r/sVFX+2NRPEsOYk2GCN+Kg cKScbVm10mcx6u4B0+Gq7ad9rTsECtxNKc3oUn1bZ7z/HHr9DoE3XEt6YeQDeSFl/vAp nYGw== X-Gm-Message-State: AOAM5311KQwJkJn22BGmOYic2ppvRRcmbX13oIe2JyBdynziTTu5EOys i3ZZKFQmzye+KqXV7IMXRETxeKORV0lVUdJh X-Google-Smtp-Source: ABdhPJx6KMCtrtMHp7w9eFk/SOEqC6j3lQ9038RlmTay+rNhkajY5VDMr9Q7C+kC0FF2uSbACiOgTg== X-Received: by 2002:a4a:6154:: with SMTP id u20mr23879492ooe.12.1608216740702; Thu, 17 Dec 2020 06:52:20 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 03/23] tcg: Consolidate 3 bits into enum TCGTempKind Date: Thu, 17 Dec 2020 08:51:55 -0600 Message-Id: <20201217145215.534637-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201217145215.534637-1-richard.henderson@linaro.org> References: <20201217145215.534637-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::c2e; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc2e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) The temp_fixed, temp_global, temp_local bits are all related. Combine them into a single enumeration. Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- include/tcg/tcg.h | 20 +++++--- tcg/optimize.c | 8 +-- tcg/tcg.c | 126 ++++++++++++++++++++++++++++------------------ 3 files changed, 92 insertions(+), 62 deletions(-) diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index 8ff9dad4ef..30bd525d83 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -483,23 +483,27 @@ typedef enum TCGTempVal { TEMP_VAL_CONST, } TCGTempVal; =20 +typedef enum TCGTempKind { + /* Temp is dead at the end of all basic blocks. */ + TEMP_NORMAL, + /* Temp is saved across basic blocks but dead at the end of TBs. */ + TEMP_LOCAL, + /* Temp is saved across both basic blocks and translation blocks. */ + TEMP_GLOBAL, + /* Temp is in a fixed register. */ + TEMP_FIXED, +} TCGTempKind; + typedef struct TCGTemp { TCGReg reg:8; TCGTempVal val_type:8; TCGType base_type:8; TCGType type:8; - unsigned int fixed_reg:1; + TCGTempKind kind:3; unsigned int indirect_reg:1; unsigned int indirect_base:1; unsigned int mem_coherent:1; unsigned int mem_allocated:1; - /* If true, the temp is saved across both basic blocks and - translation blocks. */ - unsigned int temp_global:1; - /* If true, the temp is saved across basic blocks but dead - at the end of translation blocks. If false, the temp is - dead at the end of basic blocks. */ - unsigned int temp_local:1; unsigned int temp_allocated:1; =20 tcg_target_long val; diff --git a/tcg/optimize.c b/tcg/optimize.c index 220f4601d5..3cffd941bd 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -116,21 +116,21 @@ static TCGTemp *find_better_copy(TCGContext *s, TCGTe= mp *ts) TCGTemp *i; =20 /* If this is already a global, we can't do better. */ - if (ts->temp_global) { + if (ts->kind >=3D TEMP_GLOBAL) { return ts; } =20 /* Search for a global first. */ for (i =3D ts_info(ts)->next_copy; i !=3D ts; i =3D ts_info(i)->next_c= opy) { - if (i->temp_global) { + if (i->kind >=3D TEMP_GLOBAL) { return i; } } =20 /* If it is a temp, search for a temp local. */ - if (!ts->temp_local) { + if (ts->kind =3D=3D TEMP_NORMAL) { for (i =3D ts_info(ts)->next_copy; i !=3D ts; i =3D ts_info(i)->ne= xt_copy) { - if (ts->temp_local) { + if (i->kind >=3D TEMP_LOCAL) { return i; } } diff --git a/tcg/tcg.c b/tcg/tcg.c index 2326e61b51..07a25e59b6 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -1161,7 +1161,7 @@ static inline TCGTemp *tcg_global_alloc(TCGContext *s) tcg_debug_assert(s->nb_globals =3D=3D s->nb_temps); s->nb_globals++; ts =3D tcg_temp_alloc(s); - ts->temp_global =3D 1; + ts->kind =3D TEMP_GLOBAL; =20 return ts; } @@ -1178,7 +1178,7 @@ static TCGTemp *tcg_global_reg_new_internal(TCGContex= t *s, TCGType type, ts =3D tcg_global_alloc(s); ts->base_type =3D type; ts->type =3D type; - ts->fixed_reg =3D 1; + ts->kind =3D TEMP_FIXED; ts->reg =3D reg; ts->name =3D name; tcg_regset_set_reg(s->reserved_regs, reg); @@ -1205,7 +1205,7 @@ TCGTemp *tcg_global_mem_new_internal(TCGType type, TC= Gv_ptr base, bigendian =3D 1; #endif =20 - if (!base_ts->fixed_reg) { + if (base_ts->kind !=3D TEMP_FIXED) { /* We do not support double-indirect registers. */ tcg_debug_assert(!base_ts->indirect_reg); base_ts->indirect_base =3D 1; @@ -1253,6 +1253,7 @@ TCGTemp *tcg_global_mem_new_internal(TCGType type, TC= Gv_ptr base, TCGTemp *tcg_temp_new_internal(TCGType type, bool temp_local) { TCGContext *s =3D tcg_ctx; + TCGTempKind kind =3D temp_local ? TEMP_LOCAL : TEMP_NORMAL; TCGTemp *ts; int idx, k; =20 @@ -1265,7 +1266,7 @@ TCGTemp *tcg_temp_new_internal(TCGType type, bool tem= p_local) ts =3D &s->temps[idx]; ts->temp_allocated =3D 1; tcg_debug_assert(ts->base_type =3D=3D type); - tcg_debug_assert(ts->temp_local =3D=3D temp_local); + tcg_debug_assert(ts->kind =3D=3D kind); } else { ts =3D tcg_temp_alloc(s); if (TCG_TARGET_REG_BITS =3D=3D 32 && type =3D=3D TCG_TYPE_I64) { @@ -1274,18 +1275,18 @@ TCGTemp *tcg_temp_new_internal(TCGType type, bool t= emp_local) ts->base_type =3D type; ts->type =3D TCG_TYPE_I32; ts->temp_allocated =3D 1; - ts->temp_local =3D temp_local; + ts->kind =3D kind; =20 tcg_debug_assert(ts2 =3D=3D ts + 1); ts2->base_type =3D TCG_TYPE_I64; ts2->type =3D TCG_TYPE_I32; ts2->temp_allocated =3D 1; - ts2->temp_local =3D temp_local; + ts2->kind =3D kind; } else { ts->base_type =3D type; ts->type =3D type; ts->temp_allocated =3D 1; - ts->temp_local =3D temp_local; + ts->kind =3D kind; } } =20 @@ -1342,12 +1343,12 @@ void tcg_temp_free_internal(TCGTemp *ts) } #endif =20 - tcg_debug_assert(ts->temp_global =3D=3D 0); + tcg_debug_assert(ts->kind < TEMP_GLOBAL); tcg_debug_assert(ts->temp_allocated !=3D 0); ts->temp_allocated =3D 0; =20 idx =3D temp_idx(ts); - k =3D ts->base_type + (ts->temp_local ? TCG_TYPE_COUNT : 0); + k =3D ts->base_type + (ts->kind =3D=3D TEMP_NORMAL ? 0 : TCG_TYPE_COUN= T); set_bit(idx, s->free_temps[k].l); } =20 @@ -1877,17 +1878,27 @@ void tcg_gen_callN(void *func, TCGTemp *ret, int na= rgs, TCGTemp **args) static void tcg_reg_alloc_start(TCGContext *s) { int i, n; - TCGTemp *ts; =20 - for (i =3D 0, n =3D s->nb_globals; i < n; i++) { - ts =3D &s->temps[i]; - ts->val_type =3D (ts->fixed_reg ? TEMP_VAL_REG : TEMP_VAL_MEM); - } - for (n =3D s->nb_temps; i < n; i++) { - ts =3D &s->temps[i]; - ts->val_type =3D (ts->temp_local ? TEMP_VAL_MEM : TEMP_VAL_DEAD); - ts->mem_allocated =3D 0; - ts->fixed_reg =3D 0; + for (i =3D 0, n =3D s->nb_temps; i < n; i++) { + TCGTemp *ts =3D &s->temps[i]; + TCGTempVal val =3D TEMP_VAL_MEM; + + switch (ts->kind) { + case TEMP_FIXED: + val =3D TEMP_VAL_REG; + break; + case TEMP_GLOBAL: + break; + case TEMP_NORMAL: + val =3D TEMP_VAL_DEAD; + /* fall through */ + case TEMP_LOCAL: + ts->mem_allocated =3D 0; + break; + default: + g_assert_not_reached(); + } + ts->val_type =3D val; } =20 memset(s->reg_to_temp, 0, sizeof(s->reg_to_temp)); @@ -1898,12 +1909,17 @@ static char *tcg_get_arg_str_ptr(TCGContext *s, cha= r *buf, int buf_size, { int idx =3D temp_idx(ts); =20 - if (ts->temp_global) { + switch (ts->kind) { + case TEMP_FIXED: + case TEMP_GLOBAL: pstrcpy(buf, buf_size, ts->name); - } else if (ts->temp_local) { + break; + case TEMP_LOCAL: snprintf(buf, buf_size, "loc%d", idx - s->nb_globals); - } else { + break; + case TEMP_NORMAL: snprintf(buf, buf_size, "tmp%d", idx - s->nb_globals); + break; } return buf; } @@ -2493,15 +2509,24 @@ static void la_bb_end(TCGContext *s, int ng, int nt) { int i; =20 - for (i =3D 0; i < ng; ++i) { - s->temps[i].state =3D TS_DEAD | TS_MEM; - la_reset_pref(&s->temps[i]); - } - for (i =3D ng; i < nt; ++i) { - s->temps[i].state =3D (s->temps[i].temp_local - ? TS_DEAD | TS_MEM - : TS_DEAD); - la_reset_pref(&s->temps[i]); + for (i =3D 0; i < nt; ++i) { + TCGTemp *ts =3D &s->temps[i]; + int state; + + switch (ts->kind) { + case TEMP_FIXED: + case TEMP_GLOBAL: + case TEMP_LOCAL: + state =3D TS_DEAD | TS_MEM; + break; + case TEMP_NORMAL: + state =3D TS_DEAD; + break; + default: + g_assert_not_reached(); + } + ts->state =3D state; + la_reset_pref(ts); } } =20 @@ -2529,7 +2554,7 @@ static void la_bb_sync(TCGContext *s, int ng, int nt) la_global_sync(s, ng); =20 for (int i =3D ng; i < nt; ++i) { - if (s->temps[i].temp_local) { + if (s->temps[i].kind =3D=3D TEMP_LOCAL) { int state =3D s->temps[i].state; s->temps[i].state =3D state | TS_MEM; if (state !=3D TS_DEAD) { @@ -3137,7 +3162,8 @@ static void check_regs(TCGContext *s) } for (k =3D 0; k < s->nb_temps; k++) { ts =3D &s->temps[k]; - if (ts->val_type =3D=3D TEMP_VAL_REG && !ts->fixed_reg + if (ts->val_type =3D=3D TEMP_VAL_REG + && ts->kind !=3D TEMP_FIXED && s->reg_to_temp[ts->reg] !=3D ts) { printf("Inconsistency for temp %s:\n", tcg_get_arg_str_ptr(s, buf, sizeof(buf), ts)); @@ -3174,15 +3200,14 @@ static void temp_load(TCGContext *, TCGTemp *, TCGR= egSet, TCGRegSet, TCGRegSet); mark it free; otherwise mark it dead. */ static void temp_free_or_dead(TCGContext *s, TCGTemp *ts, int free_or_dead) { - if (ts->fixed_reg) { + if (ts->kind =3D=3D TEMP_FIXED) { return; } if (ts->val_type =3D=3D TEMP_VAL_REG) { s->reg_to_temp[ts->reg] =3D NULL; } ts->val_type =3D (free_or_dead < 0 - || ts->temp_local - || ts->temp_global + || ts->kind !=3D TEMP_NORMAL ? TEMP_VAL_MEM : TEMP_VAL_DEAD); } =20 @@ -3199,7 +3224,7 @@ static inline void temp_dead(TCGContext *s, TCGTemp *= ts) static void temp_sync(TCGContext *s, TCGTemp *ts, TCGRegSet allocated_regs, TCGRegSet preferred_regs, int free_or_dead) { - if (ts->fixed_reg) { + if (ts->kind =3D=3D TEMP_FIXED) { return; } if (!ts->mem_coherent) { @@ -3382,7 +3407,8 @@ static void temp_save(TCGContext *s, TCGTemp *ts, TCG= RegSet allocated_regs) { /* The liveness analysis already ensures that globals are back in memory. Keep an tcg_debug_assert for safety. */ - tcg_debug_assert(ts->val_type =3D=3D TEMP_VAL_MEM || ts->fixed_reg); + tcg_debug_assert(ts->val_type =3D=3D TEMP_VAL_MEM + || ts->kind =3D=3D TEMP_FIXED); } =20 /* save globals to their canonical location and assume they can be @@ -3407,7 +3433,7 @@ static void sync_globals(TCGContext *s, TCGRegSet all= ocated_regs) for (i =3D 0, n =3D s->nb_globals; i < n; i++) { TCGTemp *ts =3D &s->temps[i]; tcg_debug_assert(ts->val_type !=3D TEMP_VAL_REG - || ts->fixed_reg + || ts->kind =3D=3D TEMP_FIXED || ts->mem_coherent); } } @@ -3420,7 +3446,7 @@ static void tcg_reg_alloc_bb_end(TCGContext *s, TCGRe= gSet allocated_regs) =20 for (i =3D s->nb_globals; i < s->nb_temps; i++) { TCGTemp *ts =3D &s->temps[i]; - if (ts->temp_local) { + if (ts->kind =3D=3D TEMP_LOCAL) { temp_save(s, ts, allocated_regs); } else { /* The liveness analysis already ensures that temps are dead. @@ -3446,7 +3472,7 @@ static void tcg_reg_alloc_cbranch(TCGContext *s, TCGR= egSet allocated_regs) * The liveness analysis already ensures that temps are dead. * Keep tcg_debug_asserts for safety. */ - if (ts->temp_local) { + if (ts->kind =3D=3D TEMP_LOCAL) { tcg_debug_assert(ts->val_type !=3D TEMP_VAL_REG || ts->mem_coh= erent); } else { tcg_debug_assert(ts->val_type =3D=3D TEMP_VAL_DEAD); @@ -3462,7 +3488,7 @@ static void tcg_reg_alloc_do_movi(TCGContext *s, TCGT= emp *ots, TCGRegSet preferred_regs) { /* ENV should not be modified. */ - tcg_debug_assert(!ots->fixed_reg); + tcg_debug_assert(ots->kind !=3D TEMP_FIXED); =20 /* The movi is not explicitly generated here. */ if (ots->val_type =3D=3D TEMP_VAL_REG) { @@ -3502,7 +3528,7 @@ static void tcg_reg_alloc_mov(TCGContext *s, const TC= GOp *op) ts =3D arg_temp(op->args[1]); =20 /* ENV should not be modified. */ - tcg_debug_assert(!ots->fixed_reg); + tcg_debug_assert(ots->kind !=3D TEMP_FIXED); =20 /* Note that otype !=3D itype for no-op truncation. */ otype =3D ots->type; @@ -3541,7 +3567,7 @@ static void tcg_reg_alloc_mov(TCGContext *s, const TC= GOp *op) } temp_dead(s, ots); } else { - if (IS_DEAD_ARG(1) && !ts->fixed_reg) { + if (IS_DEAD_ARG(1) && ts->kind !=3D TEMP_FIXED) { /* the mov can be suppressed */ if (ots->val_type =3D=3D TEMP_VAL_REG) { s->reg_to_temp[ots->reg] =3D NULL; @@ -3563,7 +3589,7 @@ static void tcg_reg_alloc_mov(TCGContext *s, const TC= GOp *op) * Store the source register into the destination slot * and leave the destination temp as TEMP_VAL_MEM. */ - assert(!ots->fixed_reg); + assert(ots->kind !=3D TEMP_FIXED); if (!ts->mem_allocated) { temp_allocate_frame(s, ots); } @@ -3600,7 +3626,7 @@ static void tcg_reg_alloc_dup(TCGContext *s, const TC= GOp *op) its =3D arg_temp(op->args[1]); =20 /* ENV should not be modified. */ - tcg_debug_assert(!ots->fixed_reg); + tcg_debug_assert(ots->kind !=3D TEMP_FIXED); =20 itype =3D its->type; vece =3D TCGOP_VECE(op); @@ -3740,7 +3766,7 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCG= Op *op) i_preferred_regs =3D o_preferred_regs =3D 0; if (arg_ct->ialias) { o_preferred_regs =3D op->output_pref[arg_ct->alias_index]; - if (ts->fixed_reg) { + if (ts->kind =3D=3D TEMP_FIXED) { /* if fixed register, we must allocate a new register if the alias is not the same register */ if (arg !=3D op->args[arg_ct->alias_index]) { @@ -3832,7 +3858,7 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCG= Op *op) ts =3D arg_temp(arg); =20 /* ENV should not be modified. */ - tcg_debug_assert(!ts->fixed_reg); + tcg_debug_assert(ts->kind !=3D TEMP_FIXED); =20 if (arg_ct->oalias && !const_args[arg_ct->alias_index]) { reg =3D new_args[arg_ct->alias_index]; @@ -3873,7 +3899,7 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCG= Op *op) ts =3D arg_temp(op->args[i]); =20 /* ENV should not be modified. */ - tcg_debug_assert(!ts->fixed_reg); + tcg_debug_assert(ts->kind !=3D TEMP_FIXED); =20 if (NEED_SYNC_ARG(i)) { temp_sync(s, ts, o_allocated_regs, 0, IS_DEAD_ARG(i)); @@ -4005,7 +4031,7 @@ static void tcg_reg_alloc_call(TCGContext *s, TCGOp *= op) ts =3D arg_temp(arg); =20 /* ENV should not be modified. */ - tcg_debug_assert(!ts->fixed_reg); + tcg_debug_assert(ts->kind !=3D TEMP_FIXED); =20 reg =3D tcg_target_call_oarg_regs[i]; tcg_debug_assert(s->reg_to_temp[reg] =3D=3D NULL); --=20 2.25.1 From nobody Sat May 18 21:45:31 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1608248404; cv=none; d=zohomail.com; s=zohoarc; b=ZFbMAu6peoKwG13RKjs7t7lXBQWpykWaRsModGqSesfj+LtK/WrEFQnjxwuI4otPnmzoqjkwYwLHOfHpuUeE3u/wmWY87RzkocGTVOeYLRYgmF/8CDCzYkc1mLt6TZwQO51t7M/14EvVBN3tC1DQgkphJD5btdRJ9x6xdK53+fI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608248404; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=f2WSteXPwYnIE0v0wh60wUMuRbrW6fX7jCUzcHiVN5w=; b=dZNH/kcLFZ1MDbUzIUU4XNFLDINeCOPChvmKQXC01DPYSILD69vB5GRA36ef4n53ZbU7bqY1t1Or4so8B+WMcxCXxY+q2Qsa9GoehQoC4RdbOGyU+oUPWIecM3bMf6OUbXFzYCQBhzNy9yp0QDxtXM0x+ArAioG1jmg2ggwpb5g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1608248404433644.3289177327322; Thu, 17 Dec 2020 15:40:04 -0800 (PST) Received: from localhost ([::1]:56730 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpuuT-00034c-Aa for importer@patchew.org; Thu, 17 Dec 2020 10:09:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33196) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpudt-0003Na-UT for qemu-devel@nongnu.org; Thu, 17 Dec 2020 09:52:35 -0500 Received: from mail-ot1-x335.google.com ([2607:f8b0:4864:20::335]:35438) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kpudn-0004u0-Vg for qemu-devel@nongnu.org; Thu, 17 Dec 2020 09:52:33 -0500 Received: by mail-ot1-x335.google.com with SMTP id i6so27535579otr.2 for ; Thu, 17 Dec 2020 06:52:23 -0800 (PST) Received: from localhost.localdomain (fixed-187-189-51-144.totalplay.net. [187.189.51.144]) by smtp.gmail.com with ESMTPSA id x130sm1136342oif.3.2020.12.17.06.52.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Dec 2020 06:52:21 -0800 (PST) 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=f2WSteXPwYnIE0v0wh60wUMuRbrW6fX7jCUzcHiVN5w=; b=YRSSX5xnyx0sSgvb8eGcit0yRYkp+jfjtNzPqLP6c66lt5Qlthcyt3+K7ug4gNpJTP 1Ny/EtXNSa6p+uhpFNoj8vaAfTyFWEYvGxnQU+q1YX/TUe9OTwkuPckp8HwA5ncLD6tO j5A6jAtjcsatObTEXcfw9vqsSWFQWdMY/lxDp1mn9J0e9Eg+teOUkF3hynsI9oR9W4Lv sXrwLK3BM7IskNpBp97BbKyK3I1GlEvV9Qpi+0DLhwD91jFhxMo8kDsdgDVgAr99Yg/I 7GEWKpkajWDpJ2xKpe79mIfNDjzzuWQbtQlxMOr2xVQ1krXPaY4xjvVquMMbA060BWSb LaRw== 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=f2WSteXPwYnIE0v0wh60wUMuRbrW6fX7jCUzcHiVN5w=; b=Hdwmoa57sOr7Fo8tVapHz7aNEQb/kDUcYlafkm92nWjRc3rVgislJkVfUkM+sw30N/ tO7fDqV/tYWwI9Qv7/pEOrwYmeliTfzxnp7rpYiL4IB920bA6/ke+652ZX9BKGEbZPeO XirH2Ulm38F70AUu+I8dh0HuLgrT9+p6WQNTl+FP84jFOFMzpS+sF6OlpkFQ/Xqirdyb Oqa+E3m4yY7y9ogww8fx2l7a6H2dP3o7U8+fKKqcsshFJqSefAdDNp0IXdQzkF8OK3o8 f353FjUdU967lhUR0uRhQXlABjSeJyNKOKd9ErY+GR1dtVYgPEmNMp6goA10qmd9234P jfrg== X-Gm-Message-State: AOAM530/qkwCbQ29my7mYEyq0JExbLwJrP8n7Bmj8YzN4sTxoCz4vUsE SdMfcOqjmuF3Rid40d5yb8mAAxnclgqdl6U4 X-Google-Smtp-Source: ABdhPJyr00FnmV+WinFs8RsZgmr2hwJCWp+5zn4KIIRMh4zvVbw8sDdIFoebrEodvL2ced+5dj/Lxw== X-Received: by 2002:a05:6830:1657:: with SMTP id h23mr30118402otr.184.1608216741921; Thu, 17 Dec 2020 06:52:21 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 04/23] tcg: Add temp_readonly Date: Thu, 17 Dec 2020 08:51:56 -0600 Message-Id: <20201217145215.534637-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201217145215.534637-1-richard.henderson@linaro.org> References: <20201217145215.534637-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::335; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x335.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) In most, but not all, places that we check for TEMP_FIXED, we are really testing that we do not modify the temporary. Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- include/tcg/tcg.h | 5 +++++ tcg/tcg.c | 21 ++++++++++----------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index 30bd525d83..9a9ced3b15 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -681,6 +681,11 @@ struct TCGContext { target_ulong gen_insn_data[TCG_MAX_INSNS][TARGET_INSN_START_WORDS]; }; =20 +static inline bool temp_readonly(TCGTemp *ts) +{ + return ts->kind =3D=3D TEMP_FIXED; +} + extern TCGContext tcg_init_ctx; extern __thread TCGContext *tcg_ctx; extern TCGv_env cpu_env; diff --git a/tcg/tcg.c b/tcg/tcg.c index 07a25e59b6..54619c1cbc 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -3200,7 +3200,7 @@ static void temp_load(TCGContext *, TCGTemp *, TCGReg= Set, TCGRegSet, TCGRegSet); mark it free; otherwise mark it dead. */ static void temp_free_or_dead(TCGContext *s, TCGTemp *ts, int free_or_dead) { - if (ts->kind =3D=3D TEMP_FIXED) { + if (temp_readonly(ts)) { return; } if (ts->val_type =3D=3D TEMP_VAL_REG) { @@ -3224,7 +3224,7 @@ static inline void temp_dead(TCGContext *s, TCGTemp *= ts) static void temp_sync(TCGContext *s, TCGTemp *ts, TCGRegSet allocated_regs, TCGRegSet preferred_regs, int free_or_dead) { - if (ts->kind =3D=3D TEMP_FIXED) { + if (temp_readonly(ts)) { return; } if (!ts->mem_coherent) { @@ -3407,8 +3407,7 @@ static void temp_save(TCGContext *s, TCGTemp *ts, TCG= RegSet allocated_regs) { /* The liveness analysis already ensures that globals are back in memory. Keep an tcg_debug_assert for safety. */ - tcg_debug_assert(ts->val_type =3D=3D TEMP_VAL_MEM - || ts->kind =3D=3D TEMP_FIXED); + tcg_debug_assert(ts->val_type =3D=3D TEMP_VAL_MEM || temp_readonly(ts)= ); } =20 /* save globals to their canonical location and assume they can be @@ -3488,7 +3487,7 @@ static void tcg_reg_alloc_do_movi(TCGContext *s, TCGT= emp *ots, TCGRegSet preferred_regs) { /* ENV should not be modified. */ - tcg_debug_assert(ots->kind !=3D TEMP_FIXED); + tcg_debug_assert(!temp_readonly(ots)); =20 /* The movi is not explicitly generated here. */ if (ots->val_type =3D=3D TEMP_VAL_REG) { @@ -3528,7 +3527,7 @@ static void tcg_reg_alloc_mov(TCGContext *s, const TC= GOp *op) ts =3D arg_temp(op->args[1]); =20 /* ENV should not be modified. */ - tcg_debug_assert(ots->kind !=3D TEMP_FIXED); + tcg_debug_assert(!temp_readonly(ots)); =20 /* Note that otype !=3D itype for no-op truncation. */ otype =3D ots->type; @@ -3589,7 +3588,7 @@ static void tcg_reg_alloc_mov(TCGContext *s, const TC= GOp *op) * Store the source register into the destination slot * and leave the destination temp as TEMP_VAL_MEM. */ - assert(ots->kind !=3D TEMP_FIXED); + assert(!temp_readonly(ots)); if (!ts->mem_allocated) { temp_allocate_frame(s, ots); } @@ -3626,7 +3625,7 @@ static void tcg_reg_alloc_dup(TCGContext *s, const TC= GOp *op) its =3D arg_temp(op->args[1]); =20 /* ENV should not be modified. */ - tcg_debug_assert(ots->kind !=3D TEMP_FIXED); + tcg_debug_assert(!temp_readonly(ots)); =20 itype =3D its->type; vece =3D TCGOP_VECE(op); @@ -3858,7 +3857,7 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCG= Op *op) ts =3D arg_temp(arg); =20 /* ENV should not be modified. */ - tcg_debug_assert(ts->kind !=3D TEMP_FIXED); + tcg_debug_assert(!temp_readonly(ts)); =20 if (arg_ct->oalias && !const_args[arg_ct->alias_index]) { reg =3D new_args[arg_ct->alias_index]; @@ -3899,7 +3898,7 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCG= Op *op) ts =3D arg_temp(op->args[i]); =20 /* ENV should not be modified. */ - tcg_debug_assert(ts->kind !=3D TEMP_FIXED); + tcg_debug_assert(!temp_readonly(ts)); =20 if (NEED_SYNC_ARG(i)) { temp_sync(s, ts, o_allocated_regs, 0, IS_DEAD_ARG(i)); @@ -4031,7 +4030,7 @@ static void tcg_reg_alloc_call(TCGContext *s, TCGOp *= op) ts =3D arg_temp(arg); =20 /* ENV should not be modified. */ - tcg_debug_assert(ts->kind !=3D TEMP_FIXED); + tcg_debug_assert(!temp_readonly(ts)); =20 reg =3D tcg_target_call_oarg_regs[i]; tcg_debug_assert(s->reg_to_temp[reg] =3D=3D NULL); --=20 2.25.1 From nobody Sat May 18 21:45:31 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1608248315; cv=none; d=zohomail.com; s=zohoarc; b=aDamCOurLGxkxK13I5PjygswEB6OVk9PbNfVgJ9er8wKvc+6Z7KIO7PlKHN5K+gFPeXSUzlZTdWHClR/PVH0aZ1RcFcO0pXUwfZ8z/ylhdr4mCcixrr63KtW1lcM28MXWtIwXNx+dnd5iZ56JZqtGYhSyH5zPL/kI4wgGBFMB88= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608248315; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=VSoOWcRdYXM6FZg9StjdneQwIVnMWszqCmEN1WyYVtk=; b=A5A6QMo374dMYQXaDpGLciggd45kp0CWJdpFxsdtClm4Oi4DPQPlFXh9d5XEywtoJgl9z6Adl1G46dpCbtZ/Ypixw6KPxooO5CqLr5GAnLVtGYYw8lkcdK7A14iQoMiboJX5JNoSTo/mrwrgFeqZVE/h8wtBQ6A7WmREb04uGcU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1608248315185993.8581808753574; Thu, 17 Dec 2020 15:38:35 -0800 (PST) Received: from localhost ([::1]:48202 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpuqK-0007Vv-2Z for importer@patchew.org; Thu, 17 Dec 2020 10:05:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33194) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpudt-0003NZ-Qw for qemu-devel@nongnu.org; Thu, 17 Dec 2020 09:52:33 -0500 Received: from mail-ot1-x32d.google.com ([2607:f8b0:4864:20::32d]:43570) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kpudm-0004uA-8Q for qemu-devel@nongnu.org; Thu, 17 Dec 2020 09:52:33 -0500 Received: by mail-ot1-x32d.google.com with SMTP id q25so27502652otn.10 for ; Thu, 17 Dec 2020 06:52:23 -0800 (PST) Received: from localhost.localdomain (fixed-187-189-51-144.totalplay.net. [187.189.51.144]) by smtp.gmail.com with ESMTPSA id x130sm1136342oif.3.2020.12.17.06.52.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Dec 2020 06:52:22 -0800 (PST) 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:mime-version :content-transfer-encoding; bh=VSoOWcRdYXM6FZg9StjdneQwIVnMWszqCmEN1WyYVtk=; b=C9+m/pRa+m3WkmoWxw3xjK9HpZ2DKyBz1RnHy25M+HDyBWRerMI96NgA6Sc8JWpOda gQxiFxPEFgE5XvPFdyBptnCuWKcF1XXBodFAHcJKO5GJdG26BMqhX3TU0+WtAkf1nF/M F4zmvjDoarwZJJpc66DBRrxHgctoKX3N3N5TCX3GyxqS1lsoi9KhQYziB953WuJFiOr4 laSDsLdsEOBhLwDBl80aBkleuUxa4h4Tqts5LKnMUMZzCGYqwgGBYjf+s9WAunLsDddO Ffvi4TUW8hdDeS6b0uDqvSCVbCqhC1yKPnEQuu5l9oZDz6r2rBDf3ArRWqgtymbnZfTp fuvg== 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:mime-version:content-transfer-encoding; bh=VSoOWcRdYXM6FZg9StjdneQwIVnMWszqCmEN1WyYVtk=; b=kBreDfKkKr5Hcbe4b15thlH0dca9V2OwAihxhE5hagucCm4JXR3i/7tImoFRkAhxAA GXbdH/6NnbvprGVs4rwC1J0u0ccHDP/KYTW57FkzQ0FR2mWNHSY+un1gpk1m+NW0xKbW 5BJmtQR3SC3p5BJNCp43yfTjVsHHYHFRmbZF2IPn6N6f2b6iAK2S9VeKStX7KLnMyEox aeswdZpPp1wwIjetzsvskePRf1Z3J2LljzAb8J2CGQoT/EUJjVO/h3q18vLJQnAreJQ8 QoAmVvKEO2AG/DbUXygRAMaZeEW+OrLXYAz/9cGTT1PLS4+VKYS3ZVuTHe2+JxYylOx/ HPFQ== X-Gm-Message-State: AOAM530Wv+Ud2f3URCuoKyJbxukzApi7ZeH2aq6zVG9vXcz57/9m0F4x Q7X8pDxr2DUb3dcH9RxEV+E3Yy2LmIGHyTpK X-Google-Smtp-Source: ABdhPJyPD9tuV5edX/io7KeYDZfzfcARV+veusXFmo4HQ4ksfMJW1VrABGNXG5FiQ78cdKLyrOe/LA== X-Received: by 2002:a9d:a4f:: with SMTP id 73mr29201276otg.238.1608216742956; Thu, 17 Dec 2020 06:52:22 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 05/23] tcg: Expand TCGTemp.val to 64-bits Date: Thu, 17 Dec 2020 08:51:57 -0600 Message-Id: <20201217145215.534637-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201217145215.534637-1-richard.henderson@linaro.org> References: <20201217145215.534637-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::32d; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" This will reduce the differences between 32-bit and 64-bit hosts, allowing full 64-bit constants to be created with the same interface. Signed-off-by: Richard Henderson --- include/tcg/tcg.h | 2 +- tcg/tcg.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index 9a9ced3b15..84491b5cf0 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -506,7 +506,7 @@ typedef struct TCGTemp { unsigned int mem_allocated:1; unsigned int temp_allocated:1; =20 - tcg_target_long val; + int64_t val; struct TCGTemp *mem_base; intptr_t mem_offset; const char *name; diff --git a/tcg/tcg.c b/tcg/tcg.c index 54619c1cbc..69f748082d 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -3122,7 +3122,7 @@ static void dump_regs(TCGContext *s) tcg_target_reg_names[ts->mem_base->reg]); break; case TEMP_VAL_CONST: - printf("$0x%" TCG_PRIlx, ts->val); + printf("$0x%" PRIx64, ts->val); break; case TEMP_VAL_DEAD: printf("D"); --=20 2.25.1 From nobody Sat May 18 21:45:31 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1608237372; cv=none; d=zohomail.com; s=zohoarc; b=cRHp0oXyW7huerT8Bo299VZRe8UbPGStvot3XMSgC5jeU6xbb2Msp9g7qgBuFRxxEChkTG5/yBhiEkdKjgm8ByYq5l2Vierp/+IQKap3JmqiL2WMrd6B5gerVJWeFx2Q93NCCItdYBp3pBGk71V1vEnKhHY4/7KPBfKHx+Hq55I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608237372; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=bBAAD2EsIW/155GIjaU48r4O2esHCcXs+AbT7vfXmho=; b=aynzScLz8fL3CFiDUhBpZO20kmH9UWfePCQ1ig9o3UAJSjU+XH3bbcGf41tOaITcRKym6Q1yBGir6UFBniFXYJBPkmDEauNoDh/cOzcC9/JE/LWcUzu1nY8kJHaz3lw0mKeSGRDsaIXsevLgdW2Jdn2jlGSXlicL7MgrJqUyM5c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1608237372835494.263531583887; Thu, 17 Dec 2020 12:36:12 -0800 (PST) Received: from localhost ([::1]:39534 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpuml-0003kR-Oz for importer@patchew.org; Thu, 17 Dec 2020 10:01:43 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33108) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpudp-0003Ls-SD for qemu-devel@nongnu.org; Thu, 17 Dec 2020 09:52:30 -0500 Received: from mail-ot1-x334.google.com ([2607:f8b0:4864:20::334]:40704) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kpudm-0004uN-8c for qemu-devel@nongnu.org; Thu, 17 Dec 2020 09:52:29 -0500 Received: by mail-ot1-x334.google.com with SMTP id j12so27484861ota.7 for ; Thu, 17 Dec 2020 06:52:25 -0800 (PST) Received: from localhost.localdomain (fixed-187-189-51-144.totalplay.net. [187.189.51.144]) by smtp.gmail.com with ESMTPSA id x130sm1136342oif.3.2020.12.17.06.52.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Dec 2020 06:52:23 -0800 (PST) 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=bBAAD2EsIW/155GIjaU48r4O2esHCcXs+AbT7vfXmho=; b=O/+k+KSr9hvaCLLhNFSRZoTnmppJsZP+iKhkMRFeOFLZJqY26DarRxtegaaKIqR4Gg oUDWgneg0fssO7iZiPNDR7XghhU6asWG6eEhc5LhbARpH2yhIw5HhEb6eHgtV3zLXhjR ZYw6vWPt+/Gy2f6xOxfgz0q29sjPwb0aFWoZ0Ro84C+CSwFXQ0LAEXxUwrTAQMRQn5m3 W3JmIcXrjThbe+55Gf9FqJafueB9wzagg6Q+yuJ04GhWbZu/fHLDlwSfOxe8ryg1MWjE RgPNEwSUB4ghqiAU5nbj5QhDOMZARPPiIQCLKuomyc73nezOFywBjUte5cKa5a2O+pQg 2UQQ== 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=bBAAD2EsIW/155GIjaU48r4O2esHCcXs+AbT7vfXmho=; b=aC8FXCVFhlib+JW/ANN+mtDFPyEw74VZoROVGWWJJagvj2lz9qySiOyVDuHDwJNSsI qlZH5YNyjkOL+R02yXazDZtWh/hmOec6z/sYtRVXFrQNOCpLva5SSTdoR9u7/GGbQC+/ FmUYhVySMKIb0C04d9Ic407W6uEklCfvGZVinUjHoXXjozvaeWT6LLMUVZxVYe3adAJW fh+gJ38CTiYH5UKGJHi1rbjUAUwUOd5f8FlwgVxCNXkQ/XwCx3NcpXhFfs+pIe5Na+3D S3VjYHLcZwJZQjFfgPs7xwXz0cShXYdvLQrqfcMcMpJrL4qmxXVf8tCeQVgCotbQTzMR pTUw== X-Gm-Message-State: AOAM5334gYGC51LNlydlDWzis8d048bmrezvUN2hXJzfvj88PMdHbn9k HvVDgh+v0ADiMefLBhooYcICg1ElJtFXUaTC X-Google-Smtp-Source: ABdhPJxGni9k6cd01JtRDVAVzjieOeYlYDMWLw34gCAoHeQCwhq5ayBUbpTwn4zSvupBYrFYZINlUw== X-Received: by 2002:a9d:a4e:: with SMTP id 72mr30361815otg.267.1608216744212; Thu, 17 Dec 2020 06:52:24 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 06/23] tcg: Rename struct tcg_temp_info to TempOptInfo Date: Thu, 17 Dec 2020 08:51:58 -0600 Message-Id: <20201217145215.534637-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201217145215.534637-1-richard.henderson@linaro.org> References: <20201217145215.534637-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::334; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x334.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Fix this name vs our coding style. Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- tcg/optimize.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index 3cffd941bd..81faf7cf10 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -35,20 +35,20 @@ glue(glue(case INDEX_op_, x), _i64): \ glue(glue(case INDEX_op_, x), _vec) =20 -struct tcg_temp_info { +typedef struct TempOptInfo { bool is_const; TCGTemp *prev_copy; TCGTemp *next_copy; tcg_target_ulong val; tcg_target_ulong mask; -}; +} TempOptInfo; =20 -static inline struct tcg_temp_info *ts_info(TCGTemp *ts) +static inline TempOptInfo *ts_info(TCGTemp *ts) { return ts->state_ptr; } =20 -static inline struct tcg_temp_info *arg_info(TCGArg arg) +static inline TempOptInfo *arg_info(TCGArg arg) { return ts_info(arg_temp(arg)); } @@ -71,9 +71,9 @@ static inline bool ts_is_copy(TCGTemp *ts) /* Reset TEMP's state, possibly removing the temp for the list of copies. = */ static void reset_ts(TCGTemp *ts) { - struct tcg_temp_info *ti =3D ts_info(ts); - struct tcg_temp_info *pi =3D ts_info(ti->prev_copy); - struct tcg_temp_info *ni =3D ts_info(ti->next_copy); + TempOptInfo *ti =3D ts_info(ts); + TempOptInfo *pi =3D ts_info(ti->prev_copy); + TempOptInfo *ni =3D ts_info(ti->next_copy); =20 ni->prev_copy =3D ti->prev_copy; pi->next_copy =3D ti->next_copy; @@ -89,12 +89,12 @@ static void reset_temp(TCGArg arg) } =20 /* Initialize and activate a temporary. */ -static void init_ts_info(struct tcg_temp_info *infos, +static void init_ts_info(TempOptInfo *infos, TCGTempSet *temps_used, TCGTemp *ts) { size_t idx =3D temp_idx(ts); if (!test_bit(idx, temps_used->l)) { - struct tcg_temp_info *ti =3D &infos[idx]; + TempOptInfo *ti =3D &infos[idx]; =20 ts->state_ptr =3D ti; ti->next_copy =3D ts; @@ -105,7 +105,7 @@ static void init_ts_info(struct tcg_temp_info *infos, } } =20 -static void init_arg_info(struct tcg_temp_info *infos, +static void init_arg_info(TempOptInfo *infos, TCGTempSet *temps_used, TCGArg arg) { init_ts_info(infos, temps_used, arg_temp(arg)); @@ -171,7 +171,7 @@ static void tcg_opt_gen_movi(TCGContext *s, TCGOp *op, = TCGArg dst, TCGArg val) const TCGOpDef *def; TCGOpcode new_op; tcg_target_ulong mask; - struct tcg_temp_info *di =3D arg_info(dst); + TempOptInfo *di =3D arg_info(dst); =20 def =3D &tcg_op_defs[op->opc]; if (def->flags & TCG_OPF_VECTOR) { @@ -202,8 +202,8 @@ static void tcg_opt_gen_mov(TCGContext *s, TCGOp *op, T= CGArg dst, TCGArg src) TCGTemp *dst_ts =3D arg_temp(dst); TCGTemp *src_ts =3D arg_temp(src); const TCGOpDef *def; - struct tcg_temp_info *di; - struct tcg_temp_info *si; + TempOptInfo *di; + TempOptInfo *si; tcg_target_ulong mask; TCGOpcode new_op; =20 @@ -236,7 +236,7 @@ static void tcg_opt_gen_mov(TCGContext *s, TCGOp *op, T= CGArg dst, TCGArg src) di->mask =3D mask; =20 if (src_ts->type =3D=3D dst_ts->type) { - struct tcg_temp_info *ni =3D ts_info(si->next_copy); + TempOptInfo *ni =3D ts_info(si->next_copy); =20 di->next_copy =3D si->next_copy; di->prev_copy =3D src_ts; @@ -599,7 +599,7 @@ void tcg_optimize(TCGContext *s) { int nb_temps, nb_globals; TCGOp *op, *op_next, *prev_mb =3D NULL; - struct tcg_temp_info *infos; + TempOptInfo *infos; TCGTempSet temps_used; =20 /* Array VALS has an element for each temp. @@ -610,7 +610,7 @@ void tcg_optimize(TCGContext *s) nb_temps =3D s->nb_temps; nb_globals =3D s->nb_globals; bitmap_zero(temps_used.l, nb_temps); - infos =3D tcg_malloc(sizeof(struct tcg_temp_info) * nb_temps); + infos =3D tcg_malloc(sizeof(TempOptInfo) * nb_temps); =20 QTAILQ_FOREACH_SAFE(op, &s->ops, link, op_next) { tcg_target_ulong mask, partmask, affected; --=20 2.25.1 From nobody Sat May 18 21:45:31 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1608248079; cv=none; d=zohomail.com; s=zohoarc; b=jgHYLSG6hY6ljytG39jRvtLtZqyvhbYuMntH+UYZaVlr4Rlf2JLzCTHrICfuUpd7/sBeGKLMVEzvvxq7Acrl016JCIvZk70+RAMBiEumxB5ZCveHT7pympIwfNUZB+0RObLfbv9JlTrvMv62B94jgHUqfvsTcO0vLyrpqzSD1BI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608248079; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=KysIP4SxxPHUzbaJQ7kkTPCy9I7LKQnOtelCJefhblY=; b=USdQec/hLpc5gKU/KmkZePE9d+AlDrAJI2F3zxgrI9WH2R4+YrECgNgLZagoVDrHYPGESoZ8CWBJkrvxJlDef/N6NVVCq6+NzfEYhtGhEIdhcE+GWhtPooFWNe9JBEhPk39W2kwi0mrhEzt7g+/xwod2PB1rIrlKf40Yj7JLlp8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1608248079974328.3012252685995; Thu, 17 Dec 2020 15:34:39 -0800 (PST) Received: from localhost ([::1]:51936 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpv4q-00051i-Kr for importer@patchew.org; Thu, 17 Dec 2020 10:20:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33262) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpudx-0003Pa-S5 for qemu-devel@nongnu.org; Thu, 17 Dec 2020 09:52:37 -0500 Received: from mail-oo1-xc31.google.com ([2607:f8b0:4864:20::c31]:42133) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kpudn-0004uS-VD for qemu-devel@nongnu.org; Thu, 17 Dec 2020 09:52:37 -0500 Received: by mail-oo1-xc31.google.com with SMTP id x203so6868878ooa.9 for ; Thu, 17 Dec 2020 06:52:26 -0800 (PST) Received: from localhost.localdomain (fixed-187-189-51-144.totalplay.net. [187.189.51.144]) by smtp.gmail.com with ESMTPSA id x130sm1136342oif.3.2020.12.17.06.52.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Dec 2020 06:52:24 -0800 (PST) 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:mime-version :content-transfer-encoding; bh=KysIP4SxxPHUzbaJQ7kkTPCy9I7LKQnOtelCJefhblY=; b=yIKD49JAu+6AueDqQFIaf02ddPzsHKJ54J+oQYJJYI7EAB875UO8mMJvzJNmDFCcVS +abi1Nu9XI+QU/MzII5299JymmjCEgNKuzEoYq3jpfzcRhsq3/F67dYjh4U8agAtcn7W zdENWOTlSi0ES2jfGah5rTbJfy9U/RnVJFuZYBcT3U/0x3FxrViAeopQAnHKxvuU3afc Z2irNilExahD2gecsuMaGa6KFvUBjVsiLXhg3yeLwQS52iE5U2J1dS3aaWV+c+BX8PJ6 mEY8ES8Lg0yY8jaAaHrwBnBChDwe7YDmpGRYo6pXngsccDzyOf3+FNMt5jNabt9c24Zd ojCw== 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:mime-version:content-transfer-encoding; bh=KysIP4SxxPHUzbaJQ7kkTPCy9I7LKQnOtelCJefhblY=; b=ROD/J04/nXaTiqokTwnGdkGF/uUz9wa8iXH0j0lPSjCvo0QjBhQkeQBgZeQRFDRp0X z5DpGOD9UgNnSnOTxhG6ydigBejaGRcIV8nuMuyTOURuNfHMWqCsMilRqwdkSFQCEfCA cnimqCN+xsPM1/CrgNgwJXMPmcAn69/3I7fWW3vXov0BxDzCTRdeoExF4MOTkTkAi9AH XPJO/zvYKcEE5ljwhRN9a3dS1uON5v3GLxeMH7wVHVfUyeglt5avaKSPt+lMWj8E/dLi 5QN0co5j8/K/YN+ekS0yPvZR1J78N2F4kSlsfDK8RQug+0DBPqpIHwmLPgqkXMom7Uph 1xXQ== X-Gm-Message-State: AOAM531YZb3JTHcItKCIjwvVyw1HAIyqE1e3scjB93PF0ocSoOWddVS5 zldApR2xDIN3KW+oKqoH8mQ+GLoks+O6nXlM X-Google-Smtp-Source: ABdhPJx7cw/RRdbNjjHgIsxZqMN1CB4FuLYzb1Sv9s+rE5t1Uz4ySEXN8gkAZiAfU36HgItADfbuWg== X-Received: by 2002:a4a:6c45:: with SMTP id u5mr13203208oof.61.1608216745352; Thu, 17 Dec 2020 06:52:25 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 07/23] tcg: Expand TempOptInfo to 64-bits Date: Thu, 17 Dec 2020 08:51:59 -0600 Message-Id: <20201217145215.534637-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201217145215.534637-1-richard.henderson@linaro.org> References: <20201217145215.534637-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::c31; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc31.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" This propagates the extended value of TCGTemp.val that we did before. In addition, it will be required for vector constants. Signed-off-by: Richard Henderson --- tcg/optimize.c | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index 81faf7cf10..33d1fc8f87 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -39,8 +39,8 @@ typedef struct TempOptInfo { bool is_const; TCGTemp *prev_copy; TCGTemp *next_copy; - tcg_target_ulong val; - tcg_target_ulong mask; + uint64_t val; + uint64_t mask; } TempOptInfo; =20 static inline TempOptInfo *ts_info(TCGTemp *ts) @@ -166,11 +166,11 @@ static bool args_are_copies(TCGArg arg1, TCGArg arg2) return ts_are_copies(arg_temp(arg1), arg_temp(arg2)); } =20 -static void tcg_opt_gen_movi(TCGContext *s, TCGOp *op, TCGArg dst, TCGArg = val) +static void tcg_opt_gen_movi(TCGContext *s, TCGOp *op, TCGArg dst, uint64_= t val) { const TCGOpDef *def; TCGOpcode new_op; - tcg_target_ulong mask; + uint64_t mask; TempOptInfo *di =3D arg_info(dst); =20 def =3D &tcg_op_defs[op->opc]; @@ -204,7 +204,7 @@ static void tcg_opt_gen_mov(TCGContext *s, TCGOp *op, T= CGArg dst, TCGArg src) const TCGOpDef *def; TempOptInfo *di; TempOptInfo *si; - tcg_target_ulong mask; + uint64_t mask; TCGOpcode new_op; =20 if (ts_are_copies(dst_ts, src_ts)) { @@ -247,7 +247,7 @@ static void tcg_opt_gen_mov(TCGContext *s, TCGOp *op, T= CGArg dst, TCGArg src) } } =20 -static TCGArg do_constant_folding_2(TCGOpcode op, TCGArg x, TCGArg y) +static uint64_t do_constant_folding_2(TCGOpcode op, uint64_t x, uint64_t y) { uint64_t l64, h64; =20 @@ -410,10 +410,10 @@ static TCGArg do_constant_folding_2(TCGOpcode op, TCG= Arg x, TCGArg y) } } =20 -static TCGArg do_constant_folding(TCGOpcode op, TCGArg x, TCGArg y) +static uint64_t do_constant_folding(TCGOpcode op, uint64_t x, uint64_t y) { const TCGOpDef *def =3D &tcg_op_defs[op]; - TCGArg res =3D do_constant_folding_2(op, x, y); + uint64_t res =3D do_constant_folding_2(op, x, y); if (!(def->flags & TCG_OPF_64BIT)) { res =3D (int32_t)res; } @@ -501,8 +501,9 @@ static bool do_constant_folding_cond_eq(TCGCond c) static TCGArg do_constant_folding_cond(TCGOpcode op, TCGArg x, TCGArg y, TCGCond c) { - tcg_target_ulong xv =3D arg_info(x)->val; - tcg_target_ulong yv =3D arg_info(y)->val; + uint64_t xv =3D arg_info(x)->val; + uint64_t yv =3D arg_info(y)->val; + if (arg_is_const(x) && arg_is_const(y)) { const TCGOpDef *def =3D &tcg_op_defs[op]; tcg_debug_assert(!(def->flags & TCG_OPF_VECTOR)); @@ -613,9 +614,8 @@ void tcg_optimize(TCGContext *s) infos =3D tcg_malloc(sizeof(TempOptInfo) * nb_temps); =20 QTAILQ_FOREACH_SAFE(op, &s->ops, link, op_next) { - tcg_target_ulong mask, partmask, affected; + uint64_t mask, partmask, affected, tmp; int nb_oargs, nb_iargs, i; - TCGArg tmp; TCGOpcode opc =3D op->opc; const TCGOpDef *def =3D &tcg_op_defs[opc]; =20 @@ -1221,14 +1221,15 @@ void tcg_optimize(TCGContext *s) =20 CASE_OP_32_64(extract2): if (arg_is_const(op->args[1]) && arg_is_const(op->args[2])) { - TCGArg v1 =3D arg_info(op->args[1])->val; - TCGArg v2 =3D arg_info(op->args[2])->val; + uint64_t v1 =3D arg_info(op->args[1])->val; + uint64_t v2 =3D arg_info(op->args[2])->val; + int shr =3D op->args[3]; =20 if (opc =3D=3D INDEX_op_extract2_i64) { - tmp =3D (v1 >> op->args[3]) | (v2 << (64 - op->args[3]= )); + tmp =3D (v1 >> shr) | (v2 << (64 - shr)); } else { - tmp =3D (int32_t)(((uint32_t)v1 >> op->args[3]) | - ((uint32_t)v2 << (32 - op->args[3]))); + tmp =3D (int32_t)(((uint32_t)v1 >> shr) | + ((uint32_t)v2 << (32 - shr))); } tcg_opt_gen_movi(s, op, op->args[0], tmp); break; @@ -1267,9 +1268,10 @@ void tcg_optimize(TCGContext *s) break; } if (arg_is_const(op->args[3]) && arg_is_const(op->args[4])) { - tcg_target_ulong tv =3D arg_info(op->args[3])->val; - tcg_target_ulong fv =3D arg_info(op->args[4])->val; + uint64_t tv =3D arg_info(op->args[3])->val; + uint64_t fv =3D arg_info(op->args[4])->val; TCGCond cond =3D op->args[5]; + if (fv =3D=3D 1 && tv =3D=3D 0) { cond =3D tcg_invert_cond(cond); } else if (!(tv =3D=3D 1 && fv =3D=3D 0)) { --=20 2.25.1 From nobody Sat May 18 21:45:31 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1608248313; cv=none; d=zohomail.com; s=zohoarc; b=l0MVuVKOvQBWEpSaX0p4fthURQWC8YhNgxUCsvpUMaJ9a7Mqdwtlbgkbc//Vw1auQ7TFWJaUoB/bSkgvnz0jS2qz8gg+/JH+eyI+D2OKOqAvk0PxAtehAFmS/QcsMq5RtFB6cxFjQ6SJNCTdeNKRW4Jhsea+BnZVa4grI7NhbRg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608248313; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=7SnPI3iOtS/KMHTBttflLWktP6aLMxFVVcB71yIMxy4=; b=STWV8+xtIEtmuCQynIxiJybqPt905mzhAvUGXERypcuhKSu+XTBOR03+UK0Tdl7iJvZhXHvh91RN2SD+OCTrBAHUrOqJ5Wk4mIJasHQLpGaRlWAypevRrLXODMg9uDhzyIgdIslUaWlZtHJt+GXs1UvbgNN8Kb5GbeGmciC8swM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1608248313089916.1178902173467; Thu, 17 Dec 2020 15:38:33 -0800 (PST) Received: from localhost ([::1]:45296 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpv2K-0002Ad-M5 for importer@patchew.org; Thu, 17 Dec 2020 10:17:48 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33254) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpudx-0003PJ-HF for qemu-devel@nongnu.org; Thu, 17 Dec 2020 09:52:37 -0500 Received: from mail-oi1-x233.google.com ([2607:f8b0:4864:20::233]:37641) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kpudq-0004v0-Ln for qemu-devel@nongnu.org; Thu, 17 Dec 2020 09:52:35 -0500 Received: by mail-oi1-x233.google.com with SMTP id l207so32473872oib.4 for ; Thu, 17 Dec 2020 06:52:29 -0800 (PST) Received: from localhost.localdomain (fixed-187-189-51-144.totalplay.net. [187.189.51.144]) by smtp.gmail.com with ESMTPSA id x130sm1136342oif.3.2020.12.17.06.52.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Dec 2020 06:52:25 -0800 (PST) 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:mime-version :content-transfer-encoding; bh=7SnPI3iOtS/KMHTBttflLWktP6aLMxFVVcB71yIMxy4=; b=DFJaJ2OrWrSCHvx4VQEMFDC4LZAuzBYwyRNF7fL9nkvvCH2FsmAZl0mj6TG2S4kYqx Z8wQRZMc+phQBsgbpoFJU/4tX2v/1zvki3UcWkCMpk4gPnVXFoaN5fCCl/9mHdfF7vo3 a0rJb/fTHd3zACUwvD9bkz53Z2REQvwYSJ4mjQZ+CKjUl5OzW35Db0jTaVu5cI6ab1Nh Bz9Oev9+sQ3DErMnFunqDFUe50KyRAXS1GFwQIGqx+BvXrV5ryyWe5q5l/vvA722ZjME R+8hkaOKzhciSKt1fMny5F+tbcLLySpiWqCXi6AUbONciOvKJ6adRm/msJN6jCbF7sIE 0mVQ== 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:mime-version:content-transfer-encoding; bh=7SnPI3iOtS/KMHTBttflLWktP6aLMxFVVcB71yIMxy4=; b=pIXKGDbXzx/yxboNjCW+EInnUdL5xtUc7h7POf7hRSOTEneOXfOuPgx1opbgAHGyaI k2t1SGRhE5lplvZ7mXR+VnUokXMpi8svineWbjDWrNPIUEEcT4gzAVtSEgLmxRt0RmzO 72j4XMSvQyT6Aa1KBZId+LJDNVGt8WvsgF2e/15RKTzW25wTVttkc7XS8RguKC9+UnPm jog0AIDJBP2cH32UR8ZMQElcgKcUX86+8fQsiSUWU1AgMG2KbTawdzhskDjYUTnYQ2JC D4kCy9raUhmaOhH3x/djbG4mpXcGupw0eXvt3yQJSytGjpmRVa0TBz4rwQIaTsQQB6Hv GLtQ== X-Gm-Message-State: AOAM532P9wAlS2IIqJFmvqrfeStHq5jaGOLAZUo4hc2sVq54zqqQ14NP f2G85ARqIKbVAJVEHAntrQtfieNF3v+XX7Q7 X-Google-Smtp-Source: ABdhPJwBG7zp40ujfkGsVv06KtTh2Eonxa9D5O2rE47Tj42LzhZ9Qnvi0s0y2Xrxrc8Px2SKSjJ9zA== X-Received: by 2002:aca:fc96:: with SMTP id a144mr4949769oii.146.1608216746423; Thu, 17 Dec 2020 06:52:26 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 08/23] tcg: Introduce TYPE_CONST temporaries Date: Thu, 17 Dec 2020 08:52:00 -0600 Message-Id: <20201217145215.534637-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201217145215.534637-1-richard.henderson@linaro.org> References: <20201217145215.534637-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::233; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x233.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" These will hold a single constant for the duration of the TB. They are hashed, so that each value has one temp across the TB. Not used yet, this is all infrastructure. Signed-off-by: Richard Henderson --- include/tcg/tcg.h | 24 ++++- tcg/optimize.c | 13 ++- tcg/tcg.c | 224 ++++++++++++++++++++++++++++++++++++---------- 3 files changed, 211 insertions(+), 50 deletions(-) diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index 84491b5cf0..995db20d02 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -492,6 +492,8 @@ typedef enum TCGTempKind { TEMP_GLOBAL, /* Temp is in a fixed register. */ TEMP_FIXED, + /* Temp is a fixed constant. */ + TEMP_CONST, } TCGTempKind; =20 typedef struct TCGTemp { @@ -667,6 +669,7 @@ struct TCGContext { QSIMPLEQ_HEAD(, TCGOp) plugin_ops; #endif =20 + GHashTable *const_table[TCG_TYPE_COUNT]; TCGTempSet free_temps[TCG_TYPE_COUNT * 2]; TCGTemp temps[TCG_MAX_TEMPS]; /* globals first, temps after */ =20 @@ -683,7 +686,7 @@ struct TCGContext { =20 static inline bool temp_readonly(TCGTemp *ts) { - return ts->kind =3D=3D TEMP_FIXED; + return ts->kind >=3D TEMP_FIXED; } =20 extern TCGContext tcg_init_ctx; @@ -1053,6 +1056,7 @@ TCGOp *tcg_op_insert_after(TCGContext *s, TCGOp *op, = TCGOpcode opc); =20 void tcg_optimize(TCGContext *s); =20 +/* Allocate a new temporary and initialize it with a constant. */ TCGv_i32 tcg_const_i32(int32_t val); TCGv_i64 tcg_const_i64(int64_t val); TCGv_i32 tcg_const_local_i32(int32_t val); @@ -1062,6 +1066,24 @@ TCGv_vec tcg_const_ones_vec(TCGType); TCGv_vec tcg_const_zeros_vec_matching(TCGv_vec); TCGv_vec tcg_const_ones_vec_matching(TCGv_vec); =20 +/* + * Locate or create a read-only temporary that is a constant. + * This kind of temporary need not and should not be freed. + */ +TCGTemp *tcg_constant_internal(TCGType type, int64_t val); + +static inline TCGv_i32 tcg_constant_i32(int32_t val) +{ + return temp_tcgv_i32(tcg_constant_internal(TCG_TYPE_I32, val)); +} + +static inline TCGv_i64 tcg_constant_i64(int64_t val) +{ + return temp_tcgv_i64(tcg_constant_internal(TCG_TYPE_I64, val)); +} + +TCGv_vec tcg_constant_vec(TCGType type, unsigned vece, int64_t val); + #if UINTPTR_MAX =3D=3D UINT32_MAX # define tcg_const_ptr(x) ((TCGv_ptr)tcg_const_i32((intptr_t)(x))) # define tcg_const_local_ptr(x) ((TCGv_ptr)tcg_const_local_i32((intptr_t)= (x))) diff --git a/tcg/optimize.c b/tcg/optimize.c index 33d1fc8f87..c0fd65d2e4 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -99,8 +99,17 @@ static void init_ts_info(TempOptInfo *infos, ts->state_ptr =3D ti; ti->next_copy =3D ts; ti->prev_copy =3D ts; - ti->is_const =3D false; - ti->mask =3D -1; + if (ts->kind =3D=3D TEMP_CONST) { + ti->is_const =3D true; + ti->val =3D ti->mask =3D ts->val; + if (TCG_TARGET_REG_BITS > 32 && ts->type =3D=3D TCG_TYPE_I32) { + /* High bits of a 32-bit quantity are garbage. */ + ti->mask |=3D ~0xffffffffull; + } + } else { + ti->is_const =3D false; + ti->mask =3D -1; + } set_bit(idx, temps_used->l); } } diff --git a/tcg/tcg.c b/tcg/tcg.c index 69f748082d..93f525ea3f 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -1134,6 +1134,13 @@ void tcg_func_start(TCGContext *s) /* No temps have been previously allocated for size or locality. */ memset(s->free_temps, 0, sizeof(s->free_temps)); =20 + /* No constant temps have been previously allocated. */ + for (int i =3D 0; i < TCG_TYPE_COUNT; ++i) { + if (s->const_table[i]) { + g_hash_table_remove_all(s->const_table[i]); + } + } + s->nb_ops =3D 0; s->nb_labels =3D 0; s->current_frame_offset =3D s->frame_start; @@ -1205,13 +1212,19 @@ TCGTemp *tcg_global_mem_new_internal(TCGType type, = TCGv_ptr base, bigendian =3D 1; #endif =20 - if (base_ts->kind !=3D TEMP_FIXED) { + switch (base_ts->kind) { + case TEMP_FIXED: + break; + case TEMP_GLOBAL: /* We do not support double-indirect registers. */ tcg_debug_assert(!base_ts->indirect_reg); base_ts->indirect_base =3D 1; s->nb_indirects +=3D (TCG_TARGET_REG_BITS =3D=3D 32 && type =3D=3D= TCG_TYPE_I64 ? 2 : 1); indirect_reg =3D 1; + break; + default: + g_assert_not_reached(); } =20 if (TCG_TARGET_REG_BITS =3D=3D 32 && type =3D=3D TCG_TYPE_I64) { @@ -1336,6 +1349,11 @@ void tcg_temp_free_internal(TCGTemp *ts) TCGContext *s =3D tcg_ctx; int k, idx; =20 + /* In order to simplify users of tcg_constant_*, silently ignore free.= */ + if (ts->kind =3D=3D TEMP_CONST) { + return; + } + #if defined(CONFIG_DEBUG_TCG) s->temps_in_use--; if (s->temps_in_use < 0) { @@ -1352,6 +1370,60 @@ void tcg_temp_free_internal(TCGTemp *ts) set_bit(idx, s->free_temps[k].l); } =20 +TCGTemp *tcg_constant_internal(TCGType type, int64_t val) +{ + TCGContext *s =3D tcg_ctx; + GHashTable *h =3D s->const_table[type]; + TCGTemp *ts; + + if (h =3D=3D NULL) { + h =3D g_hash_table_new(g_int64_hash, g_int64_equal); + s->const_table[type] =3D h; + } + + ts =3D g_hash_table_lookup(h, &val); + if (ts =3D=3D NULL) { + ts =3D tcg_temp_alloc(s); + + if (TCG_TARGET_REG_BITS =3D=3D 32 && type =3D=3D TCG_TYPE_I64) { + TCGTemp *ts2 =3D tcg_temp_alloc(s); + + ts->base_type =3D TCG_TYPE_I64; + ts->type =3D TCG_TYPE_I32; + ts->kind =3D TEMP_CONST; + ts->temp_allocated =3D 1; + /* + * Retain the full value of the 64-bit constant in the low + * part, so that the hash table works. Actual uses will + * truncate the value to the low part. + */ + ts->val =3D val; + + tcg_debug_assert(ts2 =3D=3D ts + 1); + ts2->base_type =3D TCG_TYPE_I64; + ts2->type =3D TCG_TYPE_I32; + ts2->kind =3D TEMP_CONST; + ts2->temp_allocated =3D 1; + ts2->val =3D val >> 32; + } else { + ts->base_type =3D type; + ts->type =3D type; + ts->kind =3D TEMP_CONST; + ts->temp_allocated =3D 1; + ts->val =3D val; + } + g_hash_table_insert(h, &ts->val, ts); + } + + return ts; +} + +TCGv_vec tcg_constant_vec(TCGType type, unsigned vece, int64_t val) +{ + val =3D dup_const(vece, val); + return temp_tcgv_vec(tcg_constant_internal(type, val)); +} + TCGv_i32 tcg_const_i32(int32_t val) { TCGv_i32 t0; @@ -1884,6 +1956,9 @@ static void tcg_reg_alloc_start(TCGContext *s) TCGTempVal val =3D TEMP_VAL_MEM; =20 switch (ts->kind) { + case TEMP_CONST: + val =3D TEMP_VAL_CONST; + break; case TEMP_FIXED: val =3D TEMP_VAL_REG; break; @@ -1920,6 +1995,26 @@ static char *tcg_get_arg_str_ptr(TCGContext *s, char= *buf, int buf_size, case TEMP_NORMAL: snprintf(buf, buf_size, "tmp%d", idx - s->nb_globals); break; + case TEMP_CONST: + switch (ts->type) { + case TCG_TYPE_I32: + snprintf(buf, buf_size, "$0x%x", (int32_t)ts->val); + break; +#if TCG_TARGET_REG_BITS > 32 + case TCG_TYPE_I64: + snprintf(buf, buf_size, "$0x%" PRIx64, ts->val); + break; +#endif + case TCG_TYPE_V64: + case TCG_TYPE_V128: + case TCG_TYPE_V256: + snprintf(buf, buf_size, "v%d$0x%" PRIx64, + 64 << (ts->type - TCG_TYPE_V64), ts->val); + break; + default: + g_assert_not_reached(); + } + break; } return buf; } @@ -2520,6 +2615,7 @@ static void la_bb_end(TCGContext *s, int ng, int nt) state =3D TS_DEAD | TS_MEM; break; case TEMP_NORMAL: + case TEMP_CONST: state =3D TS_DEAD; break; default: @@ -2554,14 +2650,24 @@ static void la_bb_sync(TCGContext *s, int ng, int n= t) la_global_sync(s, ng); =20 for (int i =3D ng; i < nt; ++i) { - if (s->temps[i].kind =3D=3D TEMP_LOCAL) { - int state =3D s->temps[i].state; - s->temps[i].state =3D state | TS_MEM; + TCGTemp *ts =3D &s->temps[i]; + int state; + + switch (ts->kind) { + case TEMP_LOCAL: + state =3D ts->state; + ts->state =3D state | TS_MEM; if (state !=3D TS_DEAD) { continue; } - } else { + break; + case TEMP_NORMAL: s->temps[i].state =3D TS_DEAD; + break; + case TEMP_CONST: + continue; + default: + g_assert_not_reached(); } la_reset_pref(&s->temps[i]); } @@ -3200,15 +3306,28 @@ static void temp_load(TCGContext *, TCGTemp *, TCGR= egSet, TCGRegSet, TCGRegSet); mark it free; otherwise mark it dead. */ static void temp_free_or_dead(TCGContext *s, TCGTemp *ts, int free_or_dead) { - if (temp_readonly(ts)) { + TCGTempVal new_type; + + switch (ts->kind) { + case TEMP_FIXED: return; + case TEMP_GLOBAL: + case TEMP_LOCAL: + new_type =3D TEMP_VAL_MEM; + break; + case TEMP_NORMAL: + new_type =3D free_or_dead < 0 ? TEMP_VAL_MEM : TEMP_VAL_DEAD; + break; + case TEMP_CONST: + new_type =3D TEMP_VAL_CONST; + break; + default: + g_assert_not_reached(); } if (ts->val_type =3D=3D TEMP_VAL_REG) { s->reg_to_temp[ts->reg] =3D NULL; } - ts->val_type =3D (free_or_dead < 0 - || ts->kind !=3D TEMP_NORMAL - ? TEMP_VAL_MEM : TEMP_VAL_DEAD); + ts->val_type =3D new_type; } =20 /* Mark a temporary as dead. */ @@ -3224,10 +3343,7 @@ static inline void temp_dead(TCGContext *s, TCGTemp = *ts) static void temp_sync(TCGContext *s, TCGTemp *ts, TCGRegSet allocated_regs, TCGRegSet preferred_regs, int free_or_dead) { - if (temp_readonly(ts)) { - return; - } - if (!ts->mem_coherent) { + if (!temp_readonly(ts) && !ts->mem_coherent) { if (!ts->mem_allocated) { temp_allocate_frame(s, ts); } @@ -3445,12 +3561,22 @@ static void tcg_reg_alloc_bb_end(TCGContext *s, TCG= RegSet allocated_regs) =20 for (i =3D s->nb_globals; i < s->nb_temps; i++) { TCGTemp *ts =3D &s->temps[i]; - if (ts->kind =3D=3D TEMP_LOCAL) { + + switch (ts->kind) { + case TEMP_LOCAL: temp_save(s, ts, allocated_regs); - } else { + break; + case TEMP_NORMAL: /* The liveness analysis already ensures that temps are dead. Keep an tcg_debug_assert for safety. */ tcg_debug_assert(ts->val_type =3D=3D TEMP_VAL_DEAD); + break; + case TEMP_CONST: + /* Similarly, we should have freed any allocated register. */ + tcg_debug_assert(ts->val_type =3D=3D TEMP_VAL_CONST); + break; + default: + g_assert_not_reached(); } } =20 @@ -3471,10 +3597,17 @@ static void tcg_reg_alloc_cbranch(TCGContext *s, TC= GRegSet allocated_regs) * The liveness analysis already ensures that temps are dead. * Keep tcg_debug_asserts for safety. */ - if (ts->kind =3D=3D TEMP_LOCAL) { + switch (ts->kind) { + case TEMP_LOCAL: tcg_debug_assert(ts->val_type !=3D TEMP_VAL_REG || ts->mem_coh= erent); - } else { + break; + case TEMP_NORMAL: tcg_debug_assert(ts->val_type =3D=3D TEMP_VAL_DEAD); + break; + case TEMP_CONST: + break; + default: + g_assert_not_reached(); } } } @@ -3765,45 +3898,42 @@ static void tcg_reg_alloc_op(TCGContext *s, const T= CGOp *op) i_preferred_regs =3D o_preferred_regs =3D 0; if (arg_ct->ialias) { o_preferred_regs =3D op->output_pref[arg_ct->alias_index]; - if (ts->kind =3D=3D TEMP_FIXED) { - /* if fixed register, we must allocate a new register - if the alias is not the same register */ - if (arg !=3D op->args[arg_ct->alias_index]) { - goto allocate_in_reg; - } - } else { - /* if the input is aliased to an output and if it is - not dead after the instruction, we must allocate - a new register and move it */ - if (!IS_DEAD_ARG(i)) { - goto allocate_in_reg; - } =20 - /* check if the current register has already been allocated - for another input aliased to an output */ - if (ts->val_type =3D=3D TEMP_VAL_REG) { - int k2, i2; - reg =3D ts->reg; - for (k2 =3D 0 ; k2 < k ; k2++) { - i2 =3D def->args_ct[nb_oargs + k2].sort_index; - if (def->args_ct[i2].ialias && reg =3D=3D new_args= [i2]) { - goto allocate_in_reg; - } + /* + * If the input is readonly, then it cannot also be an + * output and aliased to itself. If the input is not + * dead after the instruction, we must allocate a new + * register and move it. + */ + if (temp_readonly(ts) || !IS_DEAD_ARG(i)) { + goto allocate_in_reg; + } + + /* + * Check if the current register has already been allocated + * for another input aliased to an output. + */ + if (ts->val_type =3D=3D TEMP_VAL_REG) { + reg =3D ts->reg; + for (int k2 =3D 0; k2 < k; k2++) { + int i2 =3D def->args_ct[nb_oargs + k2].sort_index; + if (def->args_ct[i2].ialias && reg =3D=3D new_args[i2]= ) { + goto allocate_in_reg; } } - i_preferred_regs =3D o_preferred_regs; } + i_preferred_regs =3D o_preferred_regs; } =20 temp_load(s, ts, arg_ct->regs, i_allocated_regs, i_preferred_regs); reg =3D ts->reg; =20 - if (tcg_regset_test_reg(arg_ct->regs, reg)) { - /* nothing to do : the constraint is satisfied */ - } else { - allocate_in_reg: - /* allocate a new register matching the constraint=20 - and move the temporary register into it */ + if (!tcg_regset_test_reg(arg_ct->regs, reg)) { + allocate_in_reg: + /* + * Allocate a new register matching the constraint + * and move the temporary register into it. + */ temp_load(s, ts, tcg_target_available_regs[ts->type], i_allocated_regs, 0); reg =3D tcg_reg_alloc(s, arg_ct->regs, i_allocated_regs, --=20 2.25.1 From nobody Sat May 18 21:45:31 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1608247972; cv=none; d=zohomail.com; s=zohoarc; b=F4SHcFhYu8KjFBiOWzZGrUNiJYpeDJvxqY7CfofnK6+Z4IB0/mDprkOerilKZo0+e+greuh4DgkFQbq4MXd4XZYaU7xB/m0coLVLpxSj26+wLAi3y9TQEmE4amnCdNQ0FP9FVVPWidmS/38i6G6jAmljFzxM5I51dCsNiHFt1WQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608247972; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=x+s9W4S8X9df0AJnC/pFDE7SPPgT3/tOf2XSzgDEzSo=; b=awObaIaTJ+VwFn0hFkL6hs7ndK9WxTOtgurzy7OA2bcOc6CE2ay+iNiEh8yJxAu2gSJ6sOE208/mynmKin4pnByeQyvJUfjwybg8kXFeXTZI0FVXdz5xJ+q8NMQU9ojVocmtpevQdAhcXMwFsyXohJVuD9uZaWjUjtqF5M+Vflc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1608247972680915.4224347701279; Thu, 17 Dec 2020 15:32:52 -0800 (PST) Received: from localhost ([::1]:36706 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpuxs-0006aW-6m for importer@patchew.org; Thu, 17 Dec 2020 10:13:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33216) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpudu-0003OE-Gc for qemu-devel@nongnu.org; Thu, 17 Dec 2020 09:52:35 -0500 Received: from mail-oi1-x229.google.com ([2607:f8b0:4864:20::229]:41152) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kpudp-0004uv-Bm for qemu-devel@nongnu.org; Thu, 17 Dec 2020 09:52:34 -0500 Received: by mail-oi1-x229.google.com with SMTP id 15so32445855oix.8 for ; Thu, 17 Dec 2020 06:52:28 -0800 (PST) Received: from localhost.localdomain (fixed-187-189-51-144.totalplay.net. [187.189.51.144]) by smtp.gmail.com with ESMTPSA id x130sm1136342oif.3.2020.12.17.06.52.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Dec 2020 06:52:27 -0800 (PST) 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:mime-version :content-transfer-encoding; bh=x+s9W4S8X9df0AJnC/pFDE7SPPgT3/tOf2XSzgDEzSo=; b=Y45N7SZ/1G1wAVf4ie5dZ3ZzDQFp7nNKDtAwW0L8VeAu0tRCXRI0ojm4Y3xwTdwVZB AE1nBLiz+z6J/DnuU/WeZHo7jTlQcNIXXGE0yc35otugL8GlOz4Xv5DJ4q4eepx29wsg zzA7FfEFuqG/dFNbnCNxDfL5+WM25SOzIBzvLwfOoo+J/HndRB+jXXBr6OXwkRoJD3Ax /bOw+kgJgxV+TPgRHW8KWckuFCEDDVl2tsuh8Uva5F94Zm1iF7A0xRVTqRkkwSWguZtJ j7GSCHOpuAfZmPFWPso7o5ORgCC5OPLUl+I+Tf/oyZbR1SQbtvsLaE717WcyoypYFIDq sIVQ== 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:mime-version:content-transfer-encoding; bh=x+s9W4S8X9df0AJnC/pFDE7SPPgT3/tOf2XSzgDEzSo=; b=tt8akvsWd6uNz7vSHsQqG3vt5Ab1sBOSMmyb6j7DUG58oP5Rc1VngN6K6tIo6fbNDz 2RSvzt+6jYmpelFQmLwFPg0TDnqJ+CLqybji8WXzknWO6vjeLu68rnhacHNg7i9rHF35 3wRkz4FyL3Um/BmLfJ0HG8HyrX3ORGLi0lLaOeO6mV2lKzcGkxZl+zqaP3yK4kerVLU1 fQv2hEJeCu+avgwUdfpLaT2hDfIusVY4dYmlUyYfQV4R4mOBFyKwejqDnDHjNrZdYbAe 2iSYOMRx1jo4kobpxLXN9plBVQmekrDFZ5c7bbO2A6Vj9yIkQodmnXYszSfABDKT70FN 8BRw== X-Gm-Message-State: AOAM533rLlcxqkphfOhrgIkF30ABX/ZQxgh0i/Qv9XFRlTZ0HrZC0bJM VlWFcI1XU37CTUP74hndxN0zgu0OtPVKBw+x X-Google-Smtp-Source: ABdhPJwhNhcff5pClGvzw2epjceNe7z6/RcbsGS35vo1tsV3rvKG25mpgV+u50A4JtwmZ8rsjWtN9w== X-Received: by 2002:aca:cc01:: with SMTP id c1mr5076799oig.18.1608216747597; Thu, 17 Dec 2020 06:52:27 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 09/23] tcg/optimize: Improve find_better_copy Date: Thu, 17 Dec 2020 08:52:01 -0600 Message-Id: <20201217145215.534637-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201217145215.534637-1-richard.henderson@linaro.org> References: <20201217145215.534637-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::229; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x229.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" Prefer TEMP_CONST over anything else. Signed-off-by: Richard Henderson --- tcg/optimize.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index c0fd65d2e4..bf2c2a3ce5 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -122,31 +122,28 @@ static void init_arg_info(TempOptInfo *infos, =20 static TCGTemp *find_better_copy(TCGContext *s, TCGTemp *ts) { - TCGTemp *i; + TCGTemp *i, *g, *l; =20 - /* If this is already a global, we can't do better. */ - if (ts->kind >=3D TEMP_GLOBAL) { + /* If this is already readonly, we can't do better. */ + if (temp_readonly(ts)) { return ts; } =20 - /* Search for a global first. */ + g =3D l =3D NULL; for (i =3D ts_info(ts)->next_copy; i !=3D ts; i =3D ts_info(i)->next_c= opy) { - if (i->kind >=3D TEMP_GLOBAL) { + if (temp_readonly(i)) { return i; - } - } - - /* If it is a temp, search for a temp local. */ - if (ts->kind =3D=3D TEMP_NORMAL) { - for (i =3D ts_info(ts)->next_copy; i !=3D ts; i =3D ts_info(i)->ne= xt_copy) { - if (i->kind >=3D TEMP_LOCAL) { - return i; + } else if (i->kind > ts->kind) { + if (i->kind =3D=3D TEMP_GLOBAL) { + g =3D i; + } else if (i->kind =3D=3D TEMP_LOCAL) { + l =3D i; } } } =20 - /* Failure to find a better representation, return the same temp. */ - return ts; + /* If we didn't find a better representation, return the same temp. */ + return g ? g : l ? l : ts; } =20 static bool ts_are_copies(TCGTemp *ts1, TCGTemp *ts2) --=20 2.25.1 From nobody Sat May 18 21:45:31 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1608248419; cv=none; d=zohomail.com; s=zohoarc; b=WWDZjYry21QoBc1eZxj/OsgHwDl1Zll2vSV80655JnDoPRdxcxs1Iy2DmocrEVpZA4UJT+4LXZnmbSPXUNfrP6G8LzaZVyc8qAM+00FgAV+afwJ9VR505sCmabcsY8PwVbLW3zvaeTZLJW0XqhTeNg7DupEKGFx6aRINYtIPzys= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608248419; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=1NhNPEIDsGzd2+XZQVnWFC0k3zKAB+Awk5/hTm4NEwE=; b=YcDwDLdJKsqVWs64WhdftJXkYvMMV0pPEqiGTi4gkJ4TzD10az2/CddUmN7OuqMmh6GoOM07OPb8EmHBscG0ti6DDk17SKoHZ6CX4dHOLBiUckpxdJHcbtKajalXnNy8+i7i97eoe+meWjB+run86eVrlyvO1gX1lfAYVC5c0uQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1608248419763943.6147203459763; Thu, 17 Dec 2020 15:40:19 -0800 (PST) Received: from localhost ([::1]:54744 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpuhW-0006kI-NT for importer@patchew.org; Thu, 17 Dec 2020 09:56:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33272) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpudy-0003QO-5s for qemu-devel@nongnu.org; Thu, 17 Dec 2020 09:52:38 -0500 Received: from mail-oi1-x236.google.com ([2607:f8b0:4864:20::236]:44748) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kpudr-0004v8-Ek for qemu-devel@nongnu.org; Thu, 17 Dec 2020 09:52:37 -0500 Received: by mail-oi1-x236.google.com with SMTP id d189so32431807oig.11 for ; Thu, 17 Dec 2020 06:52:29 -0800 (PST) Received: from localhost.localdomain (fixed-187-189-51-144.totalplay.net. [187.189.51.144]) by smtp.gmail.com with ESMTPSA id x130sm1136342oif.3.2020.12.17.06.52.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Dec 2020 06:52:28 -0800 (PST) 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=1NhNPEIDsGzd2+XZQVnWFC0k3zKAB+Awk5/hTm4NEwE=; b=RBCr7+n/bBPQ15WBTjPdBzcKtFHeFj8t8I539Hk9zGHRkZDUyhoo3fGx96ltme7cVT b7wt7v1DCATNjOlKaqFp0H76k64C4pmBOQRgs1x8VMbjS0ASF3ugyUYoSsE8EsZAXlC/ oJRK+jd6bb1wO/ua2GlhcQB8NGhtrdEBxzPvejs1OgNLmBYBwSnrNk0W5+c+a5vu2UTh +UobkXw6xt2cV0cu5d+1IPFd6S9QBJOjCu1PPI2A7k2/AWVMK8jlBA103ZmQMyhZ7lHt uXzBZdzQ8CC54dILgb/TJ9XD0ec2rZmsY4FFXh9jZHtl0+HOeVQlPdfoU6fSw3mc2WLm PN9w== 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=1NhNPEIDsGzd2+XZQVnWFC0k3zKAB+Awk5/hTm4NEwE=; b=bkcUS8EvGsMW5+9rSnCnSOsKjFG95X4mtCmMf+lluuDp7lnC9x1pkbSK1IRmfhJjJy vxyXrTb4uwL0vObtFQiK/2U6nqKcfOHV5wTpx9CoFeBWv1nl/XvtIc3FzYsgFNcRpczH qs+28Pe9Ksucc7RwNnJ6Fqkw4POl9Izlg4u/W07SZAvBwMHjEMyVsHuHwDti/p6Jx6Z6 AwwL2NBPcnOsMKJI+otG81WK8v79jo6lN5L4ie8jLZfEt3tFYzQX+eTti7iVF1HF4v+P x9bimnjBmO+arrrpll/GXzW2OHjq+pwkhhoNjAq3gufC7WZYkcapbWRqc2EJ0SJ8QlZI K3Yg== X-Gm-Message-State: AOAM531GdWXhAC6aCj43ljEKDd2rQTxh7PX/rxHw2MKSAigjvz+bBuTv D389MUgP3VF8V/2ywVid2sZhp9q6brAsj+Me X-Google-Smtp-Source: ABdhPJwBQPxsK1dcr/QGLzOwfrikY4JTJuHckftlwjf/+M6IKe0NtToEOS8/BqPBfIKxT8wZKqURcw== X-Received: by 2002:aca:c30b:: with SMTP id t11mr5182693oif.61.1608216748795; Thu, 17 Dec 2020 06:52:28 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 10/23] tcg/optimize: Adjust TempOptInfo allocation Date: Thu, 17 Dec 2020 08:52:02 -0600 Message-Id: <20201217145215.534637-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201217145215.534637-1-richard.henderson@linaro.org> References: <20201217145215.534637-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::236; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x236.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Do not allocate a large block for indexing. Instead, allocate for each temporary as they are seen. In general, this will use less memory, if we consider that most TBs do not touch every target register. This also allows us to allocate TempOptInfo for new temps created during optimization. Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Richard Henderson --- tcg/optimize.c | 60 ++++++++++++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 26 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index bf2c2a3ce5..e269962932 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -89,35 +89,41 @@ static void reset_temp(TCGArg arg) } =20 /* Initialize and activate a temporary. */ -static void init_ts_info(TempOptInfo *infos, - TCGTempSet *temps_used, TCGTemp *ts) +static void init_ts_info(TCGTempSet *temps_used, TCGTemp *ts) { size_t idx =3D temp_idx(ts); - if (!test_bit(idx, temps_used->l)) { - TempOptInfo *ti =3D &infos[idx]; + TempOptInfo *ti; =20 + if (test_bit(idx, temps_used->l)) { + return; + } + set_bit(idx, temps_used->l); + + ti =3D ts->state_ptr; + if (ti =3D=3D NULL) { + ti =3D tcg_malloc(sizeof(TempOptInfo)); ts->state_ptr =3D ti; - ti->next_copy =3D ts; - ti->prev_copy =3D ts; - if (ts->kind =3D=3D TEMP_CONST) { - ti->is_const =3D true; - ti->val =3D ti->mask =3D ts->val; - if (TCG_TARGET_REG_BITS > 32 && ts->type =3D=3D TCG_TYPE_I32) { - /* High bits of a 32-bit quantity are garbage. */ - ti->mask |=3D ~0xffffffffull; - } - } else { - ti->is_const =3D false; - ti->mask =3D -1; + } + + ti->next_copy =3D ts; + ti->prev_copy =3D ts; + if (ts->kind =3D=3D TEMP_CONST) { + ti->is_const =3D true; + ti->val =3D ts->val; + ti->mask =3D ts->val; + if (TCG_TARGET_REG_BITS > 32 && ts->type =3D=3D TCG_TYPE_I32) { + /* High bits of a 32-bit quantity are garbage. */ + ti->mask |=3D ~0xffffffffull; } - set_bit(idx, temps_used->l); + } else { + ti->is_const =3D false; + ti->mask =3D -1; } } =20 -static void init_arg_info(TempOptInfo *infos, - TCGTempSet *temps_used, TCGArg arg) +static void init_arg_info(TCGTempSet *temps_used, TCGArg arg) { - init_ts_info(infos, temps_used, arg_temp(arg)); + init_ts_info(temps_used, arg_temp(arg)); } =20 static TCGTemp *find_better_copy(TCGContext *s, TCGTemp *ts) @@ -604,9 +610,8 @@ static bool swap_commutative2(TCGArg *p1, TCGArg *p2) /* Propagate constants and copies, fold constant expressions. */ void tcg_optimize(TCGContext *s) { - int nb_temps, nb_globals; + int nb_temps, nb_globals, i; TCGOp *op, *op_next, *prev_mb =3D NULL; - TempOptInfo *infos; TCGTempSet temps_used; =20 /* Array VALS has an element for each temp. @@ -616,12 +621,15 @@ void tcg_optimize(TCGContext *s) =20 nb_temps =3D s->nb_temps; nb_globals =3D s->nb_globals; + bitmap_zero(temps_used.l, nb_temps); - infos =3D tcg_malloc(sizeof(TempOptInfo) * nb_temps); + for (i =3D 0; i < nb_temps; ++i) { + s->temps[i].state_ptr =3D NULL; + } =20 QTAILQ_FOREACH_SAFE(op, &s->ops, link, op_next) { uint64_t mask, partmask, affected, tmp; - int nb_oargs, nb_iargs, i; + int nb_oargs, nb_iargs; TCGOpcode opc =3D op->opc; const TCGOpDef *def =3D &tcg_op_defs[opc]; =20 @@ -633,14 +641,14 @@ void tcg_optimize(TCGContext *s) for (i =3D 0; i < nb_oargs + nb_iargs; i++) { TCGTemp *ts =3D arg_temp(op->args[i]); if (ts) { - init_ts_info(infos, &temps_used, ts); + init_ts_info(&temps_used, ts); } } } else { nb_oargs =3D def->nb_oargs; nb_iargs =3D def->nb_iargs; for (i =3D 0; i < nb_oargs + nb_iargs; i++) { - init_arg_info(infos, &temps_used, op->args[i]); + init_arg_info(&temps_used, op->args[i]); } } =20 --=20 2.25.1 From nobody Sat May 18 21:45:31 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1608219021; cv=none; d=zohomail.com; s=zohoarc; b=OWKrnA2BnVRpZ7ZX2bW8qbFkg1X+qDYXIdr1mJ2ax9TI2N8/Y3fz9g+4ybs4VqtghHmU6Teok1mJF60ZXkk/0YxG5R75C7di0ei/PTKjFthuMlQ+t2HEeHt2k+TVUn7WsKw/NSUVoT1Tp8ShK0U8Npooz/AXR7NhZu9ce8SmM2s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608219021; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=6cqDqqpGgJpdgueLdcG6e3yOEykjqKPHvO+r5JreBA4=; b=Wo/irOamqqsQIas3hBSSI9SQj9PX0RFU451k+DpshYAGCB1Ute1l+cCYRnG3bU7g53ETpvhDOyAYlZxt5d1nsuM2Md9kcWbc75zvtUALxFEOTqPEpBv4QSV0XkFUlnz5+sLoD4RBe2JP2oqBqiTve7I9JYCiGbQZlqMH3G4o8ro= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1608219021608150.19749031136053; Thu, 17 Dec 2020 07:30:21 -0800 (PST) Received: from localhost ([::1]:35726 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpvAO-0001cX-G1 for importer@patchew.org; Thu, 17 Dec 2020 10:26:08 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33284) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpudz-0003Se-Dm for qemu-devel@nongnu.org; Thu, 17 Dec 2020 09:52:39 -0500 Received: from mail-ot1-x331.google.com ([2607:f8b0:4864:20::331]:43575) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kpudr-0004wG-Fh for qemu-devel@nongnu.org; Thu, 17 Dec 2020 09:52:39 -0500 Received: by mail-ot1-x331.google.com with SMTP id q25so27503147otn.10 for ; Thu, 17 Dec 2020 06:52:30 -0800 (PST) Received: from localhost.localdomain (fixed-187-189-51-144.totalplay.net. [187.189.51.144]) by smtp.gmail.com with ESMTPSA id x130sm1136342oif.3.2020.12.17.06.52.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Dec 2020 06:52:29 -0800 (PST) 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:mime-version :content-transfer-encoding; bh=6cqDqqpGgJpdgueLdcG6e3yOEykjqKPHvO+r5JreBA4=; b=d4K1SCVIRPsRWGjGmVz+K+KCIeqZV6Q5D+hi+kMlz0b55TbaAgxyjP5wptEz7jAMW/ Sq4FjlneUFjbwcvLnOFIK2UxuB0fLZSKXKuzQaAEVplleNnFjxJGzcRI8b8/wv6pZLb4 ztMAAkbob60VHsBBKStuGXDal0KY891J2eyzX+jipVP0xvBQBgzT+DRqzyrLBCjKg0R3 ltjrVvPY96wVDuZ/961K1iR9aae0amtvQXzHUbXSNEwcfvoat9z3pL8bySJdMqqq2/gP ALs94hTToqZ++zpkLJnhrhpTWqETl4ZSdPTHxOzk3DwElorMC5CLTI0X0JTuNFBoJEp0 DKQw== 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:mime-version:content-transfer-encoding; bh=6cqDqqpGgJpdgueLdcG6e3yOEykjqKPHvO+r5JreBA4=; b=FXihdIAWG3+Y/YueQpP/uPkQoe8OKbRroukw8TrqMQOLWzRAkZzKZjtUUR0q6oHAzl Q6ICz9r+SoRTuWmUNIeXFlIo9RT0Wd9FeY2rQkY1gZ1AXdq1yOJ03Y213BPMLIGBGPT3 3dBaknTNRiV+jGuctWgkX/sELwoaLiKiqxn5OhMPq0goTdFxWL+z0FBmhpLXJ8VcTWEV +HKqjwTogEq40IbS02EW03VplBDppbhbdchv1GQ6HSJ6EIIJlOvJu6cczOu+wUKUtPwi KELrgF4XgiCHNr9zqZ8kIPRbPlByEjWTcVSO4oUOuOvdUhFaMwcoDhIoFof0ygL8EZZY f76g== X-Gm-Message-State: AOAM532KlnMOzL5xB793SotDRrj1xhmPdF8hcP/qXos9McsEKIDcvMJH M3JvcPciYJqfp/tcXTxlGUAk2QON8vyYt6T1 X-Google-Smtp-Source: ABdhPJw6JZb6WhQOF8adyhY5DIQM3Fmjq9Yd7tow5V11exWXYSYOphEYwAOAiT6VZDBUS4kPyc8eHw== X-Received: by 2002:a9d:62d7:: with SMTP id z23mr23971262otk.353.1608216749782; Thu, 17 Dec 2020 06:52:29 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 11/23] tcg/optimize: Use tcg_constant_internal with constant folding Date: Thu, 17 Dec 2020 08:52:03 -0600 Message-Id: <20201217145215.534637-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201217145215.534637-1-richard.henderson@linaro.org> References: <20201217145215.534637-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::331; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x331.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson --- tcg/optimize.c | 108 ++++++++++++++++++++++--------------------------- 1 file changed, 49 insertions(+), 59 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index e269962932..1eda7dc419 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -178,37 +178,6 @@ static bool args_are_copies(TCGArg arg1, TCGArg arg2) return ts_are_copies(arg_temp(arg1), arg_temp(arg2)); } =20 -static void tcg_opt_gen_movi(TCGContext *s, TCGOp *op, TCGArg dst, uint64_= t val) -{ - const TCGOpDef *def; - TCGOpcode new_op; - uint64_t mask; - TempOptInfo *di =3D arg_info(dst); - - def =3D &tcg_op_defs[op->opc]; - if (def->flags & TCG_OPF_VECTOR) { - new_op =3D INDEX_op_dupi_vec; - } else if (def->flags & TCG_OPF_64BIT) { - new_op =3D INDEX_op_movi_i64; - } else { - new_op =3D INDEX_op_movi_i32; - } - op->opc =3D new_op; - /* TCGOP_VECL and TCGOP_VECE remain unchanged. */ - op->args[0] =3D dst; - op->args[1] =3D val; - - reset_temp(dst); - di->is_const =3D true; - di->val =3D val; - mask =3D val; - if (TCG_TARGET_REG_BITS > 32 && new_op =3D=3D INDEX_op_movi_i32) { - /* High bits of the destination are now garbage. */ - mask |=3D ~0xffffffffull; - } - di->mask =3D mask; -} - static void tcg_opt_gen_mov(TCGContext *s, TCGOp *op, TCGArg dst, TCGArg s= rc) { TCGTemp *dst_ts =3D arg_temp(dst); @@ -259,6 +228,27 @@ static void tcg_opt_gen_mov(TCGContext *s, TCGOp *op, = TCGArg dst, TCGArg src) } } =20 +static void tcg_opt_gen_movi(TCGContext *s, TCGTempSet *temps_used, + TCGOp *op, TCGArg dst, uint64_t val) +{ + const TCGOpDef *def =3D &tcg_op_defs[op->opc]; + TCGType type; + TCGTemp *tv; + + if (def->flags & TCG_OPF_VECTOR) { + type =3D TCGOP_VECL(op) + TCG_TYPE_V64; + } else if (def->flags & TCG_OPF_64BIT) { + type =3D TCG_TYPE_I64; + } else { + type =3D TCG_TYPE_I32; + } + + /* Convert movi to mov with constant temp. */ + tv =3D tcg_constant_internal(type, val); + init_ts_info(temps_used, tv); + tcg_opt_gen_mov(s, op, dst, temp_arg(tv)); +} + static uint64_t do_constant_folding_2(TCGOpcode op, uint64_t x, uint64_t y) { uint64_t l64, h64; @@ -622,7 +612,7 @@ void tcg_optimize(TCGContext *s) nb_temps =3D s->nb_temps; nb_globals =3D s->nb_globals; =20 - bitmap_zero(temps_used.l, nb_temps); + memset(&temps_used, 0, sizeof(temps_used)); for (i =3D 0; i < nb_temps; ++i) { s->temps[i].state_ptr =3D NULL; } @@ -727,7 +717,7 @@ void tcg_optimize(TCGContext *s) CASE_OP_32_64(rotr): if (arg_is_const(op->args[1]) && arg_info(op->args[1])->val =3D=3D 0) { - tcg_opt_gen_movi(s, op, op->args[0], 0); + tcg_opt_gen_movi(s, &temps_used, op, op->args[0], 0); continue; } break; @@ -1050,7 +1040,7 @@ void tcg_optimize(TCGContext *s) =20 if (partmask =3D=3D 0) { tcg_debug_assert(nb_oargs =3D=3D 1); - tcg_opt_gen_movi(s, op, op->args[0], 0); + tcg_opt_gen_movi(s, &temps_used, op, op->args[0], 0); continue; } if (affected =3D=3D 0) { @@ -1067,7 +1057,7 @@ void tcg_optimize(TCGContext *s) CASE_OP_32_64(mulsh): if (arg_is_const(op->args[2]) && arg_info(op->args[2])->val =3D=3D 0) { - tcg_opt_gen_movi(s, op, op->args[0], 0); + tcg_opt_gen_movi(s, &temps_used, op, op->args[0], 0); continue; } break; @@ -1094,7 +1084,7 @@ void tcg_optimize(TCGContext *s) CASE_OP_32_64_VEC(sub): CASE_OP_32_64_VEC(xor): if (args_are_copies(op->args[1], op->args[2])) { - tcg_opt_gen_movi(s, op, op->args[0], 0); + tcg_opt_gen_movi(s, &temps_used, op, op->args[0], 0); continue; } break; @@ -1111,14 +1101,14 @@ void tcg_optimize(TCGContext *s) break; CASE_OP_32_64(movi): case INDEX_op_dupi_vec: - tcg_opt_gen_movi(s, op, op->args[0], op->args[1]); + tcg_opt_gen_movi(s, &temps_used, op, op->args[0], op->args[1]); break; =20 case INDEX_op_dup_vec: if (arg_is_const(op->args[1])) { tmp =3D arg_info(op->args[1])->val; tmp =3D dup_const(TCGOP_VECE(op), tmp); - tcg_opt_gen_movi(s, op, op->args[0], tmp); + tcg_opt_gen_movi(s, &temps_used, op, op->args[0], tmp); break; } goto do_default; @@ -1128,7 +1118,7 @@ void tcg_optimize(TCGContext *s) if (arg_is_const(op->args[1]) && arg_is_const(op->args[2])) { tmp =3D arg_info(op->args[1])->val; if (tmp =3D=3D arg_info(op->args[2])->val) { - tcg_opt_gen_movi(s, op, op->args[0], tmp); + tcg_opt_gen_movi(s, &temps_used, op, op->args[0], tmp); break; } } else if (args_are_copies(op->args[1], op->args[2])) { @@ -1156,7 +1146,7 @@ void tcg_optimize(TCGContext *s) case INDEX_op_extrh_i64_i32: if (arg_is_const(op->args[1])) { tmp =3D do_constant_folding(opc, arg_info(op->args[1])->va= l, 0); - tcg_opt_gen_movi(s, op, op->args[0], tmp); + tcg_opt_gen_movi(s, &temps_used, op, op->args[0], tmp); break; } goto do_default; @@ -1186,7 +1176,7 @@ void tcg_optimize(TCGContext *s) if (arg_is_const(op->args[1]) && arg_is_const(op->args[2])) { tmp =3D do_constant_folding(opc, arg_info(op->args[1])->va= l, arg_info(op->args[2])->val); - tcg_opt_gen_movi(s, op, op->args[0], tmp); + tcg_opt_gen_movi(s, &temps_used, op, op->args[0], tmp); break; } goto do_default; @@ -1197,7 +1187,7 @@ void tcg_optimize(TCGContext *s) TCGArg v =3D arg_info(op->args[1])->val; if (v !=3D 0) { tmp =3D do_constant_folding(opc, v, 0); - tcg_opt_gen_movi(s, op, op->args[0], tmp); + tcg_opt_gen_movi(s, &temps_used, op, op->args[0], tmp); } else { tcg_opt_gen_mov(s, op, op->args[0], op->args[2]); } @@ -1210,7 +1200,7 @@ void tcg_optimize(TCGContext *s) tmp =3D deposit64(arg_info(op->args[1])->val, op->args[3], op->args[4], arg_info(op->args[2])->val); - tcg_opt_gen_movi(s, op, op->args[0], tmp); + tcg_opt_gen_movi(s, &temps_used, op, op->args[0], tmp); break; } goto do_default; @@ -1219,7 +1209,7 @@ void tcg_optimize(TCGContext *s) if (arg_is_const(op->args[1])) { tmp =3D extract64(arg_info(op->args[1])->val, op->args[2], op->args[3]); - tcg_opt_gen_movi(s, op, op->args[0], tmp); + tcg_opt_gen_movi(s, &temps_used, op, op->args[0], tmp); break; } goto do_default; @@ -1228,7 +1218,7 @@ void tcg_optimize(TCGContext *s) if (arg_is_const(op->args[1])) { tmp =3D sextract64(arg_info(op->args[1])->val, op->args[2], op->args[3]); - tcg_opt_gen_movi(s, op, op->args[0], tmp); + tcg_opt_gen_movi(s, &temps_used, op, op->args[0], tmp); break; } goto do_default; @@ -1245,7 +1235,7 @@ void tcg_optimize(TCGContext *s) tmp =3D (int32_t)(((uint32_t)v1 >> shr) | ((uint32_t)v2 << (32 - shr))); } - tcg_opt_gen_movi(s, op, op->args[0], tmp); + tcg_opt_gen_movi(s, &temps_used, op, op->args[0], tmp); break; } goto do_default; @@ -1254,7 +1244,7 @@ void tcg_optimize(TCGContext *s) tmp =3D do_constant_folding_cond(opc, op->args[1], op->args[2], op->args[3]); if (tmp !=3D 2) { - tcg_opt_gen_movi(s, op, op->args[0], tmp); + tcg_opt_gen_movi(s, &temps_used, op, op->args[0], tmp); break; } goto do_default; @@ -1264,7 +1254,7 @@ void tcg_optimize(TCGContext *s) op->args[1], op->args[2]); if (tmp !=3D 2) { if (tmp) { - bitmap_zero(temps_used.l, nb_temps); + memset(&temps_used, 0, sizeof(temps_used)); op->opc =3D INDEX_op_br; op->args[0] =3D op->args[3]; } else { @@ -1310,7 +1300,7 @@ void tcg_optimize(TCGContext *s) uint64_t a =3D ((uint64_t)ah << 32) | al; uint64_t b =3D ((uint64_t)bh << 32) | bl; TCGArg rl, rh; - TCGOp *op2 =3D tcg_op_insert_before(s, op, INDEX_op_movi_i= 32); + TCGOp *op2 =3D tcg_op_insert_before(s, op, INDEX_op_mov_i3= 2); =20 if (opc =3D=3D INDEX_op_add2_i32) { a +=3D b; @@ -1320,8 +1310,8 @@ void tcg_optimize(TCGContext *s) =20 rl =3D op->args[0]; rh =3D op->args[1]; - tcg_opt_gen_movi(s, op, rl, (int32_t)a); - tcg_opt_gen_movi(s, op2, rh, (int32_t)(a >> 32)); + tcg_opt_gen_movi(s, &temps_used, op, rl, (int32_t)a); + tcg_opt_gen_movi(s, &temps_used, op2, rh, (int32_t)(a >> 3= 2)); break; } goto do_default; @@ -1332,12 +1322,12 @@ void tcg_optimize(TCGContext *s) uint32_t b =3D arg_info(op->args[3])->val; uint64_t r =3D (uint64_t)a * b; TCGArg rl, rh; - TCGOp *op2 =3D tcg_op_insert_before(s, op, INDEX_op_movi_i= 32); + TCGOp *op2 =3D tcg_op_insert_before(s, op, INDEX_op_mov_i3= 2); =20 rl =3D op->args[0]; rh =3D op->args[1]; - tcg_opt_gen_movi(s, op, rl, (int32_t)r); - tcg_opt_gen_movi(s, op2, rh, (int32_t)(r >> 32)); + tcg_opt_gen_movi(s, &temps_used, op, rl, (int32_t)r); + tcg_opt_gen_movi(s, &temps_used, op2, rh, (int32_t)(r >> 3= 2)); break; } goto do_default; @@ -1348,7 +1338,7 @@ void tcg_optimize(TCGContext *s) if (tmp !=3D 2) { if (tmp) { do_brcond_true: - bitmap_zero(temps_used.l, nb_temps); + memset(&temps_used, 0, sizeof(temps_used)); op->opc =3D INDEX_op_br; op->args[0] =3D op->args[5]; } else { @@ -1364,7 +1354,7 @@ void tcg_optimize(TCGContext *s) /* Simplify LT/GE comparisons vs zero to a single compare vs the high word of the input. */ do_brcond_high: - bitmap_zero(temps_used.l, nb_temps); + memset(&temps_used, 0, sizeof(temps_used)); op->opc =3D INDEX_op_brcond_i32; op->args[0] =3D op->args[1]; op->args[1] =3D op->args[3]; @@ -1390,7 +1380,7 @@ void tcg_optimize(TCGContext *s) goto do_default; } do_brcond_low: - bitmap_zero(temps_used.l, nb_temps); + memset(&temps_used, 0, sizeof(temps_used)); op->opc =3D INDEX_op_brcond_i32; op->args[1] =3D op->args[2]; op->args[2] =3D op->args[4]; @@ -1425,7 +1415,7 @@ void tcg_optimize(TCGContext *s) op->args[5]); if (tmp !=3D 2) { do_setcond_const: - tcg_opt_gen_movi(s, op, op->args[0], tmp); + tcg_opt_gen_movi(s, &temps_used, op, op->args[0], tmp); } else if ((op->args[5] =3D=3D TCG_COND_LT || op->args[5] =3D=3D TCG_COND_GE) && arg_is_const(op->args[3]) @@ -1510,7 +1500,7 @@ void tcg_optimize(TCGContext *s) block, otherwise we only trash the output args. "mask" is the non-zero bits mask for the first output arg. */ if (def->flags & TCG_OPF_BB_END) { - bitmap_zero(temps_used.l, nb_temps); + memset(&temps_used, 0, sizeof(temps_used)); } else { do_reset_output: for (i =3D 0; i < nb_oargs; i++) { --=20 2.25.1 From nobody Sat May 18 21:45:31 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1608233396; cv=none; d=zohomail.com; s=zohoarc; b=iURXpCLRKfxhDQshYw9qYdDodSRAwAvXvFXi8T5XEPCOSrzWt9mEW9Utn8O/toid5TuxQz8zct78PM9Q+QNsT7ApuerbVnz8EX5H9R7whMtIRMN/E59icNLRREOajLmP52i5Z0B69jNpJ6IQHriWwbSgPB3qKpOBxj2y1z1uMy0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608233396; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=v7Fq+nWbx6XhMoBO6EO91HUGM4GfBbdLJgZ/TQ6xfhk=; b=ZZZB03a/yXdfJcBnAEvuCt2JnLZpxKlIxSCG70p6ym94FF4x0+RiVl1vRg4+4XLYFQ0uWSJVp1Cws93DWu9Dly6pHFYmFqhafAb7GdvteRoZshpI7jQZoMfJp+sh89jLEG7KkFElQIb/NCso/jZ0vtKtLpocK6pFbE3gmNCCseM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1608233396809976.5429227958476; Thu, 17 Dec 2020 11:29:56 -0800 (PST) Received: from localhost ([::1]:51816 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpug9-0005Xc-LV for importer@patchew.org; Thu, 17 Dec 2020 09:54:53 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33276) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpudz-0003RV-L4 for qemu-devel@nongnu.org; Thu, 17 Dec 2020 09:52:39 -0500 Received: from mail-oi1-x231.google.com ([2607:f8b0:4864:20::231]:37640) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kpuds-0004wP-Th for qemu-devel@nongnu.org; Thu, 17 Dec 2020 09:52:38 -0500 Received: by mail-oi1-x231.google.com with SMTP id l207so32474108oib.4 for ; Thu, 17 Dec 2020 06:52:31 -0800 (PST) Received: from localhost.localdomain (fixed-187-189-51-144.totalplay.net. [187.189.51.144]) by smtp.gmail.com with ESMTPSA id x130sm1136342oif.3.2020.12.17.06.52.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Dec 2020 06:52:30 -0800 (PST) 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:mime-version :content-transfer-encoding; bh=v7Fq+nWbx6XhMoBO6EO91HUGM4GfBbdLJgZ/TQ6xfhk=; b=O/YZcRp7EhJ/7EowOEtsTqHHpu/94I6+ukBCy84SXmQDhYJzKvCSPONrGMt0vkayRM FVkZJLrQHpBml4IS7o1JKTSxhN+00LIdBCDOyJ9oFFQGas15ucjEB9+0vHYkIT50sL3E wS4dbMms3uQSMlXW+5jXkGBZRwWU54gtP+q6V1ycpxlE1UYidV9iCyMhRhOtjHCHdG54 t5DfQJkACmgB6gc3HSPV/kVFG8bYCmE4HcPBcT1QkAs6kfTDQNdBE3ykACJ0gLTZXCB3 IWDUYXRUdgpRA5D5jvly60wsOasjqVfpeO3L8e9p6SBtQtq1Un/afuCP2KcAXzMpirwC pxUg== 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:mime-version:content-transfer-encoding; bh=v7Fq+nWbx6XhMoBO6EO91HUGM4GfBbdLJgZ/TQ6xfhk=; b=Xjes/ueeFnmrpU3wlbNTf/U9Hh0l8KiVen0sw2ZJjw6BheZKUIPG2t0Qn/KpWKFFhF dMd1BEcTA3WHxCshdwLo7QS8pHfobG+KpjEJzEB9nxgl3fqqcQ75Pti1f7dFU15fncgd WyT6torL8qmmQs8CNf+Cluf1YbKuAyW08J0Q9ZjG17yFHkF4luoRScsXekMs62Po9QVS thf79ucUAtRqPNgJRxENd8S+HAHRtYCxPF2KOLaZPiOLlcjm2CIBsGWHflFUylyZ6Meu dQe/DVR9PofL2sWG8VulC6JmpR+mzpzGyiwgo72cOBbV3RP0qvliV+0tvtrmPJCjOH+J tEXA== X-Gm-Message-State: AOAM533yMkDSBWEbTWRQvtXia9h9MhehyWIrIzbNzdFBoLkH559zZmUX 9LRURDS50TW7Pwfqd8mQvMxvYnnL1Y+SyOdz X-Google-Smtp-Source: ABdhPJwatRudaJf1CpWF7eSteq3My3fgup8XET400hWsXsRVCseibpV3DGEGx+Z1L8uXcLcGSuj9zg== X-Received: by 2002:a05:6808:49a:: with SMTP id z26mr4873555oid.137.1608216750898; Thu, 17 Dec 2020 06:52:30 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 12/23] tcg: Convert tcg_gen_dupi_vec to TCG_CONST Date: Thu, 17 Dec 2020 08:52:04 -0600 Message-Id: <20201217145215.534637-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201217145215.534637-1-richard.henderson@linaro.org> References: <20201217145215.534637-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::231; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x231.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" Because we now store uint64_t in TCGTemp, we can now always store the full 64-bit duplicate immediate. So remove the difference between 32- and 64-bit hosts. Signed-off-by: Richard Henderson --- tcg/optimize.c | 9 ++++----- tcg/tcg-op-vec.c | 39 ++++++++++----------------------------- tcg/tcg.c | 7 +------ 3 files changed, 15 insertions(+), 40 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index 1eda7dc419..af07c6f628 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -1116,11 +1116,10 @@ void tcg_optimize(TCGContext *s) case INDEX_op_dup2_vec: assert(TCG_TARGET_REG_BITS =3D=3D 32); if (arg_is_const(op->args[1]) && arg_is_const(op->args[2])) { - tmp =3D arg_info(op->args[1])->val; - if (tmp =3D=3D arg_info(op->args[2])->val) { - tcg_opt_gen_movi(s, &temps_used, op, op->args[0], tmp); - break; - } + tcg_opt_gen_movi(s, &temps_used, op, op->args[0], + deposit64(arg_info(op->args[1])->val, 32,= 32, + arg_info(op->args[2])->val)); + break; } else if (args_are_copies(op->args[1], op->args[2])) { op->opc =3D INDEX_op_dup_vec; TCGOP_VECE(op) =3D MO_32; diff --git a/tcg/tcg-op-vec.c b/tcg/tcg-op-vec.c index cdbf11c573..9fbed1366c 100644 --- a/tcg/tcg-op-vec.c +++ b/tcg/tcg-op-vec.c @@ -216,25 +216,17 @@ void tcg_gen_mov_vec(TCGv_vec r, TCGv_vec a) } } =20 -#define MO_REG (TCG_TARGET_REG_BITS =3D=3D 64 ? MO_64 : MO_32) - -static void do_dupi_vec(TCGv_vec r, unsigned vece, TCGArg a) -{ - TCGTemp *rt =3D tcgv_vec_temp(r); - vec_gen_2(INDEX_op_dupi_vec, rt->base_type, vece, temp_arg(rt), a); -} - TCGv_vec tcg_const_zeros_vec(TCGType type) { TCGv_vec ret =3D tcg_temp_new_vec(type); - do_dupi_vec(ret, MO_REG, 0); + tcg_gen_dupi_vec(MO_64, ret, 0); return ret; } =20 TCGv_vec tcg_const_ones_vec(TCGType type) { TCGv_vec ret =3D tcg_temp_new_vec(type); - do_dupi_vec(ret, MO_REG, -1); + tcg_gen_dupi_vec(MO_64, ret, -1); return ret; } =20 @@ -252,39 +244,28 @@ TCGv_vec tcg_const_ones_vec_matching(TCGv_vec m) =20 void tcg_gen_dup64i_vec(TCGv_vec r, uint64_t a) { - if (TCG_TARGET_REG_BITS =3D=3D 64) { - do_dupi_vec(r, MO_64, a); - } else if (a =3D=3D dup_const(MO_32, a)) { - do_dupi_vec(r, MO_32, a); - } else { - TCGv_i64 c =3D tcg_const_i64(a); - tcg_gen_dup_i64_vec(MO_64, r, c); - tcg_temp_free_i64(c); - } + tcg_gen_dupi_vec(MO_64, r, a); } =20 void tcg_gen_dup32i_vec(TCGv_vec r, uint32_t a) { - do_dupi_vec(r, MO_REG, dup_const(MO_32, a)); + tcg_gen_dupi_vec(MO_32, r, a); } =20 void tcg_gen_dup16i_vec(TCGv_vec r, uint32_t a) { - do_dupi_vec(r, MO_REG, dup_const(MO_16, a)); + tcg_gen_dupi_vec(MO_16, r, a); } =20 void tcg_gen_dup8i_vec(TCGv_vec r, uint32_t a) { - do_dupi_vec(r, MO_REG, dup_const(MO_8, a)); + tcg_gen_dupi_vec(MO_8, r, a); } =20 void tcg_gen_dupi_vec(unsigned vece, TCGv_vec r, uint64_t a) { - if (vece =3D=3D MO_64) { - tcg_gen_dup64i_vec(r, a); - } else { - do_dupi_vec(r, MO_REG, dup_const(vece, a)); - } + TCGTemp *rt =3D tcgv_vec_temp(r); + tcg_gen_mov_vec(r, tcg_constant_vec(rt->base_type, vece, a)); } =20 void tcg_gen_dup_i64_vec(unsigned vece, TCGv_vec r, TCGv_i64 a) @@ -489,8 +470,8 @@ void tcg_gen_abs_vec(unsigned vece, TCGv_vec r, TCGv_ve= c a) if (tcg_can_emit_vec_op(INDEX_op_sari_vec, type, vece) > 0) { tcg_gen_sari_vec(vece, t, a, (8 << vece) - 1); } else { - do_dupi_vec(t, MO_REG, 0); - tcg_gen_cmp_vec(TCG_COND_LT, vece, t, a, t); + tcg_gen_cmp_vec(TCG_COND_LT, vece, t, a, + tcg_constant_vec(type, vece, 0)); } tcg_gen_xor_vec(vece, r, a, t); tcg_gen_sub_vec(vece, r, r, t); diff --git a/tcg/tcg.c b/tcg/tcg.c index 93f525ea3f..500663e3f5 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -3485,16 +3485,11 @@ static void temp_load(TCGContext *s, TCGTemp *ts, T= CGRegSet desired_regs, * The targets will, in general, have to do this search anyway, * do this generically. */ - if (TCG_TARGET_REG_BITS =3D=3D 32) { - val =3D dup_const(MO_32, val); - vece =3D MO_32; - } if (val =3D=3D dup_const(MO_8, val)) { vece =3D MO_8; } else if (val =3D=3D dup_const(MO_16, val)) { vece =3D MO_16; - } else if (TCG_TARGET_REG_BITS =3D=3D 64 && - val =3D=3D dup_const(MO_32, val)) { + } else if (val =3D=3D dup_const(MO_32, val)) { vece =3D MO_32; } =20 --=20 2.25.1 From nobody Sat May 18 21:45:31 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1608248976; cv=none; d=zohomail.com; s=zohoarc; b=jZ0TFtdnPYKmPqbjCaKM7c0hf9aHV82eUTghhT4AMqw2n3sJSAXlHbCcIicWfc00X0SjpQ9dFYS92IxcJxLrde6d8hoCZ1vI4SxC4kqw4chFa9GYBmJZrTy4uW+G5AnL3+3Iqg0yfsHZloR2mrsASMXZFdtc0M8dbCerN+0W25Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608248976; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=mEMZJyAsz2pya7wCS7q3Y/mkN8EK0RWNbiEA9tVJa2o=; b=BtB3JI7OOMAX2iT0nF9ubbdNL286qvQSsrQ/zoK6LkA4S2ldzE1osAUGN3yu/8CMAmq5q6RGe+QPd+hdZMnX55Bir1EHC+fUTdlr85GWE8CUef8CDcAZp72x2lbhE9JgH+4wBd5HhOEy2bFjVqo3kDncwW0iT9oIEpjLmPu79Bk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1608248976245225.00495326382622; Thu, 17 Dec 2020 15:49:36 -0800 (PST) Received: from localhost ([::1]:58070 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpv80-0007dx-JC for importer@patchew.org; Thu, 17 Dec 2020 10:23:40 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33280) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpudz-0003S8-3d for qemu-devel@nongnu.org; Thu, 17 Dec 2020 09:52:39 -0500 Received: from mail-ot1-x333.google.com ([2607:f8b0:4864:20::333]:43577) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kpudt-0004wg-Jo for qemu-devel@nongnu.org; Thu, 17 Dec 2020 09:52:38 -0500 Received: by mail-ot1-x333.google.com with SMTP id q25so27503307otn.10 for ; Thu, 17 Dec 2020 06:52:32 -0800 (PST) Received: from localhost.localdomain (fixed-187-189-51-144.totalplay.net. [187.189.51.144]) by smtp.gmail.com with ESMTPSA id x130sm1136342oif.3.2020.12.17.06.52.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Dec 2020 06:52:31 -0800 (PST) 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=mEMZJyAsz2pya7wCS7q3Y/mkN8EK0RWNbiEA9tVJa2o=; b=F3hKtjarjpOgpXvZMHtUf7sH9kJr40iQ0RjZZB020BlvSk7V/48+y+2jKXH83T4T0Q vbKDfXtbUJxlzQuJjLz4Jq1LLtSVuDJpo6wofffSUVvf1V6XSGmCFOJriNFek5qzLdsJ dRHb7aHt2VHPIxjJ2WpAV60ThVrD+Njv5wXBfGCbpH3Fr2hjYtuPERA3GbxwvFzFJyXh 6BjLaNEXoSugHsc1kBnYXkf6ewv0z5ZYUF20/BZ7Yw9E8uvktPOqYmAltyaPK3mFbFgv 7+On+Pc6CEFEEIpSCjLoQ/VY9YjrsWH3huC/TvDHY58Yil1w+8fgsEJ1bVz0d6CDTBmQ Xr9Q== 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=mEMZJyAsz2pya7wCS7q3Y/mkN8EK0RWNbiEA9tVJa2o=; b=P54NAfyJ2BtawCK7G5Y0A15oem6ovJOkaYzY+z7qyutNx1r+YTatbFwWnSdrtgpe4w 8EhL6DWghD9yjhSwjsfN5iBXruns7/BIk6nfNF+xbewMg2W0+iGn7BU+XkLNQkPOFufA DA2zJuN3s91mK4MhL1Gu3l3gLazsk8mxUdbaHQ3zoRc8J7pcwu6Zw47TO9wcf5IE1iDr MMiRuFC6pZd2g35mCz/+4ZRTo9HaqGrvaUQDMW0B3d87qkbB0vKTsEUt1hy504mk2QjX +W0MGdCZHr6GG0pGtLFgrjWLVS67SK14womJkSy/vUHTIUPchHd6MmhWWiqoQDqatSwu Gb6Q== X-Gm-Message-State: AOAM530IeSFNJJMdr2uLq1eIqZbFW7TdcTD3G1F2i/SJBmjwkAWhVsL5 CVLZn4TUBlJXbLOamrZ3QV61GtXy8CjQ7fc6 X-Google-Smtp-Source: ABdhPJxNgOat/C5wgfbI1UdHO4hF5njXk6pQL+Y+qshUeVY7kFMHlRNYu3fmYHidrXZ1M7kHou6VQg== X-Received: by 2002:a9d:32c4:: with SMTP id u62mr27671564otb.63.1608216751962; Thu, 17 Dec 2020 06:52:31 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 13/23] tcg: Use tcg_constant_i32 with icount expander Date: Thu, 17 Dec 2020 08:52:05 -0600 Message-Id: <20201217145215.534637-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201217145215.534637-1-richard.henderson@linaro.org> References: <20201217145215.534637-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::333; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x333.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) We must do this before we adjust tcg_out_movi_i32, lest the under-the-hood poking that we do for icount be broken. Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Richard Henderson --- include/exec/gen-icount.h | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/include/exec/gen-icount.h b/include/exec/gen-icount.h index 822c43cfd3..404732518a 100644 --- a/include/exec/gen-icount.h +++ b/include/exec/gen-icount.h @@ -34,7 +34,7 @@ static inline void gen_io_end(void) =20 static inline void gen_tb_start(TranslationBlock *tb) { - TCGv_i32 count, imm; + TCGv_i32 count; =20 tcg_ctx->exitreq_label =3D gen_new_label(); if (tb_cflags(tb) & CF_USE_ICOUNT) { @@ -48,15 +48,13 @@ static inline void gen_tb_start(TranslationBlock *tb) offsetof(ArchCPU, env)); =20 if (tb_cflags(tb) & CF_USE_ICOUNT) { - imm =3D tcg_temp_new_i32(); - /* We emit a movi with a dummy immediate argument. Keep the insn i= ndex - * of the movi so that we later (when we know the actual insn coun= t) - * can update the immediate argument with the actual insn count. = */ - tcg_gen_movi_i32(imm, 0xdeadbeef); + /* + * We emit a sub with a dummy immediate argument. Keep the insn in= dex + * of the sub so that we later (when we know the actual insn count) + * can update the argument with the actual insn count. + */ + tcg_gen_sub_i32(count, count, tcg_constant_i32(0)); icount_start_insn =3D tcg_last_op(); - - tcg_gen_sub_i32(count, count, imm); - tcg_temp_free_i32(imm); } =20 tcg_gen_brcondi_i32(TCG_COND_LT, count, 0, tcg_ctx->exitreq_label); @@ -74,9 +72,12 @@ static inline void gen_tb_start(TranslationBlock *tb) static inline void gen_tb_end(TranslationBlock *tb, int num_insns) { if (tb_cflags(tb) & CF_USE_ICOUNT) { - /* Update the num_insn immediate parameter now that we know - * the actual insn count. */ - tcg_set_insn_param(icount_start_insn, 1, num_insns); + /* + * Update the num_insn immediate parameter now that we know + * the actual insn count. + */ + tcg_set_insn_param(icount_start_insn, 2, + tcgv_i32_arg(tcg_constant_i32(num_insns))); } =20 gen_set_label(tcg_ctx->exitreq_label); --=20 2.25.1 From nobody Sat May 18 21:45:31 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1608248244; cv=none; d=zohomail.com; s=zohoarc; b=hOfWZGEUfWV7+LDP4etXtXnfhUbN75BRFPg6I50lwRdSVCSDOdwPTzBVcEjcgrlJGV4BHkcWoBo1Gv8dt2CR40Voqz0T8ESy3Dalocy2cU5/oGFT5+yUmfzkQrUq+ODlw9c+YbsVLzfoUF1RcUBNe76ZEK/z3gvWkAEKBwlpJVc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608248244; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=aEQok0/L5FX5jAQIApgNcuA+gqvYfIDMod+uDV+LrZA=; b=Awxgz6I5vDwDYmF53YkphYGNtrd3YK9vpxsJIIIcryzBIAwuurB0R7bc6xta1zURcP8+yFSKhiYqxUUi7qD5ZIDcffqEXiMAG1YzbJLWS8ex6yhptPRQl6D5j5KjyQsvwA9FvfwXTV5Iw5wdJB0A4WYnVQ62uWw0qlsFj7XX55A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1608248244144683.9834279426327; Thu, 17 Dec 2020 15:37:24 -0800 (PST) Received: from localhost ([::1]:56282 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpuu5-0002s4-SS for importer@patchew.org; Thu, 17 Dec 2020 10:09:17 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33308) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpue0-0003Ud-Qi for qemu-devel@nongnu.org; Thu, 17 Dec 2020 09:52:40 -0500 Received: from mail-ot1-x32f.google.com ([2607:f8b0:4864:20::32f]:44498) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kpudu-0004x2-Uh for qemu-devel@nongnu.org; Thu, 17 Dec 2020 09:52:40 -0500 Received: by mail-ot1-x32f.google.com with SMTP id f16so27476814otl.11 for ; Thu, 17 Dec 2020 06:52:34 -0800 (PST) Received: from localhost.localdomain (fixed-187-189-51-144.totalplay.net. [187.189.51.144]) by smtp.gmail.com with ESMTPSA id x130sm1136342oif.3.2020.12.17.06.52.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Dec 2020 06:52:32 -0800 (PST) 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:mime-version :content-transfer-encoding; bh=aEQok0/L5FX5jAQIApgNcuA+gqvYfIDMod+uDV+LrZA=; b=M0/zEyDMPIqR/5PP88yWRmRfBiH5+UoLRD50jjHf9rbGbqnIU6Qj6133XmCfSMqHo0 HvwcI+D76kQb0afSIohuF/ezI1D8QFOjrzwLRjNb77D8s9g3/YcVkQxSO8c8JZRrhq+o o9pN8nlbWXTGJH7fFipEX+HJDLQKGl5QlalUm61XiDV9xE3oTEL7/JRd1/5950omdsrz 0H9cDRW/NE5RUdQ0vJbFfhQ7O6VgGnzUnz594eajir3CqQIXdQwh0ttLpPbb0HV2nCMW YvzG5jliaAsKH9NPMWGpnijPLtajX4WyLEgOPsy39eyr9rcDJx5uy9/8L/J/8S8UHkLe KVSw== 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:mime-version:content-transfer-encoding; bh=aEQok0/L5FX5jAQIApgNcuA+gqvYfIDMod+uDV+LrZA=; b=ONXNpVDsC5FguxONhfGGejjzDgUe8rEMngohaBOMvPI4Otx0Tw7F8yT4zjSQ6r/lF2 NpBCOYoMjVzjKUFhmpUj3/6NdpNDxwGIcOjOHYD+iLK4bacnNYdTfggldZSv+WVrWZVd Ismvlsmu2wES/2s2REOAfa5sw/lMM9lkawyH+9J2DLlFv9Nl4eBzZSD2DOJ9KE5zbYZR CXcd+H1px6D+rBPP8J7hCapyXxOhvcDNIizKBVN1GsebPtWHeM8RKlmvPYPKcJQTzlHM EaBL4gzpgZR1BERkeRLTT5KojWpEoCxS3+HRjATkk+c4W0JwStQkNb9+b+2yT1KKE/wp EVCw== X-Gm-Message-State: AOAM5337W1vHogdTAXDvL4ZwXXSkYbtsCimWJcMpc3/W+i5vS3bvG0ak 8+4udLnr7tksQ6MeuQ7jLhezMg2Q6bYHtLrL X-Google-Smtp-Source: ABdhPJyMxJyMx+Cjv/DpACrGxES73IQJgInYo3ahvBIWfOjlKZ/flDwY1PrpfK2UJOTRMBG4CxrkKQ== X-Received: by 2002:a05:6830:2144:: with SMTP id r4mr28583745otd.180.1608216753051; Thu, 17 Dec 2020 06:52:33 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 14/23] tcg: Use tcg_constant_{i32, i64} with tcg int expanders Date: Thu, 17 Dec 2020 08:52:06 -0600 Message-Id: <20201217145215.534637-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201217145215.534637-1-richard.henderson@linaro.org> References: <20201217145215.534637-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::32f; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson --- include/tcg/tcg-op.h | 13 +-- tcg/tcg-op.c | 227 ++++++++++++++++++++----------------------- 2 files changed, 109 insertions(+), 131 deletions(-) diff --git a/include/tcg/tcg-op.h b/include/tcg/tcg-op.h index 5abf17fecc..b4fba35e87 100644 --- a/include/tcg/tcg-op.h +++ b/include/tcg/tcg-op.h @@ -271,6 +271,7 @@ void tcg_gen_mb(TCGBar); =20 /* 32 bit ops */ =20 +void tcg_gen_movi_i32(TCGv_i32 ret, int32_t arg); void tcg_gen_addi_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2); void tcg_gen_subfi_i32(TCGv_i32 ret, int32_t arg1, TCGv_i32 arg2); void tcg_gen_subi_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2); @@ -349,11 +350,6 @@ static inline void tcg_gen_mov_i32(TCGv_i32 ret, TCGv_= i32 arg) } } =20 -static inline void tcg_gen_movi_i32(TCGv_i32 ret, int32_t arg) -{ - tcg_gen_op2i_i32(INDEX_op_movi_i32, ret, arg); -} - static inline void tcg_gen_ld8u_i32(TCGv_i32 ret, TCGv_ptr arg2, tcg_target_long offset) { @@ -467,6 +463,7 @@ static inline void tcg_gen_not_i32(TCGv_i32 ret, TCGv_i= 32 arg) =20 /* 64 bit ops */ =20 +void tcg_gen_movi_i64(TCGv_i64 ret, int64_t arg); void tcg_gen_addi_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2); void tcg_gen_subfi_i64(TCGv_i64 ret, int64_t arg1, TCGv_i64 arg2); void tcg_gen_subi_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2); @@ -550,11 +547,6 @@ static inline void tcg_gen_mov_i64(TCGv_i64 ret, TCGv_= i64 arg) } } =20 -static inline void tcg_gen_movi_i64(TCGv_i64 ret, int64_t arg) -{ - tcg_gen_op2i_i64(INDEX_op_movi_i64, ret, arg); -} - static inline void tcg_gen_ld8u_i64(TCGv_i64 ret, TCGv_ptr arg2, tcg_target_long offset) { @@ -698,7 +690,6 @@ static inline void tcg_gen_sub_i64(TCGv_i64 ret, TCGv_i= 64 arg1, TCGv_i64 arg2) =20 void tcg_gen_discard_i64(TCGv_i64 arg); void tcg_gen_mov_i64(TCGv_i64 ret, TCGv_i64 arg); -void tcg_gen_movi_i64(TCGv_i64 ret, int64_t arg); void tcg_gen_ld8u_i64(TCGv_i64 ret, TCGv_ptr arg2, tcg_target_long offset); void tcg_gen_ld8s_i64(TCGv_i64 ret, TCGv_ptr arg2, tcg_target_long offset); void tcg_gen_ld16u_i64(TCGv_i64 ret, TCGv_ptr arg2, tcg_target_long offset= ); diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c index 4b8a473fad..e2d8ae3234 100644 --- a/tcg/tcg-op.c +++ b/tcg/tcg-op.c @@ -104,15 +104,18 @@ void tcg_gen_mb(TCGBar mb_type) =20 /* 32 bit ops */ =20 +void tcg_gen_movi_i32(TCGv_i32 ret, int32_t arg) +{ + tcg_gen_mov_i32(ret, tcg_constant_i32(arg)); +} + void tcg_gen_addi_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2) { /* some cases can be optimized here */ if (arg2 =3D=3D 0) { tcg_gen_mov_i32(ret, arg1); } else { - TCGv_i32 t0 =3D tcg_const_i32(arg2); - tcg_gen_add_i32(ret, arg1, t0); - tcg_temp_free_i32(t0); + tcg_gen_add_i32(ret, arg1, tcg_constant_i32(arg2)); } } =20 @@ -122,9 +125,7 @@ void tcg_gen_subfi_i32(TCGv_i32 ret, int32_t arg1, TCGv= _i32 arg2) /* Don't recurse with tcg_gen_neg_i32. */ tcg_gen_op2_i32(INDEX_op_neg_i32, ret, arg2); } else { - TCGv_i32 t0 =3D tcg_const_i32(arg1); - tcg_gen_sub_i32(ret, t0, arg2); - tcg_temp_free_i32(t0); + tcg_gen_sub_i32(ret, tcg_constant_i32(arg1), arg2); } } =20 @@ -134,15 +135,12 @@ void tcg_gen_subi_i32(TCGv_i32 ret, TCGv_i32 arg1, in= t32_t arg2) if (arg2 =3D=3D 0) { tcg_gen_mov_i32(ret, arg1); } else { - TCGv_i32 t0 =3D tcg_const_i32(arg2); - tcg_gen_sub_i32(ret, arg1, t0); - tcg_temp_free_i32(t0); + tcg_gen_sub_i32(ret, arg1, tcg_constant_i32(arg2)); } } =20 void tcg_gen_andi_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2) { - TCGv_i32 t0; /* Some cases can be optimized here. */ switch (arg2) { case 0: @@ -165,9 +163,8 @@ void tcg_gen_andi_i32(TCGv_i32 ret, TCGv_i32 arg1, int3= 2_t arg2) } break; } - t0 =3D tcg_const_i32(arg2); - tcg_gen_and_i32(ret, arg1, t0); - tcg_temp_free_i32(t0); + + tcg_gen_and_i32(ret, arg1, tcg_constant_i32(arg2)); } =20 void tcg_gen_ori_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2) @@ -178,9 +175,7 @@ void tcg_gen_ori_i32(TCGv_i32 ret, TCGv_i32 arg1, int32= _t arg2) } else if (arg2 =3D=3D 0) { tcg_gen_mov_i32(ret, arg1); } else { - TCGv_i32 t0 =3D tcg_const_i32(arg2); - tcg_gen_or_i32(ret, arg1, t0); - tcg_temp_free_i32(t0); + tcg_gen_or_i32(ret, arg1, tcg_constant_i32(arg2)); } } =20 @@ -193,9 +188,7 @@ void tcg_gen_xori_i32(TCGv_i32 ret, TCGv_i32 arg1, int3= 2_t arg2) /* Don't recurse with tcg_gen_not_i32. */ tcg_gen_op2_i32(INDEX_op_not_i32, ret, arg1); } else { - TCGv_i32 t0 =3D tcg_const_i32(arg2); - tcg_gen_xor_i32(ret, arg1, t0); - tcg_temp_free_i32(t0); + tcg_gen_xor_i32(ret, arg1, tcg_constant_i32(arg2)); } } =20 @@ -205,9 +198,7 @@ void tcg_gen_shli_i32(TCGv_i32 ret, TCGv_i32 arg1, int3= 2_t arg2) if (arg2 =3D=3D 0) { tcg_gen_mov_i32(ret, arg1); } else { - TCGv_i32 t0 =3D tcg_const_i32(arg2); - tcg_gen_shl_i32(ret, arg1, t0); - tcg_temp_free_i32(t0); + tcg_gen_shl_i32(ret, arg1, tcg_constant_i32(arg2)); } } =20 @@ -217,9 +208,7 @@ void tcg_gen_shri_i32(TCGv_i32 ret, TCGv_i32 arg1, int3= 2_t arg2) if (arg2 =3D=3D 0) { tcg_gen_mov_i32(ret, arg1); } else { - TCGv_i32 t0 =3D tcg_const_i32(arg2); - tcg_gen_shr_i32(ret, arg1, t0); - tcg_temp_free_i32(t0); + tcg_gen_shr_i32(ret, arg1, tcg_constant_i32(arg2)); } } =20 @@ -229,9 +218,7 @@ void tcg_gen_sari_i32(TCGv_i32 ret, TCGv_i32 arg1, int3= 2_t arg2) if (arg2 =3D=3D 0) { tcg_gen_mov_i32(ret, arg1); } else { - TCGv_i32 t0 =3D tcg_const_i32(arg2); - tcg_gen_sar_i32(ret, arg1, t0); - tcg_temp_free_i32(t0); + tcg_gen_sar_i32(ret, arg1, tcg_constant_i32(arg2)); } } =20 @@ -250,9 +237,7 @@ void tcg_gen_brcondi_i32(TCGCond cond, TCGv_i32 arg1, i= nt32_t arg2, TCGLabel *l) if (cond =3D=3D TCG_COND_ALWAYS) { tcg_gen_br(l); } else if (cond !=3D TCG_COND_NEVER) { - TCGv_i32 t0 =3D tcg_const_i32(arg2); - tcg_gen_brcond_i32(cond, arg1, t0, l); - tcg_temp_free_i32(t0); + tcg_gen_brcond_i32(cond, arg1, tcg_constant_i32(arg2), l); } } =20 @@ -271,9 +256,7 @@ void tcg_gen_setcond_i32(TCGCond cond, TCGv_i32 ret, void tcg_gen_setcondi_i32(TCGCond cond, TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2) { - TCGv_i32 t0 =3D tcg_const_i32(arg2); - tcg_gen_setcond_i32(cond, ret, arg1, t0); - tcg_temp_free_i32(t0); + tcg_gen_setcond_i32(cond, ret, arg1, tcg_constant_i32(arg2)); } =20 void tcg_gen_muli_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2) @@ -283,9 +266,7 @@ void tcg_gen_muli_i32(TCGv_i32 ret, TCGv_i32 arg1, int3= 2_t arg2) } else if (is_power_of_2(arg2)) { tcg_gen_shli_i32(ret, arg1, ctz32(arg2)); } else { - TCGv_i32 t0 =3D tcg_const_i32(arg2); - tcg_gen_mul_i32(ret, arg1, t0); - tcg_temp_free_i32(t0); + tcg_gen_mul_i32(ret, arg1, tcg_constant_i32(arg2)); } } =20 @@ -433,9 +414,7 @@ void tcg_gen_clz_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_= i32 arg2) =20 void tcg_gen_clzi_i32(TCGv_i32 ret, TCGv_i32 arg1, uint32_t arg2) { - TCGv_i32 t =3D tcg_const_i32(arg2); - tcg_gen_clz_i32(ret, arg1, t); - tcg_temp_free_i32(t); + tcg_gen_clz_i32(ret, arg1, tcg_constant_i32(arg2)); } =20 void tcg_gen_ctz_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2) @@ -468,10 +447,9 @@ void tcg_gen_ctz_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv= _i32 arg2) tcg_gen_clzi_i32(t, t, 32); tcg_gen_xori_i32(t, t, 31); } - z =3D tcg_const_i32(0); + z =3D tcg_constant_i32(0); tcg_gen_movcond_i32(TCG_COND_EQ, ret, arg1, z, arg2, t); tcg_temp_free_i32(t); - tcg_temp_free_i32(z); } else { gen_helper_ctz_i32(ret, arg1, arg2); } @@ -487,9 +465,7 @@ void tcg_gen_ctzi_i32(TCGv_i32 ret, TCGv_i32 arg1, uint= 32_t arg2) tcg_gen_ctpop_i32(ret, t); tcg_temp_free_i32(t); } else { - TCGv_i32 t =3D tcg_const_i32(arg2); - tcg_gen_ctz_i32(ret, arg1, t); - tcg_temp_free_i32(t); + tcg_gen_ctz_i32(ret, arg1, tcg_constant_i32(arg2)); } } =20 @@ -547,9 +523,7 @@ void tcg_gen_rotli_i32(TCGv_i32 ret, TCGv_i32 arg1, int= 32_t arg2) if (arg2 =3D=3D 0) { tcg_gen_mov_i32(ret, arg1); } else if (TCG_TARGET_HAS_rot_i32) { - TCGv_i32 t0 =3D tcg_const_i32(arg2); - tcg_gen_rotl_i32(ret, arg1, t0); - tcg_temp_free_i32(t0); + tcg_gen_rotl_i32(ret, arg1, tcg_constant_i32(arg2)); } else { TCGv_i32 t0, t1; t0 =3D tcg_temp_new_i32(); @@ -653,9 +627,8 @@ void tcg_gen_deposit_z_i32(TCGv_i32 ret, TCGv_i32 arg, tcg_gen_andi_i32(ret, arg, (1u << len) - 1); } else if (TCG_TARGET_HAS_deposit_i32 && TCG_TARGET_deposit_i32_valid(ofs, len)) { - TCGv_i32 zero =3D tcg_const_i32(0); + TCGv_i32 zero =3D tcg_constant_i32(0); tcg_gen_op5ii_i32(INDEX_op_deposit_i32, ret, zero, arg, ofs, len); - tcg_temp_free_i32(zero); } else { /* To help two-operand hosts we prefer to zero-extend first, which allows ARG to stay live. */ @@ -1052,7 +1025,7 @@ void tcg_gen_bswap32_i32(TCGv_i32 ret, TCGv_i32 arg) } else { TCGv_i32 t0 =3D tcg_temp_new_i32(); TCGv_i32 t1 =3D tcg_temp_new_i32(); - TCGv_i32 t2 =3D tcg_const_i32(0x00ff00ff); + TCGv_i32 t2 =3D tcg_constant_i32(0x00ff00ff); =20 /* arg =3D abcd */ tcg_gen_shri_i32(t0, arg, 8); /* t0 =3D .abc */ @@ -1067,7 +1040,6 @@ void tcg_gen_bswap32_i32(TCGv_i32 ret, TCGv_i32 arg) =20 tcg_temp_free_i32(t0); tcg_temp_free_i32(t1); - tcg_temp_free_i32(t2); } } =20 @@ -1114,8 +1086,15 @@ void tcg_gen_discard_i64(TCGv_i64 arg) =20 void tcg_gen_mov_i64(TCGv_i64 ret, TCGv_i64 arg) { - tcg_gen_mov_i32(TCGV_LOW(ret), TCGV_LOW(arg)); - tcg_gen_mov_i32(TCGV_HIGH(ret), TCGV_HIGH(arg)); + TCGTemp *ts =3D tcgv_i64_temp(arg); + + /* Canonicalize TCGv_i64 TEMP_CONST into TCGv_i32 TEMP_CONST. */ + if (ts->kind =3D=3D TEMP_CONST) { + tcg_gen_movi_i64(ret, ts->val); + } else { + tcg_gen_mov_i32(TCGV_LOW(ret), TCGV_LOW(arg)); + tcg_gen_mov_i32(TCGV_HIGH(ret), TCGV_HIGH(arg)); + } } =20 void tcg_gen_movi_i64(TCGv_i64 ret, int64_t arg) @@ -1237,6 +1216,14 @@ void tcg_gen_mul_i64(TCGv_i64 ret, TCGv_i64 arg1, TC= Gv_i64 arg2) tcg_temp_free_i64(t0); tcg_temp_free_i32(t1); } + +#else + +void tcg_gen_movi_i64(TCGv_i64 ret, int64_t arg) +{ + tcg_gen_mov_i64(ret, tcg_constant_i64(arg)); +} + #endif /* TCG_TARGET_REG_SIZE =3D=3D 32 */ =20 void tcg_gen_addi_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2) @@ -1244,10 +1231,12 @@ void tcg_gen_addi_i64(TCGv_i64 ret, TCGv_i64 arg1, = int64_t arg2) /* some cases can be optimized here */ if (arg2 =3D=3D 0) { tcg_gen_mov_i64(ret, arg1); + } else if (TCG_TARGET_REG_BITS =3D=3D 64) { + tcg_gen_add_i64(ret, arg1, tcg_constant_i64(arg2)); } else { - TCGv_i64 t0 =3D tcg_const_i64(arg2); - tcg_gen_add_i64(ret, arg1, t0); - tcg_temp_free_i64(t0); + tcg_gen_add2_i32(TCGV_LOW(ret), TCGV_HIGH(ret), + TCGV_LOW(arg1), TCGV_HIGH(arg1), + tcg_constant_i32(arg2), tcg_constant_i32(arg2 >> = 32)); } } =20 @@ -1256,10 +1245,12 @@ void tcg_gen_subfi_i64(TCGv_i64 ret, int64_t arg1, = TCGv_i64 arg2) if (arg1 =3D=3D 0 && TCG_TARGET_HAS_neg_i64) { /* Don't recurse with tcg_gen_neg_i64. */ tcg_gen_op2_i64(INDEX_op_neg_i64, ret, arg2); + } else if (TCG_TARGET_REG_BITS =3D=3D 64) { + tcg_gen_sub_i64(ret, tcg_constant_i64(arg1), arg2); } else { - TCGv_i64 t0 =3D tcg_const_i64(arg1); - tcg_gen_sub_i64(ret, t0, arg2); - tcg_temp_free_i64(t0); + tcg_gen_sub2_i32(TCGV_LOW(ret), TCGV_HIGH(ret), + tcg_constant_i32(arg1), tcg_constant_i32(arg1 >> = 32), + TCGV_LOW(arg2), TCGV_HIGH(arg2)); } } =20 @@ -1268,17 +1259,17 @@ void tcg_gen_subi_i64(TCGv_i64 ret, TCGv_i64 arg1, = int64_t arg2) /* some cases can be optimized here */ if (arg2 =3D=3D 0) { tcg_gen_mov_i64(ret, arg1); + } else if (TCG_TARGET_REG_BITS =3D=3D 64) { + tcg_gen_sub_i64(ret, arg1, tcg_constant_i64(arg2)); } else { - TCGv_i64 t0 =3D tcg_const_i64(arg2); - tcg_gen_sub_i64(ret, arg1, t0); - tcg_temp_free_i64(t0); + tcg_gen_sub2_i32(TCGV_LOW(ret), TCGV_HIGH(ret), + TCGV_LOW(arg1), TCGV_HIGH(arg1), + tcg_constant_i32(arg2), tcg_constant_i32(arg2 >> = 32)); } } =20 void tcg_gen_andi_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2) { - TCGv_i64 t0; - if (TCG_TARGET_REG_BITS =3D=3D 32) { tcg_gen_andi_i32(TCGV_LOW(ret), TCGV_LOW(arg1), arg2); tcg_gen_andi_i32(TCGV_HIGH(ret), TCGV_HIGH(arg1), arg2 >> 32); @@ -1313,9 +1304,8 @@ void tcg_gen_andi_i64(TCGv_i64 ret, TCGv_i64 arg1, in= t64_t arg2) } break; } - t0 =3D tcg_const_i64(arg2); - tcg_gen_and_i64(ret, arg1, t0); - tcg_temp_free_i64(t0); + + tcg_gen_and_i64(ret, arg1, tcg_constant_i64(arg2)); } =20 void tcg_gen_ori_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2) @@ -1331,9 +1321,7 @@ void tcg_gen_ori_i64(TCGv_i64 ret, TCGv_i64 arg1, int= 64_t arg2) } else if (arg2 =3D=3D 0) { tcg_gen_mov_i64(ret, arg1); } else { - TCGv_i64 t0 =3D tcg_const_i64(arg2); - tcg_gen_or_i64(ret, arg1, t0); - tcg_temp_free_i64(t0); + tcg_gen_or_i64(ret, arg1, tcg_constant_i64(arg2)); } } =20 @@ -1351,9 +1339,7 @@ void tcg_gen_xori_i64(TCGv_i64 ret, TCGv_i64 arg1, in= t64_t arg2) /* Don't recurse with tcg_gen_not_i64. */ tcg_gen_op2_i64(INDEX_op_not_i64, ret, arg1); } else { - TCGv_i64 t0 =3D tcg_const_i64(arg2); - tcg_gen_xor_i64(ret, arg1, t0); - tcg_temp_free_i64(t0); + tcg_gen_xor_i64(ret, arg1, tcg_constant_i64(arg2)); } } =20 @@ -1415,9 +1401,7 @@ void tcg_gen_shli_i64(TCGv_i64 ret, TCGv_i64 arg1, in= t64_t arg2) } else if (arg2 =3D=3D 0) { tcg_gen_mov_i64(ret, arg1); } else { - TCGv_i64 t0 =3D tcg_const_i64(arg2); - tcg_gen_shl_i64(ret, arg1, t0); - tcg_temp_free_i64(t0); + tcg_gen_shl_i64(ret, arg1, tcg_constant_i64(arg2)); } } =20 @@ -1429,9 +1413,7 @@ void tcg_gen_shri_i64(TCGv_i64 ret, TCGv_i64 arg1, in= t64_t arg2) } else if (arg2 =3D=3D 0) { tcg_gen_mov_i64(ret, arg1); } else { - TCGv_i64 t0 =3D tcg_const_i64(arg2); - tcg_gen_shr_i64(ret, arg1, t0); - tcg_temp_free_i64(t0); + tcg_gen_shr_i64(ret, arg1, tcg_constant_i64(arg2)); } } =20 @@ -1443,9 +1425,7 @@ void tcg_gen_sari_i64(TCGv_i64 ret, TCGv_i64 arg1, in= t64_t arg2) } else if (arg2 =3D=3D 0) { tcg_gen_mov_i64(ret, arg1); } else { - TCGv_i64 t0 =3D tcg_const_i64(arg2); - tcg_gen_sar_i64(ret, arg1, t0); - tcg_temp_free_i64(t0); + tcg_gen_sar_i64(ret, arg1, tcg_constant_i64(arg2)); } } =20 @@ -1468,12 +1448,17 @@ void tcg_gen_brcond_i64(TCGCond cond, TCGv_i64 arg1= , TCGv_i64 arg2, TCGLabel *l) =20 void tcg_gen_brcondi_i64(TCGCond cond, TCGv_i64 arg1, int64_t arg2, TCGLab= el *l) { - if (cond =3D=3D TCG_COND_ALWAYS) { + if (TCG_TARGET_REG_BITS =3D=3D 64) { + tcg_gen_brcond_i64(cond, arg1, tcg_constant_i64(arg2), l); + } else if (cond =3D=3D TCG_COND_ALWAYS) { tcg_gen_br(l); } else if (cond !=3D TCG_COND_NEVER) { - TCGv_i64 t0 =3D tcg_const_i64(arg2); - tcg_gen_brcond_i64(cond, arg1, t0, l); - tcg_temp_free_i64(t0); + l->refs++; + tcg_gen_op6ii_i32(INDEX_op_brcond2_i32, + TCGV_LOW(arg1), TCGV_HIGH(arg1), + tcg_constant_i32(arg2), + tcg_constant_i32(arg2 >> 32), + cond, label_arg(l)); } } =20 @@ -1499,9 +1484,19 @@ void tcg_gen_setcond_i64(TCGCond cond, TCGv_i64 ret, void tcg_gen_setcondi_i64(TCGCond cond, TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2) { - TCGv_i64 t0 =3D tcg_const_i64(arg2); - tcg_gen_setcond_i64(cond, ret, arg1, t0); - tcg_temp_free_i64(t0); + if (TCG_TARGET_REG_BITS =3D=3D 64) { + tcg_gen_setcond_i64(cond, ret, arg1, tcg_constant_i64(arg2)); + } else if (cond =3D=3D TCG_COND_ALWAYS) { + tcg_gen_movi_i64(ret, 1); + } else if (cond =3D=3D TCG_COND_NEVER) { + tcg_gen_movi_i64(ret, 0); + } else { + tcg_gen_op6i_i32(INDEX_op_setcond2_i32, TCGV_LOW(ret), + TCGV_LOW(arg1), TCGV_HIGH(arg1), + tcg_constant_i32(arg2), + tcg_constant_i32(arg2 >> 32), cond); + tcg_gen_movi_i32(TCGV_HIGH(ret), 0); + } } =20 void tcg_gen_muli_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2) @@ -1690,7 +1685,7 @@ void tcg_gen_bswap32_i64(TCGv_i64 ret, TCGv_i64 arg) } else { TCGv_i64 t0 =3D tcg_temp_new_i64(); TCGv_i64 t1 =3D tcg_temp_new_i64(); - TCGv_i64 t2 =3D tcg_const_i64(0x00ff00ff); + TCGv_i64 t2 =3D tcg_constant_i64(0x00ff00ff); =20 /* arg =3D ....abcd */ tcg_gen_shri_i64(t0, arg, 8); /* t0 =3D .....abc */ @@ -1706,7 +1701,6 @@ void tcg_gen_bswap32_i64(TCGv_i64 ret, TCGv_i64 arg) =20 tcg_temp_free_i64(t0); tcg_temp_free_i64(t1); - tcg_temp_free_i64(t2); } } =20 @@ -1850,16 +1844,16 @@ void tcg_gen_clzi_i64(TCGv_i64 ret, TCGv_i64 arg1, = uint64_t arg2) if (TCG_TARGET_REG_BITS =3D=3D 32 && TCG_TARGET_HAS_clz_i32 && arg2 <=3D 0xffffffffu) { - TCGv_i32 t =3D tcg_const_i32((uint32_t)arg2 - 32); - tcg_gen_clz_i32(t, TCGV_LOW(arg1), t); + TCGv_i32 t =3D tcg_temp_new_i32(); + tcg_gen_clzi_i32(t, TCGV_LOW(arg1), arg2 - 32); tcg_gen_addi_i32(t, t, 32); tcg_gen_clz_i32(TCGV_LOW(ret), TCGV_HIGH(arg1), t); tcg_gen_movi_i32(TCGV_HIGH(ret), 0); tcg_temp_free_i32(t); } else { - TCGv_i64 t =3D tcg_const_i64(arg2); - tcg_gen_clz_i64(ret, arg1, t); - tcg_temp_free_i64(t); + TCGv_i64 t0 =3D tcg_const_i64(arg2); + tcg_gen_clz_i64(ret, arg1, t0); + tcg_temp_free_i64(t0); } } =20 @@ -1881,7 +1875,7 @@ void tcg_gen_ctz_i64(TCGv_i64 ret, TCGv_i64 arg1, TCG= v_i64 arg2) tcg_gen_clzi_i64(t, t, 64); tcg_gen_xori_i64(t, t, 63); } - z =3D tcg_const_i64(0); + z =3D tcg_constant_i64(0); tcg_gen_movcond_i64(TCG_COND_EQ, ret, arg1, z, arg2, t); tcg_temp_free_i64(t); tcg_temp_free_i64(z); @@ -1895,8 +1889,8 @@ void tcg_gen_ctzi_i64(TCGv_i64 ret, TCGv_i64 arg1, ui= nt64_t arg2) if (TCG_TARGET_REG_BITS =3D=3D 32 && TCG_TARGET_HAS_ctz_i32 && arg2 <=3D 0xffffffffu) { - TCGv_i32 t32 =3D tcg_const_i32((uint32_t)arg2 - 32); - tcg_gen_ctz_i32(t32, TCGV_HIGH(arg1), t32); + TCGv_i32 t32 =3D tcg_temp_new_i32(); + tcg_gen_ctzi_i32(t32, TCGV_HIGH(arg1), arg2 - 32); tcg_gen_addi_i32(t32, t32, 32); tcg_gen_ctz_i32(TCGV_LOW(ret), TCGV_LOW(arg1), t32); tcg_gen_movi_i32(TCGV_HIGH(ret), 0); @@ -1911,9 +1905,9 @@ void tcg_gen_ctzi_i64(TCGv_i64 ret, TCGv_i64 arg1, ui= nt64_t arg2) tcg_gen_ctpop_i64(ret, t); tcg_temp_free_i64(t); } else { - TCGv_i64 t64 =3D tcg_const_i64(arg2); - tcg_gen_ctz_i64(ret, arg1, t64); - tcg_temp_free_i64(t64); + TCGv_i64 t0 =3D tcg_const_i64(arg2); + tcg_gen_ctz_i64(ret, arg1, t0); + tcg_temp_free_i64(t0); } } =20 @@ -1969,9 +1963,7 @@ void tcg_gen_rotli_i64(TCGv_i64 ret, TCGv_i64 arg1, i= nt64_t arg2) if (arg2 =3D=3D 0) { tcg_gen_mov_i64(ret, arg1); } else if (TCG_TARGET_HAS_rot_i64) { - TCGv_i64 t0 =3D tcg_const_i64(arg2); - tcg_gen_rotl_i64(ret, arg1, t0); - tcg_temp_free_i64(t0); + tcg_gen_rotl_i64(ret, arg1, tcg_constant_i64(arg2)); } else { TCGv_i64 t0, t1; t0 =3D tcg_temp_new_i64(); @@ -2089,9 +2081,8 @@ void tcg_gen_deposit_z_i64(TCGv_i64 ret, TCGv_i64 arg, tcg_gen_andi_i64(ret, arg, (1ull << len) - 1); } else if (TCG_TARGET_HAS_deposit_i64 && TCG_TARGET_deposit_i64_valid(ofs, len)) { - TCGv_i64 zero =3D tcg_const_i64(0); + TCGv_i64 zero =3D tcg_constant_i64(0); tcg_gen_op5ii_i64(INDEX_op_deposit_i64, ret, zero, arg, ofs, len); - tcg_temp_free_i64(zero); } else { if (TCG_TARGET_REG_BITS =3D=3D 32) { if (ofs >=3D 32) { @@ -3102,9 +3093,8 @@ void tcg_gen_atomic_cmpxchg_i32(TCGv_i32 retv, TCGv a= ddr, TCGv_i32 cmpv, =20 #ifdef CONFIG_SOFTMMU { - TCGv_i32 oi =3D tcg_const_i32(make_memop_idx(memop & ~MO_SIGN,= idx)); - gen(retv, cpu_env, addr, cmpv, newv, oi); - tcg_temp_free_i32(oi); + TCGMemOpIdx oi =3D make_memop_idx(memop & ~MO_SIGN, idx); + gen(retv, cpu_env, addr, cmpv, newv, tcg_constant_i32(oi)); } #else gen(retv, cpu_env, addr, cmpv, newv); @@ -3147,9 +3137,8 @@ void tcg_gen_atomic_cmpxchg_i64(TCGv_i64 retv, TCGv a= ddr, TCGv_i64 cmpv, =20 #ifdef CONFIG_SOFTMMU { - TCGv_i32 oi =3D tcg_const_i32(make_memop_idx(memop, idx)); - gen(retv, cpu_env, addr, cmpv, newv, oi); - tcg_temp_free_i32(oi); + TCGMemOpIdx oi =3D make_memop_idx(memop, idx); + gen(retv, cpu_env, addr, cmpv, newv, tcg_constant_i32(oi)); } #else gen(retv, cpu_env, addr, cmpv, newv); @@ -3211,9 +3200,8 @@ static void do_atomic_op_i32(TCGv_i32 ret, TCGv addr,= TCGv_i32 val, =20 #ifdef CONFIG_SOFTMMU { - TCGv_i32 oi =3D tcg_const_i32(make_memop_idx(memop & ~MO_SIGN, idx= )); - gen(ret, cpu_env, addr, val, oi); - tcg_temp_free_i32(oi); + TCGMemOpIdx oi =3D make_memop_idx(memop & ~MO_SIGN, idx); + gen(ret, cpu_env, addr, val, tcg_constant_i32(oi)); } #else gen(ret, cpu_env, addr, val); @@ -3257,9 +3245,8 @@ static void do_atomic_op_i64(TCGv_i64 ret, TCGv addr,= TCGv_i64 val, =20 #ifdef CONFIG_SOFTMMU { - TCGv_i32 oi =3D tcg_const_i32(make_memop_idx(memop & ~MO_SIGN,= idx)); - gen(ret, cpu_env, addr, val, oi); - tcg_temp_free_i32(oi); + TCGMemOpIdx oi =3D make_memop_idx(memop & ~MO_SIGN, idx); + gen(ret, cpu_env, addr, val, tcg_constant_i32(oi)); } #else gen(ret, cpu_env, addr, val); --=20 2.25.1 From nobody Sat May 18 21:45:31 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1608219064; cv=none; d=zohomail.com; s=zohoarc; b=geBKmyhnSLuyaloV5n4aPiSmkDPeWd4uqa0wMwG1r654rA49cyaF+EXU6iYWn//6LjoeFDWXsmvgGPsbAd3aesqn3ReVoxfg2otnLPxOAsRVaZI9dw5RHsjQ5LC/TTWcFhSPeThzOybJHApYqlZXI3gQs2Of3b2HQBiZS25zAic= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608219064; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=HakP3QzMMgoP+5PWHWKQnZl86G7xrmBYKlGdyeWSyq0=; b=I/5O42Cu7EAV3df20pMZjlpnoIImfELnFxMc1RiPVQunYJdhhDiREpkB1a8sO2/HLm8AbYwenfqdNRjJeiAUzJlxGcpEwJt2uOff4hmmIyp2aAH7vSlt5cpxWzQKHZgF+1ccKKaYVfvCVkJp+pq1UHvoGuarnIZgg3T4zEmIEXI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1608219062557260.7067177984866; Thu, 17 Dec 2020 07:31:02 -0800 (PST) Received: from localhost ([::1]:43468 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpvF5-00052s-3p for importer@patchew.org; Thu, 17 Dec 2020 10:30:59 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33334) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpue4-0003Y4-5m for qemu-devel@nongnu.org; Thu, 17 Dec 2020 09:52:44 -0500 Received: from mail-ot1-x330.google.com ([2607:f8b0:4864:20::330]:39848) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kpudv-0004xE-O3 for qemu-devel@nongnu.org; Thu, 17 Dec 2020 09:52:42 -0500 Received: by mail-ot1-x330.google.com with SMTP id d8so27520803otq.6 for ; Thu, 17 Dec 2020 06:52:35 -0800 (PST) Received: from localhost.localdomain (fixed-187-189-51-144.totalplay.net. [187.189.51.144]) by smtp.gmail.com with ESMTPSA id x130sm1136342oif.3.2020.12.17.06.52.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Dec 2020 06:52:33 -0800 (PST) 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=HakP3QzMMgoP+5PWHWKQnZl86G7xrmBYKlGdyeWSyq0=; b=IMZyzKq3d8o3AyeSInAdPCruq1KpvShtpxG6Hbgo9XrqUBR0iy+ffTs51I9D7Kr8Tk Dtj11wFNmx/5FxPe/K1+S6RXpPImVcSNCqeinbPShOi2UJ5g2p6m6SYLMTzfCyCeGc5a FQP2jCXF2SIYuvtjYEVE7wHHfTKhLKSJpDXCdM5ZLXekyf3B2ea1Ql4uU1IWdcsGfv01 kYI9AyVxWLRdHoSESZdUP/2D6n3k6feQ9WOonEolEA7I38KlIWuA/GUpEuMGJuqa4Nul gWxPu6GimkJg7TqyQ9ASSB4EXBIMC23131lbPS4s6tcUPNyEQWjt5HnMtBrpSUtTh/Rx ycVg== 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=HakP3QzMMgoP+5PWHWKQnZl86G7xrmBYKlGdyeWSyq0=; b=IwxxBeTgLBh9UmO6buywBxB24YcscakvgDesJGtNmpIZxKrHEGfCNzKbJqKGivVRW2 rq/pTIh5Uj62fLpXJA/cSIUCnANgQ3nfZz/YtKhNSt3sfrpROSMNqUgWIhKlmp2T1GB8 Uu9VM5zXF8ZFu25BqmFd7BWkghqbP6yq3HwUpDP5s9k3G11M2+6zWyUPkTexc864aTtK +7ZdDvL412iLNXETDRqDswmF/r7BAMj5bA6MjdEZhT8PaA3kEJzuvE+tM3XbpvjtbHEj mw+EHXfjVctuVSNWlQ8Kp4o7H+F9WkfYiu/xVVyNMc7memGFxe50Ir5vaGCclApdnRG9 ljpw== X-Gm-Message-State: AOAM532yC95SNXigiDAH2ejKAXx4pcQF1R7g2fw0WgR1nb0MPiKKQICp XM1Wq5J+FvGDyiyJY+DGQrAAzdeMObCTACQj X-Google-Smtp-Source: ABdhPJxo+HZW2wA/SoiG5FXHT688UzsN3Lg0eLJJqRAC0zCGWpgqmpDHULJBTEXJTiRMsfmxvLdfOw== X-Received: by 2002:a05:6830:110b:: with SMTP id w11mr26695273otq.285.1608216754152; Thu, 17 Dec 2020 06:52:34 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 15/23] tcg: Use tcg_constant_{i32,i64} with tcg plugins Date: Thu, 17 Dec 2020 08:52:07 -0600 Message-Id: <20201217145215.534637-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201217145215.534637-1-richard.henderson@linaro.org> References: <20201217145215.534637-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::330; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x330.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Richard Henderson --- accel/tcg/plugin-gen.c | 49 +++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 27 deletions(-) diff --git a/accel/tcg/plugin-gen.c b/accel/tcg/plugin-gen.c index 51580d51a0..e5dc9d0ca9 100644 --- a/accel/tcg/plugin-gen.c +++ b/accel/tcg/plugin-gen.c @@ -284,8 +284,8 @@ static TCGOp *copy_extu_i32_i64(TCGOp **begin_op, TCGOp= *op) if (TCG_TARGET_REG_BITS =3D=3D 32) { /* mov_i32 */ op =3D copy_op(begin_op, op, INDEX_op_mov_i32); - /* movi_i32 */ - op =3D copy_op(begin_op, op, INDEX_op_movi_i32); + /* mov_i32 w/ $0 */ + op =3D copy_op(begin_op, op, INDEX_op_mov_i32); } else { /* extu_i32_i64 */ op =3D copy_op(begin_op, op, INDEX_op_extu_i32_i64); @@ -306,39 +306,34 @@ static TCGOp *copy_mov_i64(TCGOp **begin_op, TCGOp *o= p) return op; } =20 -static TCGOp *copy_movi_i64(TCGOp **begin_op, TCGOp *op, uint64_t v) -{ - if (TCG_TARGET_REG_BITS =3D=3D 32) { - /* 2x movi_i32 */ - op =3D copy_op(begin_op, op, INDEX_op_movi_i32); - op->args[1] =3D v; - - op =3D copy_op(begin_op, op, INDEX_op_movi_i32); - op->args[1] =3D v >> 32; - } else { - /* movi_i64 */ - op =3D copy_op(begin_op, op, INDEX_op_movi_i64); - op->args[1] =3D v; - } - return op; -} - static TCGOp *copy_const_ptr(TCGOp **begin_op, TCGOp *op, void *ptr) { if (UINTPTR_MAX =3D=3D UINT32_MAX) { - /* movi_i32 */ - op =3D copy_op(begin_op, op, INDEX_op_movi_i32); - op->args[1] =3D (uintptr_t)ptr; + /* mov_i32 */ + op =3D copy_op(begin_op, op, INDEX_op_mov_i32); + op->args[1] =3D tcgv_i32_arg(tcg_constant_i32((uintptr_t)ptr)); } else { - /* movi_i64 */ - op =3D copy_movi_i64(begin_op, op, (uint64_t)(uintptr_t)ptr); + /* mov_i64 */ + op =3D copy_op(begin_op, op, INDEX_op_mov_i64); + op->args[1] =3D tcgv_i64_arg(tcg_constant_i64((uintptr_t)ptr)); } return op; } =20 static TCGOp *copy_const_i64(TCGOp **begin_op, TCGOp *op, uint64_t v) { - return copy_movi_i64(begin_op, op, v); + if (TCG_TARGET_REG_BITS =3D=3D 32) { + /* 2x mov_i32 */ + op =3D copy_op(begin_op, op, INDEX_op_mov_i32); + op->args[1] =3D tcgv_i32_arg(tcg_constant_i32(v)); + op =3D copy_op(begin_op, op, INDEX_op_mov_i32); + op->args[1] =3D tcgv_i32_arg(tcg_constant_i32(v >> 32)); + } else { + /* mov_i64 */ + op =3D copy_op(begin_op, op, INDEX_op_mov_i64); + op->args[1] =3D tcgv_i64_arg(tcg_constant_i64(v)); + } + return op; } =20 static TCGOp *copy_extu_tl_i64(TCGOp **begin_op, TCGOp *op) @@ -486,8 +481,8 @@ static TCGOp *append_mem_cb(const struct qemu_plugin_dy= n_cb *cb, =20 tcg_debug_assert(type =3D=3D PLUGIN_GEN_CB_MEM); =20 - /* const_i32 =3D=3D movi_i32 ("info", so it remains as is) */ - op =3D copy_op(&begin_op, op, INDEX_op_movi_i32); + /* const_i32 =3D=3D mov_i32 ("info", so it remains as is) */ + op =3D copy_op(&begin_op, op, INDEX_op_mov_i32); =20 /* const_ptr */ op =3D copy_const_ptr(&begin_op, op, cb->userp); --=20 2.25.1 From nobody Sat May 18 21:45:31 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1608244205; cv=none; d=zohomail.com; s=zohoarc; b=X0W4l11z0o34C+1gcj4LzAJxUS8k8sFiY+G/Bnf5zj7yTOSWAVYcI1uxIwkasMO/xQnufwvwYEW6jmp8DWe9nLiRiTLrvusbZvzGBj4LM23REaU2HEuCG7cdjoJY6nCbaBOhzW+K6Kc90OndEpUMQfucl8Ptg8E21q57i69ohog= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608244205; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ox5YWQlNJNlsuA0qRB89A1f0SSeK3bMPNyOLlduLqTk=; b=LHaPWHVTbYK6EvJvBq7WlPkPva1QrLbXx3lgnhlHVAUCCzJSKEaLtGH7/CY8WCbgbXqSkmQBfYPshKfsV/J71tvsm5hps3/UnTb5rtnI48gF/+4KQpzan1l55ayIhCu4HnPw55/6R+gsz0Z4Cl0BcmJwiYWG+PR2NyjDB3v7IZM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1608244205125984.3754707758781; Thu, 17 Dec 2020 14:30:05 -0800 (PST) Received: from localhost ([::1]:35884 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpuxQ-0006ER-OM for importer@patchew.org; Thu, 17 Dec 2020 10:12:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33388) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpue5-0003cg-ES for qemu-devel@nongnu.org; Thu, 17 Dec 2020 09:52:45 -0500 Received: from mail-ot1-x32f.google.com ([2607:f8b0:4864:20::32f]:43574) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kpudx-0004y5-Ax for qemu-devel@nongnu.org; Thu, 17 Dec 2020 09:52:45 -0500 Received: by mail-ot1-x32f.google.com with SMTP id q25so27503520otn.10 for ; Thu, 17 Dec 2020 06:52:36 -0800 (PST) Received: from localhost.localdomain (fixed-187-189-51-144.totalplay.net. [187.189.51.144]) by smtp.gmail.com with ESMTPSA id x130sm1136342oif.3.2020.12.17.06.52.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Dec 2020 06:52:34 -0800 (PST) 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:mime-version :content-transfer-encoding; bh=ox5YWQlNJNlsuA0qRB89A1f0SSeK3bMPNyOLlduLqTk=; b=xo92cT6mnWM8GzRlzWnY7vfCRPJP8Qgm1rOLxP6WJ9mhYUpqncnc0PVmdOzqSIJBf3 7D1jUtL0L51yCfq2NbsQVHd5HnMMii7+fJFwcQabLhc4BldIlkR92HiqgCJO3ILrSIFw mM0nR++JupgFGzLFlSlu/EEd/MVlmoXsVfGwCOsY7qHzuN/BGOFOBfpVG7lHD0UDIPwS M/I9ia4DmoNajaJgNjktUX5kZxCO6brveRZdpF4Yos1DdDvZxzY8Ub/VzQ/cCMCxz5np 8gRKhohnk0XH6hl168fiC2IBPQdTF31ZKIKWWFjonWFbJGbzL0OheW4iGvMlcvJ9lUmN 4wLw== 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:mime-version:content-transfer-encoding; bh=ox5YWQlNJNlsuA0qRB89A1f0SSeK3bMPNyOLlduLqTk=; b=XtCChYoOnS8uOPWQVDFAaXkWf4YK0YSLmHog64utk8CH/blBQmlL6jga5bky3SgtKQ 95UEkrBIcnBeF2vRr1qSg9fN8BQv5JqsPnPyL4RQSH+kteRai7T74TILWyBpAaThvnts tKWswA3B35um0xblpPFEaqS1G0kbsdWwp4YmfnVwL9YsTrcItrcVbx3MVSRonIMA0pBv wxGg4oT07nLq7I4Lz9m+WMTOorUUPkJqwS9NCFqAMG+zofYzcrzpeSR3YDqAGbT7DQaz xdfFnOB8DYnaCPCoo7zRz9d4/7mfWedwlzAH2DPCvK/ru6hWDCnhyKX1ZR5UovaxTTly jPgA== X-Gm-Message-State: AOAM533zSqQkUlnohfb/uE1NK8/+ncEkqOo/p8cr4SV257jd6BLIooYH psfFZNGwAveS40ZuGJkqceJ4St/gviPCk6ny X-Google-Smtp-Source: ABdhPJx4LIkaruCswCCDcESxMrMZJgl5jqk5LUslycq0NNjeBnnDXEA9jXY+ixyUPo8S4iT7ipLbAA== X-Received: by 2002:a05:6830:402c:: with SMTP id i12mr29840113ots.25.1608216755288; Thu, 17 Dec 2020 06:52:35 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 16/23] tcg: Use tcg_constant_{i32, i64, vec} with gvec expanders Date: Thu, 17 Dec 2020 08:52:08 -0600 Message-Id: <20201217145215.534637-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201217145215.534637-1-richard.henderson@linaro.org> References: <20201217145215.534637-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::32f; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson --- include/tcg/tcg.h | 1 + tcg/tcg-op-gvec.c | 125 ++++++++++++++++++---------------------------- tcg/tcg.c | 8 +++ 3 files changed, 58 insertions(+), 76 deletions(-) diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index 995db20d02..5a5413f0d4 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -1083,6 +1083,7 @@ static inline TCGv_i64 tcg_constant_i64(int64_t val) } =20 TCGv_vec tcg_constant_vec(TCGType type, unsigned vece, int64_t val); +TCGv_vec tcg_constant_vec_matching(TCGv_vec match, unsigned vece, int64_t = val); =20 #if UINTPTR_MAX =3D=3D UINT32_MAX # define tcg_const_ptr(x) ((TCGv_ptr)tcg_const_i32((intptr_t)(x))) diff --git a/tcg/tcg-op-gvec.c b/tcg/tcg-op-gvec.c index ddbe06b71a..80eb53c770 100644 --- a/tcg/tcg-op-gvec.c +++ b/tcg/tcg-op-gvec.c @@ -115,7 +115,7 @@ void tcg_gen_gvec_2_ool(uint32_t dofs, uint32_t aofs, gen_helper_gvec_2 *fn) { TCGv_ptr a0, a1; - TCGv_i32 desc =3D tcg_const_i32(simd_desc(oprsz, maxsz, data)); + TCGv_i32 desc =3D tcg_constant_i32(simd_desc(oprsz, maxsz, data)); =20 a0 =3D tcg_temp_new_ptr(); a1 =3D tcg_temp_new_ptr(); @@ -127,7 +127,6 @@ void tcg_gen_gvec_2_ool(uint32_t dofs, uint32_t aofs, =20 tcg_temp_free_ptr(a0); tcg_temp_free_ptr(a1); - tcg_temp_free_i32(desc); } =20 /* Generate a call to a gvec-style helper with two vector operands @@ -137,7 +136,7 @@ void tcg_gen_gvec_2i_ool(uint32_t dofs, uint32_t aofs, = TCGv_i64 c, gen_helper_gvec_2i *fn) { TCGv_ptr a0, a1; - TCGv_i32 desc =3D tcg_const_i32(simd_desc(oprsz, maxsz, data)); + TCGv_i32 desc =3D tcg_constant_i32(simd_desc(oprsz, maxsz, data)); =20 a0 =3D tcg_temp_new_ptr(); a1 =3D tcg_temp_new_ptr(); @@ -149,7 +148,6 @@ void tcg_gen_gvec_2i_ool(uint32_t dofs, uint32_t aofs, = TCGv_i64 c, =20 tcg_temp_free_ptr(a0); tcg_temp_free_ptr(a1); - tcg_temp_free_i32(desc); } =20 /* Generate a call to a gvec-style helper with three vector operands. */ @@ -158,7 +156,7 @@ void tcg_gen_gvec_3_ool(uint32_t dofs, uint32_t aofs, u= int32_t bofs, gen_helper_gvec_3 *fn) { TCGv_ptr a0, a1, a2; - TCGv_i32 desc =3D tcg_const_i32(simd_desc(oprsz, maxsz, data)); + TCGv_i32 desc =3D tcg_constant_i32(simd_desc(oprsz, maxsz, data)); =20 a0 =3D tcg_temp_new_ptr(); a1 =3D tcg_temp_new_ptr(); @@ -173,7 +171,6 @@ void tcg_gen_gvec_3_ool(uint32_t dofs, uint32_t aofs, u= int32_t bofs, tcg_temp_free_ptr(a0); tcg_temp_free_ptr(a1); tcg_temp_free_ptr(a2); - tcg_temp_free_i32(desc); } =20 /* Generate a call to a gvec-style helper with four vector operands. */ @@ -182,7 +179,7 @@ void tcg_gen_gvec_4_ool(uint32_t dofs, uint32_t aofs, u= int32_t bofs, int32_t data, gen_helper_gvec_4 *fn) { TCGv_ptr a0, a1, a2, a3; - TCGv_i32 desc =3D tcg_const_i32(simd_desc(oprsz, maxsz, data)); + TCGv_i32 desc =3D tcg_constant_i32(simd_desc(oprsz, maxsz, data)); =20 a0 =3D tcg_temp_new_ptr(); a1 =3D tcg_temp_new_ptr(); @@ -200,7 +197,6 @@ void tcg_gen_gvec_4_ool(uint32_t dofs, uint32_t aofs, u= int32_t bofs, tcg_temp_free_ptr(a1); tcg_temp_free_ptr(a2); tcg_temp_free_ptr(a3); - tcg_temp_free_i32(desc); } =20 /* Generate a call to a gvec-style helper with five vector operands. */ @@ -209,7 +205,7 @@ void tcg_gen_gvec_5_ool(uint32_t dofs, uint32_t aofs, u= int32_t bofs, uint32_t maxsz, int32_t data, gen_helper_gvec_5 *f= n) { TCGv_ptr a0, a1, a2, a3, a4; - TCGv_i32 desc =3D tcg_const_i32(simd_desc(oprsz, maxsz, data)); + TCGv_i32 desc =3D tcg_constant_i32(simd_desc(oprsz, maxsz, data)); =20 a0 =3D tcg_temp_new_ptr(); a1 =3D tcg_temp_new_ptr(); @@ -230,7 +226,6 @@ void tcg_gen_gvec_5_ool(uint32_t dofs, uint32_t aofs, u= int32_t bofs, tcg_temp_free_ptr(a2); tcg_temp_free_ptr(a3); tcg_temp_free_ptr(a4); - tcg_temp_free_i32(desc); } =20 /* Generate a call to a gvec-style helper with three vector operands @@ -240,7 +235,7 @@ void tcg_gen_gvec_2_ptr(uint32_t dofs, uint32_t aofs, int32_t data, gen_helper_gvec_2_ptr *fn) { TCGv_ptr a0, a1; - TCGv_i32 desc =3D tcg_const_i32(simd_desc(oprsz, maxsz, data)); + TCGv_i32 desc =3D tcg_constant_i32(simd_desc(oprsz, maxsz, data)); =20 a0 =3D tcg_temp_new_ptr(); a1 =3D tcg_temp_new_ptr(); @@ -252,7 +247,6 @@ void tcg_gen_gvec_2_ptr(uint32_t dofs, uint32_t aofs, =20 tcg_temp_free_ptr(a0); tcg_temp_free_ptr(a1); - tcg_temp_free_i32(desc); } =20 /* Generate a call to a gvec-style helper with three vector operands @@ -262,7 +256,7 @@ void tcg_gen_gvec_3_ptr(uint32_t dofs, uint32_t aofs, u= int32_t bofs, int32_t data, gen_helper_gvec_3_ptr *fn) { TCGv_ptr a0, a1, a2; - TCGv_i32 desc =3D tcg_const_i32(simd_desc(oprsz, maxsz, data)); + TCGv_i32 desc =3D tcg_constant_i32(simd_desc(oprsz, maxsz, data)); =20 a0 =3D tcg_temp_new_ptr(); a1 =3D tcg_temp_new_ptr(); @@ -277,7 +271,6 @@ void tcg_gen_gvec_3_ptr(uint32_t dofs, uint32_t aofs, u= int32_t bofs, tcg_temp_free_ptr(a0); tcg_temp_free_ptr(a1); tcg_temp_free_ptr(a2); - tcg_temp_free_i32(desc); } =20 /* Generate a call to a gvec-style helper with four vector operands @@ -288,7 +281,7 @@ void tcg_gen_gvec_4_ptr(uint32_t dofs, uint32_t aofs, u= int32_t bofs, gen_helper_gvec_4_ptr *fn) { TCGv_ptr a0, a1, a2, a3; - TCGv_i32 desc =3D tcg_const_i32(simd_desc(oprsz, maxsz, data)); + TCGv_i32 desc =3D tcg_constant_i32(simd_desc(oprsz, maxsz, data)); =20 a0 =3D tcg_temp_new_ptr(); a1 =3D tcg_temp_new_ptr(); @@ -306,7 +299,6 @@ void tcg_gen_gvec_4_ptr(uint32_t dofs, uint32_t aofs, u= int32_t bofs, tcg_temp_free_ptr(a1); tcg_temp_free_ptr(a2); tcg_temp_free_ptr(a3); - tcg_temp_free_i32(desc); } =20 /* Generate a call to a gvec-style helper with five vector operands @@ -317,7 +309,7 @@ void tcg_gen_gvec_5_ptr(uint32_t dofs, uint32_t aofs, u= int32_t bofs, gen_helper_gvec_5_ptr *fn) { TCGv_ptr a0, a1, a2, a3, a4; - TCGv_i32 desc =3D tcg_const_i32(simd_desc(oprsz, maxsz, data)); + TCGv_i32 desc =3D tcg_constant_i32(simd_desc(oprsz, maxsz, data)); =20 a0 =3D tcg_temp_new_ptr(); a1 =3D tcg_temp_new_ptr(); @@ -338,7 +330,6 @@ void tcg_gen_gvec_5_ptr(uint32_t dofs, uint32_t aofs, u= int32_t bofs, tcg_temp_free_ptr(a2); tcg_temp_free_ptr(a3); tcg_temp_free_ptr(a4); - tcg_temp_free_i32(desc); } =20 /* Return true if we want to implement something of OPRSZ bytes @@ -602,9 +593,9 @@ static void do_dup(unsigned vece, uint32_t dofs, uint32= _t oprsz, || (TCG_TARGET_REG_BITS =3D=3D 64 && (in_c =3D=3D 0 || in_c =3D=3D -1 || !check_size_impl(oprsz, 4)))) { - t_64 =3D tcg_const_i64(in_c); + t_64 =3D tcg_constant_i64(in_c); } else { - t_32 =3D tcg_const_i32(in_c); + t_32 =3D tcg_constant_i32(in_c); } } =20 @@ -628,15 +619,14 @@ static void do_dup(unsigned vece, uint32_t dofs, uint= 32_t oprsz, /* Otherwise implement out of line. */ t_ptr =3D tcg_temp_new_ptr(); tcg_gen_addi_ptr(t_ptr, cpu_env, dofs); - t_desc =3D tcg_const_i32(simd_desc(oprsz, maxsz, 0)); + t_desc =3D tcg_constant_i32(simd_desc(oprsz, maxsz, 0)); =20 if (vece =3D=3D MO_64) { if (in_64) { gen_helper_gvec_dup64(t_ptr, t_desc, in_64); } else { - t_64 =3D tcg_const_i64(in_c); + t_64 =3D tcg_constant_i64(in_c); gen_helper_gvec_dup64(t_ptr, t_desc, t_64); - tcg_temp_free_i64(t_64); } } else { typedef void dup_fn(TCGv_ptr, TCGv_i32, TCGv_i32); @@ -648,24 +638,23 @@ static void do_dup(unsigned vece, uint32_t dofs, uint= 32_t oprsz, =20 if (in_32) { fns[vece](t_ptr, t_desc, in_32); - } else { + } else if (in_64) { t_32 =3D tcg_temp_new_i32(); - if (in_64) { - tcg_gen_extrl_i64_i32(t_32, in_64); - } else if (vece =3D=3D MO_8) { - tcg_gen_movi_i32(t_32, in_c & 0xff); - } else if (vece =3D=3D MO_16) { - tcg_gen_movi_i32(t_32, in_c & 0xffff); - } else { - tcg_gen_movi_i32(t_32, in_c); - } + tcg_gen_extrl_i64_i32(t_32, in_64); fns[vece](t_ptr, t_desc, t_32); tcg_temp_free_i32(t_32); + } else { + if (vece =3D=3D MO_8) { + in_c &=3D 0xff; + } else if (vece =3D=3D MO_16) { + in_c &=3D 0xffff; + } + t_32 =3D tcg_constant_i32(in_c); + fns[vece](t_ptr, t_desc, t_32); } } =20 tcg_temp_free_ptr(t_ptr); - tcg_temp_free_i32(t_desc); return; =20 done: @@ -1215,10 +1204,9 @@ void tcg_gen_gvec_2i(uint32_t dofs, uint32_t aofs, u= int32_t oprsz, if (g->fno) { tcg_gen_gvec_2_ool(dofs, aofs, oprsz, maxsz, c, g->fno); } else { - TCGv_i64 tcg_c =3D tcg_const_i64(c); + TCGv_i64 tcg_c =3D tcg_constant_i64(c); tcg_gen_gvec_2i_ool(dofs, aofs, tcg_c, oprsz, maxsz, c, g->fnoi); - tcg_temp_free_i64(tcg_c); } oprsz =3D maxsz; } @@ -1712,16 +1700,14 @@ static void gen_addv_mask(TCGv_i64 d, TCGv_i64 a, T= CGv_i64 b, TCGv_i64 m) =20 void tcg_gen_vec_add8_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b) { - TCGv_i64 m =3D tcg_const_i64(dup_const(MO_8, 0x80)); + TCGv_i64 m =3D tcg_constant_i64(dup_const(MO_8, 0x80)); gen_addv_mask(d, a, b, m); - tcg_temp_free_i64(m); } =20 void tcg_gen_vec_add16_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b) { - TCGv_i64 m =3D tcg_const_i64(dup_const(MO_16, 0x8000)); + TCGv_i64 m =3D tcg_constant_i64(dup_const(MO_16, 0x8000)); gen_addv_mask(d, a, b, m); - tcg_temp_free_i64(m); } =20 void tcg_gen_vec_add32_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b) @@ -1805,9 +1791,8 @@ void tcg_gen_gvec_adds(unsigned vece, uint32_t dofs, = uint32_t aofs, void tcg_gen_gvec_addi(unsigned vece, uint32_t dofs, uint32_t aofs, int64_t c, uint32_t oprsz, uint32_t maxsz) { - TCGv_i64 tmp =3D tcg_const_i64(c); + TCGv_i64 tmp =3D tcg_constant_i64(c); tcg_gen_gvec_adds(vece, dofs, aofs, tmp, oprsz, maxsz); - tcg_temp_free_i64(tmp); } =20 static const TCGOpcode vecop_list_sub[] =3D { INDEX_op_sub_vec, 0 }; @@ -1865,16 +1850,14 @@ static void gen_subv_mask(TCGv_i64 d, TCGv_i64 a, T= CGv_i64 b, TCGv_i64 m) =20 void tcg_gen_vec_sub8_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b) { - TCGv_i64 m =3D tcg_const_i64(dup_const(MO_8, 0x80)); + TCGv_i64 m =3D tcg_constant_i64(dup_const(MO_8, 0x80)); gen_subv_mask(d, a, b, m); - tcg_temp_free_i64(m); } =20 void tcg_gen_vec_sub16_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b) { - TCGv_i64 m =3D tcg_const_i64(dup_const(MO_16, 0x8000)); + TCGv_i64 m =3D tcg_constant_i64(dup_const(MO_16, 0x8000)); gen_subv_mask(d, a, b, m); - tcg_temp_free_i64(m); } =20 void tcg_gen_vec_sub32_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b) @@ -1985,9 +1968,8 @@ void tcg_gen_gvec_muls(unsigned vece, uint32_t dofs, = uint32_t aofs, void tcg_gen_gvec_muli(unsigned vece, uint32_t dofs, uint32_t aofs, int64_t c, uint32_t oprsz, uint32_t maxsz) { - TCGv_i64 tmp =3D tcg_const_i64(c); + TCGv_i64 tmp =3D tcg_constant_i64(c); tcg_gen_gvec_muls(vece, dofs, aofs, tmp, oprsz, maxsz); - tcg_temp_free_i64(tmp); } =20 void tcg_gen_gvec_ssadd(unsigned vece, uint32_t dofs, uint32_t aofs, @@ -2044,18 +2026,16 @@ void tcg_gen_gvec_sssub(unsigned vece, uint32_t dof= s, uint32_t aofs, =20 static void tcg_gen_usadd_i32(TCGv_i32 d, TCGv_i32 a, TCGv_i32 b) { - TCGv_i32 max =3D tcg_const_i32(-1); + TCGv_i32 max =3D tcg_constant_i32(-1); tcg_gen_add_i32(d, a, b); tcg_gen_movcond_i32(TCG_COND_LTU, d, d, a, max, d); - tcg_temp_free_i32(max); } =20 static void tcg_gen_usadd_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b) { - TCGv_i64 max =3D tcg_const_i64(-1); + TCGv_i64 max =3D tcg_constant_i64(-1); tcg_gen_add_i64(d, a, b); tcg_gen_movcond_i64(TCG_COND_LTU, d, d, a, max, d); - tcg_temp_free_i64(max); } =20 void tcg_gen_gvec_usadd(unsigned vece, uint32_t dofs, uint32_t aofs, @@ -2088,18 +2068,16 @@ void tcg_gen_gvec_usadd(unsigned vece, uint32_t dof= s, uint32_t aofs, =20 static void tcg_gen_ussub_i32(TCGv_i32 d, TCGv_i32 a, TCGv_i32 b) { - TCGv_i32 min =3D tcg_const_i32(0); + TCGv_i32 min =3D tcg_constant_i32(0); tcg_gen_sub_i32(d, a, b); tcg_gen_movcond_i32(TCG_COND_LTU, d, a, b, min, d); - tcg_temp_free_i32(min); } =20 static void tcg_gen_ussub_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b) { - TCGv_i64 min =3D tcg_const_i64(0); + TCGv_i64 min =3D tcg_constant_i64(0); tcg_gen_sub_i64(d, a, b); tcg_gen_movcond_i64(TCG_COND_LTU, d, a, b, min, d); - tcg_temp_free_i64(min); } =20 void tcg_gen_gvec_ussub(unsigned vece, uint32_t dofs, uint32_t aofs, @@ -2260,16 +2238,14 @@ static void gen_negv_mask(TCGv_i64 d, TCGv_i64 b, T= CGv_i64 m) =20 void tcg_gen_vec_neg8_i64(TCGv_i64 d, TCGv_i64 b) { - TCGv_i64 m =3D tcg_const_i64(dup_const(MO_8, 0x80)); + TCGv_i64 m =3D tcg_constant_i64(dup_const(MO_8, 0x80)); gen_negv_mask(d, b, m); - tcg_temp_free_i64(m); } =20 void tcg_gen_vec_neg16_i64(TCGv_i64 d, TCGv_i64 b) { - TCGv_i64 m =3D tcg_const_i64(dup_const(MO_16, 0x8000)); + TCGv_i64 m =3D tcg_constant_i64(dup_const(MO_16, 0x8000)); gen_negv_mask(d, b, m); - tcg_temp_free_i64(m); } =20 void tcg_gen_vec_neg32_i64(TCGv_i64 d, TCGv_i64 b) @@ -2538,9 +2514,8 @@ void tcg_gen_gvec_ands(unsigned vece, uint32_t dofs, = uint32_t aofs, void tcg_gen_gvec_andi(unsigned vece, uint32_t dofs, uint32_t aofs, int64_t c, uint32_t oprsz, uint32_t maxsz) { - TCGv_i64 tmp =3D tcg_const_i64(dup_const(vece, c)); + TCGv_i64 tmp =3D tcg_constant_i64(dup_const(vece, c)); tcg_gen_gvec_2s(dofs, aofs, oprsz, maxsz, tmp, &gop_ands); - tcg_temp_free_i64(tmp); } =20 static const GVecGen2s gop_xors =3D { @@ -2563,9 +2538,8 @@ void tcg_gen_gvec_xors(unsigned vece, uint32_t dofs, = uint32_t aofs, void tcg_gen_gvec_xori(unsigned vece, uint32_t dofs, uint32_t aofs, int64_t c, uint32_t oprsz, uint32_t maxsz) { - TCGv_i64 tmp =3D tcg_const_i64(dup_const(vece, c)); + TCGv_i64 tmp =3D tcg_constant_i64(dup_const(vece, c)); tcg_gen_gvec_2s(dofs, aofs, oprsz, maxsz, tmp, &gop_xors); - tcg_temp_free_i64(tmp); } =20 static const GVecGen2s gop_ors =3D { @@ -2588,9 +2562,8 @@ void tcg_gen_gvec_ors(unsigned vece, uint32_t dofs, u= int32_t aofs, void tcg_gen_gvec_ori(unsigned vece, uint32_t dofs, uint32_t aofs, int64_t c, uint32_t oprsz, uint32_t maxsz) { - TCGv_i64 tmp =3D tcg_const_i64(dup_const(vece, c)); + TCGv_i64 tmp =3D tcg_constant_i64(dup_const(vece, c)); tcg_gen_gvec_2s(dofs, aofs, oprsz, maxsz, tmp, &gop_ors); - tcg_temp_free_i64(tmp); } =20 void tcg_gen_vec_shl8i_i64(TCGv_i64 d, TCGv_i64 a, int64_t c) @@ -3078,9 +3051,9 @@ static void tcg_gen_shlv_mod_vec(unsigned vece, TCGv_= vec d, TCGv_vec a, TCGv_vec b) { TCGv_vec t =3D tcg_temp_new_vec_matching(d); + TCGv_vec m =3D tcg_constant_vec_matching(d, vece, (8 << vece) - 1); =20 - tcg_gen_dupi_vec(vece, t, (8 << vece) - 1); - tcg_gen_and_vec(vece, t, t, b); + tcg_gen_and_vec(vece, t, b, m); tcg_gen_shlv_vec(vece, d, a, t); tcg_temp_free_vec(t); } @@ -3141,9 +3114,9 @@ static void tcg_gen_shrv_mod_vec(unsigned vece, TCGv_= vec d, TCGv_vec a, TCGv_vec b) { TCGv_vec t =3D tcg_temp_new_vec_matching(d); + TCGv_vec m =3D tcg_constant_vec_matching(d, vece, (8 << vece) - 1); =20 - tcg_gen_dupi_vec(vece, t, (8 << vece) - 1); - tcg_gen_and_vec(vece, t, t, b); + tcg_gen_and_vec(vece, t, b, m); tcg_gen_shrv_vec(vece, d, a, t); tcg_temp_free_vec(t); } @@ -3204,9 +3177,9 @@ static void tcg_gen_sarv_mod_vec(unsigned vece, TCGv_= vec d, TCGv_vec a, TCGv_vec b) { TCGv_vec t =3D tcg_temp_new_vec_matching(d); + TCGv_vec m =3D tcg_constant_vec_matching(d, vece, (8 << vece) - 1); =20 - tcg_gen_dupi_vec(vece, t, (8 << vece) - 1); - tcg_gen_and_vec(vece, t, t, b); + tcg_gen_and_vec(vece, t, b, m); tcg_gen_sarv_vec(vece, d, a, t); tcg_temp_free_vec(t); } @@ -3267,9 +3240,9 @@ static void tcg_gen_rotlv_mod_vec(unsigned vece, TCGv= _vec d, TCGv_vec a, TCGv_vec b) { TCGv_vec t =3D tcg_temp_new_vec_matching(d); + TCGv_vec m =3D tcg_constant_vec_matching(d, vece, (8 << vece) - 1); =20 - tcg_gen_dupi_vec(vece, t, (8 << vece) - 1); - tcg_gen_and_vec(vece, t, t, b); + tcg_gen_and_vec(vece, t, b, m); tcg_gen_rotlv_vec(vece, d, a, t); tcg_temp_free_vec(t); } @@ -3326,9 +3299,9 @@ static void tcg_gen_rotrv_mod_vec(unsigned vece, TCGv= _vec d, TCGv_vec a, TCGv_vec b) { TCGv_vec t =3D tcg_temp_new_vec_matching(d); + TCGv_vec m =3D tcg_constant_vec_matching(d, vece, (8 << vece) - 1); =20 - tcg_gen_dupi_vec(vece, t, (8 << vece) - 1); - tcg_gen_and_vec(vece, t, t, b); + tcg_gen_and_vec(vece, t, b, m); tcg_gen_rotrv_vec(vece, d, a, t); tcg_temp_free_vec(t); } diff --git a/tcg/tcg.c b/tcg/tcg.c index 500663e3f5..231d1950ed 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -1424,6 +1424,14 @@ TCGv_vec tcg_constant_vec(TCGType type, unsigned vec= e, int64_t val) return temp_tcgv_vec(tcg_constant_internal(type, val)); } =20 +TCGv_vec tcg_constant_vec_matching(TCGv_vec match, unsigned vece, int64_t = val) +{ + TCGTemp *t =3D tcgv_vec_temp(match); + + tcg_debug_assert(t->temp_allocated !=3D 0); + return tcg_constant_vec(t->base_type, vece, val); +} + TCGv_i32 tcg_const_i32(int32_t val) { TCGv_i32 t0; --=20 2.25.1 From nobody Sat May 18 21:45:31 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1608217145; cv=none; d=zohomail.com; s=zohoarc; b=WSkgE9EHnvnhDDY+BiLSa4KddMEQOt+21hcAPUBhiI/JHrJ7Jgvc6COoXiefyljd/olEkmpjHUF/zgfK8KL+QRkAP6qcTetQQSPl08tLAeEZV4CnPja6gGVItQy3S2Mugbm02Iid8NN6M+GssdeQbCpBadFsPf5OK3wwG0/EQWU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608217145; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=g/NK8zJ+1oHnRf7YalpC2REaHWJdBcpCs5uuohec03c=; b=mbe/G1B9QITyRV5PwQ+E9++695ikxTUf80e9MYuB1dbdXnoVUNJfyuqRT4cZ5m7wimH/2ytbucLtuKjes+1T221kL3K6SWbJvs2w1Pr3P9BYKFaeVhJBfkp9VGkrFzjsfq77a4emG190llQt9wifRX6huuJg9wjQUUKk+megkK4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1608217145061168.40068003890042; Thu, 17 Dec 2020 06:59:05 -0800 (PST) Received: from localhost ([::1]:34946 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpukA-0001pT-TF for importer@patchew.org; Thu, 17 Dec 2020 09:59:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33446) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpueF-0003tF-M2 for qemu-devel@nongnu.org; Thu, 17 Dec 2020 09:52:56 -0500 Received: from mail-ot1-x333.google.com ([2607:f8b0:4864:20::333]:45815) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kpudx-0004yA-Rw for qemu-devel@nongnu.org; Thu, 17 Dec 2020 09:52:54 -0500 Received: by mail-ot1-x333.google.com with SMTP id h18so27515378otq.12 for ; Thu, 17 Dec 2020 06:52:37 -0800 (PST) Received: from localhost.localdomain (fixed-187-189-51-144.totalplay.net. [187.189.51.144]) by smtp.gmail.com with ESMTPSA id x130sm1136342oif.3.2020.12.17.06.52.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Dec 2020 06:52:35 -0800 (PST) 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=g/NK8zJ+1oHnRf7YalpC2REaHWJdBcpCs5uuohec03c=; b=lMw0ZOywxjjM0quZ//K4uPZuJByne6EnDcoV1FVXTzSMKH5/ZrxoRzHsCGd2JBOPoM R+6w6O8b527f18ujJVzsL7s0AKEzuMQ44dsVEP9WM6qjr2PJFcWeJrnb13Zx9gWkF7c+ ufKnFp2cesl+XodVV853+TOobu9dVusaMn9fjDfUNImACUNuNFBHFyg6x00vclSUYqVf M1G/3Ye2mylFi5L/4EaZA7o3FBegUmuaPk9zel+lO3COKIk2YjrjJNgjHtIgEpBJO9Ft eE2l2co83/WRd3OKJSuHtX4W+xSdC0VdENrIapx+g7nQCoLnr/aFcd60EE3IoBYZAWC9 ++bg== 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=g/NK8zJ+1oHnRf7YalpC2REaHWJdBcpCs5uuohec03c=; b=dF7/EU5E3lEj/+yAtlPw7empPv9assxtHcvVSMFVmRQEnVS4V8db1gRdkJYaHiyQAp I8wC3bEa6wxim1Niztjq+KFi5r9jvVobg29H6kEc5lUCJIbnku3JdHJ7dq3H+eJvzGN5 RGGaW8SZvqNfWxYec1Txql1LTzuapbFxuyJXJpr96RAnRJbVAV8i0DvFNIYBPUDxA0Wu p+F9zOThuGkaE15JcFsa3dLES3Fnr8/XYp8N8XXDHO2iYF14PE9MdursUVcxyuo/g/Ls DI414ubn6DvuC66LobhpdUNoMla3KBFGwwMjR5OuUuwKIjCXUhyqVNqlNohkJYTpXlXz XfoQ== X-Gm-Message-State: AOAM532I0c+S/vPUSFMBo9ym8msmA+DpdaQlKX64ymDmj9cV8UW8C7jL XaOlZyP/cGpDrdSZGa35TH4HxWKSP0xqQTkz X-Google-Smtp-Source: ABdhPJyMtuHmyTyy9XExp8/Nk9Rd900PD/2idBP0OCxU8vZH+LMWVRCuqLz0b1K7+o59idyseD2xaQ== X-Received: by 2002:a9d:6b10:: with SMTP id g16mr28970771otp.301.1608216756522; Thu, 17 Dec 2020 06:52:36 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 17/23] tcg/tci: Add special tci_movi_{i32,i64} opcodes Date: Thu, 17 Dec 2020 08:52:09 -0600 Message-Id: <20201217145215.534637-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201217145215.534637-1-richard.henderson@linaro.org> References: <20201217145215.534637-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::333; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x333.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) The normal movi opcodes are going away. We need something for TCI to use internally. Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Richard Henderson --- include/tcg/tcg-opc.h | 8 ++++++++ tcg/tci.c | 4 ++-- tcg/tci/tcg-target.c.inc | 4 ++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/include/tcg/tcg-opc.h b/include/tcg/tcg-opc.h index 67092e82c6..314455b386 100644 --- a/include/tcg/tcg-opc.h +++ b/include/tcg/tcg-opc.h @@ -273,6 +273,14 @@ DEF(last_generic, 0, 0, 0, TCG_OPF_NOT_PRESENT) #include "tcg-target.opc.h" #endif =20 +#ifdef TCG_TARGET_INTERPRETER +/* These opcodes are only for use between the tci generator and interprete= r. */ +DEF(tci_movi_i32, 1, 0, 1, TCG_OPF_NOT_PRESENT) +#if TCG_TARGET_REG_BITS =3D=3D 64 +DEF(tci_movi_i64, 1, 0, 1, TCG_OPF_64BIT | TCG_OPF_NOT_PRESENT) +#endif +#endif + #undef TLADDR_ARGS #undef DATA64_ARGS #undef IMPL diff --git a/tcg/tci.c b/tcg/tci.c index 82039fd163..52b34bd70f 100644 --- a/tcg/tci.c +++ b/tcg/tci.c @@ -576,7 +576,7 @@ uintptr_t tcg_qemu_tb_exec(CPUArchState *env, uint8_t *= tb_ptr) t1 =3D tci_read_r32(regs, &tb_ptr); tci_write_reg32(regs, t0, t1); break; - case INDEX_op_movi_i32: + case INDEX_op_tci_movi_i32: t0 =3D *tb_ptr++; t1 =3D tci_read_i32(&tb_ptr); tci_write_reg32(regs, t0, t1); @@ -847,7 +847,7 @@ uintptr_t tcg_qemu_tb_exec(CPUArchState *env, uint8_t *= tb_ptr) t1 =3D tci_read_r64(regs, &tb_ptr); tci_write_reg64(regs, t0, t1); break; - case INDEX_op_movi_i64: + case INDEX_op_tci_movi_i64: t0 =3D *tb_ptr++; t1 =3D tci_read_i64(&tb_ptr); tci_write_reg64(regs, t0, t1); diff --git a/tcg/tci/tcg-target.c.inc b/tcg/tci/tcg-target.c.inc index 231b9b1775..c8c8386a72 100644 --- a/tcg/tci/tcg-target.c.inc +++ b/tcg/tci/tcg-target.c.inc @@ -529,13 +529,13 @@ static void tcg_out_movi(TCGContext *s, TCGType type, uint8_t *old_code_ptr =3D s->code_ptr; uint32_t arg32 =3D arg; if (type =3D=3D TCG_TYPE_I32 || arg =3D=3D arg32) { - tcg_out_op_t(s, INDEX_op_movi_i32); + tcg_out_op_t(s, INDEX_op_tci_movi_i32); tcg_out_r(s, t0); tcg_out32(s, arg32); } else { tcg_debug_assert(type =3D=3D TCG_TYPE_I64); #if TCG_TARGET_REG_BITS =3D=3D 64 - tcg_out_op_t(s, INDEX_op_movi_i64); + tcg_out_op_t(s, INDEX_op_tci_movi_i64); tcg_out_r(s, t0); tcg_out64(s, arg); #else --=20 2.25.1 From nobody Sat May 18 21:45:31 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1608224647; cv=none; d=zohomail.com; s=zohoarc; b=V23iYJBYcQmRNm0ksWVXuk+sM1L+pZKyxLGngaiv4JKEKC32yszb9K5fhx3V3/3fCjTG6X5IPCPtCj+zcGz3MTrN+PiAlKio77GZacbh8ve34aycx/yqYeLhu0TPSDV1ky+p+mYOjM6wZri3YDzMwn44L0IlSVP0JS6kfV8b+C4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608224647; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=T6zl2uASh6CoYxMghgzJy0NJ+a9C4k9ZiM/l/5q4INQ=; b=ddaQr0i5rc7Go+xyCBeBZaI3CNZxWlY5U3hc7ieSZ6sAM4M+QIl+xHK3sO21rcGZIY8xkALYaC0+f0AKXf/xO4exJ7D6/racliJCtxHpQfr25hkKmaNmmPhcJynt3IRFKZHgPUZPrUPI2A+gvQ47zSG3c7JFlY/I5s58iMzYdQw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1608224647578489.5329518485207; Thu, 17 Dec 2020 09:04:07 -0800 (PST) Received: from localhost ([::1]:40666 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpunM-0004Fz-IR for importer@patchew.org; Thu, 17 Dec 2020 10:02:20 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33396) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpue6-0003eZ-4q for qemu-devel@nongnu.org; Thu, 17 Dec 2020 09:52:46 -0500 Received: from mail-ot1-x330.google.com ([2607:f8b0:4864:20::330]:33209) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kpue0-0004yl-PT for qemu-devel@nongnu.org; Thu, 17 Dec 2020 09:52:45 -0500 Received: by mail-ot1-x330.google.com with SMTP id b24so10013714otj.0 for ; Thu, 17 Dec 2020 06:52:39 -0800 (PST) Received: from localhost.localdomain (fixed-187-189-51-144.totalplay.net. [187.189.51.144]) by smtp.gmail.com with ESMTPSA id x130sm1136342oif.3.2020.12.17.06.52.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Dec 2020 06:52:37 -0800 (PST) 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=T6zl2uASh6CoYxMghgzJy0NJ+a9C4k9ZiM/l/5q4INQ=; b=se/fnTbuLkaUXpDfymgz1dYtTY5eNLpYKZ4aW3+Y+ItR1PK0XCiQQeKtfdkVaywcCF fuITDGg+GZRY2tdS36L0axuYDzbOjcxj5lyFrQE8EGbHZG03DA3gRbZpa7Tk4mhyLt46 f6hXT86Ss7VyTsyE3JEiDUljDl0FDix5v65HEydq2daPN0Fbtt5UXwSulGv6ttEXthG9 82odBtsbY6omOA7tDNmJwWguZmp3M7u5FQiYHdwLRZlWIzs5305bt4E4eKvzUIaXFAEt heH4dfgCz0wzBBCzsVug/YJZRsoJWtAhUK2ZtAUmjlshEJip+55HvMOYN2L2UQOZCZqc SCLQ== 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=T6zl2uASh6CoYxMghgzJy0NJ+a9C4k9ZiM/l/5q4INQ=; b=HYFJIvMbtsmj7I92St21Rgn+p/TBjF+aWe9Zpk4eeDjQPH32SLSdBG6A49kOtgiNCl isB5CcaZAVgkagwMXWwrnRiOYdl8vooXtoqRTWClXOAzVDEYEwiC6nu0PDbrFl1KtN7o OV9C5L3Qwav9Axn8Se/IfQIGNiv44/W+hem4ezc3TdvPpaddWN9JLVKecZIRX1wmTDMG jcw/SdJtSfPKHuovlVk0BBUeMla9o38ylc+e13jwmbV4IPxXF8GXQLJGsIwKCpdlGqvn Y0ke1m99NXhqZoJIG4U87a/QGsDM0hCjAlayfMWVbWAfO37Rog504K2DXkXTeY9/SJZK /ocw== X-Gm-Message-State: AOAM530GE39XXJf9DsLLegFtRXl82g3ra+wCoLdhORn+tmTF2sID4glm DOoWNvqwH8Xp5RqRopz8p5UvKZLnqA6Kt6Ta X-Google-Smtp-Source: ABdhPJwwhldKW7o93tCdp7yRu51OBi4ifgACys0vG85A4RFQNbPp+T6Qc2Vz2dEmKlP6R2vwCEnFAg== X-Received: by 2002:a05:6830:916:: with SMTP id v22mr30201162ott.257.1608216757770; Thu, 17 Dec 2020 06:52:37 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 18/23] tcg: Remove movi and dupi opcodes Date: Thu, 17 Dec 2020 08:52:10 -0600 Message-Id: <20201217145215.534637-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201217145215.534637-1-richard.henderson@linaro.org> References: <20201217145215.534637-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::330; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x330.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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: Aleksandar Markovic , =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) These are now completely covered by mov from a TYPE_CONST temporary. Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Aleksandar Markovic Signed-off-by: Richard Henderson --- include/tcg/tcg-opc.h | 3 --- tcg/optimize.c | 4 ---- tcg/tcg-op-vec.c | 1 - tcg/tcg.c | 18 +----------------- tcg/aarch64/tcg-target.c.inc | 3 --- tcg/arm/tcg-target.c.inc | 1 - tcg/i386/tcg-target.c.inc | 3 --- tcg/mips/tcg-target.c.inc | 2 -- tcg/ppc/tcg-target.c.inc | 3 --- tcg/riscv/tcg-target.c.inc | 2 -- tcg/s390/tcg-target.c.inc | 2 -- tcg/sparc/tcg-target.c.inc | 2 -- tcg/tci/tcg-target.c.inc | 2 -- 13 files changed, 1 insertion(+), 45 deletions(-) diff --git a/include/tcg/tcg-opc.h b/include/tcg/tcg-opc.h index 314455b386..2e5860a057 100644 --- a/include/tcg/tcg-opc.h +++ b/include/tcg/tcg-opc.h @@ -45,7 +45,6 @@ DEF(br, 0, 0, 1, TCG_OPF_BB_END) DEF(mb, 0, 0, 1, 0) =20 DEF(mov_i32, 1, 1, 0, TCG_OPF_NOT_PRESENT) -DEF(movi_i32, 1, 0, 1, TCG_OPF_NOT_PRESENT) DEF(setcond_i32, 1, 2, 1, 0) DEF(movcond_i32, 1, 4, 1, IMPL(TCG_TARGET_HAS_movcond_i32)) /* load/store */ @@ -111,7 +110,6 @@ DEF(ctz_i32, 1, 2, 0, IMPL(TCG_TARGET_HAS_ctz_i32)) DEF(ctpop_i32, 1, 1, 0, IMPL(TCG_TARGET_HAS_ctpop_i32)) =20 DEF(mov_i64, 1, 1, 0, TCG_OPF_64BIT | TCG_OPF_NOT_PRESENT) -DEF(movi_i64, 1, 0, 1, TCG_OPF_64BIT | TCG_OPF_NOT_PRESENT) DEF(setcond_i64, 1, 2, 1, IMPL64) DEF(movcond_i64, 1, 4, 1, IMPL64 | IMPL(TCG_TARGET_HAS_movcond_i64)) /* load/store */ @@ -216,7 +214,6 @@ DEF(qemu_st_i64, 0, TLADDR_ARGS + DATA64_ARGS, 1, #define IMPLVEC TCG_OPF_VECTOR | IMPL(TCG_TARGET_MAYBE_vec) =20 DEF(mov_vec, 1, 1, 0, TCG_OPF_VECTOR | TCG_OPF_NOT_PRESENT) -DEF(dupi_vec, 1, 0, 1, TCG_OPF_VECTOR | TCG_OPF_NOT_PRESENT) =20 DEF(dup_vec, 1, 1, 0, IMPLVEC) DEF(dup2_vec, 1, 2, 0, IMPLVEC | IMPL(TCG_TARGET_REG_BITS =3D=3D 32)) diff --git a/tcg/optimize.c b/tcg/optimize.c index af07c6f628..1a94e9a41b 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -1099,10 +1099,6 @@ void tcg_optimize(TCGContext *s) CASE_OP_32_64_VEC(mov): tcg_opt_gen_mov(s, op, op->args[0], op->args[1]); break; - CASE_OP_32_64(movi): - case INDEX_op_dupi_vec: - tcg_opt_gen_movi(s, &temps_used, op, op->args[0], op->args[1]); - break; =20 case INDEX_op_dup_vec: if (arg_is_const(op->args[1])) { diff --git a/tcg/tcg-op-vec.c b/tcg/tcg-op-vec.c index 9fbed1366c..ce0d2f6e0e 100644 --- a/tcg/tcg-op-vec.c +++ b/tcg/tcg-op-vec.c @@ -83,7 +83,6 @@ bool tcg_can_emit_vecop_list(const TCGOpcode *list, case INDEX_op_xor_vec: case INDEX_op_mov_vec: case INDEX_op_dup_vec: - case INDEX_op_dupi_vec: case INDEX_op_dup2_vec: case INDEX_op_ld_vec: case INDEX_op_st_vec: diff --git a/tcg/tcg.c b/tcg/tcg.c index 231d1950ed..8def2f99e6 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -1511,7 +1511,6 @@ bool tcg_op_supported(TCGOpcode op) return TCG_TARGET_HAS_goto_ptr; =20 case INDEX_op_mov_i32: - case INDEX_op_movi_i32: case INDEX_op_setcond_i32: case INDEX_op_brcond_i32: case INDEX_op_ld8u_i32: @@ -1605,7 +1604,6 @@ bool tcg_op_supported(TCGOpcode op) return TCG_TARGET_REG_BITS =3D=3D 32; =20 case INDEX_op_mov_i64: - case INDEX_op_movi_i64: case INDEX_op_setcond_i64: case INDEX_op_brcond_i64: case INDEX_op_ld8u_i64: @@ -1711,7 +1709,6 @@ bool tcg_op_supported(TCGOpcode op) =20 case INDEX_op_mov_vec: case INDEX_op_dup_vec: - case INDEX_op_dupi_vec: case INDEX_op_dupm_vec: case INDEX_op_ld_vec: case INDEX_op_st_vec: @@ -3616,7 +3613,7 @@ static void tcg_reg_alloc_cbranch(TCGContext *s, TCGR= egSet allocated_regs) } =20 /* - * Specialized code generation for INDEX_op_movi_*. + * Specialized code generation for INDEX_op_mov_* with a constant. */ static void tcg_reg_alloc_do_movi(TCGContext *s, TCGTemp *ots, tcg_target_ulong val, TCGLifeData arg_li= fe, @@ -3639,14 +3636,6 @@ static void tcg_reg_alloc_do_movi(TCGContext *s, TCG= Temp *ots, } } =20 -static void tcg_reg_alloc_movi(TCGContext *s, const TCGOp *op) -{ - TCGTemp *ots =3D arg_temp(op->args[0]); - tcg_target_ulong val =3D op->args[1]; - - tcg_reg_alloc_do_movi(s, ots, val, op->life, op->output_pref[0]); -} - /* * Specialized code generation for INDEX_op_mov_*. */ @@ -4422,11 +4411,6 @@ int tcg_gen_code(TCGContext *s, TranslationBlock *tb) case INDEX_op_mov_vec: tcg_reg_alloc_mov(s, op); break; - case INDEX_op_movi_i32: - case INDEX_op_movi_i64: - case INDEX_op_dupi_vec: - tcg_reg_alloc_movi(s, op); - break; case INDEX_op_dup_vec: tcg_reg_alloc_dup(s, op); break; diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc index 56056be74b..a6c2d54c4d 100644 --- a/tcg/aarch64/tcg-target.c.inc +++ b/tcg/aarch64/tcg-target.c.inc @@ -2252,8 +2252,6 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, =20 case INDEX_op_mov_i32: /* Always emitted via tcg_out_mov. */ case INDEX_op_mov_i64: - case INDEX_op_movi_i32: /* Always emitted via tcg_out_movi. */ - case INDEX_op_movi_i64: case INDEX_op_call: /* Always emitted via tcg_out_call. */ default: g_assert_not_reached(); @@ -2461,7 +2459,6 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode o= pc, break; =20 case INDEX_op_mov_vec: /* Always emitted via tcg_out_mov. */ - case INDEX_op_dupi_vec: /* Always emitted via tcg_out_movi. */ case INDEX_op_dup_vec: /* Always emitted via tcg_out_dup_vec. */ default: g_assert_not_reached(); diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc index 62c37a954b..30d30874c7 100644 --- a/tcg/arm/tcg-target.c.inc +++ b/tcg/arm/tcg-target.c.inc @@ -2065,7 +2065,6 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcod= e opc, break; =20 case INDEX_op_mov_i32: /* Always emitted via tcg_out_mov. */ - case INDEX_op_movi_i32: /* Always emitted via tcg_out_movi. */ case INDEX_op_call: /* Always emitted via tcg_out_call. */ default: tcg_abort(); diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc index 6b7cbaa47a..819ee25cff 100644 --- a/tcg/i386/tcg-target.c.inc +++ b/tcg/i386/tcg-target.c.inc @@ -2692,8 +2692,6 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcod= e opc, break; case INDEX_op_mov_i32: /* Always emitted via tcg_out_mov. */ case INDEX_op_mov_i64: - case INDEX_op_movi_i32: /* Always emitted via tcg_out_movi. */ - case INDEX_op_movi_i64: case INDEX_op_call: /* Always emitted via tcg_out_call. */ default: tcg_abort(); @@ -2979,7 +2977,6 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode o= pc, break; =20 case INDEX_op_mov_vec: /* Always emitted via tcg_out_mov. */ - case INDEX_op_dupi_vec: /* Always emitted via tcg_out_movi. */ case INDEX_op_dup_vec: /* Always emitted via tcg_out_dup_vec. */ default: g_assert_not_reached(); diff --git a/tcg/mips/tcg-target.c.inc b/tcg/mips/tcg-target.c.inc index 41be574e89..39e7bc3f8d 100644 --- a/tcg/mips/tcg-target.c.inc +++ b/tcg/mips/tcg-target.c.inc @@ -2152,8 +2152,6 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcod= e opc, break; case INDEX_op_mov_i32: /* Always emitted via tcg_out_mov. */ case INDEX_op_mov_i64: - case INDEX_op_movi_i32: /* Always emitted via tcg_out_movi. */ - case INDEX_op_movi_i64: case INDEX_op_call: /* Always emitted via tcg_out_call. */ default: tcg_abort(); diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index 2428faeabd..163a5bb32c 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -2973,8 +2973,6 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, = const TCGArg *args, =20 case INDEX_op_mov_i32: /* Always emitted via tcg_out_mov. */ case INDEX_op_mov_i64: - case INDEX_op_movi_i32: /* Always emitted via tcg_out_movi. */ - case INDEX_op_movi_i64: case INDEX_op_call: /* Always emitted via tcg_out_call. */ default: tcg_abort(); @@ -3322,7 +3320,6 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode o= pc, return; =20 case INDEX_op_mov_vec: /* Always emitted via tcg_out_mov. */ - case INDEX_op_dupi_vec: /* Always emitted via tcg_out_movi. */ case INDEX_op_dup_vec: /* Always emitted via tcg_out_dup_vec. */ default: g_assert_not_reached(); diff --git a/tcg/riscv/tcg-target.c.inc b/tcg/riscv/tcg-target.c.inc index d536f3ccc1..aaef1c5eed 100644 --- a/tcg/riscv/tcg-target.c.inc +++ b/tcg/riscv/tcg-target.c.inc @@ -1602,8 +1602,6 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, =20 case INDEX_op_mov_i32: /* Always emitted via tcg_out_mov. */ case INDEX_op_mov_i64: - case INDEX_op_movi_i32: /* Always emitted via tcg_out_movi. */ - case INDEX_op_movi_i64: case INDEX_op_call: /* Always emitted via tcg_out_call. */ default: g_assert_not_reached(); diff --git a/tcg/s390/tcg-target.c.inc b/tcg/s390/tcg-target.c.inc index c5e096449b..824a07aa7a 100644 --- a/tcg/s390/tcg-target.c.inc +++ b/tcg/s390/tcg-target.c.inc @@ -2306,8 +2306,6 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcod= e opc, =20 case INDEX_op_mov_i32: /* Always emitted via tcg_out_mov. */ case INDEX_op_mov_i64: - case INDEX_op_movi_i32: /* Always emitted via tcg_out_movi. */ - case INDEX_op_movi_i64: case INDEX_op_call: /* Always emitted via tcg_out_call. */ default: tcg_abort(); diff --git a/tcg/sparc/tcg-target.c.inc b/tcg/sparc/tcg-target.c.inc index 6775bd30fc..79e1a96aac 100644 --- a/tcg/sparc/tcg-target.c.inc +++ b/tcg/sparc/tcg-target.c.inc @@ -1586,8 +1586,6 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, =20 case INDEX_op_mov_i32: /* Always emitted via tcg_out_mov. */ case INDEX_op_mov_i64: - case INDEX_op_movi_i32: /* Always emitted via tcg_out_movi. */ - case INDEX_op_movi_i64: case INDEX_op_call: /* Always emitted via tcg_out_call. */ default: tcg_abort(); diff --git a/tcg/tci/tcg-target.c.inc b/tcg/tci/tcg-target.c.inc index c8c8386a72..25ed868505 100644 --- a/tcg/tci/tcg-target.c.inc +++ b/tcg/tci/tcg-target.c.inc @@ -814,8 +814,6 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, co= nst TCGArg *args, break; case INDEX_op_mov_i32: /* Always emitted via tcg_out_mov. */ case INDEX_op_mov_i64: - case INDEX_op_movi_i32: /* Always emitted via tcg_out_movi. */ - case INDEX_op_movi_i64: case INDEX_op_call: /* Always emitted via tcg_out_call. */ default: tcg_abort(); --=20 2.25.1 From nobody Sat May 18 21:45:31 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1608217088; cv=none; d=zohomail.com; s=zohoarc; b=cPqhsJMoijhc4i4xrhTcmEc4XVKuEAkBB8J2+C0G6I+ooF73zwZqyAhAQEk82B4CD5H6nJH40KhAnsv2vsH+7PXT2famkJC7iLBJhSZvGtu+JFYPEeRcDV3wSZ2yb0RE1Id9GvsTfyXdMKlGaF6I41iwo0oal15Q9nYDUwKgigg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608217088; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=7smMUJ3GTwe/WfNNy/U+eGwwMqkpocbG1ZOKTJ5WLrw=; b=eFj47Mb/rikPm4wBOd8fT3a3zN0jAFLbOOCUVNzgyDAkKG25C1Gr1YG0Ioz8TWiF8Qs1QC6kD3ohrYNKga1qdyV2fyi0/roASK8SE/7lWWm9jlWktnmJ7nr9WrnH0EJpCP67htOb4eInHegh6B6AF/bEWIrsIvftQj+VBC1eFzk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1608217088378157.93794128885747; Thu, 17 Dec 2020 06:58:08 -0800 (PST) Received: from localhost ([::1]:60534 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpujG-0000m0-Rw for importer@patchew.org; Thu, 17 Dec 2020 09:58:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33372) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpue4-0003bG-RD for qemu-devel@nongnu.org; Thu, 17 Dec 2020 09:52:44 -0500 Received: from mail-oi1-x230.google.com ([2607:f8b0:4864:20::230]:42572) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kpue0-0004zQ-Qf for qemu-devel@nongnu.org; Thu, 17 Dec 2020 09:52:44 -0500 Received: by mail-oi1-x230.google.com with SMTP id l200so32405956oig.9 for ; Thu, 17 Dec 2020 06:52:39 -0800 (PST) Received: from localhost.localdomain (fixed-187-189-51-144.totalplay.net. [187.189.51.144]) by smtp.gmail.com with ESMTPSA id x130sm1136342oif.3.2020.12.17.06.52.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Dec 2020 06:52:38 -0800 (PST) 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:mime-version :content-transfer-encoding; bh=7smMUJ3GTwe/WfNNy/U+eGwwMqkpocbG1ZOKTJ5WLrw=; b=aihn+utz6fKF5JU3te3+cKyCh6ajzt5ghaeROUMI6UhGmdvtiq1iP+qPXNcFuBk4sE r1HSCZfSwMrwCLSSJ+qHZSu2bzO4uvg8lvjruwrZlJti8eRpSnll3T52YiUNTOUuTHCM D+bUCkFtUDuAIv7dxBkquwn1OG4PKv8R5h/GndiqS6uZOe6eKF6HTQNa6rtBM2Jy/zil 0Zk6fCFggV4N+yBdnyFQXSQ/LZJn8/BKwMt7ZTJlim1xkEetdh80yGiGwkZ05FyWOWgu WwPslwm+K+2J6spcCN2/19IxeW1q6Gl5Y9tRq4ibT3axM8PUyUrGZO9fcRHHqCDpkuYN O30g== 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:mime-version:content-transfer-encoding; bh=7smMUJ3GTwe/WfNNy/U+eGwwMqkpocbG1ZOKTJ5WLrw=; b=GfiiRwTfIb4mmTTbvJn3/LS76Nx5W5I4tmAhbhIR7bVxzvItwiojGPxaf42ss6sbU7 XAsmfJgV+opiOkkMmKbHi+YHTiOLMSP2HRIqYJCf4Gz7IU2JutaM0G/MR6TIk7HqGVbL oya1eddwVH0KqY/Udidhv6qZEannIWgHD8NFTPWh2Qs1++YLlqElDyNr/50S+S1+vc2E z/oW4pTqr7eDh5wYgeNbNFqX0ML3WGAzdcs9YGllIiP8muKBzLd3uUdBEu0+y/0KVVf/ 6fZYmhwfHUzLyTvlUtLMYw7w/fG/b51bdLXPH01HC9eZ4F19G9dRF6mlmloQYBRUZDbv 2TMQ== X-Gm-Message-State: AOAM530rw3+MMCyPbCT9QJl1wErg5a7OnQQOYKvUVGXNtZRvEnQI0sDT wutJ8tklbou9JBiOQHy8ji5T9AiOh5D5qyxr X-Google-Smtp-Source: ABdhPJx3RS86MdOdbpYgJcZGiar9jK3bh9a1FQBm2J2sugZmjvoMzNFc4BveLWWN1yX8oRynFF5IDA== X-Received: by 2002:aca:c1d6:: with SMTP id r205mr5002914oif.37.1608216758795; Thu, 17 Dec 2020 06:52:38 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 19/23] tcg: Add tcg_reg_alloc_dup2 Date: Thu, 17 Dec 2020 08:52:11 -0600 Message-Id: <20201217145215.534637-20-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201217145215.534637-1-richard.henderson@linaro.org> References: <20201217145215.534637-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::230; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x230.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" There are several ways we can expand a vector dup of a 64-bit element on a 32-bit host. Signed-off-by: Richard Henderson --- tcg/tcg.c | 97 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) diff --git a/tcg/tcg.c b/tcg/tcg.c index 8def2f99e6..09a82d444f 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -4030,6 +4030,98 @@ static void tcg_reg_alloc_op(TCGContext *s, const TC= GOp *op) } } =20 +static bool tcg_reg_alloc_dup2(TCGContext *s, const TCGOp *op) +{ + const TCGLifeData arg_life =3D op->life; + TCGTemp *ots, *itsl, *itsh; + TCGType vtype =3D TCGOP_VECL(op) + TCG_TYPE_V64; + + /* This opcode is only valid for 32-bit hosts, for 64-bit elements. */ + tcg_debug_assert(TCG_TARGET_REG_BITS =3D=3D 32); + tcg_debug_assert(TCGOP_VECE(op) =3D=3D MO_64); + + ots =3D arg_temp(op->args[0]); + itsl =3D arg_temp(op->args[1]); + itsh =3D arg_temp(op->args[2]); + + /* ENV should not be modified. */ + tcg_debug_assert(!temp_readonly(ots)); + + /* Allocate the output register now. */ + if (ots->val_type !=3D TEMP_VAL_REG) { + TCGRegSet allocated_regs =3D s->reserved_regs; + TCGRegSet dup_out_regs =3D + tcg_op_defs[INDEX_op_dup_vec].args_ct[0].regs; + + /* Make sure to not spill the input registers. */ + if (!IS_DEAD_ARG(1) && itsl->val_type =3D=3D TEMP_VAL_REG) { + tcg_regset_set_reg(allocated_regs, itsl->reg); + } + if (!IS_DEAD_ARG(2) && itsh->val_type =3D=3D TEMP_VAL_REG) { + tcg_regset_set_reg(allocated_regs, itsh->reg); + } + + ots->reg =3D tcg_reg_alloc(s, dup_out_regs, allocated_regs, + op->output_pref[0], ots->indirect_base); + ots->val_type =3D TEMP_VAL_REG; + ots->mem_coherent =3D 0; + s->reg_to_temp[ots->reg] =3D ots; + } + + /* Promote dup2 of immediates to dupi_vec. */ + if (itsl->val_type =3D=3D TEMP_VAL_CONST && itsh->val_type =3D=3D TEMP= _VAL_CONST) { + uint64_t val =3D deposit64(itsl->val, 32, 32, itsh->val); + MemOp vece =3D MO_64; + + if (val =3D=3D dup_const(MO_8, val)) { + vece =3D MO_8; + } else if (val =3D=3D dup_const(MO_16, val)) { + vece =3D MO_16; + } else if (val =3D=3D dup_const(MO_32, val)) { + vece =3D MO_32; + } + + tcg_out_dupi_vec(s, vtype, vece, ots->reg, val); + goto done; + } + + /* If the two inputs form one 64-bit value, try dupm_vec. */ + if (itsl + 1 =3D=3D itsh && itsl->base_type =3D=3D TCG_TYPE_I64) { + if (!itsl->mem_coherent) { + temp_sync(s, itsl, s->reserved_regs, 0, 0); + } + if (!itsh->mem_coherent) { + temp_sync(s, itsh, s->reserved_regs, 0, 0); + } +#ifdef HOST_WORDS_BIGENDIAN + TCGTemp *its =3D itsh; +#else + TCGTemp *its =3D itsl; +#endif + if (tcg_out_dupm_vec(s, vtype, MO_64, ots->reg, + its->mem_base->reg, its->mem_offset)) { + goto done; + } + } + + /* Fall back to generic expansion. */ + return false; + + done: + if (IS_DEAD_ARG(1)) { + temp_dead(s, itsl); + } + if (IS_DEAD_ARG(2)) { + temp_dead(s, itsh); + } + if (NEED_SYNC_ARG(0)) { + temp_sync(s, ots, s->reserved_regs, 0, IS_DEAD_ARG(0)); + } else if (IS_DEAD_ARG(0)) { + temp_dead(s, ots); + } + return true; +} + #ifdef TCG_TARGET_STACK_GROWSUP #define STACK_DIR(x) (-(x)) #else @@ -4442,6 +4534,11 @@ int tcg_gen_code(TCGContext *s, TranslationBlock *tb) case INDEX_op_call: tcg_reg_alloc_call(s, op); break; + case INDEX_op_dup2_vec: + if (tcg_reg_alloc_dup2(s, op)) { + break; + } + /* fall through */ default: /* Sanity check that we've not introduced any unhandled opcode= s. */ tcg_debug_assert(tcg_op_supported(opc)); --=20 2.25.1 From nobody Sat May 18 21:45:31 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1608248070; cv=none; d=zohomail.com; s=zohoarc; b=huOUAoDBqKPBoRbsIv9E97qZQLuJbEkLr9w7sgipVaMsvliz6qVQHGeSa3SpGbSTGN5nFUnIp6LPfVVk/4ByfPBcKbhH7ypGfeGvCt0vtrUIk9s3NAZ3hHhGbn5fl5BAqssCq5vmKHfW/hYCOupyGf/Vha73ngoVL39TXit364E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608248070; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=YeAFN1TxVwViZ21GVBc/8//iF1bKTyiFYfoX+LM9wcw=; b=csDjpLlkcI/Z6tZ26jC3Dt2eST7J6Uriz3e0mYIfMWJpM7nLBUr1ZpuoglzCU3C4L+deIBqfLmmDBqjqyV+Qjs5OOsoLQmsEQZuFQrltXkKaZ6CdOFy9yc33m9pjOLQUID0m76I2aPqvmC5X3Hl7WhKAj349y9CI0ijbMmp+EtE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1608248070608102.65617283279448; Thu, 17 Dec 2020 15:34:30 -0800 (PST) Received: from localhost ([::1]:44364 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpv1l-0001gs-GK for importer@patchew.org; Thu, 17 Dec 2020 10:17:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33426) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpue8-0003iS-09 for qemu-devel@nongnu.org; Thu, 17 Dec 2020 09:52:48 -0500 Received: from mail-ot1-x329.google.com ([2607:f8b0:4864:20::329]:44493) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kpue2-0004zg-Gg for qemu-devel@nongnu.org; Thu, 17 Dec 2020 09:52:47 -0500 Received: by mail-ot1-x329.google.com with SMTP id f16so27477195otl.11 for ; Thu, 17 Dec 2020 06:52:41 -0800 (PST) Received: from localhost.localdomain (fixed-187-189-51-144.totalplay.net. [187.189.51.144]) by smtp.gmail.com with ESMTPSA id x130sm1136342oif.3.2020.12.17.06.52.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Dec 2020 06:52:39 -0800 (PST) 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=YeAFN1TxVwViZ21GVBc/8//iF1bKTyiFYfoX+LM9wcw=; b=UlSKFHzJCW8ADKmyYlXuJfaS81Lm82wsaOdFJ98R2xwZubS+djDOjPfHKCuj97scTc fAp0eC3o+GR3Ml9sGPpYJWmIfdAhn+gDMuzyISwFqB9Mg5FAx/p9/VdTjBlRl7/867RO uhtO6fa1Vhre+XMbuiXZ53F8LmbV7qqUG5ovHoEqyqxHYOr2IS/PPAR386lhqh9KmOLE 3sdlUdS/XXf5c5WZ+Q5eRC2xKL/WOP4VK2Em7t87Ynd7UGsp2AvqvFCKSwTsMPExZfmW ZWrcqGF+kB0kyGN48qBU1MNVYyPrcnNitU3VAvO/oGYsJNjA+wtpcT+qHBopW/XUAlep 5PSQ== 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=YeAFN1TxVwViZ21GVBc/8//iF1bKTyiFYfoX+LM9wcw=; b=iiMrZfQ0kro2yjN+BqEdkcHxqJPyyyfngZiQtYMdrrqEbkv1EaNqLFxV48AmHitIS0 Qw5ZRu+QSUKd4ZfASqWKviinG2RUb/wn4Co3pOC22uCHjzfdgTYsErRd7QbI5k/9ONC8 6qjEaWZQBrpnbpsS6Y9SalTDBCpdlgZX1nRDPD5ncfZQ1k+jGHTtUIc9CKNTDityMicW Cdhik5+uKFqIuxk94aeRnZGVtPMpK0dOm7lJ+Yp4qCZYrVSKSFZZulBwek1uOLD2pMJg 1FkIzfvaItAqKyStiBhtc6eQ6+aToL71zshGMZNGsHk2iCuXIm4YttwuacmclOngiGVs 2KmA== X-Gm-Message-State: AOAM530mbg6ReqFK6kV7mk2xRV6OzQNrpCno1pBiheA3kLW+4LVY1OdA pdLU6Iw20+v/+R0V2UGwK/ogyYH/nZ5zZlQH X-Google-Smtp-Source: ABdhPJxH4MzXSIRZfLnA5LZJ5B34g153VIQjg1PtLsAqrrukcewkvsUSzvq0/+s0/47nmR9z0Wg/GQ== X-Received: by 2002:a9d:154:: with SMTP id 78mr10806259otu.171.1608216760082; Thu, 17 Dec 2020 06:52:40 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 20/23] tcg/i386: Use tcg_constant_vec with tcg vec expanders Date: Thu, 17 Dec 2020 08:52:12 -0600 Message-Id: <20201217145215.534637-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201217145215.534637-1-richard.henderson@linaro.org> References: <20201217145215.534637-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::329; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x329.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Richard Henderson --- tcg/i386/tcg-target.c.inc | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc index 819ee25cff..36a90e7ef3 100644 --- a/tcg/i386/tcg-target.c.inc +++ b/tcg/i386/tcg-target.c.inc @@ -3508,7 +3508,7 @@ static void expand_vec_rotv(TCGType type, unsigned ve= ce, TCGv_vec v0, static void expand_vec_mul(TCGType type, unsigned vece, TCGv_vec v0, TCGv_vec v1, TCGv_vec v2) { - TCGv_vec t1, t2, t3, t4; + TCGv_vec t1, t2, t3, t4, zero; =20 tcg_debug_assert(vece =3D=3D MO_8); =20 @@ -3526,11 +3526,11 @@ static void expand_vec_mul(TCGType type, unsigned v= ece, case TCG_TYPE_V64: t1 =3D tcg_temp_new_vec(TCG_TYPE_V128); t2 =3D tcg_temp_new_vec(TCG_TYPE_V128); - tcg_gen_dup16i_vec(t2, 0); + zero =3D tcg_constant_vec(TCG_TYPE_V128, MO_8, 0); vec_gen_3(INDEX_op_x86_punpckl_vec, TCG_TYPE_V128, MO_8, - tcgv_vec_arg(t1), tcgv_vec_arg(v1), tcgv_vec_arg(t2)); + tcgv_vec_arg(t1), tcgv_vec_arg(v1), tcgv_vec_arg(zero)); vec_gen_3(INDEX_op_x86_punpckl_vec, TCG_TYPE_V128, MO_8, - tcgv_vec_arg(t2), tcgv_vec_arg(t2), tcgv_vec_arg(v2)); + tcgv_vec_arg(t2), tcgv_vec_arg(zero), tcgv_vec_arg(v2)); tcg_gen_mul_vec(MO_16, t1, t1, t2); tcg_gen_shri_vec(MO_16, t1, t1, 8); vec_gen_3(INDEX_op_x86_packus_vec, TCG_TYPE_V128, MO_8, @@ -3545,15 +3545,15 @@ static void expand_vec_mul(TCGType type, unsigned v= ece, t2 =3D tcg_temp_new_vec(type); t3 =3D tcg_temp_new_vec(type); t4 =3D tcg_temp_new_vec(type); - tcg_gen_dup16i_vec(t4, 0); + zero =3D tcg_constant_vec(TCG_TYPE_V128, MO_8, 0); vec_gen_3(INDEX_op_x86_punpckl_vec, type, MO_8, - tcgv_vec_arg(t1), tcgv_vec_arg(v1), tcgv_vec_arg(t4)); + tcgv_vec_arg(t1), tcgv_vec_arg(v1), tcgv_vec_arg(zero)); vec_gen_3(INDEX_op_x86_punpckl_vec, type, MO_8, - tcgv_vec_arg(t2), tcgv_vec_arg(t4), tcgv_vec_arg(v2)); + tcgv_vec_arg(t2), tcgv_vec_arg(zero), tcgv_vec_arg(v2)); vec_gen_3(INDEX_op_x86_punpckh_vec, type, MO_8, - tcgv_vec_arg(t3), tcgv_vec_arg(v1), tcgv_vec_arg(t4)); + tcgv_vec_arg(t3), tcgv_vec_arg(v1), tcgv_vec_arg(zero)); vec_gen_3(INDEX_op_x86_punpckh_vec, type, MO_8, - tcgv_vec_arg(t4), tcgv_vec_arg(t4), tcgv_vec_arg(v2)); + tcgv_vec_arg(t4), tcgv_vec_arg(zero), tcgv_vec_arg(v2)); tcg_gen_mul_vec(MO_16, t1, t1, t2); tcg_gen_mul_vec(MO_16, t3, t3, t4); tcg_gen_shri_vec(MO_16, t1, t1, 8); @@ -3581,7 +3581,7 @@ static bool expand_vec_cmp_noinv(TCGType type, unsign= ed vece, TCGv_vec v0, NEED_UMIN =3D 8, NEED_UMAX =3D 16, }; - TCGv_vec t1, t2; + TCGv_vec t1, t2, t3; uint8_t fixup; =20 switch (cond) { @@ -3652,9 +3652,9 @@ static bool expand_vec_cmp_noinv(TCGType type, unsign= ed vece, TCGv_vec v0, } else if (fixup & NEED_BIAS) { t1 =3D tcg_temp_new_vec(type); t2 =3D tcg_temp_new_vec(type); - tcg_gen_dupi_vec(vece, t2, 1ull << ((8 << vece) - 1)); - tcg_gen_sub_vec(vece, t1, v1, t2); - tcg_gen_sub_vec(vece, t2, v2, t2); + t3 =3D tcg_constant_vec(type, vece, 1ull << ((8 << vece) - 1)); + tcg_gen_sub_vec(vece, t1, v1, t3); + tcg_gen_sub_vec(vece, t2, v2, t3); v1 =3D t1; v2 =3D t2; cond =3D tcg_signed_cond(cond); --=20 2.25.1 From nobody Sat May 18 21:45:31 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1608218992; cv=none; d=zohomail.com; s=zohoarc; b=b78JqXakc1tMmCherWkI9IF9sXSmEqdCrGbTrW5phlppfJnhp8PqJ7j6N4dxRmgTUUl6INPF0dOTWxsqfUsHTdG/STiXbW4+pXLtwOn+g9QmKdsnmyeUPEbBfqBczTBdRjGRp1pDO+6U+uaqMx5earVu0qVit7g97hvqps3r7gY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608218992; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=+RAengYno9BTXIpaDVeX7bv8hOtDAoI5mtNi1wVDY20=; b=ilhKuPbzuMJYDf+JaiW/yv8i8tvys7KkzjuLwRpFJZefAuOLbwM/5MTIEmAub8kHPXp9AHDmuN/lQidjV6IMkCpuauhh0pMmKcLh7F4oOmDTzjZd8enzlDpup9MtA9LqfYNV4hUwuGmtdOdiQ6P9cZQjVJ2bUaUnVe12Xcn3EhE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1608218992746635.7691572290265; Thu, 17 Dec 2020 07:29:52 -0800 (PST) Received: from localhost ([::1]:49132 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpuqV-0007ta-30 for importer@patchew.org; Thu, 17 Dec 2020 10:05:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33444) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpueC-0003nX-DK for qemu-devel@nongnu.org; Thu, 17 Dec 2020 09:52:52 -0500 Received: from mail-oi1-x234.google.com ([2607:f8b0:4864:20::234]:42576) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kpue2-0004zm-Ik for qemu-devel@nongnu.org; Thu, 17 Dec 2020 09:52:51 -0500 Received: by mail-oi1-x234.google.com with SMTP id l200so32406099oig.9 for ; Thu, 17 Dec 2020 06:52:42 -0800 (PST) Received: from localhost.localdomain (fixed-187-189-51-144.totalplay.net. [187.189.51.144]) by smtp.gmail.com with ESMTPSA id x130sm1136342oif.3.2020.12.17.06.52.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Dec 2020 06:52:40 -0800 (PST) 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=+RAengYno9BTXIpaDVeX7bv8hOtDAoI5mtNi1wVDY20=; b=qzTYs5FV9miQwv7VdVRFFjmoONFy5cM9L7FgkfyTAyCqF0bC9YtWT88j1NqxcxyHQc uproWvsqPCNNRnIrt0jhdrVkrYostRRiBnbN8qx5iE8SmVzV8PwWOhSQegbmxGaZMT0C OhBslZpwtgSBTqs53Qf7Y6Fk6o24iNgrl+dy4lOEUHK5U3+MZzZuoy1C3rSvJVF5hCpy 1gp51qAPvfny2cvevYiLoWQU24hobU1fVrXCiaDJzZQr/xomwTNUMlMPcpgRIPyHtFdx iQG7T0fD7PNltEgyTX/kv4Dh4NHz+Np8cJ3KwonnXbZVqXafWSasMrfBQwYqMB3TeoEM 1gEw== 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=+RAengYno9BTXIpaDVeX7bv8hOtDAoI5mtNi1wVDY20=; b=YxgVm4JW9UBKpCDQEWNYq0zhLPSVmzoE9oJgs4eo5Z5XJUT7K3Dcm71AwCmoLkOT3o am2oFiMYFTicIgK27YJI1xGReEJBreOjskEzKDs0Au6EZGEL00qnR1iV8beHPLdFuMwZ OxEWr8eAU7RnoBOOI+YRdzkcpEfxF9QQWmOQ+lbFZMLkrD4Vt/PwBb4+U51Nr+K6juLC jR0N6FpR7/9IVeL2Kcya8cV24lKcfAODdIYHbgO2NgX6Zoswr6O6fEmBGIr0TVeGpOYn 48SdRJL/AtHO/L8F4VT+30PxhJBEESMk8nVDEbJ8BqQzzWGJTfa9VcKvwFewHXp0vAL7 IS7A== X-Gm-Message-State: AOAM5339SZLh+hPz0lT7gN447Fm7fOfvAPadcz87T/2LEbKfrUyHiR0V Jr8iIwnQZC81h+gHEwBteqDe7oS0k/xDyOl+ X-Google-Smtp-Source: ABdhPJwwSfHoRH0A0r8v0iih0EfOWM/piVhdhQdWWTXQUYNCUIBKerJtH7IfyMWxqCQHHLAq3K+8bQ== X-Received: by 2002:aca:c592:: with SMTP id v140mr4977506oif.10.1608216761206; Thu, 17 Dec 2020 06:52:41 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 21/23] tcg: Remove tcg_gen_dup{8,16,32,64}i_vec Date: Thu, 17 Dec 2020 08:52:13 -0600 Message-Id: <20201217145215.534637-22-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201217145215.534637-1-richard.henderson@linaro.org> References: <20201217145215.534637-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::234; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x234.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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: =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) These interfaces have been replaced by tcg_gen_dupi_vec and tcg_constant_vec. Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Richard Henderson --- include/tcg/tcg-op.h | 4 ---- tcg/tcg-op-vec.c | 20 -------------------- 2 files changed, 24 deletions(-) diff --git a/include/tcg/tcg-op.h b/include/tcg/tcg-op.h index b4fba35e87..d0319692ec 100644 --- a/include/tcg/tcg-op.h +++ b/include/tcg/tcg-op.h @@ -959,10 +959,6 @@ void tcg_gen_mov_vec(TCGv_vec, TCGv_vec); void tcg_gen_dup_i32_vec(unsigned vece, TCGv_vec, TCGv_i32); void tcg_gen_dup_i64_vec(unsigned vece, TCGv_vec, TCGv_i64); void tcg_gen_dup_mem_vec(unsigned vece, TCGv_vec, TCGv_ptr, tcg_target_lon= g); -void tcg_gen_dup8i_vec(TCGv_vec, uint32_t); -void tcg_gen_dup16i_vec(TCGv_vec, uint32_t); -void tcg_gen_dup32i_vec(TCGv_vec, uint32_t); -void tcg_gen_dup64i_vec(TCGv_vec, uint64_t); void tcg_gen_dupi_vec(unsigned vece, TCGv_vec, uint64_t); void tcg_gen_add_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b); void tcg_gen_sub_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b); diff --git a/tcg/tcg-op-vec.c b/tcg/tcg-op-vec.c index ce0d2f6e0e..d19aa7373e 100644 --- a/tcg/tcg-op-vec.c +++ b/tcg/tcg-op-vec.c @@ -241,26 +241,6 @@ TCGv_vec tcg_const_ones_vec_matching(TCGv_vec m) return tcg_const_ones_vec(t->base_type); } =20 -void tcg_gen_dup64i_vec(TCGv_vec r, uint64_t a) -{ - tcg_gen_dupi_vec(MO_64, r, a); -} - -void tcg_gen_dup32i_vec(TCGv_vec r, uint32_t a) -{ - tcg_gen_dupi_vec(MO_32, r, a); -} - -void tcg_gen_dup16i_vec(TCGv_vec r, uint32_t a) -{ - tcg_gen_dupi_vec(MO_16, r, a); -} - -void tcg_gen_dup8i_vec(TCGv_vec r, uint32_t a) -{ - tcg_gen_dupi_vec(MO_8, r, a); -} - void tcg_gen_dupi_vec(unsigned vece, TCGv_vec r, uint64_t a) { TCGTemp *rt =3D tcgv_vec_temp(r); --=20 2.25.1 From nobody Sat May 18 21:45:31 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1608249161; cv=none; d=zohomail.com; s=zohoarc; b=Qv8i+kdFL7QyGH35rDg4FG6OTT2rkTrbbvslfJFK2w7AdUkcbEGZqOkfX9iZzh+nZE8VFsshEpBCh4BClLWbfjrP7fmvSvRVMSxtWef4EbW1yXoanaCSaqNc8V1XDPtni5NpdLavcgrNJOJ1KYoqj+wSmxH7gDM7wePTe52nxL4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608249161; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=WiJrIjKcAYzAf+icIPzlY9kRfNkMth80Cycr47tfyJ4=; b=AzuzyBl9lPXag5yZxT8fncZSpA9B8LMlMZ9Wu2+ItkfW/Q6VyPHA1WzwPfmeiz0CH/hCSUT00RohszgS3bZjMirFowDiXqU55J/qAYr1N4unp9f3YuLqWCao96SXgsUZRgZIGxOoJUFCM2vVU70TAYgWXqXROL97QXwKYUTgyD4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1608249161333449.11235298831014; Thu, 17 Dec 2020 15:52:41 -0800 (PST) Received: from localhost ([::1]:50832 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpvII-000876-7K for importer@patchew.org; Thu, 17 Dec 2020 10:34:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33422) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpue7-0003hv-N6 for qemu-devel@nongnu.org; Thu, 17 Dec 2020 09:52:47 -0500 Received: from mail-oi1-x231.google.com ([2607:f8b0:4864:20::231]:40745) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kpue4-00050e-I7 for qemu-devel@nongnu.org; Thu, 17 Dec 2020 09:52:47 -0500 Received: by mail-oi1-x231.google.com with SMTP id p126so32419251oif.7 for ; Thu, 17 Dec 2020 06:52:43 -0800 (PST) Received: from localhost.localdomain (fixed-187-189-51-144.totalplay.net. [187.189.51.144]) by smtp.gmail.com with ESMTPSA id x130sm1136342oif.3.2020.12.17.06.52.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Dec 2020 06:52:41 -0800 (PST) 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:mime-version :content-transfer-encoding; bh=WiJrIjKcAYzAf+icIPzlY9kRfNkMth80Cycr47tfyJ4=; b=oBJGHur6cEeHhlRI1EwmtjyJBaoCIGY8DEq75GtMZH6z4mxf3enLJyC68UHsO7HdsV 3OrqPhydDwsoQwtbqTUVVRMdpabiQifFsw6x3kWKsGEYKb98K53YQeme4jJ0z5eNLX62 2vwT0eP9Qor7wWvAW5EkRhroN4Ks98ukfC8g/3ABkTLQ0h0eoZ/1TEWtRlIPfeBz4XM1 EMAu1AzEekNapunJhuliHdUxN8xuYc4p0IIBZ/tyqwY9Po4YknAxZA9VZdMqRGjTOaN5 epTS/nwNoBOFJzyPkVT05ehDVri9dH1oKTEgqTRzNJMDxtK7BgMV593zhXxrTF3SvgHY xmFA== 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:mime-version:content-transfer-encoding; bh=WiJrIjKcAYzAf+icIPzlY9kRfNkMth80Cycr47tfyJ4=; b=RCND19sBA94+CYg2TBcxRTBLZISJs69pwW5Q026omEbNpiFWJvl8Qzb9qj7EPnsUuJ PoIqjsx4lLIp6P1iWFcZdmEphuPz0cQN+9TuLyjRHByP8FvNkeH+HaUbxnYyiBBPtVl/ wQRODXFtBImdiqydRuafxJTD0FC36r9q2FncpOoTVhhE2UX6TM7/oDOfzcDEodSl8EFy EcDMLXCbesZXZbXU623R1KMP9uDuX5hZtVCOfMoGu25MjHDFg1UD2g73DuAqmt06cXOI NX4VZ0zTe+ZmmPaHF0/Gr1kBQQNb8np6nhdq5UcYZZAz/SO4rTGNDu4evHQ6CkX/MSXg 29Bg== X-Gm-Message-State: AOAM530U/Ns3GLL4Bm9yQ84mRYOhwyOA8ycjOrXjTh84ISSzbSWYiU7y oZFoklEDPPkrTimb1xRJCahL+ZJ86B5sV4tk X-Google-Smtp-Source: ABdhPJy/pJK6gFKFsKoDoTPxQXZNsrPryGz2d7bpKQyYnEB1gcV/9xHSHsrBBLxUQK766t5Pa6drPw== X-Received: by 2002:aca:4a84:: with SMTP id x126mr4909542oia.111.1608216762179; Thu, 17 Dec 2020 06:52:42 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 22/23] tcg/ppc: Use tcg_constant_vec with tcg vec expanders Date: Thu, 17 Dec 2020 08:52:14 -0600 Message-Id: <20201217145215.534637-23-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201217145215.534637-1-richard.henderson@linaro.org> References: <20201217145215.534637-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::231; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x231.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" Improve expand_vec_shi to use sign-extraction for MO_32. This allows a single VSPLTISB instruction to load all of the valid shift constants. Signed-off-by: Richard Henderson --- tcg/ppc/tcg-target.c.inc | 44 ++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index 163a5bb32c..8778f729de 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -3332,13 +3332,22 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode= opc, static void expand_vec_shi(TCGType type, unsigned vece, TCGv_vec v0, TCGv_vec v1, TCGArg imm, TCGOpcode opci) { - TCGv_vec t1 =3D tcg_temp_new_vec(type); + TCGv_vec t1; =20 - /* Splat w/bytes for xxspltib. */ - tcg_gen_dupi_vec(MO_8, t1, imm & ((8 << vece) - 1)); + if (vece =3D=3D MO_32) { + /* + * Only 5 bits are significant, and VSPLTISB can represent -16..15. + * So using negative numbers gets us the 4th bit easily. + */ + imm =3D sextract32(imm, 0, 5); + } else { + imm &=3D (8 << vece) - 1; + } + + /* Splat w/bytes for xxspltib when 2.07 allows MO_64. */ + t1 =3D tcg_constant_vec(type, MO_8, imm); vec_gen_3(opci, type, vece, tcgv_vec_arg(v0), tcgv_vec_arg(v1), tcgv_vec_arg(t1)); - tcg_temp_free_vec(t1); } =20 static void expand_vec_cmp(TCGType type, unsigned vece, TCGv_vec v0, @@ -3396,7 +3405,7 @@ static void expand_vec_mul(TCGType type, unsigned vec= e, TCGv_vec v0, { TCGv_vec t1 =3D tcg_temp_new_vec(type); TCGv_vec t2 =3D tcg_temp_new_vec(type); - TCGv_vec t3, t4; + TCGv_vec c0, c16; =20 switch (vece) { case MO_8: @@ -3415,21 +3424,22 @@ static void expand_vec_mul(TCGType type, unsigned v= ece, TCGv_vec v0, =20 case MO_32: tcg_debug_assert(!have_isa_2_07); - t3 =3D tcg_temp_new_vec(type); - t4 =3D tcg_temp_new_vec(type); - tcg_gen_dupi_vec(MO_8, t4, -16); + /* + * Only 5 bits are significant, and VSPLTISB can represent -16..15. + * So using -16 is a quick way to represent 16. + */ + c16 =3D tcg_constant_vec(type, MO_8, -16); + c0 =3D tcg_constant_vec(type, MO_8, 0); + vec_gen_3(INDEX_op_rotlv_vec, type, MO_32, tcgv_vec_arg(t1), - tcgv_vec_arg(v2), tcgv_vec_arg(t4)); + tcgv_vec_arg(v2), tcgv_vec_arg(c16)); vec_gen_3(INDEX_op_ppc_mulou_vec, type, MO_16, tcgv_vec_arg(t2), tcgv_vec_arg(v1), tcgv_vec_arg(v2)); - tcg_gen_dupi_vec(MO_8, t3, 0); - vec_gen_4(INDEX_op_ppc_msum_vec, type, MO_16, tcgv_vec_arg(t3), - tcgv_vec_arg(v1), tcgv_vec_arg(t1), tcgv_vec_arg(t3)); - vec_gen_3(INDEX_op_shlv_vec, type, MO_32, tcgv_vec_arg(t3), - tcgv_vec_arg(t3), tcgv_vec_arg(t4)); - tcg_gen_add_vec(MO_32, v0, t2, t3); - tcg_temp_free_vec(t3); - tcg_temp_free_vec(t4); + vec_gen_4(INDEX_op_ppc_msum_vec, type, MO_16, tcgv_vec_arg(t1), + tcgv_vec_arg(v1), tcgv_vec_arg(t1), tcgv_vec_arg(c0)); + vec_gen_3(INDEX_op_shlv_vec, type, MO_32, tcgv_vec_arg(t1), + tcgv_vec_arg(t1), tcgv_vec_arg(c16)); + tcg_gen_add_vec(MO_32, v0, t1, t2); break; =20 default: --=20 2.25.1 From nobody Sat May 18 21:45:31 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1608230281; cv=none; d=zohomail.com; s=zohoarc; b=cgWQfq93J0pbLAev2Vg4ehxn9Pe+C61T1Q+a5GxcEBWRllWzCSXfGLiI9mg3CL3GwQg7yt6JNNMHSqay8f2wrYzkWYjQ2hQ/wnmXfkpK8boe7xeRbCFq3k34StzTGtN7Xpm3w+xKby7hpil4up04AyQiT1mnYvt4Q+zUH2+XVYg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608230281; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=lzQwpKw8YyVUpw0ONL4kM5TrE9yjiczje0Eh4uLUkAs=; b=OXtHDTbIV7B53cTqKP5Hdmbpn/hjBRRZcUw7nyA8WsTqF0M9t+l9gGYVGSOY7Vc41/A5jzIl42GBVPg/WfSjphe613BsT71J/ZUp0N51YWmnX25rbSJorrR8rUEF6iTUZTNQaw+iZ+qjCLfsCCvXp5emj9dDpPyigzdvaUV2hdc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1608230281337207.9988997296457; Thu, 17 Dec 2020 10:38:01 -0800 (PST) Received: from localhost ([::1]:51154 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpv4f-0004hS-1C for importer@patchew.org; Thu, 17 Dec 2020 10:20:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33436) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpue9-0003kM-HM for qemu-devel@nongnu.org; Thu, 17 Dec 2020 09:52:49 -0500 Received: from mail-oi1-x22d.google.com ([2607:f8b0:4864:20::22d]:42570) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kpue4-00050p-Hz for qemu-devel@nongnu.org; Thu, 17 Dec 2020 09:52:49 -0500 Received: by mail-oi1-x22d.google.com with SMTP id l200so32406243oig.9 for ; Thu, 17 Dec 2020 06:52:44 -0800 (PST) Received: from localhost.localdomain (fixed-187-189-51-144.totalplay.net. [187.189.51.144]) by smtp.gmail.com with ESMTPSA id x130sm1136342oif.3.2020.12.17.06.52.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Dec 2020 06:52:42 -0800 (PST) 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:mime-version :content-transfer-encoding; bh=lzQwpKw8YyVUpw0ONL4kM5TrE9yjiczje0Eh4uLUkAs=; b=ocVaL31oo6XP2qqR/muUXO6ijrVyl8NfnSc0zVqpg9CcjGPJhE5937YsP7jwOGiGT2 HAn6FCqrVm+BP6R1j2IeIjLz0T5J67d3ql2o+syD3LQRD6Sxf6/BNkZAH4C+2VTikbnn a+Srbsb76hPlEByx4dgFLmnT4qp33xYb90eRizL9rq7D+ccP4TbmY6NslWwwUSiQTXr7 ySAKCxVkCw5B5I4M8BQiD9UgdhasmyTCY7GhYM9jOu+vF2IITRugV1E6InxWp+c1zUvg 7NFJA5ZccMWdha40o9oyX7AVJdfQcHkleOBjb42eqRPiOzPSC4HXo5gOFTp2EBuF2Imj o/qA== 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:mime-version:content-transfer-encoding; bh=lzQwpKw8YyVUpw0ONL4kM5TrE9yjiczje0Eh4uLUkAs=; b=dLy52LbseEhlVQmcnfAv1pHC5SjNsuumuwcIx3qSwl4y4opIHjvXynbD4EDcT2zfdE zqw+YSwtBD7oGy0j4MuIqiMbwBeOqUxtPsqfJngtjnq2y9ZNpnBt3kSXp9Ys9tkiOVJB Duz0JoZd3EbZTq0o7VDF9pOGyJf/iKOsE9IleeRX8H5v7O+x9M3TECTjpx1bF093uacA b+gtnvn0CvlGQTQXoAVp8aB7nwENJd4WUim9gayrQHvM3ITYGeSojKIrL8lJtXfnWFEw oe6iyb1Ph8uUrq8BFLXQ1SvUFTeCtUNuIbF7uQsoV7W06Ibpwtd/Qk4iObbN9K+NQiuI CTSw== X-Gm-Message-State: AOAM530wPFrXf8RBfrycy0WP3EBgCoDndimv7gV/3aadFJlBXMomVsh0 lubV1u8eSY0PxBl/+ElqDGbFTKXIQRNPCEJz X-Google-Smtp-Source: ABdhPJzEHdI6sFuypXoUq/U6xkxeTCfJXWoj+PF/VIkCiDmgVLiS0aTvlpw2pwAIl5A0rGxdP8cGIg== X-Received: by 2002:a05:6808:a90:: with SMTP id q16mr4992812oij.107.1608216763239; Thu, 17 Dec 2020 06:52:43 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 23/23] tcg/aarch64: Use tcg_constant_vec with tcg vec expanders Date: Thu, 17 Dec 2020 08:52:15 -0600 Message-Id: <20201217145215.534637-24-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201217145215.534637-1-richard.henderson@linaro.org> References: <20201217145215.534637-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::22d; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x22d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" Improve rotrv_vec to reduce "t1 =3D -v2, t2 =3D t1 + c" to "t1 =3D -v, t2 =3D c - v2". This avoids a serial dependency between t1 and t2. Signed-off-by: Richard Henderson --- tcg/aarch64/tcg-target.c.inc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc index a6c2d54c4d..c78e809de8 100644 --- a/tcg/aarch64/tcg-target.c.inc +++ b/tcg/aarch64/tcg-target.c.inc @@ -2511,7 +2511,7 @@ void tcg_expand_vec_op(TCGOpcode opc, TCGType type, u= nsigned vece, TCGArg a0, ...) { va_list va; - TCGv_vec v0, v1, v2, t1, t2; + TCGv_vec v0, v1, v2, t1, t2, c1; TCGArg a2; =20 va_start(va, a0); @@ -2543,8 +2543,8 @@ void tcg_expand_vec_op(TCGOpcode opc, TCGType type, u= nsigned vece, =20 case INDEX_op_rotlv_vec: t1 =3D tcg_temp_new_vec(type); - tcg_gen_dupi_vec(vece, t1, 8 << vece); - tcg_gen_sub_vec(vece, t1, v2, t1); + c1 =3D tcg_constant_vec(type, vece, 8 << vece); + tcg_gen_sub_vec(vece, t1, v2, c1); /* Right shifts are negative left shifts for AArch64. */ vec_gen_3(INDEX_op_shlv_vec, type, vece, tcgv_vec_arg(t1), tcgv_vec_arg(v1), tcgv_vec_arg(t1)); @@ -2557,9 +2557,9 @@ void tcg_expand_vec_op(TCGOpcode opc, TCGType type, u= nsigned vece, case INDEX_op_rotrv_vec: t1 =3D tcg_temp_new_vec(type); t2 =3D tcg_temp_new_vec(type); + c1 =3D tcg_constant_vec(type, vece, 8 << vece); tcg_gen_neg_vec(vece, t1, v2); - tcg_gen_dupi_vec(vece, t2, 8 << vece); - tcg_gen_add_vec(vece, t2, t1, t2); + tcg_gen_sub_vec(vece, t2, c1, v2); /* Right shifts are negative left shifts for AArch64. */ vec_gen_3(INDEX_op_shlv_vec, type, vece, tcgv_vec_arg(t1), tcgv_vec_arg(v1), tcgv_vec_arg(t1)); --=20 2.25.1