From patchwork Thu Jan 14 02:16:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 362791 Delivered-To: patch@linaro.org Received: by 2002:a02:ccad:0:0:0:0:0 with SMTP id t13csp65425jap; Wed, 13 Jan 2021 18:19:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJyMqP0JrnQXMRqq6lZLYr17q6ipjL2P9MA/ppLk6/l1UHUER6qVuBs70KNj9MK/RiV11meV X-Received: by 2002:a25:d452:: with SMTP id m79mr7304306ybf.417.1610590786502; Wed, 13 Jan 2021 18:19:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610590786; cv=none; d=google.com; s=arc-20160816; b=R0SsGd0VKyKqfGucWmvoQWz0XhqEuXSkun71lECEu4a7JS/+5QMOfOiO5joAugmR0I HiaA3B0K9U0sJcfN0R1LGgM8gI1LJWA6Wa2vvpAUCu6h8VLHDTuX2+Fl3U5vhoI3zunY kR5p6Hvq2Mn3EO2Tgt5cJBGITqB0FrGgdyyYXocOvtMEJTczKDwebc3uu70c05LDfILU X2nLyY405g+Eg56tL/FdVw0Vnl0KDSx1i11VcWTGAiDg473tp3GB0I9xq+254LyUWGSo IEv4Nk4lLrmP4eLifvLkHgxQHa69/l4Rpo4CLH3Ht3sqQY60JHefEWbelWkhK4L0Gc/x UDWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=9lqObm2OHpXJPRkDAvjp4GmeUvPN9FBnk/3uv3qF2Aw=; b=bWYe1Xml9Gait8+7HjTGmoJCpjjbsSd3vE/7+lS6KwxGWyp7PwGY+OEQuSm92B4NWm Q7I3fwoxjp8iutdsjU/VUTKTHX19xqVu+4fXS9Pi8mWB1PX3aq+XudBPYBmhoqoTod6n Q+mimkxWW7i9TJ7O5YAIfaFqwIOdlY3mbJcFuT2dMe7z6581U63XSSYPUoyOVUMCKKO+ f8LK4a8sPnOlLXmhP21Tjy8UkaI+atN3I1TRUVrUz/Bo69vsyYVr3IoUAoGbvj4NqS/t hSqEnUbBfDD8ZYy1YA/mOXV6O5Y4bBBSc0/pH6vkeTYDrpn7mJrpM9dbiEpUG3kGzEz6 ZsGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=isASu2nE; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id r8si4084519ybk.154.2021.01.13.18.19.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 13 Jan 2021 18:19:46 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=isASu2nE; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:41700 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kzsEk-0006d5-0B for patch@linaro.org; Wed, 13 Jan 2021 21:19:46 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60076) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kzsCA-0003IZ-V4 for qemu-devel@nongnu.org; Wed, 13 Jan 2021 21:17:06 -0500 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]:45001) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kzsC5-0003N7-Js for qemu-devel@nongnu.org; Wed, 13 Jan 2021 21:17:06 -0500 Received: by mail-pf1-x431.google.com with SMTP id a188so2440472pfa.11 for ; Wed, 13 Jan 2021 18:17:01 -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=9lqObm2OHpXJPRkDAvjp4GmeUvPN9FBnk/3uv3qF2Aw=; b=isASu2nE2C1YzIfsM6U2oaiztneMch0AItPyaXa/PuT6KAxIAt8R/3vWjvo3hAs/+Y bJHYYQ/nkDx0PEnxcIOlDC9Y8Zb3Jo30scP6T2BjBi4HPTwQutkBzgSLmc+8eogUCRK3 XisXygw82yxzDZ9LB0bQmxtpDh9qguldkOJ9g9lpXSAGotWdRUk3MpVSIBgtR3hZb9Y8 jAi67ioZHQNeLG+VWuh5yF2hw+ZznoJ6xvcAJ85zsP5vmjyZFG+WaIqubQbvVoQdm9ZH lxzeRr4JEPZXudERhCzFObNSagcKWoGaEKXvDDBriClxazHuwwleGgcDxr3jwZxuCEaO 76vw== 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=9lqObm2OHpXJPRkDAvjp4GmeUvPN9FBnk/3uv3qF2Aw=; b=nohrw6LdpCV3Ue3psMLkx1rFkOrvySdHLjeAtqNHiXgk0J0qRD85qUsYc99cZPQMZb x0RIEQXCkjYrHPutQDHDUzXwdGhWmFm05bVf1DfwJECYJ/MriCRgY/Zc3lXejKQLbltd UEZ4h6pOBRZwu0cvv5WkO4XhqAwvM3Yg8D2n0+CPKE9PXWaeArALqFKgqI12aBQP9+8i Q4fadJwScc3kJagRzhETZjYDZoThYH3qcHhkpwf3hZfnIpbrpGD0xktzabOEgUHLKN0p ze85FL5HBhYV2AgbH3Z5hhmg1ZXtLHrh1hKHEf8/80qUCu0AY++oIhUJBC9/6qA7R5ND cshQ== X-Gm-Message-State: AOAM533HpjjYlfHuYQvJ/drLx41HSajJ041bz8UImwlrOJTDuUBGRgNB v1W5tx1yVkr0QgcS9pIL3H2B2XMmGrJ7sw== X-Received: by 2002:a63:752:: with SMTP id 79mr4936567pgh.272.1610590619757; Wed, 13 Jan 2021 18:16:59 -0800 (PST) Received: from localhost.localdomain (rrcs-173-197-107-21.west.biz.rr.com. [173.197.107.21]) by smtp.gmail.com with ESMTPSA id i7sm3771687pfc.50.2021.01.13.18.16.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jan 2021 18:16:59 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 01/24] tcg: Use tcg_out_dupi_vec from temp_load Date: Wed, 13 Jan 2021 16:16:31 -1000 Message-Id: <20210114021654.647242-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210114021654.647242-1-richard.henderson@linaro.org> References: <20210114021654.647242-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::431; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x431.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: peter.maydell@linaro.org, =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Having dupi pass though movi is confusing and arguably wrong. Reviewed-by: Alex Bennée 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(-) -- 2.25.1 diff --git a/tcg/tcg.c b/tcg/tcg.c index 472bf1755b..ded3c928e3 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -3387,7 +3387,11 @@ static void temp_load(TCGContext *s, TCGTemp *ts, TCGRegSet desired_regs, case TEMP_VAL_CONST: reg = 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 <= 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 = 0; break; case TEMP_VAL_MEM: diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc index ab199b143f..a2a588e3aa 100644 --- a/tcg/aarch64/tcg-target.c.inc +++ b/tcg/aarch64/tcg-target.c.inc @@ -1011,13 +1011,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 >= 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 46e856f442..35554fd1e8 100644 --- a/tcg/i386/tcg-target.c.inc +++ b/tcg/i386/tcg-target.c.inc @@ -975,30 +975,32 @@ static void tcg_out_dupi_vec(TCGContext *s, TCGType type, } } -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 == 0) { + tcg_out_vex_modrm(s, OPC_PXOR, ret, ret, ret); + return; + } + if (arg == -1) { + tcg_out_vex_modrm(s, OPC_PCMPEQB, ret, ret, ret); + return; + } + + int rexw = (type == TCG_TYPE_I32 ? 0 : P_REXW); + tcg_out_vex_modrm_pool(s, OPC_MOVD_VyEy + rexw, ret); + if (TCG_TARGET_REG_BITS == 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; - switch (type) { - case TCG_TYPE_I32: -#if TCG_TARGET_REG_BITS == 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 >= 16); - tcg_out_dupi_vec(s, type, ret, arg); - return; - default: - g_assert_not_reached(); - } - if (arg == 0) { tgen_arithr(s, ARITH_XOR, ret, ret); return; @@ -1027,6 +1029,25 @@ static void tcg_out_movi(TCGContext *s, TCGType type, tcg_out64(s, arg); } +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 == 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 == (int8_t)val) { diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index 19a4a12f15..a3f1bd41cd 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -987,12 +987,6 @@ static void tcg_out_movi(TCGContext *s, TCGType type, TCGReg ret, tcg_out_movi_int(s, type, ret, arg, false); break; - case TCG_TYPE_V64: - case TCG_TYPE_V128: - tcg_debug_assert(ret >= TCG_REG_V0); - tcg_out_dupi_vec(s, type, ret, arg); - break; - default: g_assert_not_reached(); } From patchwork Thu Jan 14 02:16:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 362792 Delivered-To: patch@linaro.org Received: by 2002:a02:ccad:0:0:0:0:0 with SMTP id t13csp65496jap; Wed, 13 Jan 2021 18:19:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJye5DxOslBwZSGcHmrKwaYC3a4ypm/vj0zXMFp/B1KqEH4mqBsJVWP/zePh3p1Dv3gw5J+E X-Received: by 2002:a25:d24a:: with SMTP id j71mr7347043ybg.13.1610590794623; Wed, 13 Jan 2021 18:19:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610590794; cv=none; d=google.com; s=arc-20160816; b=u99YDj9wYCmE9WWLZPtBfkk0xvCoVfesKrymvfI2MocKxJ45XynBLD/FXxKAb2RqsA krj4y5LF8XXvSFbQB5x3cCsbezVrI5qcWnYUYSBlddz+75NwhIcEZXwrjvD60sOHN+ab POVO02L5HJuGb4PFW0lrkD9O4ElIqHmvnlT48WsbBE5KB6pdpttAkM0AJSKi8d0W7Ac8 /NKjpuRgUjOdtBZiyMNTJ3jmpqKRhQhxk3FlpG+xGfeNWWTJoA55DOTHDY1Vccbuoqsy EJlr9XfWubICOXjwjET2XNkmPs8J88U68eJ11m4OL/tzpq7tYOems+uTDz5JFwl1Pkkn hBDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=igVFuD7tCOBdGtqW4y6U7yVjBtZG8cMMEC6HvvNAy3M=; b=fQCQ3HzAUrkgd2gIFQxaIsJUOBuPWplnCnJKm0wqPqc9dtzYpwaB8bx3FQSLDui/4z xw3mA92aiEQD2T5f0dv20olhFaEbT4v0307xxYXr54gl/jV0h8es/A9s8eGvgAn2+ghZ skAjbuhYO3ex05LxSa7INawSD5IA4ZzbsPN9/h9lWhmNtXoTKD+VylLwwPxZFjYtdu9D dZQ6GQWB7Ld8OlDCC9w6wnT5tfWsdOOsbkQIm24PXFhcGTZ4n85v5wJPdWv5lrjiFmld BklK/lDuFocGamTfO/SamLUY8yC/mVOOTvIFAbWsgX7Bo4hfbiL4pgcX2HTpXjrvF0PP sUUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lndZMeWw; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id o138si3555725yba.85.2021.01.13.18.19.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 13 Jan 2021 18:19:54 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lndZMeWw; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:42038 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kzsEs-0006lk-3s for patch@linaro.org; Wed, 13 Jan 2021 21:19:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60116) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kzsCC-0003JS-AR for qemu-devel@nongnu.org; Wed, 13 Jan 2021 21:17:08 -0500 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]:33542) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kzsCA-0003O2-4u for qemu-devel@nongnu.org; Wed, 13 Jan 2021 21:17:08 -0500 Received: by mail-pj1-x102e.google.com with SMTP id w1so3916413pjc.0 for ; Wed, 13 Jan 2021 18:17:02 -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=igVFuD7tCOBdGtqW4y6U7yVjBtZG8cMMEC6HvvNAy3M=; b=lndZMeWwdYWUu7K77yv017nxvg1DKl+FxmeULOgmLK+MckEd9faAso3mArbATenfFc 68TRcPOBHq7g+VZ2dGSSGdiSKWLbjnjhn6mx2z0jBa3wxAeYoGKXmweLAThfQC1MOuir jvZSBmHxZaW1VGoCujq+WVxFFxT0Dyf5WHPislZHMd3+hUxsdFzdB1NXDNUjgWhGhvul TlT7tpi4IICqYAS4g/WvWIU1O6zX7Q5/1bDS44EFx6f6PGtUkKftxPzlJ9AfnxoiBn2T ijrmVvdpXPB9fSC3ErX5ZSo66lzaEwqVXFDOSUs8Lx2AleMvtnqhXUPisEklXuXL6hLu XQNQ== 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=igVFuD7tCOBdGtqW4y6U7yVjBtZG8cMMEC6HvvNAy3M=; b=ko2WG7czzcU7KgpsOJbMuNZtgkT8EdbyZBCi4wORnb71okhlve4H41jgO8C92hk4wU LynDdLOVcysBymAqX//zX/qdsGL3swpqQ+zikT6SWhQbrQSgeyk7R6Hjo2gYYdvOqv8v uVA6/ZHNbgY73QUP4rbWrZYvjDK82Grs5bNfNUdwMY1OMKlQgThUHkWAnaC3oioKNJ2p X2YJTpgVXibsYaZ0dH4D+BzcAB6+HtryG3Fjj6oOr5PP0Ti3wvVaPA/iJAbg/xJUbaiz JDB3MV+bKsB0VrYvAFHg0VmncS3fGQw/IQGaKy9vnqNABKo5Yj2sByn8btrN5DE74Xjg CGUw== X-Gm-Message-State: AOAM532ma+IidvkCSn/ynL9Yf3u+CP2H/vP+iLENkSrLDdI7qYUMB+2I MCPADfiHlx7Tmp7x5rt/9HKQGEzTjTGY1A== X-Received: by 2002:a17:902:8d8d:b029:dc:4609:58a9 with SMTP id v13-20020a1709028d8db02900dc460958a9mr5392848plo.27.1610590621345; Wed, 13 Jan 2021 18:17:01 -0800 (PST) Received: from localhost.localdomain (rrcs-173-197-107-21.west.biz.rr.com. [173.197.107.21]) by smtp.gmail.com with ESMTPSA id i7sm3771687pfc.50.2021.01.13.18.17.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jan 2021 18:17:00 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 02/24] tcg: Increase tcg_out_dupi_vec immediate to int64_t Date: Wed, 13 Jan 2021 16:16:32 -1000 Message-Id: <20210114021654.647242-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210114021654.647242-1-richard.henderson@linaro.org> References: <20210114021654.647242-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102e; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102e.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: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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(-) -- 2.25.1 diff --git a/tcg/tcg.c b/tcg/tcg.c index ded3c928e3..c73128208c 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -117,8 +117,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); @@ -133,8 +133,8 @@ static inline bool tcg_out_dupm_vec(TCGContext *s, TCGType 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(); } @@ -3390,7 +3390,28 @@ static void temp_load(TCGContext *s, TCGTemp *ts, TCGRegSet desired_regs, if (ts->type <= 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 = ts->val; + MemOp vece = 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 == 32) { + val = dup_const(MO_32, val); + vece = MO_32; + } + if (val == dup_const(MO_8, val)) { + vece = MO_8; + } else if (val == dup_const(MO_16, val)) { + vece = MO_16; + } else if (TCG_TARGET_REG_BITS == 64 && + val == dup_const(MO_32, val)) { + vece = MO_32; + } + + tcg_out_dupi_vec(s, ts->type, vece, reg, ts->val); } ts->mem_coherent = 0; break; diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc index a2a588e3aa..be6d3ea2a8 100644 --- a/tcg/aarch64/tcg-target.c.inc +++ b/tcg/aarch64/tcg-target.c.inc @@ -857,14 +857,14 @@ static void tcg_out_logicali(TCGContext *s, AArch64Insn insn, TCGType ext, tcg_out_insn_3404(s, insn, ext, rd, rn, ext, r, c); } -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 = type == TCG_TYPE_V128; int cmode, imm8, i; /* Test all bytes equal first. */ - if (v64 == dup_const(MO_8, v64)) { + if (vece == MO_8) { imm8 = (uint8_t)v64; tcg_out_insn(s, 3606, MOVI, q, rd, 0, 0xe, imm8); return; @@ -891,7 +891,7 @@ static void tcg_out_dupi_vec(TCGContext *s, TCGType type, * cannot find an expansion there's no point checking a larger * width because we already know by replication it cannot match. */ - if (v64 == dup_const(MO_16, v64)) { + if (vece == MO_16) { uint16_t v16 = v64; if (is_shimm16(v16, &cmode, &imm8)) { @@ -910,7 +910,7 @@ static void tcg_out_dupi_vec(TCGContext *s, TCGType type, 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 == dup_const(MO_32, v64)) { + } else if (vece == MO_32) { uint32_t v32 = v64; uint32_t n32 = ~v32; @@ -2435,7 +2435,7 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, 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 = TCG_VEC_TMP; } insn = cmp_insn[cond]; diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc index 35554fd1e8..9f81e11773 100644 --- a/tcg/i386/tcg-target.c.inc +++ b/tcg/i386/tcg-target.c.inc @@ -942,8 +942,8 @@ static bool tcg_out_dupm_vec(TCGContext *s, TCGType type, unsigned vece, return true; } -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 = (type == TCG_TYPE_V256 ? P_VEXL : 0); @@ -956,7 +956,14 @@ static void tcg_out_dupi_vec(TCGContext *s, TCGType type, return; } - if (TCG_TARGET_REG_BITS == 64) { + if (TCG_TARGET_REG_BITS == 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 == TCG_TYPE_V64) { tcg_out_vex_modrm_pool(s, OPC_MOVQ_VqWq, ret); } else if (have_avx2) { @@ -964,14 +971,11 @@ static void tcg_out_dupi_vec(TCGContext *s, TCGType type, } 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 == 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); } } diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index a3f1bd41cd..d00ec20203 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -912,31 +912,41 @@ static void tcg_out_movi_int(TCGContext *s, TCGType type, TCGReg ret, } } -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; - low = (int8_t)val; - if (low >= -16 && low < 16) { - if (val == (tcg_target_long)dup_const(MO_8, low)) { + switch (vece) { + case MO_8: + low = (int8_t)val; + if (low >= -16 && low < 16) { tcg_out32(s, VSPLTISB | VRT(ret) | ((val & 31) << 16)); return; } - if (val == (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 = (int16_t)val; + if (low >= -16 && low < 16) { tcg_out32(s, VSPLTISH | VRT(ret) | ((val & 31) << 16)); return; } - if (val == (tcg_target_long)dup_const(MO_32, low)) { + break; + + case MO_32: + low = (int32_t)val; + if (low >= -16 && low < 16) { tcg_out32(s, VSPLTISW | VRT(ret) | ((val & 31) << 16)); return; } - } - if (have_isa_3_00 && val == (tcg_target_long)dup_const(MO_8, val)) { - tcg_out32(s, XXSPLTIB | VRT(ret) | ((val & 0xff) << 11)); - return; + break; } /* @@ -956,14 +966,15 @@ static void tcg_out_dupi_vec(TCGContext *s, TCGType type, TCGReg ret, if (TCG_TARGET_REG_BITS == 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 = LVX | VRT(ret) | RB(TCG_REG_TMP1); if (TCG_TARGET_REG_BITS == 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); } } From patchwork Thu Jan 14 02:16:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 362789 Delivered-To: patch@linaro.org Received: by 2002:a02:ccad:0:0:0:0:0 with SMTP id t13csp64173jap; Wed, 13 Jan 2021 18:17:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJylvUqqtInEijcx7Y1fCyOnTJw7caD6ZUqJsUSWme3IqzXj2EhjXoOkdUFOrTTkcHe7V75y X-Received: by 2002:a25:af0d:: with SMTP id a13mr7921354ybh.453.1610590667324; Wed, 13 Jan 2021 18:17:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610590667; cv=none; d=google.com; s=arc-20160816; b=sp+KeNSOXrgwCGy2mWabrAzQgPT1wGnuyS7CdqoZWeEQ0fXdkgO0mNlAT863zcvLX8 qV/p/C9ID7aEoitqnSVx5QgbhtybVzxXhNhlbsGaFx4ikmV0vIe5Ie9Ecg1Tfl9iA0ku r9IU/VeAlZT0wX/6m9YivuT4w11a0w3PAHoYnZa6ZMYdyU05MH25QU//mns2LfBPh0o8 cY9mlVHBZYktWuo/T30N25gDEoil40kVa2KflZFs4fbPnP3L0KliRjAt2orcUzASdlI1 JyCE0WzfqLGEF/I4/fXss3fDOR2UExSGv5zRk7Nqhx3Xy1fGFjLRMBGsLMKrr1srFqrF yUXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=XLAgXi9Czh5X/FA90bM/X3fbOzQ/DCfR5wliDIq/uwU=; b=ajIkR+z5wz330LVGT9jSY8k6b3HU9j4QC0wqHPxa9LWWRbozCMg3tRzKsLc9ZlhAwz fs0PRa0z13uPDil3+ZZgQPWlqtk6psC1d32taSsDKaKatPSU25hZArkdHIyM8vzL788f tgo/xrDzcT+42b6VgvnfVJ6eFiQPQYqJbwjXZ5Nu634I9kgM8aRlhVufrOA6Rx2gfDRy /7JFUVFslV4a7eWMltcKdsECId2ejRLLDOWh1eUDMvbnp8BkiHcrv/0mYlvEUoI8ERV8 S3rhLndJQBabhiCfEYuX2KvTz0XUGC+er00uLUGI3j0vdllsPcrU9D/lmcKegzRCuzNZ C61g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CWqyamgp; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id y63si4082205yby.344.2021.01.13.18.17.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 13 Jan 2021 18:17:47 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CWqyamgp; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:33952 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kzsCo-0003P3-Lm for patch@linaro.org; Wed, 13 Jan 2021 21:17:46 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60128) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kzsCD-0003Kc-87 for qemu-devel@nongnu.org; Wed, 13 Jan 2021 21:17:09 -0500 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]:52227) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kzsCA-0003OA-5M for qemu-devel@nongnu.org; Wed, 13 Jan 2021 21:17:09 -0500 Received: by mail-pj1-x102e.google.com with SMTP id v1so2267512pjr.2 for ; Wed, 13 Jan 2021 18:17:04 -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=XLAgXi9Czh5X/FA90bM/X3fbOzQ/DCfR5wliDIq/uwU=; b=CWqyamgpNLVCTcaOifpWf9qMrPDKmRpnwEqYa+8QWZPRmcWm8AsnhlAdDlqFC7L9v0 phKy7CPE+fIU8U2kKt4YmbMdFSeqnZentsxDmao2qdD1ZDLZFaZ5GNdEVkepfjC6v/lD XLM16d5RVAAtg+RVlkt2HZLmKGCKj3ltCupMtJS1A2kJnxXlaY9Cz8vf8eQsalTpu/KS ZhreGFytp1LAfLhEzUT3XZm40o9mtQD3RyxRTJim9IAwwNnpFhRopfeext/SCR3EguhO j4hTMtUd/mVnVD3Mlt5K6cc90CwrnV5PWXAxQkCCLzu8jYaDK/JwJIBEbn+ajtmw6yr9 TMsA== 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=XLAgXi9Czh5X/FA90bM/X3fbOzQ/DCfR5wliDIq/uwU=; b=EywQGYgEerftkjkbMslfAQZyZc9wNTlDjXVtTkN4+gp2/Slcakc0b3eD9mQPXuUBrD joa83lv4wIhvEda8jNvk3KfK+WkKqeNedogMc8R4MxIIfqLZdf6XGUSCF5VyqUKoEvO9 1L/IgbXeaG0iIMXV9rPqpOS4stK3TpoIcAsodPZaOxwO8D9XLDKfldXsfRox161VqwGx QONEV0OTTJut4sm/J8zArV9+p9LdLaHM0VNW/6wbhNqZ7Z2UpMG+0RIL/JKSwM/tuo9X 9wuEL6hVPYEPrpfBe+6lTFRxzLbdyHy97mQ/rnTNFdFjSOn1TKHJ4QNgzyethnmKGdGC Tp1A== X-Gm-Message-State: AOAM532Z28mvF54L/m7lxgjNQPUAi/ka1TMW5fgYg4kY+zYyOD2KKqKv vmQtKFPwL0B7/ksIJujDBiZ+vDffUybZzw== X-Received: by 2002:a17:902:d894:b029:db:e0c6:49a4 with SMTP id b20-20020a170902d894b02900dbe0c649a4mr5440528plz.1.1610590623192; Wed, 13 Jan 2021 18:17:03 -0800 (PST) Received: from localhost.localdomain (rrcs-173-197-107-21.west.biz.rr.com. [173.197.107.21]) by smtp.gmail.com with ESMTPSA id i7sm3771687pfc.50.2021.01.13.18.17.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jan 2021 18:17:02 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 03/24] tcg: Consolidate 3 bits into enum TCGTempKind Date: Wed, 13 Jan 2021 16:16:33 -1000 Message-Id: <20210114021654.647242-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210114021654.647242-1-richard.henderson@linaro.org> References: <20210114021654.647242-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102e; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102e.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: peter.maydell@linaro.org, =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The temp_fixed, temp_global, temp_local bits are all related. Combine them into a single enumeration. Reviewed-by: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé 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(-) -- 2.25.1 diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index 95fe5604eb..571d4e0fa3 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -483,23 +483,27 @@ typedef enum TCGTempVal { TEMP_VAL_CONST, } TCGTempVal; +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; tcg_target_long val; diff --git a/tcg/optimize.c b/tcg/optimize.c index 1fb42eb2a9..2f827a9d2d 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -116,21 +116,21 @@ static TCGTemp *find_better_copy(TCGContext *s, TCGTemp *ts) TCGTemp *i; /* If this is already a global, we can't do better. */ - if (ts->temp_global) { + if (ts->kind >= TEMP_GLOBAL) { return ts; } /* Search for a global first. */ for (i = ts_info(ts)->next_copy; i != ts; i = ts_info(i)->next_copy) { - if (i->temp_global) { + if (i->kind >= TEMP_GLOBAL) { return i; } } /* If it is a temp, search for a temp local. */ - if (!ts->temp_local) { + if (ts->kind == TEMP_NORMAL) { for (i = ts_info(ts)->next_copy; i != ts; i = ts_info(i)->next_copy) { - if (ts->temp_local) { + if (i->kind >= TEMP_LOCAL) { return i; } } diff --git a/tcg/tcg.c b/tcg/tcg.c index c73128208c..143794a585 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -1211,7 +1211,7 @@ static inline TCGTemp *tcg_global_alloc(TCGContext *s) tcg_debug_assert(s->nb_globals == s->nb_temps); s->nb_globals++; ts = tcg_temp_alloc(s); - ts->temp_global = 1; + ts->kind = TEMP_GLOBAL; return ts; } @@ -1228,7 +1228,7 @@ static TCGTemp *tcg_global_reg_new_internal(TCGContext *s, TCGType type, ts = tcg_global_alloc(s); ts->base_type = type; ts->type = type; - ts->fixed_reg = 1; + ts->kind = TEMP_FIXED; ts->reg = reg; ts->name = name; tcg_regset_set_reg(s->reserved_regs, reg); @@ -1255,7 +1255,7 @@ TCGTemp *tcg_global_mem_new_internal(TCGType type, TCGv_ptr base, bigendian = 1; #endif - if (!base_ts->fixed_reg) { + if (base_ts->kind != TEMP_FIXED) { /* We do not support double-indirect registers. */ tcg_debug_assert(!base_ts->indirect_reg); base_ts->indirect_base = 1; @@ -1303,6 +1303,7 @@ TCGTemp *tcg_global_mem_new_internal(TCGType type, TCGv_ptr base, TCGTemp *tcg_temp_new_internal(TCGType type, bool temp_local) { TCGContext *s = tcg_ctx; + TCGTempKind kind = temp_local ? TEMP_LOCAL : TEMP_NORMAL; TCGTemp *ts; int idx, k; @@ -1315,7 +1316,7 @@ TCGTemp *tcg_temp_new_internal(TCGType type, bool temp_local) ts = &s->temps[idx]; ts->temp_allocated = 1; tcg_debug_assert(ts->base_type == type); - tcg_debug_assert(ts->temp_local == temp_local); + tcg_debug_assert(ts->kind == kind); } else { ts = tcg_temp_alloc(s); if (TCG_TARGET_REG_BITS == 32 && type == TCG_TYPE_I64) { @@ -1324,18 +1325,18 @@ TCGTemp *tcg_temp_new_internal(TCGType type, bool temp_local) ts->base_type = type; ts->type = TCG_TYPE_I32; ts->temp_allocated = 1; - ts->temp_local = temp_local; + ts->kind = kind; tcg_debug_assert(ts2 == ts + 1); ts2->base_type = TCG_TYPE_I64; ts2->type = TCG_TYPE_I32; ts2->temp_allocated = 1; - ts2->temp_local = temp_local; + ts2->kind = kind; } else { ts->base_type = type; ts->type = type; ts->temp_allocated = 1; - ts->temp_local = temp_local; + ts->kind = kind; } } @@ -1392,12 +1393,12 @@ void tcg_temp_free_internal(TCGTemp *ts) } #endif - tcg_debug_assert(ts->temp_global == 0); + tcg_debug_assert(ts->kind < TEMP_GLOBAL); tcg_debug_assert(ts->temp_allocated != 0); ts->temp_allocated = 0; idx = temp_idx(ts); - k = ts->base_type + (ts->temp_local ? TCG_TYPE_COUNT : 0); + k = ts->base_type + (ts->kind == TEMP_NORMAL ? 0 : TCG_TYPE_COUNT); set_bit(idx, s->free_temps[k].l); } @@ -1930,17 +1931,27 @@ void tcg_gen_callN(void *func, TCGTemp *ret, int nargs, TCGTemp **args) static void tcg_reg_alloc_start(TCGContext *s) { int i, n; - TCGTemp *ts; - for (i = 0, n = s->nb_globals; i < n; i++) { - ts = &s->temps[i]; - ts->val_type = (ts->fixed_reg ? TEMP_VAL_REG : TEMP_VAL_MEM); - } - for (n = s->nb_temps; i < n; i++) { - ts = &s->temps[i]; - ts->val_type = (ts->temp_local ? TEMP_VAL_MEM : TEMP_VAL_DEAD); - ts->mem_allocated = 0; - ts->fixed_reg = 0; + for (i = 0, n = s->nb_temps; i < n; i++) { + TCGTemp *ts = &s->temps[i]; + TCGTempVal val = TEMP_VAL_MEM; + + switch (ts->kind) { + case TEMP_FIXED: + val = TEMP_VAL_REG; + break; + case TEMP_GLOBAL: + break; + case TEMP_NORMAL: + val = TEMP_VAL_DEAD; + /* fall through */ + case TEMP_LOCAL: + ts->mem_allocated = 0; + break; + default: + g_assert_not_reached(); + } + ts->val_type = val; } memset(s->reg_to_temp, 0, sizeof(s->reg_to_temp)); @@ -1951,12 +1962,17 @@ static char *tcg_get_arg_str_ptr(TCGContext *s, char *buf, int buf_size, { int idx = temp_idx(ts); - 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; } @@ -2547,15 +2563,24 @@ static void la_bb_end(TCGContext *s, int ng, int nt) { int i; - for (i = 0; i < ng; ++i) { - s->temps[i].state = TS_DEAD | TS_MEM; - la_reset_pref(&s->temps[i]); - } - for (i = ng; i < nt; ++i) { - s->temps[i].state = (s->temps[i].temp_local - ? TS_DEAD | TS_MEM - : TS_DEAD); - la_reset_pref(&s->temps[i]); + for (i = 0; i < nt; ++i) { + TCGTemp *ts = &s->temps[i]; + int state; + + switch (ts->kind) { + case TEMP_FIXED: + case TEMP_GLOBAL: + case TEMP_LOCAL: + state = TS_DEAD | TS_MEM; + break; + case TEMP_NORMAL: + state = TS_DEAD; + break; + default: + g_assert_not_reached(); + } + ts->state = state; + la_reset_pref(ts); } } @@ -2583,7 +2608,7 @@ static void la_bb_sync(TCGContext *s, int ng, int nt) la_global_sync(s, ng); for (int i = ng; i < nt; ++i) { - if (s->temps[i].temp_local) { + if (s->temps[i].kind == TEMP_LOCAL) { int state = s->temps[i].state; s->temps[i].state = state | TS_MEM; if (state != TS_DEAD) { @@ -3191,7 +3216,8 @@ static void check_regs(TCGContext *s) } for (k = 0; k < s->nb_temps; k++) { ts = &s->temps[k]; - if (ts->val_type == TEMP_VAL_REG && !ts->fixed_reg + if (ts->val_type == TEMP_VAL_REG + && ts->kind != TEMP_FIXED && s->reg_to_temp[ts->reg] != ts) { printf("Inconsistency for temp %s:\n", tcg_get_arg_str_ptr(s, buf, sizeof(buf), ts)); @@ -3228,15 +3254,14 @@ static void temp_load(TCGContext *, TCGTemp *, TCGRegSet, 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 == TEMP_FIXED) { return; } if (ts->val_type == TEMP_VAL_REG) { s->reg_to_temp[ts->reg] = NULL; } ts->val_type = (free_or_dead < 0 - || ts->temp_local - || ts->temp_global + || ts->kind != TEMP_NORMAL ? TEMP_VAL_MEM : TEMP_VAL_DEAD); } @@ -3253,7 +3278,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 == TEMP_FIXED) { return; } if (!ts->mem_coherent) { @@ -3436,7 +3461,8 @@ static void temp_save(TCGContext *s, TCGTemp *ts, TCGRegSet 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 == TEMP_VAL_MEM || ts->fixed_reg); + tcg_debug_assert(ts->val_type == TEMP_VAL_MEM + || ts->kind == TEMP_FIXED); } /* save globals to their canonical location and assume they can be @@ -3461,7 +3487,7 @@ static void sync_globals(TCGContext *s, TCGRegSet allocated_regs) for (i = 0, n = s->nb_globals; i < n; i++) { TCGTemp *ts = &s->temps[i]; tcg_debug_assert(ts->val_type != TEMP_VAL_REG - || ts->fixed_reg + || ts->kind == TEMP_FIXED || ts->mem_coherent); } } @@ -3474,7 +3500,7 @@ static void tcg_reg_alloc_bb_end(TCGContext *s, TCGRegSet allocated_regs) for (i = s->nb_globals; i < s->nb_temps; i++) { TCGTemp *ts = &s->temps[i]; - if (ts->temp_local) { + if (ts->kind == TEMP_LOCAL) { temp_save(s, ts, allocated_regs); } else { /* The liveness analysis already ensures that temps are dead. @@ -3500,7 +3526,7 @@ static void tcg_reg_alloc_cbranch(TCGContext *s, TCGRegSet allocated_regs) * The liveness analysis already ensures that temps are dead. * Keep tcg_debug_asserts for safety. */ - if (ts->temp_local) { + if (ts->kind == TEMP_LOCAL) { tcg_debug_assert(ts->val_type != TEMP_VAL_REG || ts->mem_coherent); } else { tcg_debug_assert(ts->val_type == TEMP_VAL_DEAD); @@ -3516,7 +3542,7 @@ static void tcg_reg_alloc_do_movi(TCGContext *s, TCGTemp *ots, TCGRegSet preferred_regs) { /* ENV should not be modified. */ - tcg_debug_assert(!ots->fixed_reg); + tcg_debug_assert(ots->kind != TEMP_FIXED); /* The movi is not explicitly generated here. */ if (ots->val_type == TEMP_VAL_REG) { @@ -3556,7 +3582,7 @@ static void tcg_reg_alloc_mov(TCGContext *s, const TCGOp *op) ts = arg_temp(op->args[1]); /* ENV should not be modified. */ - tcg_debug_assert(!ots->fixed_reg); + tcg_debug_assert(ots->kind != TEMP_FIXED); /* Note that otype != itype for no-op truncation. */ otype = ots->type; @@ -3595,7 +3621,7 @@ static void tcg_reg_alloc_mov(TCGContext *s, const TCGOp *op) } temp_dead(s, ots); } else { - if (IS_DEAD_ARG(1) && !ts->fixed_reg) { + if (IS_DEAD_ARG(1) && ts->kind != TEMP_FIXED) { /* the mov can be suppressed */ if (ots->val_type == TEMP_VAL_REG) { s->reg_to_temp[ots->reg] = NULL; @@ -3617,7 +3643,7 @@ static void tcg_reg_alloc_mov(TCGContext *s, const TCGOp *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 != TEMP_FIXED); if (!ts->mem_allocated) { temp_allocate_frame(s, ots); } @@ -3654,7 +3680,7 @@ static void tcg_reg_alloc_dup(TCGContext *s, const TCGOp *op) its = arg_temp(op->args[1]); /* ENV should not be modified. */ - tcg_debug_assert(!ots->fixed_reg); + tcg_debug_assert(ots->kind != TEMP_FIXED); itype = its->type; vece = TCGOP_VECE(op); @@ -3794,7 +3820,7 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op) i_preferred_regs = o_preferred_regs = 0; if (arg_ct->ialias) { o_preferred_regs = op->output_pref[arg_ct->alias_index]; - if (ts->fixed_reg) { + if (ts->kind == TEMP_FIXED) { /* if fixed register, we must allocate a new register if the alias is not the same register */ if (arg != op->args[arg_ct->alias_index]) { @@ -3886,7 +3912,7 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op) ts = arg_temp(arg); /* ENV should not be modified. */ - tcg_debug_assert(!ts->fixed_reg); + tcg_debug_assert(ts->kind != TEMP_FIXED); if (arg_ct->oalias && !const_args[arg_ct->alias_index]) { reg = new_args[arg_ct->alias_index]; @@ -3927,7 +3953,7 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op) ts = arg_temp(op->args[i]); /* ENV should not be modified. */ - tcg_debug_assert(!ts->fixed_reg); + tcg_debug_assert(ts->kind != TEMP_FIXED); if (NEED_SYNC_ARG(i)) { temp_sync(s, ts, o_allocated_regs, 0, IS_DEAD_ARG(i)); @@ -4059,7 +4085,7 @@ static void tcg_reg_alloc_call(TCGContext *s, TCGOp *op) ts = arg_temp(arg); /* ENV should not be modified. */ - tcg_debug_assert(!ts->fixed_reg); + tcg_debug_assert(ts->kind != TEMP_FIXED); reg = tcg_target_call_oarg_regs[i]; tcg_debug_assert(s->reg_to_temp[reg] == NULL); From patchwork Thu Jan 14 02:16:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 362793 Delivered-To: patch@linaro.org Received: by 2002:a02:ccad:0:0:0:0:0 with SMTP id t13csp67143jap; Wed, 13 Jan 2021 18:22:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJxm3YrcEX9cCe7Ri5dqxu1pCEwVjsnmhi4sujPwIx8C6po5QbNqOLe4S+LEzaQ7xDps/hSf X-Received: by 2002:a25:d452:: with SMTP id m79mr7315087ybf.417.1610590942911; Wed, 13 Jan 2021 18:22:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610590942; cv=none; d=google.com; s=arc-20160816; b=EDeGrzAT7yaL9On0tqOd1q4KQVX7b5oT5OPQkjmm6GYuP/4csFUTdDrWVa4vqrOgWA 4F59ZNXPcIu6J2i++bWks1ABNK4HkYsyoGA8rXT6J2wU3OaOYazz5S0HYlOlR7X3jchC 0dxCrUMUmeTXr9SdsPPYRgcAQtqZ+r4CsO1RjHb153Wg18wMO8BnFne6oYtxWbW+KYR6 XAWY8JPZ7jaRIZPgOQq7NwVZ0Nzj8xGP8gQkjUaFhomFLZT4llBdeDVYDB8yLvzo/XYI pNg9wgulFkAcvitWVpdCOoen839BtFA67e/BZoCV2ll1Gxk1V1n4FTY98A4JEd3P575j yhBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=YpDNiHW+o2iNjUonn03i++LfISaZVtNqCD0CIRtryeM=; b=Hy6HWUHWuzEnI7i9Fsq8eVK49cQzlruNKV0mlcZuAYvnN9cAXwqeXsqr8BOWJVxIuI t7Ad+S9QImIYbVQ2KfMKH815TTRqGifirKl8sfOO+JrsWkWP4mOVmvQPF66nIgvcc/bs 9HC7i3EiTV7f3/ZCM7G7kJ6H4GIBKIrt/3dzHjQ/Y1i0YfTkt/J/4fHmamzzttKMyrJs kKa+450tHNGaVp/iyBEsxxBv1cRF3XAOF+pluICCVIQfNeHqHYPCbJNV5YMLy1/M1VSh uQya6hA4EUeF2xmShGByD3zSmB/12QsDY7oQ2SE6fn/VxNz5cjtAG5KFa9qnVn2Row0d zfzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hTCnrVLi; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id z206si3709881ybz.48.2021.01.13.18.22.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 13 Jan 2021 18:22:22 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hTCnrVLi; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:49632 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kzsHG-0001bx-Bl for patch@linaro.org; Wed, 13 Jan 2021 21:22:22 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60118) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kzsCC-0003Jk-IC for qemu-devel@nongnu.org; Wed, 13 Jan 2021 21:17:08 -0500 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]:44603) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kzsCA-0003OI-Nk for qemu-devel@nongnu.org; Wed, 13 Jan 2021 21:17:08 -0500 Received: by mail-pl1-x62c.google.com with SMTP id r4so2128983pls.11 for ; Wed, 13 Jan 2021 18:17:06 -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=YpDNiHW+o2iNjUonn03i++LfISaZVtNqCD0CIRtryeM=; b=hTCnrVLieh1AdfZur6mt7/4aqb2IYuq+A6eGXOMK8meNXUBTmDFJ+tgBH0QBRiTJBO c/FvApDpkI0fZhUq/7r7j2OuNpWlRdP/BoPUoOvqw0OeYfImO7XtnuOvGtNdV7opqNcw yvhg5z9v+GZs9CGo5KOnG9JnrevmeFCDDxbPG9/lfTMwOSEsWS5Kv8/GsTtLiQi6Q9/O sLG+XRTYsJIds8/eMt5w64mUdBNxMSKMbVlxMYd0FLXLUUd8ve1THWslmxSG3QRYyYrT dViuQxIfnqaayHgK+/frtZIOpmvGP0gXEUsgrGh2KPK5poxaYRNj+bavVu3CwckCWXKw Y5/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=YpDNiHW+o2iNjUonn03i++LfISaZVtNqCD0CIRtryeM=; b=J7omKF5pUZer+EQQ9uDFEJijOp8O/e731N9v8lHlsIVrUxXaft+3SzfbfAGFqqffOi 0Y4ajhHoBAjcdhOf12FkeRtpzSk6e7Nw2w2MpClssVO5oibvPONS04TcXeTsTob+LV7f UjfpuSAyVnOFslrrqFm1tuvcbVHethoeuFO4D+ASnprKZs3u52RrXRdS7UlREmR2bKJM 9qVJSLxAC/Y01OF26UsaKjjVGo1OtfG7l8CVowyTcbeMdvjYiRQ342aWTSS/MOtojGdn NmlnHZfYTEG4Uo5R9I2ivzMmk63BrF28AeKUX/McK6Z0IOlsoFuyBKjFFvRSrhohFKzk bMIQ== X-Gm-Message-State: AOAM5324Dcj6mbwgRyL+jG8/KE6q1TSXkEvFTRhSUA0Vpbukt2vsQiIX 7Gt11cvon/JCvVRv6lJ226FvED0owmIfsQ== X-Received: by 2002:a17:90a:454e:: with SMTP id r14mr2501853pjm.194.1610590624956; Wed, 13 Jan 2021 18:17:04 -0800 (PST) Received: from localhost.localdomain (rrcs-173-197-107-21.west.biz.rr.com. [173.197.107.21]) by smtp.gmail.com with ESMTPSA id i7sm3771687pfc.50.2021.01.13.18.17.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jan 2021 18:17:04 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 04/24] tcg: Add temp_readonly Date: Wed, 13 Jan 2021 16:16:34 -1000 Message-Id: <20210114021654.647242-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210114021654.647242-1-richard.henderson@linaro.org> References: <20210114021654.647242-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62c; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62c.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: peter.maydell@linaro.org, =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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ée Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- include/tcg/tcg.h | 5 +++++ tcg/tcg.c | 21 ++++++++++----------- 2 files changed, 15 insertions(+), 11 deletions(-) -- 2.25.1 diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index 571d4e0fa3..2bdaeaa69c 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -679,6 +679,11 @@ struct TCGContext { target_ulong gen_insn_data[TCG_MAX_INSNS][TARGET_INSN_START_WORDS]; }; +static inline bool temp_readonly(TCGTemp *ts) +{ + return ts->kind == TEMP_FIXED; +} + extern TCGContext tcg_init_ctx; extern __thread TCGContext *tcg_ctx; extern const void *tcg_code_gen_epilogue; diff --git a/tcg/tcg.c b/tcg/tcg.c index 143794a585..e02bb71953 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -3254,7 +3254,7 @@ static void temp_load(TCGContext *, TCGTemp *, TCGRegSet, 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 == TEMP_FIXED) { + if (temp_readonly(ts)) { return; } if (ts->val_type == TEMP_VAL_REG) { @@ -3278,7 +3278,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 == TEMP_FIXED) { + if (temp_readonly(ts)) { return; } if (!ts->mem_coherent) { @@ -3461,8 +3461,7 @@ static void temp_save(TCGContext *s, TCGTemp *ts, TCGRegSet 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 == TEMP_VAL_MEM - || ts->kind == TEMP_FIXED); + tcg_debug_assert(ts->val_type == TEMP_VAL_MEM || temp_readonly(ts)); } /* save globals to their canonical location and assume they can be @@ -3542,7 +3541,7 @@ static void tcg_reg_alloc_do_movi(TCGContext *s, TCGTemp *ots, TCGRegSet preferred_regs) { /* ENV should not be modified. */ - tcg_debug_assert(ots->kind != TEMP_FIXED); + tcg_debug_assert(!temp_readonly(ots)); /* The movi is not explicitly generated here. */ if (ots->val_type == TEMP_VAL_REG) { @@ -3582,7 +3581,7 @@ static void tcg_reg_alloc_mov(TCGContext *s, const TCGOp *op) ts = arg_temp(op->args[1]); /* ENV should not be modified. */ - tcg_debug_assert(ots->kind != TEMP_FIXED); + tcg_debug_assert(!temp_readonly(ots)); /* Note that otype != itype for no-op truncation. */ otype = ots->type; @@ -3643,7 +3642,7 @@ static void tcg_reg_alloc_mov(TCGContext *s, const TCGOp *op) * Store the source register into the destination slot * and leave the destination temp as TEMP_VAL_MEM. */ - assert(ots->kind != TEMP_FIXED); + assert(!temp_readonly(ots)); if (!ts->mem_allocated) { temp_allocate_frame(s, ots); } @@ -3680,7 +3679,7 @@ static void tcg_reg_alloc_dup(TCGContext *s, const TCGOp *op) its = arg_temp(op->args[1]); /* ENV should not be modified. */ - tcg_debug_assert(ots->kind != TEMP_FIXED); + tcg_debug_assert(!temp_readonly(ots)); itype = its->type; vece = TCGOP_VECE(op); @@ -3912,7 +3911,7 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op) ts = arg_temp(arg); /* ENV should not be modified. */ - tcg_debug_assert(ts->kind != TEMP_FIXED); + tcg_debug_assert(!temp_readonly(ts)); if (arg_ct->oalias && !const_args[arg_ct->alias_index]) { reg = new_args[arg_ct->alias_index]; @@ -3953,7 +3952,7 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op) ts = arg_temp(op->args[i]); /* ENV should not be modified. */ - tcg_debug_assert(ts->kind != TEMP_FIXED); + tcg_debug_assert(!temp_readonly(ts)); if (NEED_SYNC_ARG(i)) { temp_sync(s, ts, o_allocated_regs, 0, IS_DEAD_ARG(i)); @@ -4085,7 +4084,7 @@ static void tcg_reg_alloc_call(TCGContext *s, TCGOp *op) ts = arg_temp(arg); /* ENV should not be modified. */ - tcg_debug_assert(ts->kind != TEMP_FIXED); + tcg_debug_assert(!temp_readonly(ts)); reg = tcg_target_call_oarg_regs[i]; tcg_debug_assert(s->reg_to_temp[reg] == NULL); From patchwork Thu Jan 14 02:16:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 362799 Delivered-To: patch@linaro.org Received: by 2002:a02:ccad:0:0:0:0:0 with SMTP id t13csp68671jap; Wed, 13 Jan 2021 18:24:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJyemU+bFQB1qj+l/7jda3hnC7x2OHnfPvQNzUW2ecaprxfbONJdGHvbeqjzVyIu9aFOO3Jy X-Received: by 2002:a25:d088:: with SMTP id h130mr7007373ybg.442.1610591092160; Wed, 13 Jan 2021 18:24:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610591092; cv=none; d=google.com; s=arc-20160816; b=VfDY/m/gCZ2FQnI890BkRtIyThUe8xz5kfN8VSPObiUq9sfUvdI3iaZTHgCdsOB9aq AuCii8lAqvXGZ7jzvkU/NoL2SmHq2cTLFvuAtJC16A32vc5h3eaR+ltPBnphNRD98eBY tcjwv3xw+/tAc0+qxW3xSmulwcnlMNCbTdAAAws8kFF/yynb6BjxfUbFKu40Zk689zRA re5BWFY38rZKu0FZCEyVTodFz3bPmvOrPHvB50ZdzRuDPpyrdB91vExnvggjGKewol79 zZ2FyeDoas1CQk5I4lxGngtFNYGY50Q9DSejY7L05VbD/JyLhKS9qGGIBZEweeyKOoIp qAeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=AC87R9xtxutHL4s1/n8odbHgwbxpwhaLEHoWjKyBlaU=; b=A00ZKbn/f+b4KOTuowGvGaiPhHoQwEypnrNG6+cPGk9ZxI61z/4HjpjKQI068W22Qp DMbwjjXBy6jjnydu3aic16NHEhYMoyyIN6Oie51hI0rJSkWBEzhJTWO7EBfesIpcpq4P PhuRaIujdQ1RUeQliORefD5lEp7v/zoIC55aeYuETe5A7jxEiOBzZ5tGASHlPtpn1FPV sSLyUFF93zsEQLDTHpe9MfeT4EYXDpl6sv9NsH74rL1XuiCQl2oupWz2DLoI8Q37Mo9a hbbqtRS/A3OkMh2kItjR/4RfDj08qw8kMMhUOuYLcVN9NznK/4kgX0DT2XFyJ5UmYfZs R+VA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DjzjC54T; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id j7si3429387ybt.380.2021.01.13.18.24.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 13 Jan 2021 18:24:52 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DjzjC54T; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:57904 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kzsJf-00050u-KQ for patch@linaro.org; Wed, 13 Jan 2021 21:24:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60134) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kzsCE-0003Nt-7U for qemu-devel@nongnu.org; Wed, 13 Jan 2021 21:17:10 -0500 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]:46393) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kzsCC-0003PO-1F for qemu-devel@nongnu.org; Wed, 13 Jan 2021 21:17:09 -0500 Received: by mail-pf1-x42f.google.com with SMTP id w2so2435193pfc.13 for ; Wed, 13 Jan 2021 18:17:07 -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=AC87R9xtxutHL4s1/n8odbHgwbxpwhaLEHoWjKyBlaU=; b=DjzjC54TGmJxdQOByP3MvVXBxYbz02nYRtqlhSvX08aWyXqfcQAVvFJ2VdkL4khI1U 12oCg1K5ezCkc3BhK79HyB5UXv0J2mMXcMWEzyU/EJtt2xYINeZbcVQX3xQHd5mb4KpQ bl/S07VcneAPr7Lnrwe2i5LWa2Y528h6k01ecg9GJLIotC+wSp0rgyd3AM5Bp2cI+tf9 t8yDcVnJC/u0132Kphu3v0B60aZ1UTSDjCi3mfBu+WF29by+FwjK9Inm+9ZglFEbUzN7 Wa/argGI+v4n16CN/U8ELhthGDoogvXEtt8KqlI0oHITC56tEVXSaeYn7spRZHO9RmOk dhxw== 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=AC87R9xtxutHL4s1/n8odbHgwbxpwhaLEHoWjKyBlaU=; b=iqrRh+BQPmctmfkPeJd//GnEk4fxmcfeeFZwErxgYjuWrtf+JjV0/UHC85dqbNZ80b AUzJ/HKZTN89/ijZrPJeijuAAeAI42Gj2DHwk2mf6SmAq9UbbWiYKZ2CeVPgH90Jsj53 b+qvV5Ikl/eejiCxvV0X9YGfZoOUTOGJoupOfzIwtDEydVpfSMGPHwjpTGg940YQ4RXZ WIiQ6EEijYTl7NGPmdibUpdUXtNCWj03qcUwkinWooPYaZAM2VxGOLNFvff6p4eYYzRz Uaxuivknw8URyFBXgF86Atln8ft4KcjX7mEr25XwRXc6g+4SOG0PsRU4URLlao5fah72 dn5g== X-Gm-Message-State: AOAM533GpraasjJ7yLkNP4qePahv/b/1XnnLbs3FRtqjihyn6t91k6g/ 2lP7p2a1rM/CX+dW9Nrv10g/NafI9ZbhcQ== X-Received: by 2002:a63:50a:: with SMTP id 10mr5027713pgf.273.1610590626558; Wed, 13 Jan 2021 18:17:06 -0800 (PST) Received: from localhost.localdomain (rrcs-173-197-107-21.west.biz.rr.com. [173.197.107.21]) by smtp.gmail.com with ESMTPSA id i7sm3771687pfc.50.2021.01.13.18.17.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jan 2021 18:17:06 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 05/24] tcg: Expand TCGTemp.val to 64-bits Date: Wed, 13 Jan 2021 16:16:35 -1000 Message-Id: <20210114021654.647242-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210114021654.647242-1-richard.henderson@linaro.org> References: <20210114021654.647242-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42f; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42f.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: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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(-) -- 2.25.1 diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index 2bdaeaa69c..e7adc7e265 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; - 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 e02bb71953..545dd2b0b2 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -3176,7 +3176,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"); From patchwork Thu Jan 14 02:16:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 362802 Delivered-To: patch@linaro.org Received: by 2002:a02:ccad:0:0:0:0:0 with SMTP id t13csp70582jap; Wed, 13 Jan 2021 18:27:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJxyQlhNQISY78I2A3mstAbKS9wsXD5VC5q04Pa9fx0nkmj329g/rnAINiB9CLTV81Z0VE3V X-Received: by 2002:a25:adc5:: with SMTP id d5mr7312420ybe.401.1610591278849; Wed, 13 Jan 2021 18:27:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610591278; cv=none; d=google.com; s=arc-20160816; b=ggL/6BRgCgJjMv77jM+VtmZVW6Fzz978yA10H7X7L1xBe+RR5bWXNA12FO1PF2raK3 C4QfA4MW66URwU/IHFM7DDKlnBsyfDEbGFEsEpTof3zdZ8W3hl3qxh61X5T2pkbMsoke PjO7wu9u2q6QiJhc+Viq3CI0nBLvHR/eVb2/qCofw7lAcjZGIGrGUa6R4MC15fYM7n6L 9D62E7baLynVxvFv+qIv86rcXxEBFjNGSJIvbmVuR8/BUX36WFg73WZnOX47xv/euNeU 08uuxwqf9RX75mwJPaSNxmTJs6CeRiaewjyrd7bt+5Rm4UyDBGmtkPz6EtlQpdae5v9q Qeyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=qXpykEtc7vaKX9QcxuT/1Uq7HaNn7jlaJj69OtcFcWE=; b=jZwtct4Xcl7D0vrIoikkKIRR82UzFnbo9epRDnZuutvAvOS6sbsz7XkV+xAjX8x/pn 2WxGCHfq8umjfKETBb9j8ADqXLOKfBcPD6Z7Ft6b9zkJPUDgap6E/iNpgaiBjqyywlBj ZsmqJ/bfxIIrnYvFFqxhGrYD9VQOZB3VYq+c5+Zw8i/4T6wU5k1kP2xdwWgBCdZ6XC3v XJBoVhxWi7ouKIVqLEGFxOyPc8ZY2f9GXLKnun6C5YgMAbsyo4Rax6t/WIK6wAyg8PmI Mc7l8VvuORh5yz6iK6aXFBfAP9DvaF/Y+lEeI7qdyXn0WiZ18a8Tu+YO/03w/iBcXhWA IZoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eHAB5yNR; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id a9si3792797ybc.91.2021.01.13.18.27.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 13 Jan 2021 18:27:58 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eHAB5yNR; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:37272 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kzsMg-0008HF-A5 for patch@linaro.org; Wed, 13 Jan 2021 21:27:58 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60144) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kzsCF-0003RP-PS for qemu-devel@nongnu.org; Wed, 13 Jan 2021 21:17:11 -0500 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]:43871) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kzsCE-0003Pm-0u for qemu-devel@nongnu.org; Wed, 13 Jan 2021 21:17:11 -0500 Received: by mail-pf1-x42e.google.com with SMTP id c12so2447698pfo.10 for ; Wed, 13 Jan 2021 18:17:09 -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=qXpykEtc7vaKX9QcxuT/1Uq7HaNn7jlaJj69OtcFcWE=; b=eHAB5yNRSmzYV23tyKPFIXCzDNNBO7jyOFjJ3U53SBkBcS48ftXISiyn93yKOpeSTh PdTa0uZYhQLK5DOED1BUl2C/YWmXLlmOwHPXtcxiTyz8Z2luvk5tGFFxjt8Vc2zJ7WHq UJT13y0BZkbWP/NlLWmKx2KnitJ+hkig6wMuV/5SFql+xSUXg0m7TswiCBGKLR2xFd/I r1TBYbR5TVaFU4sLIfBA1A+k6kjOexFv/FmGwdatL9RUhd3oM9AUJbe9zXJJGh8uJWeC EdbgZ1t/lTS1he/4n7wh2GfE+x0KAXPiKJf0QRIVWH+VEfHEHmSwrgg7upT/foiPyQ7O l6Qg== 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=qXpykEtc7vaKX9QcxuT/1Uq7HaNn7jlaJj69OtcFcWE=; b=fT0HrZ+Apb/EUnsvjTcuPd/Pzy3Dts8yoEh6799Ang5J7iyTVd35rkwR+JNaGqBAqu CUm4CcJm09z4EpIGNF+HH63S+RDUIfORGM4ZEtzCk4rkFG089RyIuf1YITwsFk5UdrKJ +is3W3QQcVXTcq3sCSNj4maZDTwVO7y8OKTdbAnmlRYIRCB+JtJJzZhu8/9HyScX2m1x 7md1th7n8Ht7hKgI1W77kvg8xaBcjNKnu2wce+4EzjlnHrLB47tvwxZtsPcxJ6zYLnCC 6Svl+ogPQn7AKuyJoJsi6cpNrjQL8Ovg2WyO8E0D2V2cStixT7E0h+l+LdhPSmXE+S2H owNQ== X-Gm-Message-State: AOAM532J5OzK7eXrOuYxcZQiTAN0DMRfCfJgCYN/lqFlZNcFcemxWMXU MocFK9ZScHQQg875Ocoyoq7ojgstCEv+Og== X-Received: by 2002:a63:f512:: with SMTP id w18mr5064342pgh.154.1610590628506; Wed, 13 Jan 2021 18:17:08 -0800 (PST) Received: from localhost.localdomain (rrcs-173-197-107-21.west.biz.rr.com. [173.197.107.21]) by smtp.gmail.com with ESMTPSA id i7sm3771687pfc.50.2021.01.13.18.17.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jan 2021 18:17:07 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 06/24] tcg: Rename struct tcg_temp_info to TempOptInfo Date: Wed, 13 Jan 2021 16:16:36 -1000 Message-Id: <20210114021654.647242-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210114021654.647242-1-richard.henderson@linaro.org> References: <20210114021654.647242-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42e.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: peter.maydell@linaro.org, =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Fix this name vs our coding style. Reviewed-by: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- tcg/optimize.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) -- 2.25.1 diff --git a/tcg/optimize.c b/tcg/optimize.c index 2f827a9d2d..0da9750b65 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) -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; -static inline struct tcg_temp_info *ts_info(TCGTemp *ts) +static inline TempOptInfo *ts_info(TCGTemp *ts) { return ts->state_ptr; } -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 = ts_info(ts); - struct tcg_temp_info *pi = ts_info(ti->prev_copy); - struct tcg_temp_info *ni = ts_info(ti->next_copy); + TempOptInfo *ti = ts_info(ts); + TempOptInfo *pi = ts_info(ti->prev_copy); + TempOptInfo *ni = ts_info(ti->next_copy); ni->prev_copy = ti->prev_copy; pi->next_copy = ti->next_copy; @@ -89,12 +89,12 @@ static void reset_temp(TCGArg arg) } /* 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 = temp_idx(ts); if (!test_bit(idx, temps_used->l)) { - struct tcg_temp_info *ti = &infos[idx]; + TempOptInfo *ti = &infos[idx]; ts->state_ptr = ti; ti->next_copy = ts; @@ -105,7 +105,7 @@ static void init_ts_info(struct tcg_temp_info *infos, } } -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 = arg_info(dst); + TempOptInfo *di = arg_info(dst); def = &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, TCGArg dst, TCGArg src) TCGTemp *dst_ts = arg_temp(dst); TCGTemp *src_ts = 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; @@ -236,7 +236,7 @@ static void tcg_opt_gen_mov(TCGContext *s, TCGOp *op, TCGArg dst, TCGArg src) di->mask = mask; if (src_ts->type == dst_ts->type) { - struct tcg_temp_info *ni = ts_info(si->next_copy); + TempOptInfo *ni = ts_info(si->next_copy); di->next_copy = si->next_copy; di->prev_copy = src_ts; @@ -599,7 +599,7 @@ void tcg_optimize(TCGContext *s) { int nb_temps, nb_globals; TCGOp *op, *op_next, *prev_mb = NULL; - struct tcg_temp_info *infos; + TempOptInfo *infos; TCGTempSet temps_used; /* Array VALS has an element for each temp. @@ -610,7 +610,7 @@ void tcg_optimize(TCGContext *s) nb_temps = s->nb_temps; nb_globals = s->nb_globals; bitmap_zero(temps_used.l, nb_temps); - infos = tcg_malloc(sizeof(struct tcg_temp_info) * nb_temps); + infos = tcg_malloc(sizeof(TempOptInfo) * nb_temps); QTAILQ_FOREACH_SAFE(op, &s->ops, link, op_next) { tcg_target_ulong mask, partmask, affected; From patchwork Thu Jan 14 02:16:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 362794 Delivered-To: patch@linaro.org Received: by 2002:a02:ccad:0:0:0:0:0 with SMTP id t13csp67168jap; Wed, 13 Jan 2021 18:22:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJzK3dLsa6nuKiw1JIiVQW19LT1w5a5ybwQywZGU7gx7r/+EAH6ROUz9apeOC+TMMLwen590 X-Received: by 2002:a25:3d81:: with SMTP id k123mr7185599yba.430.1610590945980; Wed, 13 Jan 2021 18:22:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610590945; cv=none; d=google.com; s=arc-20160816; b=NR5CaXokWpFVG6fI9R/K2eODkiC4jk8pad4aSARGxmZ89EeFAxNDb2YsLyP9LhiAjp GNX8xDMDwGp4R+8UcmJasDplJy5yaL1dieNw6R/5xw7CYWPM7a7pj7yrgj2xvo8jF8gG 7/r+8N9s6zHnwfV1tgB7q3x16WaOTWBteyD3fAuArFn5csdHVAS+CQ41Sw7Y5YW+zkZ3 Jqw40Gs4bI/nyyzvWhTdjdNIOHLauJq9ph1jrCYKbovUgTuCnE2adzTrFm2Ol0esdKAo voibWuet0AaWx2kpDMa2QStUuoOsxRQDM+aCawpFMybCYDr0UgW4sfKIhhP4BitrO3A0 ixiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=HdlisOqlJWN9os3gMBGAWcsA358Yd0mVBunQfB+T/MQ=; b=Vw6QyBZ/g3X7FaxlesUufah/Mo0gK4sFZvqJ0DqUFrGszle7hlTdHfbstCpgvKnJS2 QsiMF94g+mBGEM5D/itHetJqLc0RUPXYtM+QGwQ4RWfn6jgkxU3HWdqgXeIHpblURZpz F/ndAf4DExBenMx6atjK9vAPp7qhoaC+gl5+hgpp8cVBs+M2kXc1VrZ0qen3GWKOtUuM P7cdTyc1oDJvTVotVyHKbiZOjv/UzXysMN2GjaYWcVfpeq4dHcKjFlnkaBb4h60Ef9It En3Pt0PUCF+WrVsJKuvnGYBT1KevFQofJQT6Qd3XwkXlJAwHcpMDofyXBg6fIvLabiET z2Ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=An8zDQwI; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w15si3411022ybe.101.2021.01.13.18.22.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 13 Jan 2021 18:22:25 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=An8zDQwI; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:49940 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kzsHJ-0001js-Bv for patch@linaro.org; Wed, 13 Jan 2021 21:22:25 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60158) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kzsCH-0003W0-DZ for qemu-devel@nongnu.org; Wed, 13 Jan 2021 21:17:13 -0500 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]:39058) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kzsCF-0003Rm-MB for qemu-devel@nongnu.org; Wed, 13 Jan 2021 21:17:13 -0500 Received: by mail-pf1-x42b.google.com with SMTP id m6so2453176pfm.6 for ; Wed, 13 Jan 2021 18:17:11 -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=HdlisOqlJWN9os3gMBGAWcsA358Yd0mVBunQfB+T/MQ=; b=An8zDQwI0p8Y/xpTtMF0VXM7xNKwgmWNHnzM0nTj6PhnMEvzNvlOsS+LT0E8cGe/6p gTfoPMYKrs/AAjeEmJsvl72pKiPrzDF4FDChpz84xhgKz1reUFHhCXKZ9nTIl7CVSN+K 7D7svUF+9jUZAOJgDWpMs0pr1/I89xTuF2cqsfL6O0I3zxItvM07c/MYybAarQSlNwyz eoPxxGlDt9cHFTG1tNnAFSZIjPh/QLGoNkEIoKrUt7dvD8qO7VzhBOiAuULQHA2cDaYk mnsL300mWwtMaviDPT1fB93Mtodt/7wl3u/Xfthvkej4VcvyHeD9vPh5R93+2KWz3Kc6 BHeA== 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=HdlisOqlJWN9os3gMBGAWcsA358Yd0mVBunQfB+T/MQ=; b=EumafHH4Z/dc/2zDk5YA0FUue1tvhqXnC0JqcbF6SZLnZkBkYRToSuSrW469FI3LIM paLEIGoSX5O5XPxDC2AICh9bBfcKJFNx1scPvf+HmSeX6VXIBIwB6jTGjIurulNc3AUJ pEbOVUIt7P3b0fLhriMHNXKxojzJc2jBI4LGl2Or/+DruzK6jPxnXzSTWVCdDcni2dO+ /uDzIRBj7w7UgPO6sPswnK7ZtU97wfXLUVRMtFcau5aElvH5YOaxxKY3x+7hA2TXTuVQ sG9yznRUIG/2zcd2/sisCRPf4+exhL984xgTgo5qfNP/SFmfceZ5VLknp+iU7Sg99UHV EDCw== X-Gm-Message-State: AOAM531N7KOv8wOa/agJZsYHXjPdQwkKp3BqtwoLDTsD+8WM2K5M3Ae5 5Cu/w8MR04grSa7cNaCB3Ti5f9yWUhxgVw== X-Received: by 2002:a63:1a10:: with SMTP id a16mr4862288pga.317.1610590630066; Wed, 13 Jan 2021 18:17:10 -0800 (PST) Received: from localhost.localdomain (rrcs-173-197-107-21.west.biz.rr.com. [173.197.107.21]) by smtp.gmail.com with ESMTPSA id i7sm3771687pfc.50.2021.01.13.18.17.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jan 2021 18:17:09 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 07/24] tcg: Expand TempOptInfo to 64-bits Date: Wed, 13 Jan 2021 16:16:37 -1000 Message-Id: <20210114021654.647242-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210114021654.647242-1-richard.henderson@linaro.org> References: <20210114021654.647242-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42b; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42b.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: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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(-) -- 2.25.1 diff --git a/tcg/optimize.c b/tcg/optimize.c index 0da9750b65..433d2540f4 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; 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)); } -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 = arg_info(dst); def = &tcg_op_defs[op->opc]; @@ -204,7 +204,7 @@ static void tcg_opt_gen_mov(TCGContext *s, TCGOp *op, TCGArg dst, TCGArg src) const TCGOpDef *def; TempOptInfo *di; TempOptInfo *si; - tcg_target_ulong mask; + uint64_t mask; TCGOpcode new_op; if (ts_are_copies(dst_ts, src_ts)) { @@ -247,7 +247,7 @@ static void tcg_opt_gen_mov(TCGContext *s, TCGOp *op, TCGArg dst, TCGArg src) } } -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; @@ -410,10 +410,10 @@ static TCGArg do_constant_folding_2(TCGOpcode op, TCGArg x, TCGArg y) } } -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 = &tcg_op_defs[op]; - TCGArg res = do_constant_folding_2(op, x, y); + uint64_t res = do_constant_folding_2(op, x, y); if (!(def->flags & TCG_OPF_64BIT)) { res = (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 = arg_info(x)->val; - tcg_target_ulong yv = arg_info(y)->val; + uint64_t xv = arg_info(x)->val; + uint64_t yv = arg_info(y)->val; + if (arg_is_const(x) && arg_is_const(y)) { const TCGOpDef *def = &tcg_op_defs[op]; tcg_debug_assert(!(def->flags & TCG_OPF_VECTOR)); @@ -613,9 +614,8 @@ void tcg_optimize(TCGContext *s) infos = tcg_malloc(sizeof(TempOptInfo) * nb_temps); 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 = op->opc; const TCGOpDef *def = &tcg_op_defs[opc]; @@ -1225,14 +1225,15 @@ void tcg_optimize(TCGContext *s) CASE_OP_32_64(extract2): if (arg_is_const(op->args[1]) && arg_is_const(op->args[2])) { - TCGArg v1 = arg_info(op->args[1])->val; - TCGArg v2 = arg_info(op->args[2])->val; + uint64_t v1 = arg_info(op->args[1])->val; + uint64_t v2 = arg_info(op->args[2])->val; + int shr = op->args[3]; if (opc == INDEX_op_extract2_i64) { - tmp = (v1 >> op->args[3]) | (v2 << (64 - op->args[3])); + tmp = (v1 >> shr) | (v2 << (64 - shr)); } else { - tmp = (int32_t)(((uint32_t)v1 >> op->args[3]) | - ((uint32_t)v2 << (32 - op->args[3]))); + tmp = (int32_t)(((uint32_t)v1 >> shr) | + ((uint32_t)v2 << (32 - shr))); } tcg_opt_gen_movi(s, op, op->args[0], tmp); break; @@ -1271,9 +1272,10 @@ void tcg_optimize(TCGContext *s) break; } if (arg_is_const(op->args[3]) && arg_is_const(op->args[4])) { - tcg_target_ulong tv = arg_info(op->args[3])->val; - tcg_target_ulong fv = arg_info(op->args[4])->val; + uint64_t tv = arg_info(op->args[3])->val; + uint64_t fv = arg_info(op->args[4])->val; TCGCond cond = op->args[5]; + if (fv == 1 && tv == 0) { cond = tcg_invert_cond(cond); } else if (!(tv == 1 && fv == 0)) { From patchwork Thu Jan 14 02:16:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 362796 Delivered-To: patch@linaro.org Received: by 2002:a02:ccad:0:0:0:0:0 with SMTP id t13csp67376jap; Wed, 13 Jan 2021 18:22:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJyZ7Frxiw+xxstR5NtH9KvLoVT1lVg5teVjlroW9t6NMFP4WtpAbeLLNqqZ8ReJ0PlvVeIy X-Received: by 2002:a25:b703:: with SMTP id t3mr8316864ybj.96.1610590968622; Wed, 13 Jan 2021 18:22:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610590968; cv=none; d=google.com; s=arc-20160816; b=iLweXSiqlEb4ZyIzWXKawtEyCi3dQAxw0sm8hUxfgznkwVXLbjfbiPeSicWbpUcghK KA1EYraRYf/tKuU5Ukcn6876VQC79F/IhsEmM7bmwBdNAqoCCE2lkOCCmUgjrZGiFPfj Abq9K6SUlxZ7Wvo9/W9XYe74k/D9EE/v8CHrHysMlPv8rwvg/C4uYRUOmOgnrWLF3nh7 LZhhrRRX7Xniq7f7Em5CdLulf3ixekG9GcFG+qGjV/8kV6lVps/go9mpcwCJoLqsSYgR scw3byR7XVqmtb47PP8PqybkdWPlRbc1AJSK/4HGa/p2UnvlzXCuaAivhFtIIOgVLp5L 8GIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=LsIdAJbKACMjuuIjOJp26kSOqsc3HuJuSVDCVt9lL6E=; b=fezinlES/qJacrakbs9YnJA2w3u+8dKiNS6PpnJb/cSWgj5s8z3Oqq3QOnHnpWqtQt 89z4/2uw4uj+D/VkAojR5amBEduKSHPeZ4OIjq6Cc0idblE6s6rbGm6u2b/9jSCYs2U8 vD7mpnZY6Jf33a6DdiTGmzwJfU5RBNHRXM8tRolhyjlS1psNXR3gVUuQIc/Jfxned+GC e58m4vBePAlRonbqxVeujhN0u+calsuLDnnAXC4GlTsiQJz2bdzjy1vwDhYe/ANwiHU5 9FAt2OzXkOG7ZwaPtoopxgEgrPsx5V6cuOMCDy0CgLxkHr8jSwAkshbxfT+Cs6Tt7tnn 7/YQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PEAN90QD; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h13si3801233ybq.232.2021.01.13.18.22.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 13 Jan 2021 18:22:48 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PEAN90QD; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:50536 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kzsHg-0001yQ-3P for patch@linaro.org; Wed, 13 Jan 2021 21:22:48 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60190) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kzsCJ-0003ai-OH for qemu-devel@nongnu.org; Wed, 13 Jan 2021 21:17:21 -0500 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]:36260) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kzsCH-0003Ry-Hw for qemu-devel@nongnu.org; Wed, 13 Jan 2021 21:17:15 -0500 Received: by mail-pj1-x102f.google.com with SMTP id l23so2366187pjg.1 for ; Wed, 13 Jan 2021 18:17:13 -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=LsIdAJbKACMjuuIjOJp26kSOqsc3HuJuSVDCVt9lL6E=; b=PEAN90QDdYWg0D6+2VK+ECzrdt94z49ITK0kV81PjzWuIvu4XTH8BKUA4Fi2Ym3KEV u6MSflwnYbWycHeb+E7ryAcNRSqaH6Dk1n+psSC15WBz0NHZVeRU/6Yv1ILeYYC+IjJD 9qYHddH3dfVUdLOZLGJGurc8RPhhgCuMYxDU77t9S/8u835zMP1Oaj3+sc9tOCuGY+SA 7pENk91p/VOH4tZGOiDdyU6um2wNI8nfH1HUOHhCdej76STfFQA6jYFCm2RqQiA3LmEg nF2SSr6FzmCkZnI43BMghg41oo65G3HnDywqLQ/ZFJy5yqfi6gGJl5a+TfbvN7E1XEUY hUmA== 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=LsIdAJbKACMjuuIjOJp26kSOqsc3HuJuSVDCVt9lL6E=; b=didqRJzJCzQC8/hVzXz0f1vqmmIqDqm6LEg+NFibkQBG9dgs05XhwkNklgIPAzqKmf kRPJ1wirEUFL3ZTp1knyhHcbiThh3LWGcSyHRNM1UiCSQDAZoqC8Zr5gqhBd+M6hQQZn hl/j6ZTFH0/C3DBfAd0WAH2iAFNFbNcE9UG5gyK8wjuRW4BaH5jJB7z3hlxOao8yzfa8 HFQDlIATs8quOARzYUpTZRWDo90Q8rbZX2CZapkTcUy2ZKimLqR43swGdRm2WM0SSdeJ aiNp3MlpnMVoKUn9H5DFVP1zwdhsUI89Z33uew7QSwjQNKySTjPdtDMS/uZ02cboSbj+ 4ZoA== X-Gm-Message-State: AOAM530YpuY8yHzuQRw14HySQwBrhLdu8qPMFlsK2bnqW1RKNixT0CMw u+P9dI6LzUngFFFYwHKHwaaSyOgDgh/gig== X-Received: by 2002:a17:902:bc41:b029:de:1ec2:dac1 with SMTP id t1-20020a170902bc41b02900de1ec2dac1mr5315916plz.9.1610590631728; Wed, 13 Jan 2021 18:17:11 -0800 (PST) Received: from localhost.localdomain (rrcs-173-197-107-21.west.biz.rr.com. [173.197.107.21]) by smtp.gmail.com with ESMTPSA id i7sm3771687pfc.50.2021.01.13.18.17.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jan 2021 18:17:11 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 08/24] tcg: Introduce TYPE_CONST temporaries Date: Wed, 13 Jan 2021 16:16:38 -1000 Message-Id: <20210114021654.647242-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210114021654.647242-1-richard.henderson@linaro.org> References: <20210114021654.647242-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102f; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102f.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: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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(-) -- 2.25.1 diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index e7adc7e265..eeeb70ad43 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; typedef struct TCGTemp { @@ -665,6 +667,7 @@ struct TCGContext { QSIMPLEQ_HEAD(, TCGOp) plugin_ops; #endif + GHashTable *const_table[TCG_TYPE_COUNT]; TCGTempSet free_temps[TCG_TYPE_COUNT * 2]; TCGTemp temps[TCG_MAX_TEMPS]; /* globals first, temps after */ @@ -681,7 +684,7 @@ struct TCGContext { static inline bool temp_readonly(TCGTemp *ts) { - return ts->kind == TEMP_FIXED; + return ts->kind >= TEMP_FIXED; } extern TCGContext tcg_init_ctx; @@ -1079,6 +1082,7 @@ TCGOp *tcg_op_insert_after(TCGContext *s, TCGOp *op, TCGOpcode opc); void tcg_optimize(TCGContext *s); +/* 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); @@ -1088,6 +1092,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); +/* + * 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 == 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 433d2540f4..16b0aa7229 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -99,8 +99,17 @@ static void init_ts_info(TempOptInfo *infos, ts->state_ptr = ti; ti->next_copy = ts; ti->prev_copy = ts; - ti->is_const = false; - ti->mask = -1; + if (ts->kind == TEMP_CONST) { + ti->is_const = true; + ti->val = ti->mask = ts->val; + if (TCG_TARGET_REG_BITS > 32 && ts->type == TCG_TYPE_I32) { + /* High bits of a 32-bit quantity are garbage. */ + ti->mask |= ~0xffffffffull; + } + } else { + ti->is_const = false; + ti->mask = -1; + } set_bit(idx, temps_used->l); } } diff --git a/tcg/tcg.c b/tcg/tcg.c index 545dd2b0b2..802f0b8a32 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -1184,6 +1184,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)); + /* No constant temps have been previously allocated. */ + for (int i = 0; i < TCG_TYPE_COUNT; ++i) { + if (s->const_table[i]) { + g_hash_table_remove_all(s->const_table[i]); + } + } + s->nb_ops = 0; s->nb_labels = 0; s->current_frame_offset = s->frame_start; @@ -1255,13 +1262,19 @@ TCGTemp *tcg_global_mem_new_internal(TCGType type, TCGv_ptr base, bigendian = 1; #endif - if (base_ts->kind != 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 = 1; s->nb_indirects += (TCG_TARGET_REG_BITS == 32 && type == TCG_TYPE_I64 ? 2 : 1); indirect_reg = 1; + break; + default: + g_assert_not_reached(); } if (TCG_TARGET_REG_BITS == 32 && type == TCG_TYPE_I64) { @@ -1386,6 +1399,11 @@ void tcg_temp_free_internal(TCGTemp *ts) TCGContext *s = tcg_ctx; int k, idx; + /* In order to simplify users of tcg_constant_*, silently ignore free. */ + if (ts->kind == TEMP_CONST) { + return; + } + #if defined(CONFIG_DEBUG_TCG) s->temps_in_use--; if (s->temps_in_use < 0) { @@ -1402,6 +1420,60 @@ void tcg_temp_free_internal(TCGTemp *ts) set_bit(idx, s->free_temps[k].l); } +TCGTemp *tcg_constant_internal(TCGType type, int64_t val) +{ + TCGContext *s = tcg_ctx; + GHashTable *h = s->const_table[type]; + TCGTemp *ts; + + if (h == NULL) { + h = g_hash_table_new(g_int64_hash, g_int64_equal); + s->const_table[type] = h; + } + + ts = g_hash_table_lookup(h, &val); + if (ts == NULL) { + ts = tcg_temp_alloc(s); + + if (TCG_TARGET_REG_BITS == 32 && type == TCG_TYPE_I64) { + TCGTemp *ts2 = tcg_temp_alloc(s); + + ts->base_type = TCG_TYPE_I64; + ts->type = TCG_TYPE_I32; + ts->kind = TEMP_CONST; + ts->temp_allocated = 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 = val; + + tcg_debug_assert(ts2 == ts + 1); + ts2->base_type = TCG_TYPE_I64; + ts2->type = TCG_TYPE_I32; + ts2->kind = TEMP_CONST; + ts2->temp_allocated = 1; + ts2->val = val >> 32; + } else { + ts->base_type = type; + ts->type = type; + ts->kind = TEMP_CONST; + ts->temp_allocated = 1; + ts->val = val; + } + g_hash_table_insert(h, &ts->val, ts); + } + + return ts; +} + +TCGv_vec tcg_constant_vec(TCGType type, unsigned vece, int64_t val) +{ + val = dup_const(vece, val); + return temp_tcgv_vec(tcg_constant_internal(type, val)); +} + TCGv_i32 tcg_const_i32(int32_t val) { TCGv_i32 t0; @@ -1937,6 +2009,9 @@ static void tcg_reg_alloc_start(TCGContext *s) TCGTempVal val = TEMP_VAL_MEM; switch (ts->kind) { + case TEMP_CONST: + val = TEMP_VAL_CONST; + break; case TEMP_FIXED: val = TEMP_VAL_REG; break; @@ -1973,6 +2048,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; } @@ -2574,6 +2669,7 @@ static void la_bb_end(TCGContext *s, int ng, int nt) state = TS_DEAD | TS_MEM; break; case TEMP_NORMAL: + case TEMP_CONST: state = TS_DEAD; break; default: @@ -2608,14 +2704,24 @@ static void la_bb_sync(TCGContext *s, int ng, int nt) la_global_sync(s, ng); for (int i = ng; i < nt; ++i) { - if (s->temps[i].kind == TEMP_LOCAL) { - int state = s->temps[i].state; - s->temps[i].state = state | TS_MEM; + TCGTemp *ts = &s->temps[i]; + int state; + + switch (ts->kind) { + case TEMP_LOCAL: + state = ts->state; + ts->state = state | TS_MEM; if (state != TS_DEAD) { continue; } - } else { + break; + case TEMP_NORMAL: s->temps[i].state = TS_DEAD; + break; + case TEMP_CONST: + continue; + default: + g_assert_not_reached(); } la_reset_pref(&s->temps[i]); } @@ -3254,15 +3360,28 @@ static void temp_load(TCGContext *, TCGTemp *, TCGRegSet, 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 = TEMP_VAL_MEM; + break; + case TEMP_NORMAL: + new_type = free_or_dead < 0 ? TEMP_VAL_MEM : TEMP_VAL_DEAD; + break; + case TEMP_CONST: + new_type = TEMP_VAL_CONST; + break; + default: + g_assert_not_reached(); } if (ts->val_type == TEMP_VAL_REG) { s->reg_to_temp[ts->reg] = NULL; } - ts->val_type = (free_or_dead < 0 - || ts->kind != TEMP_NORMAL - ? TEMP_VAL_MEM : TEMP_VAL_DEAD); + ts->val_type = new_type; } /* Mark a temporary as dead. */ @@ -3278,10 +3397,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); } @@ -3499,12 +3615,22 @@ static void tcg_reg_alloc_bb_end(TCGContext *s, TCGRegSet allocated_regs) for (i = s->nb_globals; i < s->nb_temps; i++) { TCGTemp *ts = &s->temps[i]; - if (ts->kind == 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 == TEMP_VAL_DEAD); + break; + case TEMP_CONST: + /* Similarly, we should have freed any allocated register. */ + tcg_debug_assert(ts->val_type == TEMP_VAL_CONST); + break; + default: + g_assert_not_reached(); } } @@ -3525,10 +3651,17 @@ static void tcg_reg_alloc_cbranch(TCGContext *s, TCGRegSet allocated_regs) * The liveness analysis already ensures that temps are dead. * Keep tcg_debug_asserts for safety. */ - if (ts->kind == TEMP_LOCAL) { + switch (ts->kind) { + case TEMP_LOCAL: tcg_debug_assert(ts->val_type != TEMP_VAL_REG || ts->mem_coherent); - } else { + break; + case TEMP_NORMAL: tcg_debug_assert(ts->val_type == TEMP_VAL_DEAD); + break; + case TEMP_CONST: + break; + default: + g_assert_not_reached(); } } } @@ -3819,45 +3952,42 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op) i_preferred_regs = o_preferred_regs = 0; if (arg_ct->ialias) { o_preferred_regs = op->output_pref[arg_ct->alias_index]; - if (ts->kind == TEMP_FIXED) { - /* if fixed register, we must allocate a new register - if the alias is not the same register */ - if (arg != 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; - } - /* check if the current register has already been allocated - for another input aliased to an output */ - if (ts->val_type == TEMP_VAL_REG) { - int k2, i2; - reg = ts->reg; - for (k2 = 0 ; k2 < k ; k2++) { - i2 = def->args_ct[nb_oargs + k2].sort_index; - if (def->args_ct[i2].ialias && reg == 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 == TEMP_VAL_REG) { + reg = ts->reg; + for (int k2 = 0; k2 < k; k2++) { + int i2 = def->args_ct[nb_oargs + k2].sort_index; + if (def->args_ct[i2].ialias && reg == new_args[i2]) { + goto allocate_in_reg; } } - i_preferred_regs = o_preferred_regs; } + i_preferred_regs = o_preferred_regs; } temp_load(s, ts, arg_ct->regs, i_allocated_regs, i_preferred_regs); reg = ts->reg; - 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 - 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 = tcg_reg_alloc(s, arg_ct->regs, i_allocated_regs, From patchwork Thu Jan 14 02:16:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 362800 Delivered-To: patch@linaro.org Received: by 2002:a02:ccad:0:0:0:0:0 with SMTP id t13csp68799jap; Wed, 13 Jan 2021 18:25:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJwu0l7Vb0tIKL7lNMKED+x2NCPZE//xON5Y4K40vSRsz+nB56ARtkGwcawX6dAPwZPVsUFr X-Received: by 2002:a25:b4d:: with SMTP id 74mr6976667ybl.189.1610591106056; Wed, 13 Jan 2021 18:25:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610591106; cv=none; d=google.com; s=arc-20160816; b=PtOWDoI7GNSumePiAz2c0AWXDE8v4DJiz6Mwt3TAT+W4amh0oRLXTWBCXd1IfeHLlL vKZ8DID9XlfOzn47Ty4w28wJjisAKRjKWDBLjTfZ1pchN0rEupk5gQz6LmfeCfUX44oo t5QBHbPZKuYIpcn2Qks/YZ+Ce1QVRG27TIurR8YH/uLbnP7A/l6A12P+ItbpNPU6BWqY YKjH2cfYJkkcDbkhdPLvOv/xeAZqWIS60e8NCtGJpnAc+jnt2deTBzies29YpsQAYiW5 +h9faw4LD+yfRyHf/CT/ltF6GH5gOBLIhK2eu0OwF8l4LPgwOSas3x5j70pUvuLGjObQ PQyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=ukQ7RjPHGqGDNjwPl9c9BeoLOp2dRJAKhrKe0DnYWUg=; b=M2Ree3xi52OyBZoV6yHH80TuDSPZxy+HvVZe7ElI+CEg8uBcWoMi7A5az13OMkTbE1 gLMga9sSMZ4iiErexHhXgj4iIz9CtuxnQOnZyY1HbHTt4Yol98x5n5u9m3//Scubpbxb s7mvsmdxLNRRnSnew0jGmemuXHZorpmQtSX8+F+kzk3ksf5ZxxRxt9dNMUil5Wx2G46/ /XamJ5UeX/GTnqviPQb+4L9xnIdvD5dc9VNKIVKN1cZ4IetRJmRqfxjXM2Nfa1PWc9Pb vZOy+P+uUGz0JFDFxPZ9Dwxn9a9L8Zm4NibpD7Cu2T8BIeCeby2t/LQRfi9jI4KVNra8 TInw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gtc4joOe; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id a17si913141ybj.148.2021.01.13.18.25.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 13 Jan 2021 18:25:06 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gtc4joOe; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:58854 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kzsJt-0005Or-H3 for patch@linaro.org; Wed, 13 Jan 2021 21:25:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60208) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kzsCP-0003aw-Bi for qemu-devel@nongnu.org; Wed, 13 Jan 2021 21:17:22 -0500 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]:34212) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kzsCI-0003Sp-Rd for qemu-devel@nongnu.org; Wed, 13 Jan 2021 21:17:19 -0500 Received: by mail-pj1-x102e.google.com with SMTP id my11so3198059pjb.1 for ; Wed, 13 Jan 2021 18:17:14 -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=ukQ7RjPHGqGDNjwPl9c9BeoLOp2dRJAKhrKe0DnYWUg=; b=gtc4joOehf/F6/cXYanWxoNiRQghhJuG5QFJHE9gXZopLyzGOtSweO5P9Fv7WuE28H sbXi4/K+CShToreJGXxlaPBqSrPa8CdRo0yFB9dxisLaSOGXc7w/eX/CdcQ45R9DH7yX 0mEIgSAFZfFWM99xT28AOPaQL0+l7T80jMPJAqOGN9KNVy5V1lj6nN98kxi9xZMS6QEd DJfYj1b3XO5hjfNTOgAdjZGwwpSbAj9CHBuBKDLhqplRMC1JpCDuun5LvEb2ZJ6at/as Wlyc7HE9PIUH8ujS/GgNyzOl0gzLEpOPFNc/bPGunSt1kHqjMmz9pVI/jsoErjjWIuRH /IDw== 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=ukQ7RjPHGqGDNjwPl9c9BeoLOp2dRJAKhrKe0DnYWUg=; b=pX8RBzQZqmmsX58CyMucVXjVTfiQfZKozwLL71ByN+n0fsVYMYIsaDSCLBut0BapKV KOFKtZ/doSXDcjCthBAJ0oHeQcQWgIQ4P/Shgr8qKKgb3KaECiPetp6vdb7j33e1uCwl 4SlCWcRWzbCsj3F0LrZ6QIt1xeTZIHnzHftsOSR0uyJkPFssQUHepTfNDEkN77KO+fpi lG4Q9gU/q00T32Dwg5VCuhtQX+osglRN6tmh+VpoRN33G/a249un+C3WlGmJmi0guAPl z4b6bpmRRgQxxFBKSTm61+/KRQVzgGYnEYu7zCsNpJTnynzbcmG1zap3jj2CE3AaF1+m QmYw== X-Gm-Message-State: AOAM530Q0HtXX+1W0ryR4OgROMyKQUHdw9Yl468Er7px6OHkDC7ob5r+ fM5nj+p+R/TncLoZ7JsdLSK+NVCobdNGHg== X-Received: by 2002:a17:902:b616:b029:da:fcfd:7568 with SMTP id b22-20020a170902b616b02900dafcfd7568mr5398496pls.35.1610590633409; Wed, 13 Jan 2021 18:17:13 -0800 (PST) Received: from localhost.localdomain (rrcs-173-197-107-21.west.biz.rr.com. [173.197.107.21]) by smtp.gmail.com with ESMTPSA id i7sm3771687pfc.50.2021.01.13.18.17.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jan 2021 18:17:12 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 09/24] tcg/optimize: Improve find_better_copy Date: Wed, 13 Jan 2021 16:16:39 -1000 Message-Id: <20210114021654.647242-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210114021654.647242-1-richard.henderson@linaro.org> References: <20210114021654.647242-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102e; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102e.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: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Prefer TEMP_CONST over anything else. Signed-off-by: Richard Henderson --- tcg/optimize.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) -- 2.25.1 diff --git a/tcg/optimize.c b/tcg/optimize.c index 16b0aa7229..e42f9c89a8 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -122,31 +122,28 @@ static void init_arg_info(TempOptInfo *infos, static TCGTemp *find_better_copy(TCGContext *s, TCGTemp *ts) { - TCGTemp *i; + TCGTemp *i, *g, *l; - /* If this is already a global, we can't do better. */ - if (ts->kind >= TEMP_GLOBAL) { + /* If this is already readonly, we can't do better. */ + if (temp_readonly(ts)) { return ts; } - /* Search for a global first. */ + g = l = NULL; for (i = ts_info(ts)->next_copy; i != ts; i = ts_info(i)->next_copy) { - if (i->kind >= TEMP_GLOBAL) { + if (temp_readonly(i)) { return i; - } - } - - /* If it is a temp, search for a temp local. */ - if (ts->kind == TEMP_NORMAL) { - for (i = ts_info(ts)->next_copy; i != ts; i = ts_info(i)->next_copy) { - if (i->kind >= TEMP_LOCAL) { - return i; + } else if (i->kind > ts->kind) { + if (i->kind == TEMP_GLOBAL) { + g = i; + } else if (i->kind == TEMP_LOCAL) { + l = i; } } } - /* 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; } static bool ts_are_copies(TCGTemp *ts1, TCGTemp *ts2) From patchwork Thu Jan 14 02:16:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 362803 Delivered-To: patch@linaro.org Received: by 2002:a02:ccad:0:0:0:0:0 with SMTP id t13csp70896jap; Wed, 13 Jan 2021 18:28:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJwn6E66ahmM0xSVI0dJIRhhf6FsunEHpdbkRroSwHxGMpNIXtfshQlJHiMItiS7OyEoWT3f X-Received: by 2002:a25:7e05:: with SMTP id z5mr7383020ybc.497.1610591306705; Wed, 13 Jan 2021 18:28:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610591306; cv=none; d=google.com; s=arc-20160816; b=hJLy4BBk8N1clN+3EWYLWAmK6BSIYEyQE6hufmv/HHwcz/43MIa5U9uDglZK1//oqc WSJ3b04gxV3gAu/+xhRglfDPb5cYmdGrKiDQrYKi6DEo6yOlXd0BMxSQx7r1FD6CXqs8 MqNVAGDtiMULb7A4Em2nWMz6Gk4HZ6ARpvZWBvEyiKf+HR80sYEH5jSzTl2EuOHtJblT HxkOqjZnWDVa+maKWS/NuHaAMOrNP6UNGv9oAkvZF/2qluAh1sw4nme7/EtXjgdqKA5n SGzmhZ5Ami3TgwuWo60gq4t5erbnaWd4CYzG93RQvNLqckLO9sPOazVRf0OocOyzh4+0 mfOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=cRVnylJXcFc8ozdMeUWi6zX6AVte8Tt6BWKvI+IXZu0=; b=OIPUOWTVg0Q/kQZEkgRxiHYzZXSzylzwrXJR337QFbrsldjzqE11UeFWD03cb/j1wc 06URG6N/XtVScQfxW4Hy8VWCh8kvNHN1byfHmFlSXlmoSWZvNzdKRyBNMtlUdM66qsB/ SjPH1VlKuj0i2auQKTYET8wAegYc/N8PVR/AhK+O/2rJhRwKyq29Xgz7l+I3cDOjrKK+ lduyjnYiagDwUV6fodoyEeYQghe5cXgOPAH9kNAzOWNYq7WIo8sJJxzmsA+A0n31Hw1l LiHqREvhQ4z3Bxi8rw4rV/9A4mahixG5YQWFJBZWUIeS/YYibwgWGySJ0O2Kw4504yn3 OW5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bLorooYi; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id n69si3825124yba.80.2021.01.13.18.28.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 13 Jan 2021 18:28:26 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bLorooYi; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:38058 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kzsN8-0000Ai-6o for patch@linaro.org; Wed, 13 Jan 2021 21:28:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60288) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kzsCT-0003bw-0w for qemu-devel@nongnu.org; Wed, 13 Jan 2021 21:17:27 -0500 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]:45622) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kzsCN-0003T2-Uv for qemu-devel@nongnu.org; Wed, 13 Jan 2021 21:17:24 -0500 Received: by mail-pf1-x42f.google.com with SMTP id c13so2438814pfi.12 for ; Wed, 13 Jan 2021 18:17:16 -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=cRVnylJXcFc8ozdMeUWi6zX6AVte8Tt6BWKvI+IXZu0=; b=bLorooYirPcJAVCEmLckCHwa8AxY0G3YfgXVfOm1jzwtVEqa5nmHV05bmwAY3KgGcD Ah6MdlQkx9++7+3hj6kiHAZlLUkW1CmCSpKx0TqKINxml9KPrlh83KZh1shzJWKyLCwf HMPaC6TLpxyVrprCcxGJTMMLGSYGlSzgEGBBknEe82EicSnellCvOQo6w2jCQfAO3cdO 5iDmGrMd0Bpx/TwoJAPCgtUiALxTF1lJFdnqsxYL+NuTHbFwD283MsAX/KZjOaz52CqY uDqRMisHofAqfPvKC0sPgiZqjuEflP2kJ/u8WN7m7TiLqcew8xgglPrk+E60hSKL7ta7 uZVg== 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=cRVnylJXcFc8ozdMeUWi6zX6AVte8Tt6BWKvI+IXZu0=; b=TrZhrY7x/G7SJjCNlD1REmpf1rp9CV7u1NpzD5wmm+SLhxWKhPMA96ccc77FDxGOAp DcfxsC4h4fiwOegzcMP0PGhD0/qiALLxuJgTk4H3rswFuYZTR323m+Bh94v4qvlWfyly SrWqj2VAyKVKn3IiZ0rK0lDzngLzrZmixIR+ROGNIUD6LW5qb1bgK7iIlq1lHtQv+ECJ HmgzVQdurg/xflvjmP4lJAoEEKNL3uLqmH+3xFX86kfx7sKAMnTslFutFokH3LMSTzUe iOYB+rIliqeoc5G0642N1WoiaSNGpL7Vsj6Kx5a8nDs+2x8hgXf4kJzmj6LLQylevuQt cNWg== X-Gm-Message-State: AOAM530QbRjNoVcCD/jYrGk/ijBd4cgUwefOa2BIiBd7ZbQsdYE5aZXm 19C9D4VGplvpQUrN/08X7+d9s1WiXlBrcA== X-Received: by 2002:a63:cf43:: with SMTP id b3mr4896930pgj.387.1610590635356; Wed, 13 Jan 2021 18:17:15 -0800 (PST) Received: from localhost.localdomain (rrcs-173-197-107-21.west.biz.rr.com. [173.197.107.21]) by smtp.gmail.com with ESMTPSA id i7sm3771687pfc.50.2021.01.13.18.17.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jan 2021 18:17:14 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 10/24] tcg/optimize: Adjust TempOptInfo allocation Date: Wed, 13 Jan 2021 16:16:40 -1000 Message-Id: <20210114021654.647242-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210114021654.647242-1-richard.henderson@linaro.org> References: <20210114021654.647242-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42f; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42f.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: peter.maydell@linaro.org, =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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ée Signed-off-by: Richard Henderson --- tcg/optimize.c | 60 ++++++++++++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 26 deletions(-) -- 2.25.1 diff --git a/tcg/optimize.c b/tcg/optimize.c index e42f9c89a8..49bf1386c7 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -89,35 +89,41 @@ static void reset_temp(TCGArg arg) } /* 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 = temp_idx(ts); - if (!test_bit(idx, temps_used->l)) { - TempOptInfo *ti = &infos[idx]; + TempOptInfo *ti; + if (test_bit(idx, temps_used->l)) { + return; + } + set_bit(idx, temps_used->l); + + ti = ts->state_ptr; + if (ti == NULL) { + ti = tcg_malloc(sizeof(TempOptInfo)); ts->state_ptr = ti; - ti->next_copy = ts; - ti->prev_copy = ts; - if (ts->kind == TEMP_CONST) { - ti->is_const = true; - ti->val = ti->mask = ts->val; - if (TCG_TARGET_REG_BITS > 32 && ts->type == TCG_TYPE_I32) { - /* High bits of a 32-bit quantity are garbage. */ - ti->mask |= ~0xffffffffull; - } - } else { - ti->is_const = false; - ti->mask = -1; + } + + ti->next_copy = ts; + ti->prev_copy = ts; + if (ts->kind == TEMP_CONST) { + ti->is_const = true; + ti->val = ts->val; + ti->mask = ts->val; + if (TCG_TARGET_REG_BITS > 32 && ts->type == TCG_TYPE_I32) { + /* High bits of a 32-bit quantity are garbage. */ + ti->mask |= ~0xffffffffull; } - set_bit(idx, temps_used->l); + } else { + ti->is_const = false; + ti->mask = -1; } } -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)); } 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 = NULL; - TempOptInfo *infos; TCGTempSet temps_used; /* Array VALS has an element for each temp. @@ -616,12 +621,15 @@ void tcg_optimize(TCGContext *s) nb_temps = s->nb_temps; nb_globals = s->nb_globals; + bitmap_zero(temps_used.l, nb_temps); - infos = tcg_malloc(sizeof(TempOptInfo) * nb_temps); + for (i = 0; i < nb_temps; ++i) { + s->temps[i].state_ptr = NULL; + } 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 = op->opc; const TCGOpDef *def = &tcg_op_defs[opc]; @@ -633,14 +641,14 @@ void tcg_optimize(TCGContext *s) for (i = 0; i < nb_oargs + nb_iargs; i++) { TCGTemp *ts = arg_temp(op->args[i]); if (ts) { - init_ts_info(infos, &temps_used, ts); + init_ts_info(&temps_used, ts); } } } else { nb_oargs = def->nb_oargs; nb_iargs = def->nb_iargs; for (i = 0; i < nb_oargs + nb_iargs; i++) { - init_arg_info(infos, &temps_used, op->args[i]); + init_arg_info(&temps_used, op->args[i]); } } From patchwork Thu Jan 14 02:16:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 362810 Delivered-To: patch@linaro.org Received: by 2002:a02:ccad:0:0:0:0:0 with SMTP id t13csp74105jap; Wed, 13 Jan 2021 18:33:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJyP42KVweV+38jGDf2bBnkAegtDGpXeSpuwdhYB7xrNkqw++Si0vr31JCnMIAxf4PHsk4HI X-Received: by 2002:a25:e048:: with SMTP id x69mr7659621ybg.353.1610591617703; Wed, 13 Jan 2021 18:33:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610591617; cv=none; d=google.com; s=arc-20160816; b=OoTQFM7Suv+8kix3Rdgf5UHR09rxAqqVQ8q6cpvsJohD0KZ9MpGJQhkPn7acpz2gIB R3N1h+5fZf9nAk4mOddlEELXvtZjdTe8sAc1N0eyJcoy9x0nqM689yK09Pu0KUyYGxYz wqbjN/IPuB2gwZ1uBQrLw9eGxH9/lBZYZx0cYQUoZaZVt1UNzqvasrRwnpxYxJTMbb55 cPjIkLs+G2D0mDdLny+zvof21T7Z4fRveGALA8fcIrdd0cY1CyGMBNLjA2L5M21Wi6GU zWekjfk2COOdiaWY5zJYE78RuX1bIKv9FDpMKDHrgrMxtpkucF1iwLRh7AQ5UcgDYmJM FAmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=uEiBPhKLKz+SNXjEHNJYg16zyVS+pzInRZgKwDfY3iQ=; b=EkXIXsfXEzyLfFiPLGwCjA3npz7ubTfx5X41GVRoYSlWFeBOzN/ImCx8oBUhsu/4zQ dWGcUfjnIJ1iyDl07gNvPkkroIocU38pDhOKv/sBMTCmkylDEim4e0ZT+7y579+JwlPY f1OzecOjevQEuPQmG1SsKCA8HhgrXMu6paqq68LRhKILdWtBfRHGvT1LdPOo3PQRjRk6 25K8fc9ATHghe3yNpPioc26Ah/S7ORzAsQq/HHeRpTks4XneNHZPRlh5Ye3WldygLaQa v7cWEsVeJ8xfvNLFWpdYv4AllkQqOiJmz85BPkER6dpaeRPl/DTehCCdSkBSB1ne0JIe F8wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZQfasglE; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id m21si4207296ybf.254.2021.01.13.18.33.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 13 Jan 2021 18:33:37 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZQfasglE; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:52106 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kzsS9-000667-5N for patch@linaro.org; Wed, 13 Jan 2021 21:33:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60374) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kzsCc-0003eh-DZ for qemu-devel@nongnu.org; Wed, 13 Jan 2021 21:17:34 -0500 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]:41330) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kzsCP-0003T9-5L for qemu-devel@nongnu.org; Wed, 13 Jan 2021 21:17:32 -0500 Received: by mail-pf1-x436.google.com with SMTP id q20so2454267pfu.8 for ; Wed, 13 Jan 2021 18:17:18 -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=uEiBPhKLKz+SNXjEHNJYg16zyVS+pzInRZgKwDfY3iQ=; b=ZQfasglE+RF+pWagDJimYZuYdLU7KQ9gZe+YGtMi81OREdNDuIhw5RseCooY2zR37w 5BQXP29tiaThNPFEcP9ucJqqJrvo+2ubZ+Ohnwy7Cu2fKFaO2R4p6TQaSEWNzyLnzsJb v/Kdh+Wajfs9o/iQWmf7fLylqoydyNmACFn8DsGBsE3RMbbsyPatRG2QbcEoIVo51J3D mMccwOgDQJMrv3uYFVyMKYntd5owisjmRkVEluffeBGhjldwkIU9TrMdxMKKb8V0j7Xe y+iKVIolSmJBIU4OQYDMJoVNdVkOo7kZzZFB9sRVmjST8PZIfptHnIGmoBY1v7sts+AV 6Mbw== 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=uEiBPhKLKz+SNXjEHNJYg16zyVS+pzInRZgKwDfY3iQ=; b=is4VXtq2hBa5BweeCaUCpCueW5YIw3ckPDyXAAozVQqc8SRj8OPJK3swRHNwRvZv1q /LhFLtMeDr+1SE4XckDqnMXVz0xC99gP0wgCDTxU+fzGsstMLhJq0wfUna4gFZ0JfSty RlXiyRzpuMnGRA6ZJsQ2sg0mS7wVllNDZnSbviKaOqVCQr8ogrLjXx3Tn+t4isd3U67+ PmnAc3PSaDW1pf7yyXO/wYU7Yfu0HTqIyq4tSsUOxmZmDfdasxvRYHo5kjRkssLYsgdz U8TBDeFpD9kMkR04bLfPjLyzWLC2U5b0wjIJZ8ccv/Lvwv44TcUz2gtxic2DnJqR6bIW VpFQ== X-Gm-Message-State: AOAM532wr9+k+F9g2NCCciDvJNcHY0f0OEyABko8GKHxU/kc6wSDO37g DB+VXk8Tvv1p8ga4R1qeHPB5Dwc84GqGoQ== X-Received: by 2002:a63:cc05:: with SMTP id x5mr5046428pgf.254.1610590636835; Wed, 13 Jan 2021 18:17:16 -0800 (PST) Received: from localhost.localdomain (rrcs-173-197-107-21.west.biz.rr.com. [173.197.107.21]) by smtp.gmail.com with ESMTPSA id i7sm3771687pfc.50.2021.01.13.18.17.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jan 2021 18:17:16 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 11/24] tcg/optimize: Use tcg_constant_internal with constant folding Date: Wed, 13 Jan 2021 16:16:41 -1000 Message-Id: <20210114021654.647242-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210114021654.647242-1-richard.henderson@linaro.org> References: <20210114021654.647242-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::436; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x436.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=unavailable 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: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- tcg/optimize.c | 108 ++++++++++++++++++++++--------------------------- 1 file changed, 49 insertions(+), 59 deletions(-) -- 2.25.1 diff --git a/tcg/optimize.c b/tcg/optimize.c index 49bf1386c7..bda727d5ed 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)); } -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 = arg_info(dst); - - def = &tcg_op_defs[op->opc]; - if (def->flags & TCG_OPF_VECTOR) { - new_op = INDEX_op_dupi_vec; - } else if (def->flags & TCG_OPF_64BIT) { - new_op = INDEX_op_movi_i64; - } else { - new_op = INDEX_op_movi_i32; - } - op->opc = new_op; - /* TCGOP_VECL and TCGOP_VECE remain unchanged. */ - op->args[0] = dst; - op->args[1] = val; - - reset_temp(dst); - di->is_const = true; - di->val = val; - mask = val; - if (TCG_TARGET_REG_BITS > 32 && new_op == INDEX_op_movi_i32) { - /* High bits of the destination are now garbage. */ - mask |= ~0xffffffffull; - } - di->mask = mask; -} - static void tcg_opt_gen_mov(TCGContext *s, TCGOp *op, TCGArg dst, TCGArg src) { TCGTemp *dst_ts = arg_temp(dst); @@ -259,6 +228,27 @@ static void tcg_opt_gen_mov(TCGContext *s, TCGOp *op, TCGArg dst, TCGArg src) } } +static void tcg_opt_gen_movi(TCGContext *s, TCGTempSet *temps_used, + TCGOp *op, TCGArg dst, uint64_t val) +{ + const TCGOpDef *def = &tcg_op_defs[op->opc]; + TCGType type; + TCGTemp *tv; + + if (def->flags & TCG_OPF_VECTOR) { + type = TCGOP_VECL(op) + TCG_TYPE_V64; + } else if (def->flags & TCG_OPF_64BIT) { + type = TCG_TYPE_I64; + } else { + type = TCG_TYPE_I32; + } + + /* Convert movi to mov with constant temp. */ + tv = 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 = s->nb_temps; nb_globals = s->nb_globals; - bitmap_zero(temps_used.l, nb_temps); + memset(&temps_used, 0, sizeof(temps_used)); for (i = 0; i < nb_temps; ++i) { s->temps[i].state_ptr = 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 == 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; @@ -1054,7 +1044,7 @@ void tcg_optimize(TCGContext *s) if (partmask == 0) { tcg_debug_assert(nb_oargs == 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 == 0) { @@ -1071,7 +1061,7 @@ void tcg_optimize(TCGContext *s) CASE_OP_32_64(mulsh): if (arg_is_const(op->args[2]) && arg_info(op->args[2])->val == 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; @@ -1098,7 +1088,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; @@ -1115,14 +1105,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; case INDEX_op_dup_vec: if (arg_is_const(op->args[1])) { tmp = arg_info(op->args[1])->val; tmp = 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; @@ -1132,7 +1122,7 @@ void tcg_optimize(TCGContext *s) if (arg_is_const(op->args[1]) && arg_is_const(op->args[2])) { tmp = arg_info(op->args[1])->val; if (tmp == 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])) { @@ -1160,7 +1150,7 @@ void tcg_optimize(TCGContext *s) case INDEX_op_extrh_i64_i32: if (arg_is_const(op->args[1])) { tmp = do_constant_folding(opc, arg_info(op->args[1])->val, 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; @@ -1190,7 +1180,7 @@ void tcg_optimize(TCGContext *s) if (arg_is_const(op->args[1]) && arg_is_const(op->args[2])) { tmp = do_constant_folding(opc, arg_info(op->args[1])->val, 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; @@ -1201,7 +1191,7 @@ void tcg_optimize(TCGContext *s) TCGArg v = arg_info(op->args[1])->val; if (v != 0) { tmp = 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]); } @@ -1214,7 +1204,7 @@ void tcg_optimize(TCGContext *s) tmp = 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; @@ -1223,7 +1213,7 @@ void tcg_optimize(TCGContext *s) if (arg_is_const(op->args[1])) { tmp = 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; @@ -1232,7 +1222,7 @@ void tcg_optimize(TCGContext *s) if (arg_is_const(op->args[1])) { tmp = 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; @@ -1249,7 +1239,7 @@ void tcg_optimize(TCGContext *s) tmp = (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; @@ -1258,7 +1248,7 @@ void tcg_optimize(TCGContext *s) tmp = do_constant_folding_cond(opc, op->args[1], op->args[2], op->args[3]); if (tmp != 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; @@ -1268,7 +1258,7 @@ void tcg_optimize(TCGContext *s) op->args[1], op->args[2]); if (tmp != 2) { if (tmp) { - bitmap_zero(temps_used.l, nb_temps); + memset(&temps_used, 0, sizeof(temps_used)); op->opc = INDEX_op_br; op->args[0] = op->args[3]; } else { @@ -1314,7 +1304,7 @@ void tcg_optimize(TCGContext *s) uint64_t a = ((uint64_t)ah << 32) | al; uint64_t b = ((uint64_t)bh << 32) | bl; TCGArg rl, rh; - TCGOp *op2 = tcg_op_insert_before(s, op, INDEX_op_movi_i32); + TCGOp *op2 = tcg_op_insert_before(s, op, INDEX_op_mov_i32); if (opc == INDEX_op_add2_i32) { a += b; @@ -1324,8 +1314,8 @@ void tcg_optimize(TCGContext *s) rl = op->args[0]; rh = 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 >> 32)); break; } goto do_default; @@ -1336,12 +1326,12 @@ void tcg_optimize(TCGContext *s) uint32_t b = arg_info(op->args[3])->val; uint64_t r = (uint64_t)a * b; TCGArg rl, rh; - TCGOp *op2 = tcg_op_insert_before(s, op, INDEX_op_movi_i32); + TCGOp *op2 = tcg_op_insert_before(s, op, INDEX_op_mov_i32); rl = op->args[0]; rh = 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 >> 32)); break; } goto do_default; @@ -1352,7 +1342,7 @@ void tcg_optimize(TCGContext *s) if (tmp != 2) { if (tmp) { do_brcond_true: - bitmap_zero(temps_used.l, nb_temps); + memset(&temps_used, 0, sizeof(temps_used)); op->opc = INDEX_op_br; op->args[0] = op->args[5]; } else { @@ -1368,7 +1358,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 = INDEX_op_brcond_i32; op->args[0] = op->args[1]; op->args[1] = op->args[3]; @@ -1394,7 +1384,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 = INDEX_op_brcond_i32; op->args[1] = op->args[2]; op->args[2] = op->args[4]; @@ -1429,7 +1419,7 @@ void tcg_optimize(TCGContext *s) op->args[5]); if (tmp != 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] == TCG_COND_LT || op->args[5] == TCG_COND_GE) && arg_is_const(op->args[3]) @@ -1514,7 +1504,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 = 0; i < nb_oargs; i++) { From patchwork Thu Jan 14 02:16:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 362805 Delivered-To: patch@linaro.org Received: by 2002:a02:ccad:0:0:0:0:0 with SMTP id t13csp71212jap; Wed, 13 Jan 2021 18:28:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJzTf4tXdxDH4oVCRjshglQlE/IYx4EwuAMLnpnH2ZA95U1W4FnloyxSnTsJHy49jT4q9LYY X-Received: by 2002:a25:af0d:: with SMTP id a13mr7971752ybh.453.1610591335950; Wed, 13 Jan 2021 18:28:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610591335; cv=none; d=google.com; s=arc-20160816; b=maaahMwckAH3yGDHUQyNPgFztTPXRdhkxgnKqnNgtns/XBPbQmvbwQmLvdnWl5K5Dq CXMWFjU4Lg/4xZ4b8OIR9IReW2EfX7b1/Qi+3jmXuTY9/Ho1lOsI+HKBZjQPV695VQCm IngPZD+V3Owg/E40GpT6R+/IGDdL/pbPiLSgR8svjHkGnYaKwXkYyvc2KjUQePY9wn4i TzB/WtkKHEd8KAd7RzfteSmrnN4p3+OX1E06giEzTh8Zil+ZjOLk5oJQikG125d54h6V gJ5Ywn1D0CqxUW8IJRL4URudBSr5EtZBRD2pu4MypCs8Q6lq+3E1gVcCHLKhgsvjMzUY 1uCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=mSdOJnq5o42NhYADknuNWjZocBsJJt/CxyEeh2zDN58=; b=NTyHnSQKBKJuHNssVfrkoaeWhZJF5XCmMwUmL6zfFyRfmOBaJTsSGjZ7QZn2wWEDmZ YTSkm1Jj52e8us7o5WCdvh8+mcMDxMXJl08b9LbB7DbjnC0vhY/h7XQkDgRjOkS9Ee4T cxPskj0pLMCwEu1OXf3AfUiX+PdDX6tD6EnhNyKyemA1FTvBQAvFBIXRvtSF8S8FyZ3v h+ydoOxCG9Txh9y52DM4qezbq316q+/PtnuVHiUwFX6mesOtSIhbuyyCZKWMjZeI1eVE W1yEB6Cu2DKTbeldtvDSV14OiSvpMLRaMQvm0xrZ+EsBUPcUZJm+rAlZhoweVn7LwlCk ZbDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Xd/QJUhp"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id o13si4133740ybk.139.2021.01.13.18.28.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 13 Jan 2021 18:28:55 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Xd/QJUhp"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:39848 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kzsNb-0000uz-Ej for patch@linaro.org; Wed, 13 Jan 2021 21:28:55 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60372) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kzsCc-0003ef-DG for qemu-devel@nongnu.org; Wed, 13 Jan 2021 21:17:34 -0500 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]:35882) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kzsCP-0003TH-5O for qemu-devel@nongnu.org; Wed, 13 Jan 2021 21:17:31 -0500 Received: by mail-pg1-x52c.google.com with SMTP id c132so2752449pga.3 for ; Wed, 13 Jan 2021 18:17:19 -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=mSdOJnq5o42NhYADknuNWjZocBsJJt/CxyEeh2zDN58=; b=Xd/QJUhpQJZW/Ni4gTWzHqvrc8CYsDrabctg+7HSgq28PPv8RaTHFIpEnjYpL2yBfe I6NP2utAz5hh4Bhh/FOLfJZLPAufm/CuGgyvTez9ftj+79vNqGVoEXkjl/Z6ORIWncSI IcYuAk/U4mON/J2ctPIDJJoOab26tP4DOA7fvq5TKwGaSgurWEguhkZZXEdcKLCSnJpF 0WVbueH3guqwcMwOw1UpsZ6gxFb2b/Vn4DJ1pIEyb8lFYGdhm6wpcwsY+KAn4dbpglqP LKaL95Eb+OqeWXyiuV5X6H9jsf5sI0hZ4IFPpaDvc3SPvT72zJggkiijeRs98BEItzju PaTw== 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=mSdOJnq5o42NhYADknuNWjZocBsJJt/CxyEeh2zDN58=; b=sh0TJi7iW+nD6Q+lzfICzHE18sHxax9wczzdAr2+IZhIpXL+2sWhhLms6EE820/9X9 dt3PnYa5GYvOEUurs5quHh26ffNJHG7rC1WHkICzrzh7KtOqgi/h5f2cko1/Rzcpzm9R g/oa+4g9ziNDxp1I21LfzyVjxtFypzz2B1HMtU36Hd4ZiRFUMcDLUA+X8KbQWc7O84lX xaFnbO9qoLwe1M9fp+Fc1xqlc8gy8SINOUvUj9JmL8mvwX9Gw3VzA2scCA3gkuPRh7Pj l/IBcj+DPeB/GBLZfw9xeeHoaD6IwTsPYlfLGh+agVFLFJQU2X4Mle7Y3vs99xdnh2PT 7SOQ== X-Gm-Message-State: AOAM530JRtb0NDHONHs1ZMX2OsiyKHqjvTFf3/UBrFdMAG6MBHYg3gDf 4LWu4fwiaqeRIlLofFvea2IoFHzHhdCIXQ== X-Received: by 2002:a65:4983:: with SMTP id r3mr5153361pgs.288.1610590638497; Wed, 13 Jan 2021 18:17:18 -0800 (PST) Received: from localhost.localdomain (rrcs-173-197-107-21.west.biz.rr.com. [173.197.107.21]) by smtp.gmail.com with ESMTPSA id i7sm3771687pfc.50.2021.01.13.18.17.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jan 2021 18:17:17 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 12/24] tcg: Convert tcg_gen_dupi_vec to TCG_CONST Date: Wed, 13 Jan 2021 16:16:42 -1000 Message-Id: <20210114021654.647242-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210114021654.647242-1-richard.henderson@linaro.org> References: <20210114021654.647242-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52c; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52c.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=unavailable 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: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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(-) -- 2.25.1 diff --git a/tcg/optimize.c b/tcg/optimize.c index bda727d5ed..dbb03ef96b 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -1120,11 +1120,10 @@ void tcg_optimize(TCGContext *s) case INDEX_op_dup2_vec: assert(TCG_TARGET_REG_BITS == 32); if (arg_is_const(op->args[1]) && arg_is_const(op->args[2])) { - tmp = arg_info(op->args[1])->val; - if (tmp == 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 = INDEX_op_dup_vec; TCGOP_VECE(op) = 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) } } -#define MO_REG (TCG_TARGET_REG_BITS == 64 ? MO_64 : MO_32) - -static void do_dupi_vec(TCGv_vec r, unsigned vece, TCGArg a) -{ - TCGTemp *rt = 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 = tcg_temp_new_vec(type); - do_dupi_vec(ret, MO_REG, 0); + tcg_gen_dupi_vec(MO_64, ret, 0); return ret; } TCGv_vec tcg_const_ones_vec(TCGType type) { TCGv_vec ret = tcg_temp_new_vec(type); - do_dupi_vec(ret, MO_REG, -1); + tcg_gen_dupi_vec(MO_64, ret, -1); return ret; } @@ -252,39 +244,28 @@ TCGv_vec tcg_const_ones_vec_matching(TCGv_vec m) void tcg_gen_dup64i_vec(TCGv_vec r, uint64_t a) { - if (TCG_TARGET_REG_BITS == 64) { - do_dupi_vec(r, MO_64, a); - } else if (a == dup_const(MO_32, a)) { - do_dupi_vec(r, MO_32, a); - } else { - TCGv_i64 c = 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); } 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); } 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); } 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); } void tcg_gen_dupi_vec(unsigned vece, TCGv_vec r, uint64_t a) { - if (vece == MO_64) { - tcg_gen_dup64i_vec(r, a); - } else { - do_dupi_vec(r, MO_REG, dup_const(vece, a)); - } + TCGTemp *rt = tcgv_vec_temp(r); + tcg_gen_mov_vec(r, tcg_constant_vec(rt->base_type, vece, a)); } 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_vec 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 802f0b8a32..ad1348d811 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -3539,16 +3539,11 @@ static void temp_load(TCGContext *s, TCGTemp *ts, TCGRegSet desired_regs, * The targets will, in general, have to do this search anyway, * do this generically. */ - if (TCG_TARGET_REG_BITS == 32) { - val = dup_const(MO_32, val); - vece = MO_32; - } if (val == dup_const(MO_8, val)) { vece = MO_8; } else if (val == dup_const(MO_16, val)) { vece = MO_16; - } else if (TCG_TARGET_REG_BITS == 64 && - val == dup_const(MO_32, val)) { + } else if (val == dup_const(MO_32, val)) { vece = MO_32; } From patchwork Thu Jan 14 02:16:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 362804 Delivered-To: patch@linaro.org Received: by 2002:a02:ccad:0:0:0:0:0 with SMTP id t13csp71017jap; Wed, 13 Jan 2021 18:28:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJz9LY3ps5mqmpMgEsRwGdhGcLvyxjzX2wYmFBD+0c+dVmTJkxfz2xlrqjo55/Gg3Xmy55BB X-Received: by 2002:a5b:a8d:: with SMTP id h13mr7095074ybq.170.1610591319045; Wed, 13 Jan 2021 18:28:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610591319; cv=none; d=google.com; s=arc-20160816; b=SUuUzHZ1t2z2lQsP+CNHc08ZC4c40w/3/9bH+YwJnvJtcTdf5aF6G1PAechUb7fBFr II6rZwnT6oFMyPihZ5d94AkuBgJ/QpTCLaJTDgvmVjDx9posMWYeFC0DlfUGfCKf39g4 4fwE23U8nP7AJ9NBFn/KyZN+X/38t4vfgInsuA3rZtaWra4YlMFDdcP3wkewoYeEvK1h DKlJ7oDmM2nXDg/lJMon4TRo4GYXhvDmuHVSgutfXHVSJ9T5fYTykgjhcpURDCR29fU+ jONXrdcJYj5pxXl4MKmusPHmDC/dCtut9/7CG6duyfunJS69vvwfZjNrveohirJxjJhQ 4Z9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=tYsbmjolK+Eg4JFu4uyWsu7Q9CaREMLO0zlw/InU6fk=; b=ioeLrRfS6WJni7jLrigZs3CoMI4NVbd2G5/mI7pz1pTLpdtsNCTKRKmnswNqudLH1I DpdQnNZsj9In6Zbw/HVShVkueYsSn7cpNwT7LruifxqWcm641wvYTFYpxvJdPA7Lm24A u8iiXNIEDnbcy161nOjuWKpU/PXhfT3OU9zRbKB8IvUyM3Iz2ckgg8VUFIwlp1CU+FY8 GWIZZojzh7N5KJpBcG7mtmOq1tdNJk235FXI7KlChZtl1xcx1a/nUWYhPP4JFFTuCy5Q UF8megnmcmJNtUfVNXAXiQ5x336yKzoFH3sascNJT2e5ypjLRgyTRYz/0SYfXJZa4PHI tSMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=y5RcDgq2; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id y10si3428895ybr.300.2021.01.13.18.28.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 13 Jan 2021 18:28:39 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=y5RcDgq2; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:38432 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kzsNK-0000L8-IL for patch@linaro.org; Wed, 13 Jan 2021 21:28:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60366) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kzsCc-0003eT-C9 for qemu-devel@nongnu.org; Wed, 13 Jan 2021 21:17:34 -0500 Received: from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]:41145) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kzsCP-0003TR-SI for qemu-devel@nongnu.org; Wed, 13 Jan 2021 21:17:31 -0500 Received: by mail-pg1-x534.google.com with SMTP id i7so2734015pgc.8 for ; Wed, 13 Jan 2021 18:17: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=tYsbmjolK+Eg4JFu4uyWsu7Q9CaREMLO0zlw/InU6fk=; b=y5RcDgq2fdst/kBTTQbLorBBSIs0VaKJXmrZWD++/CRbwTCbij/FJkj4/RrNMi2cPk XOeaecF7GTY+rTNcDBhLdyk6xyXykujqhRGbJTrhkPGIQ94i3yDV3f6a3Zcb22bidsJP TSw5vCj08V8/OT4JN04k6RJwZ7UUYS3U1yC+CQa8gVK/xJplDUdz9Dd9c3Xx8w8BGqxJ HXW6D2ROPVG1IeX4EVSYNmfJnT5NrKxwzDFp490Y4kAnt1V1yriYZfIIFYvfvT9jXzNT ds1WFktaws5cgA33TXrlCc0ZA+r2R+rkTHiMxM8lj+kSuqotBVj/p6h+kElzZzMepyTG EnCQ== 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=tYsbmjolK+Eg4JFu4uyWsu7Q9CaREMLO0zlw/InU6fk=; b=JaPX4CmeTxCw/JJ9tgQIgm6Y/6hMx7cp+7MM7dT0cU8opb6npuAoOrYvs0QvueJR0r Ozg74oMW8lV4wEDPYF1keszhDXk9hJLYmeTJllLcOV4w1WAxce5JEy/V2U0u98DYNAKj MvnsHywm75XBPIlGt5qvDlhgh8FNO8iJ0OzgqwUw4CJ4OaQdSMXeJUTJrCb6z54X0YSt dD+TiXfxjTjYmuFQyclWZ8cc8vmB6VPP8SOGv6GJznlbuD8JUnyjKuXSXkOv0GG2Qq3X a7TaR0yUbKUgkelOAeS+T1LiYShgS+3Qdfj8EAXkgwJWY68MnwU8WWND7oLJccytpF+W W41w== X-Gm-Message-State: AOAM530Ng04B2wT0bkIvKsbwEqVFOzUONvnpAQF9hxSHvBb3M6tNGRLp 6bQcAq+GlHC4Gl4lOv/JEwWJbV7yBj6nOw== X-Received: by 2002:a63:ff4f:: with SMTP id s15mr5075928pgk.62.1610590640158; Wed, 13 Jan 2021 18:17:20 -0800 (PST) Received: from localhost.localdomain (rrcs-173-197-107-21.west.biz.rr.com. [173.197.107.21]) by smtp.gmail.com with ESMTPSA id i7sm3771687pfc.50.2021.01.13.18.17.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jan 2021 18:17:19 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 13/24] tcg: Use tcg_constant_i32 with icount expander Date: Wed, 13 Jan 2021 16:16:43 -1000 Message-Id: <20210114021654.647242-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210114021654.647242-1-richard.henderson@linaro.org> References: <20210114021654.647242-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::534; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x534.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: peter.maydell@linaro.org, =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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ée Signed-off-by: Richard Henderson --- include/exec/gen-icount.h | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) -- 2.25.1 diff --git a/include/exec/gen-icount.h b/include/exec/gen-icount.h index aa4b44354a..298e01eef4 100644 --- a/include/exec/gen-icount.h +++ b/include/exec/gen-icount.h @@ -34,7 +34,7 @@ static inline void gen_io_end(void) static inline void gen_tb_start(const TranslationBlock *tb) { - TCGv_i32 count, imm; + TCGv_i32 count; tcg_ctx->exitreq_label = gen_new_label(); if (tb_cflags(tb) & CF_USE_ICOUNT) { @@ -48,15 +48,13 @@ static inline void gen_tb_start(const TranslationBlock *tb) offsetof(ArchCPU, env)); if (tb_cflags(tb) & CF_USE_ICOUNT) { - imm = tcg_temp_new_i32(); - /* We emit a movi with a dummy immediate argument. Keep the insn index - * of the movi so that we later (when we know the actual insn count) - * 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 index + * 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 = tcg_last_op(); - - tcg_gen_sub_i32(count, count, imm); - tcg_temp_free_i32(imm); } tcg_gen_brcondi_i32(TCG_COND_LT, count, 0, tcg_ctx->exitreq_label); @@ -74,9 +72,12 @@ static inline void gen_tb_start(const TranslationBlock *tb) static inline void gen_tb_end(const 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))); } gen_set_label(tcg_ctx->exitreq_label); From patchwork Thu Jan 14 02:16:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 362808 Delivered-To: patch@linaro.org Received: by 2002:a02:ccad:0:0:0:0:0 with SMTP id t13csp73932jap; Wed, 13 Jan 2021 18:33:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJyu1stq0yIKf1xvlchWrvOx810X1ImtYvnQOEt9B8HIgWyZBliAW/kPQz8Yw9QtAfBKW87x X-Received: by 2002:a25:aea1:: with SMTP id b33mr4596146ybj.343.1610591600737; Wed, 13 Jan 2021 18:33:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610591600; cv=none; d=google.com; s=arc-20160816; b=JOBoOcvt27cYDVk1SIXbI8hL9iD6AposxCpTr0DHmSrnAVdNswY8A71pXQu84BnsJo yAGEn5nXcXB34cFeAX9GZiClyJyDk3DkmIvnSw7F+3cfULpD5/soNPGfngyFgqSZ/Hvr hDewpeaQxzq3ygcvCEvhTVuxJi5pyEi6Wm8hlE31byEl4S2IWc7dxmEUA+wFdqiTr2Qo 3pT04kKm6t3MLlX3GHrcUiHAzW/IpXN3YnNYQwuvrYfaUQYSknlD7I2FiHtOIEfMpBdn PRgeR1Znu7i3GcZG7W+zuxDG5DDXdTMqsGCMzPHHHL/A9BQAfonCEI6uL49Azs72NEuN /YDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=SP7y7BmDV8PvBtP7aflncUZbvfpV0QEs/q9zdjQfYwI=; b=Gp5kbjqLu8azEvGwFUooXZ8ZzwA1qMSo4CGZouygzvQoAAX9cKDQMEgpiy6ehRkC+N Seq157uzjhV73gybrOWmgFbhMSB5dEtNujUAB2aQx31FdkIYk4vrOONu0etnd+QUAFaJ 9YVDOaAk8eNo/0/g+LIvfGBgMDJgzTx6o5f3OcYoy4C3cXT33h0Oye8U/lRriF9M7pO2 rUKOrAH2Arhs3NajQrPFO/0j+QfwkS0ncG1ttVt8csdrfPkjDb+b7+uIi+AmuBYRo7c3 QMuIvGs6gJ9gnzT/TF1btbnfCpTr7pMMetZko9Lt1ZudvFIdLlnMukAixwN5mTJYcgXg F33g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vVuRlzWg; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h8si3720491ybq.491.2021.01.13.18.33.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 13 Jan 2021 18:33:20 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vVuRlzWg; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:50670 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kzsRs-0005X0-5o for patch@linaro.org; Wed, 13 Jan 2021 21:33:20 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60392) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kzsCd-0003fe-4V for qemu-devel@nongnu.org; Wed, 13 Jan 2021 21:17:35 -0500 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]:46398) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kzsCS-0003UY-P6 for qemu-devel@nongnu.org; Wed, 13 Jan 2021 21:17:34 -0500 Received: by mail-pf1-x433.google.com with SMTP id w2so2435571pfc.13 for ; Wed, 13 Jan 2021 18:17: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=SP7y7BmDV8PvBtP7aflncUZbvfpV0QEs/q9zdjQfYwI=; b=vVuRlzWg1EZtoVDJav0tAm4ytUMhi8A0DR/L1kLv9Tm0Gx12dMwcyzI+e6em0oaIWd 4FTsautSKa7Q8jOgWtyOarv6+p+drsIZUM4VFFR4qV2EcHWYYNYjAH11c402SPu/kppe sgFCZ6QBou8qdiIfdwuTpc1RxGFtAlkjGQaaNbbf7yPzbIFopbfsNlSIb8tfm//Vafvq ycS2b6wYVLJwLJ7gDiEJPANvOcDi4tUR+Dez3vnNn7PlnV3KOWUQlgbHKXL9VeCMwfni EcQBJLvfFPee0G5CZGFxzT0h3uvcyg42mxja1O5MYaKO3NROJ7tVYCv1J4G+EcGEZT6/ XTag== 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=SP7y7BmDV8PvBtP7aflncUZbvfpV0QEs/q9zdjQfYwI=; b=g0e5nBogm+HeC0ZuHErPNr/mt0V7e/KXi5VWRH38hosUQRZk8RIWWHGJRjTLBR2Q5f pbdT1F00hOlxzSVkInufdtSYMime96/3M+bBXJfiwQxwTRgVJlS0FK1Fmy93j1PofoUw u6saP2AMUOo1Of5JS77M+uNiUT3RyQbCM/Kt3k0JgH+P/kRYwNqx46gnScG4dpveXnlH p+OMjZKesRMA8lIKFhYeYKwHHyYgyIg01Ye7xoKjKjpwnzGgldujb4oG69egZkzAwSFR DtNIECxPlfRasYKsWLphz7nP6OaRoMJjjjmuWqtVqJal3Adm1gy2gWTpiuGlei3VrWff 7HaQ== X-Gm-Message-State: AOAM531hWc8Q1WJpkCOvFW8Px+t537DRElYbY+6TkvuE5hl2wwEK3MQk h5KvvbYXCTluadC18+3umnWyUG+/zHQoLQ== X-Received: by 2002:a65:5244:: with SMTP id q4mr5087018pgp.50.1610590641870; Wed, 13 Jan 2021 18:17:21 -0800 (PST) Received: from localhost.localdomain (rrcs-173-197-107-21.west.biz.rr.com. [173.197.107.21]) by smtp.gmail.com with ESMTPSA id i7sm3771687pfc.50.2021.01.13.18.17.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jan 2021 18:17:21 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 14/24] tcg: Use tcg_constant_{i32, i64} with tcg int expanders Date: Wed, 13 Jan 2021 16:16:44 -1000 Message-Id: <20210114021654.647242-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210114021654.647242-1-richard.henderson@linaro.org> References: <20210114021654.647242-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::433; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x433.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: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- include/tcg/tcg-op.h | 13 +-- tcg/tcg-op.c | 227 ++++++++++++++++++++----------------------- 2 files changed, 109 insertions(+), 131 deletions(-) -- 2.25.1 diff --git a/include/tcg/tcg-op.h b/include/tcg/tcg-op.h index 901b19f32a..ed8de045e2 100644 --- a/include/tcg/tcg-op.h +++ b/include/tcg/tcg-op.h @@ -271,6 +271,7 @@ void tcg_gen_mb(TCGBar); /* 32 bit ops */ +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) } } -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_i32 arg) /* 64 bit ops */ +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) } } -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_i64 arg1, TCGv_i64 arg2) 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 0374b5d56d..70475773f4 100644 --- a/tcg/tcg-op.c +++ b/tcg/tcg-op.c @@ -104,15 +104,18 @@ void tcg_gen_mb(TCGBar mb_type) /* 32 bit ops */ +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 == 0) { tcg_gen_mov_i32(ret, arg1); } else { - TCGv_i32 t0 = 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)); } } @@ -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 = 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); } } @@ -134,15 +135,12 @@ void tcg_gen_subi_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2) if (arg2 == 0) { tcg_gen_mov_i32(ret, arg1); } else { - TCGv_i32 t0 = 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)); } } 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, int32_t arg2) } break; } - t0 = 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)); } 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 == 0) { tcg_gen_mov_i32(ret, arg1); } else { - TCGv_i32 t0 = 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)); } } @@ -193,9 +188,7 @@ void tcg_gen_xori_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2) /* Don't recurse with tcg_gen_not_i32. */ tcg_gen_op2_i32(INDEX_op_not_i32, ret, arg1); } else { - TCGv_i32 t0 = 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)); } } @@ -205,9 +198,7 @@ void tcg_gen_shli_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2) if (arg2 == 0) { tcg_gen_mov_i32(ret, arg1); } else { - TCGv_i32 t0 = 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)); } } @@ -217,9 +208,7 @@ void tcg_gen_shri_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2) if (arg2 == 0) { tcg_gen_mov_i32(ret, arg1); } else { - TCGv_i32 t0 = 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)); } } @@ -229,9 +218,7 @@ void tcg_gen_sari_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2) if (arg2 == 0) { tcg_gen_mov_i32(ret, arg1); } else { - TCGv_i32 t0 = 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)); } } @@ -250,9 +237,7 @@ void tcg_gen_brcondi_i32(TCGCond cond, TCGv_i32 arg1, int32_t arg2, TCGLabel *l) if (cond == TCG_COND_ALWAYS) { tcg_gen_br(l); } else if (cond != TCG_COND_NEVER) { - TCGv_i32 t0 = 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); } } @@ -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 = 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)); } 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, int32_t arg2) } else if (is_power_of_2(arg2)) { tcg_gen_shli_i32(ret, arg1, ctz32(arg2)); } else { - TCGv_i32 t0 = 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)); } } @@ -433,9 +414,7 @@ void tcg_gen_clz_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2) void tcg_gen_clzi_i32(TCGv_i32 ret, TCGv_i32 arg1, uint32_t arg2) { - TCGv_i32 t = 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)); } 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 = tcg_const_i32(0); + z = 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, uint32_t arg2) tcg_gen_ctpop_i32(ret, t); tcg_temp_free_i32(t); } else { - TCGv_i32 t = 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)); } } @@ -547,9 +523,7 @@ void tcg_gen_rotli_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2) if (arg2 == 0) { tcg_gen_mov_i32(ret, arg1); } else if (TCG_TARGET_HAS_rot_i32) { - TCGv_i32 t0 = 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 = 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 = tcg_const_i32(0); + TCGv_i32 zero = 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 = tcg_temp_new_i32(); TCGv_i32 t1 = tcg_temp_new_i32(); - TCGv_i32 t2 = tcg_const_i32(0x00ff00ff); + TCGv_i32 t2 = tcg_constant_i32(0x00ff00ff); /* arg = abcd */ tcg_gen_shri_i32(t0, arg, 8); /* t0 = .abc */ @@ -1067,7 +1040,6 @@ void tcg_gen_bswap32_i32(TCGv_i32 ret, TCGv_i32 arg) tcg_temp_free_i32(t0); tcg_temp_free_i32(t1); - tcg_temp_free_i32(t2); } } @@ -1114,8 +1086,15 @@ void tcg_gen_discard_i64(TCGv_i64 arg) 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 = tcgv_i64_temp(arg); + + /* Canonicalize TCGv_i64 TEMP_CONST into TCGv_i32 TEMP_CONST. */ + if (ts->kind == 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)); + } } 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, TCGv_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 == 32 */ 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 == 0) { tcg_gen_mov_i64(ret, arg1); + } else if (TCG_TARGET_REG_BITS == 64) { + tcg_gen_add_i64(ret, arg1, tcg_constant_i64(arg2)); } else { - TCGv_i64 t0 = 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)); } } @@ -1256,10 +1245,12 @@ void tcg_gen_subfi_i64(TCGv_i64 ret, int64_t arg1, TCGv_i64 arg2) if (arg1 == 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 == 64) { + tcg_gen_sub_i64(ret, tcg_constant_i64(arg1), arg2); } else { - TCGv_i64 t0 = 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)); } } @@ -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 == 0) { tcg_gen_mov_i64(ret, arg1); + } else if (TCG_TARGET_REG_BITS == 64) { + tcg_gen_sub_i64(ret, arg1, tcg_constant_i64(arg2)); } else { - TCGv_i64 t0 = 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)); } } void tcg_gen_andi_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2) { - TCGv_i64 t0; - if (TCG_TARGET_REG_BITS == 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, int64_t arg2) } break; } - t0 = 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)); } 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, int64_t arg2) } else if (arg2 == 0) { tcg_gen_mov_i64(ret, arg1); } else { - TCGv_i64 t0 = 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)); } } @@ -1351,9 +1339,7 @@ void tcg_gen_xori_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2) /* Don't recurse with tcg_gen_not_i64. */ tcg_gen_op2_i64(INDEX_op_not_i64, ret, arg1); } else { - TCGv_i64 t0 = 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)); } } @@ -1415,9 +1401,7 @@ void tcg_gen_shli_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2) } else if (arg2 == 0) { tcg_gen_mov_i64(ret, arg1); } else { - TCGv_i64 t0 = 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)); } } @@ -1429,9 +1413,7 @@ void tcg_gen_shri_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2) } else if (arg2 == 0) { tcg_gen_mov_i64(ret, arg1); } else { - TCGv_i64 t0 = 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)); } } @@ -1443,9 +1425,7 @@ void tcg_gen_sari_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2) } else if (arg2 == 0) { tcg_gen_mov_i64(ret, arg1); } else { - TCGv_i64 t0 = 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)); } } @@ -1468,12 +1448,17 @@ void tcg_gen_brcond_i64(TCGCond cond, TCGv_i64 arg1, TCGv_i64 arg2, TCGLabel *l) void tcg_gen_brcondi_i64(TCGCond cond, TCGv_i64 arg1, int64_t arg2, TCGLabel *l) { - if (cond == TCG_COND_ALWAYS) { + if (TCG_TARGET_REG_BITS == 64) { + tcg_gen_brcond_i64(cond, arg1, tcg_constant_i64(arg2), l); + } else if (cond == TCG_COND_ALWAYS) { tcg_gen_br(l); } else if (cond != TCG_COND_NEVER) { - TCGv_i64 t0 = 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)); } } @@ -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 = tcg_const_i64(arg2); - tcg_gen_setcond_i64(cond, ret, arg1, t0); - tcg_temp_free_i64(t0); + if (TCG_TARGET_REG_BITS == 64) { + tcg_gen_setcond_i64(cond, ret, arg1, tcg_constant_i64(arg2)); + } else if (cond == TCG_COND_ALWAYS) { + tcg_gen_movi_i64(ret, 1); + } else if (cond == 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); + } } 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 = tcg_temp_new_i64(); TCGv_i64 t1 = tcg_temp_new_i64(); - TCGv_i64 t2 = tcg_const_i64(0x00ff00ff); + TCGv_i64 t2 = tcg_constant_i64(0x00ff00ff); /* arg = ....abcd */ tcg_gen_shri_i64(t0, arg, 8); /* t0 = .....abc */ @@ -1706,7 +1701,6 @@ void tcg_gen_bswap32_i64(TCGv_i64 ret, TCGv_i64 arg) tcg_temp_free_i64(t0); tcg_temp_free_i64(t1); - tcg_temp_free_i64(t2); } } @@ -1850,16 +1844,16 @@ void tcg_gen_clzi_i64(TCGv_i64 ret, TCGv_i64 arg1, uint64_t arg2) if (TCG_TARGET_REG_BITS == 32 && TCG_TARGET_HAS_clz_i32 && arg2 <= 0xffffffffu) { - TCGv_i32 t = tcg_const_i32((uint32_t)arg2 - 32); - tcg_gen_clz_i32(t, TCGV_LOW(arg1), t); + TCGv_i32 t = 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 = tcg_const_i64(arg2); - tcg_gen_clz_i64(ret, arg1, t); - tcg_temp_free_i64(t); + TCGv_i64 t0 = tcg_const_i64(arg2); + tcg_gen_clz_i64(ret, arg1, t0); + tcg_temp_free_i64(t0); } } @@ -1881,7 +1875,7 @@ void tcg_gen_ctz_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) tcg_gen_clzi_i64(t, t, 64); tcg_gen_xori_i64(t, t, 63); } - z = tcg_const_i64(0); + z = 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, uint64_t arg2) if (TCG_TARGET_REG_BITS == 32 && TCG_TARGET_HAS_ctz_i32 && arg2 <= 0xffffffffu) { - TCGv_i32 t32 = tcg_const_i32((uint32_t)arg2 - 32); - tcg_gen_ctz_i32(t32, TCGV_HIGH(arg1), t32); + TCGv_i32 t32 = 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, uint64_t arg2) tcg_gen_ctpop_i64(ret, t); tcg_temp_free_i64(t); } else { - TCGv_i64 t64 = tcg_const_i64(arg2); - tcg_gen_ctz_i64(ret, arg1, t64); - tcg_temp_free_i64(t64); + TCGv_i64 t0 = tcg_const_i64(arg2); + tcg_gen_ctz_i64(ret, arg1, t0); + tcg_temp_free_i64(t0); } } @@ -1969,9 +1963,7 @@ void tcg_gen_rotli_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2) if (arg2 == 0) { tcg_gen_mov_i64(ret, arg1); } else if (TCG_TARGET_HAS_rot_i64) { - TCGv_i64 t0 = 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 = 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 = tcg_const_i64(0); + TCGv_i64 zero = 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 == 32) { if (ofs >= 32) { @@ -3117,9 +3108,8 @@ void tcg_gen_atomic_cmpxchg_i32(TCGv_i32 retv, TCGv addr, TCGv_i32 cmpv, #ifdef CONFIG_SOFTMMU { - TCGv_i32 oi = 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 = 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); @@ -3162,9 +3152,8 @@ void tcg_gen_atomic_cmpxchg_i64(TCGv_i64 retv, TCGv addr, TCGv_i64 cmpv, #ifdef CONFIG_SOFTMMU { - TCGv_i32 oi = tcg_const_i32(make_memop_idx(memop, idx)); - gen(retv, cpu_env, addr, cmpv, newv, oi); - tcg_temp_free_i32(oi); + TCGMemOpIdx oi = make_memop_idx(memop, idx); + gen(retv, cpu_env, addr, cmpv, newv, tcg_constant_i32(oi)); } #else gen(retv, cpu_env, addr, cmpv, newv); @@ -3226,9 +3215,8 @@ static void do_atomic_op_i32(TCGv_i32 ret, TCGv addr, TCGv_i32 val, #ifdef CONFIG_SOFTMMU { - TCGv_i32 oi = tcg_const_i32(make_memop_idx(memop & ~MO_SIGN, idx)); - gen(ret, cpu_env, addr, val, oi); - tcg_temp_free_i32(oi); + TCGMemOpIdx oi = make_memop_idx(memop & ~MO_SIGN, idx); + gen(ret, cpu_env, addr, val, tcg_constant_i32(oi)); } #else gen(ret, cpu_env, addr, val); @@ -3272,9 +3260,8 @@ static void do_atomic_op_i64(TCGv_i64 ret, TCGv addr, TCGv_i64 val, #ifdef CONFIG_SOFTMMU { - TCGv_i32 oi = tcg_const_i32(make_memop_idx(memop & ~MO_SIGN, idx)); - gen(ret, cpu_env, addr, val, oi); - tcg_temp_free_i32(oi); + TCGMemOpIdx oi = make_memop_idx(memop & ~MO_SIGN, idx); + gen(ret, cpu_env, addr, val, tcg_constant_i32(oi)); } #else gen(ret, cpu_env, addr, val); From patchwork Thu Jan 14 02:16:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 362797 Delivered-To: patch@linaro.org Received: by 2002:a02:ccad:0:0:0:0:0 with SMTP id t13csp67532jap; Wed, 13 Jan 2021 18:23:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJxUe5U5jj5F1f7J5GhRSmDbtLYaT4thFrWhOR/4mib6ElckMj/VaDo1CXyK+u8mSIk/uAJf X-Received: by 2002:a25:3d47:: with SMTP id k68mr7532449yba.415.1610590982159; Wed, 13 Jan 2021 18:23:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610590982; cv=none; d=google.com; s=arc-20160816; b=yV/Rixk+Df8RTwB0udYo4RJ1h+NZgbJkz0aN5LZnXXlH1U2Q4R6unuPDVRDuNYCHQk DRgBIwvoZ+THZuPL54VG/KPtLZ/g54141WRAbaRTEW3rtz5SJlcdjLuDKfI7fKThuEVY MeB88SdEXkNW80DuHNjibtOy2oKmOy6hcmzfBIam6xNOuefAtXlRa8Lt5hEqvZC0GqPN 492wKHRVpWGD8e3PnC7O8oc7ZgFmdzl74hrnEPAGq6pM0XEv3wbxMy6sGqaO0KvRXq/4 EqAzkcu1tyhog5s2/IwGnryRpfoudkg10vdveNoPE24FKNw7ihvGusNt0dxvJBclER7T YT2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=HakP3QzMMgoP+5PWHWKQnZl86G7xrmBYKlGdyeWSyq0=; b=NcfXB1KpyPW81k5Drrc3MlgB+jERmBBdhEAK9IMymZ1PDppIDUaKXt81BTsI/05URw /3siIkPKP6+KVTWtMRalti+L92LUiJV2FqJKhw5F0m0JYd8yd6y/MD+KQ1LKeKHoNRVA t/zlyn2hOcsPGaDCMF3CiBn1VeTBiP7ykBCJ1duwoZMvPJdwSEdLuVeTbGhCdUCBsWha rJ1jAiWF5ATbFRKS9oO0mPEGvIMxLJbedPHDWSqHB639DoXgjrZeNS9bjMaV5QrDzB7u UIP6uiofC5P3jQ7/yv/b6BLLnAZ0IxBUqaUDnniTNKNvQZk/A+Sa+pk5i2fa/9i+8c4g ssoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KolioF77; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id n1si2264208ybj.138.2021.01.13.18.23.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 13 Jan 2021 18:23:02 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KolioF77; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:50412 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kzsHt-0001vm-Jz for patch@linaro.org; Wed, 13 Jan 2021 21:23:01 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60410) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kzsCd-0003hV-Nk for qemu-devel@nongnu.org; Wed, 13 Jan 2021 21:17:35 -0500 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]:36862) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kzsCT-0003Uj-HR for qemu-devel@nongnu.org; Wed, 13 Jan 2021 21:17:35 -0500 Received: by mail-pf1-x434.google.com with SMTP id b3so2468729pft.3 for ; Wed, 13 Jan 2021 18:17:24 -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=KolioF7780csIbpfhsCxUusJR/cGC2brujTGh0VUrBCPvA7rmhIBEjPKbxQXm+/Le6 8ZzlowHMpbaLL2EV1gag5f0CGwxAc94lMb8v+QGDKbYo5aCs6FkPOUX3Ec8jlELHcdt8 NHdHTVW3Ih9o0wLQiJmwz0lcZswgnguJrJh8sDj8V75R0eHfAUOen1EtJ4jVOVu8CEJn IIbuYel4a7lRs6LHqzTNkqjgByCxEUw0saHK7koUnMi+XK63GHXPwtPOQroKS3M9mxnP pa5eJRdnWs7uWSj3B//lXe7QS5TovHgLTt58Vu47d/ANLsod6XzPX6lBwSaESP2zujvX MoAQ== 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=Y2gXSbNeCzrgVIfzC1CwUPCovHnsrHIKc+XFLDM95k1G1z6MFbeWPq3r+G2NCXkdsg 0ORyRoPVoENqFCCLe+jnLC5ov4i3SMnSoz4NBdA6xKHr0r0Nbz9IhFPDpb1sGyDVO9L1 rpr0kZaDlambvxEEPEV1vSo1ffxIsLk4BR4coIUjHE2vngRbK5rbxdqN40BW+4p4AEY+ jqQQH69rHPCT9kQoD3KM6espv6np8/ovoNZXA3OsNOj/BxhcJZJ3o+xyBXsmjmbf0uTp rfMpHO/D0t4WjZjfDkDxWeKt9L0Du9zHICRcmjmDzhImGBp7Wqdiv9Xy6alPIU0DymWz fOGg== X-Gm-Message-State: AOAM533cRqvAuSCBMVbaSof6DieTfezIzAGfeLVwJIsJGTxy84o8e8j6 9XAcFaDYCRNfiRO+0XJ4TBvQSmDZv2qmiQ== X-Received: by 2002:a63:5309:: with SMTP id h9mr5049051pgb.19.1610590643511; Wed, 13 Jan 2021 18:17:23 -0800 (PST) Received: from localhost.localdomain (rrcs-173-197-107-21.west.biz.rr.com. [173.197.107.21]) by smtp.gmail.com with ESMTPSA id i7sm3771687pfc.50.2021.01.13.18.17.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jan 2021 18:17:22 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 15/24] tcg: Use tcg_constant_{i32,i64} with tcg plugins Date: Wed, 13 Jan 2021 16:16:45 -1000 Message-Id: <20210114021654.647242-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210114021654.647242-1-richard.henderson@linaro.org> References: <20210114021654.647242-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::434; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x434.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: peter.maydell@linaro.org, =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- accel/tcg/plugin-gen.c | 49 +++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 27 deletions(-) -- 2.25.1 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 == 32) { /* mov_i32 */ op = copy_op(begin_op, op, INDEX_op_mov_i32); - /* movi_i32 */ - op = copy_op(begin_op, op, INDEX_op_movi_i32); + /* mov_i32 w/ $0 */ + op = copy_op(begin_op, op, INDEX_op_mov_i32); } else { /* extu_i32_i64 */ op = copy_op(begin_op, op, INDEX_op_extu_i32_i64); @@ -306,39 +306,34 @@ static TCGOp *copy_mov_i64(TCGOp **begin_op, TCGOp *op) return op; } -static TCGOp *copy_movi_i64(TCGOp **begin_op, TCGOp *op, uint64_t v) -{ - if (TCG_TARGET_REG_BITS == 32) { - /* 2x movi_i32 */ - op = copy_op(begin_op, op, INDEX_op_movi_i32); - op->args[1] = v; - - op = copy_op(begin_op, op, INDEX_op_movi_i32); - op->args[1] = v >> 32; - } else { - /* movi_i64 */ - op = copy_op(begin_op, op, INDEX_op_movi_i64); - op->args[1] = v; - } - return op; -} - static TCGOp *copy_const_ptr(TCGOp **begin_op, TCGOp *op, void *ptr) { if (UINTPTR_MAX == UINT32_MAX) { - /* movi_i32 */ - op = copy_op(begin_op, op, INDEX_op_movi_i32); - op->args[1] = (uintptr_t)ptr; + /* mov_i32 */ + op = copy_op(begin_op, op, INDEX_op_mov_i32); + op->args[1] = tcgv_i32_arg(tcg_constant_i32((uintptr_t)ptr)); } else { - /* movi_i64 */ - op = copy_movi_i64(begin_op, op, (uint64_t)(uintptr_t)ptr); + /* mov_i64 */ + op = copy_op(begin_op, op, INDEX_op_mov_i64); + op->args[1] = tcgv_i64_arg(tcg_constant_i64((uintptr_t)ptr)); } return op; } 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 == 32) { + /* 2x mov_i32 */ + op = copy_op(begin_op, op, INDEX_op_mov_i32); + op->args[1] = tcgv_i32_arg(tcg_constant_i32(v)); + op = copy_op(begin_op, op, INDEX_op_mov_i32); + op->args[1] = tcgv_i32_arg(tcg_constant_i32(v >> 32)); + } else { + /* mov_i64 */ + op = copy_op(begin_op, op, INDEX_op_mov_i64); + op->args[1] = tcgv_i64_arg(tcg_constant_i64(v)); + } + return op; } static TCGOp *copy_extu_tl_i64(TCGOp **begin_op, TCGOp *op) @@ -486,8 +481,8 @@ static TCGOp *append_mem_cb(const struct qemu_plugin_dyn_cb *cb, tcg_debug_assert(type == PLUGIN_GEN_CB_MEM); - /* const_i32 == movi_i32 ("info", so it remains as is) */ - op = copy_op(&begin_op, op, INDEX_op_movi_i32); + /* const_i32 == mov_i32 ("info", so it remains as is) */ + op = copy_op(&begin_op, op, INDEX_op_mov_i32); /* const_ptr */ op = copy_const_ptr(&begin_op, op, cb->userp); From patchwork Thu Jan 14 02:16:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 362795 Delivered-To: patch@linaro.org Received: by 2002:a02:ccad:0:0:0:0:0 with SMTP id t13csp67373jap; Wed, 13 Jan 2021 18:22:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJxK/WBEEuwBp/0PZemWeXpaoBUbMs6z3EOkCn1jp6W/zM/e3OT4MBStUX4DRSML78EoKvTw X-Received: by 2002:a25:1241:: with SMTP id 62mr7590216ybs.366.1610590968442; Wed, 13 Jan 2021 18:22:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610590968; cv=none; d=google.com; s=arc-20160816; b=CkLqUy30Hg5QHqnZtbLzeOJqySlgfLjSK361dkx4eOOSvZylGmOf4JdBDbdrQd1fbr sRG3INvImoymimBwjsPurPGG6B9TPTcq/3FkFHvCFN36GOjMWfTNs1ZySh0fzMj9FwHC Nf3byTvHlp6yordlXvHkVPCs+Cq6Mv1nhSV1myCiBAF6Q8qhMwpy+UWK4f8eisvM80tp DK12jFY2Ew78UhksY9cTyJF7rZ4N4clSPpS42JDLyWAUmLVZhP+F+CekRcrKOzmBdvA3 R6A8Ef1BgQ9yPoiR3/jrwjs0hsMP5a8rRkQYnM7cVj61GGw4nRoydoQZUHct3mHMK1Jk aeWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=gINepdGckOBPQozHF12k+VkgG8lWS2hW2lWUZ4aP3Vk=; b=n0LXVkH++XPxJ57CKM+BSQlnI+Hu/OCbgIthpb67hcgDLYqewyJ8DQlPZw9HWpVDFn 5SVd0tWwXLxlgOjwikwm27tChkL7CbBEQDWSdcIw9WzGlZZOC2HTeNAtFQo7Vx2ZTNXl M4OF+nru1XNBI2SQ/XwwhMX9NjYWYqyfHIPPPoqgs/MEk8CfQmLrZRjgxv3mS6yEXcOo B7tnUH48njutBMWh+IVv7C4i5FTG1Yz1nJ5bYTsLNg0gNh50nwYZAzbyqD9AiMWOqEmU 8c0lRHTbEDruYVBCs2+USk94DcsR+G4BB4GjFiaY3QW+gEdEqRW7vYP+bRCj3mkw3+pZ SXTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IdxT9Eqe; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id a204si3549884ybg.111.2021.01.13.18.22.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 13 Jan 2021 18:22:48 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IdxT9Eqe; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:50488 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kzsHf-0001xI-RY for patch@linaro.org; Wed, 13 Jan 2021 21:22:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60454) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kzsCf-0003lJ-4X for qemu-devel@nongnu.org; Wed, 13 Jan 2021 21:17:37 -0500 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]:33546) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kzsCY-0003Uw-TK for qemu-devel@nongnu.org; Wed, 13 Jan 2021 21:17:36 -0500 Received: by mail-pj1-x1031.google.com with SMTP id w1so3916828pjc.0 for ; Wed, 13 Jan 2021 18:17:26 -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=gINepdGckOBPQozHF12k+VkgG8lWS2hW2lWUZ4aP3Vk=; b=IdxT9EqekcvblMa0xHcYRXzVfD6q74UEhXbLKHZ1K7YKj7JEa6bPpRZmFIWQx/YKsq LXLs8tEwWa4xQ5+WQHgrW1wF3YnNe0Z3P3rXRaI/NkCFKhjvM6s8UoOMBC22NCXvwN0x 9ayHTEV5qhRfdoT39pKR8p3dCDyE+Aqc7BzHEMNdjyO7fB/B3ckwoqsewrwSoKzPufgK 6+hMJMnkUH2uXk1YJxmNwc5vsDVigqH2YgM+5EBoAjdvJZRnZoYOvuc9kRb+kphcDjBu 7sv/kgvB/92j0tJiLmBiPdNR6YuLRddGrxN8wN9M2NmEJYUTISAy7Fya/+Isj3S2kE0w sogg== 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=gINepdGckOBPQozHF12k+VkgG8lWS2hW2lWUZ4aP3Vk=; b=GRov9pGcJMnu8P9IXuoZcMe/8fk/VDmXm0dTvIDus4QfyagtMQBVU2ZecQ09fGv+aQ uI1U/W+KjFUSazv5tKV1DSm6zkg7wtO9JMbySuzJ+lMFA8jTnr7dlWf4kpd58LBHuit8 C9s8EkTJ9TYnEbGxX/IJhd10AEuB81UmWzCmDst6SGS1R9qCx/TpeiwIwXVqzsZ98i6o aVnO+/iSqqBe1gD5cma1zkJlU3JpMiKHlBY/U9fVfLHOh5dwY6n4NrvclGdNaI/5fAQe uE7TaNGM9fImEl+oq4N7BvMYs7AJZYE03bWm+Oydp8ig3Q5/F7SdJ/WaqvKPJQeScz3X aSQw== X-Gm-Message-State: AOAM530p/oUbcnJRWJoJQk1WZi/7XEipqhklAKVurniCRNxyjzMQK/Ma A67fOC8e7RyoyJgGfnhC3Qhzud/wlyPhiQ== X-Received: by 2002:a17:902:9896:b029:dc:3306:8aa7 with SMTP id s22-20020a1709029896b02900dc33068aa7mr5405158plp.6.1610590645069; Wed, 13 Jan 2021 18:17:25 -0800 (PST) Received: from localhost.localdomain (rrcs-173-197-107-21.west.biz.rr.com. [173.197.107.21]) by smtp.gmail.com with ESMTPSA id i7sm3771687pfc.50.2021.01.13.18.17.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jan 2021 18:17:24 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 16/24] tcg: Use tcg_constant_{i32, i64, vec} with gvec expanders Date: Wed, 13 Jan 2021 16:16:46 -1000 Message-Id: <20210114021654.647242-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210114021654.647242-1-richard.henderson@linaro.org> References: <20210114021654.647242-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1031; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1031.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: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- include/tcg/tcg.h | 1 + tcg/tcg-op-gvec.c | 129 ++++++++++++++++++---------------------------- tcg/tcg.c | 8 +++ 3 files changed, 60 insertions(+), 78 deletions(-) -- 2.25.1 diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index eeeb70ad43..504c5e9bb0 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -1109,6 +1109,7 @@ static inline TCGv_i64 tcg_constant_i64(int64_t val) } 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); #if UINTPTR_MAX == 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 1a41dfa908..498a959839 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 = tcg_const_i32(simd_desc(oprsz, maxsz, data)); + TCGv_i32 desc = tcg_constant_i32(simd_desc(oprsz, maxsz, data)); a0 = tcg_temp_new_ptr(); a1 = tcg_temp_new_ptr(); @@ -127,7 +127,6 @@ void tcg_gen_gvec_2_ool(uint32_t dofs, uint32_t aofs, tcg_temp_free_ptr(a0); tcg_temp_free_ptr(a1); - tcg_temp_free_i32(desc); } /* 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 = tcg_const_i32(simd_desc(oprsz, maxsz, data)); + TCGv_i32 desc = tcg_constant_i32(simd_desc(oprsz, maxsz, data)); a0 = tcg_temp_new_ptr(); a1 = tcg_temp_new_ptr(); @@ -149,7 +148,6 @@ void tcg_gen_gvec_2i_ool(uint32_t dofs, uint32_t aofs, TCGv_i64 c, tcg_temp_free_ptr(a0); tcg_temp_free_ptr(a1); - tcg_temp_free_i32(desc); } /* 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, uint32_t bofs, gen_helper_gvec_3 *fn) { TCGv_ptr a0, a1, a2; - TCGv_i32 desc = tcg_const_i32(simd_desc(oprsz, maxsz, data)); + TCGv_i32 desc = tcg_constant_i32(simd_desc(oprsz, maxsz, data)); a0 = tcg_temp_new_ptr(); a1 = tcg_temp_new_ptr(); @@ -173,7 +171,6 @@ void tcg_gen_gvec_3_ool(uint32_t dofs, uint32_t aofs, uint32_t bofs, tcg_temp_free_ptr(a0); tcg_temp_free_ptr(a1); tcg_temp_free_ptr(a2); - tcg_temp_free_i32(desc); } /* 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, uint32_t bofs, int32_t data, gen_helper_gvec_4 *fn) { TCGv_ptr a0, a1, a2, a3; - TCGv_i32 desc = tcg_const_i32(simd_desc(oprsz, maxsz, data)); + TCGv_i32 desc = tcg_constant_i32(simd_desc(oprsz, maxsz, data)); a0 = tcg_temp_new_ptr(); a1 = tcg_temp_new_ptr(); @@ -200,7 +197,6 @@ void tcg_gen_gvec_4_ool(uint32_t dofs, uint32_t aofs, uint32_t bofs, tcg_temp_free_ptr(a1); tcg_temp_free_ptr(a2); tcg_temp_free_ptr(a3); - tcg_temp_free_i32(desc); } /* 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, uint32_t bofs, uint32_t maxsz, int32_t data, gen_helper_gvec_5 *fn) { TCGv_ptr a0, a1, a2, a3, a4; - TCGv_i32 desc = tcg_const_i32(simd_desc(oprsz, maxsz, data)); + TCGv_i32 desc = tcg_constant_i32(simd_desc(oprsz, maxsz, data)); a0 = tcg_temp_new_ptr(); a1 = tcg_temp_new_ptr(); @@ -230,7 +226,6 @@ void tcg_gen_gvec_5_ool(uint32_t dofs, uint32_t aofs, uint32_t bofs, tcg_temp_free_ptr(a2); tcg_temp_free_ptr(a3); tcg_temp_free_ptr(a4); - tcg_temp_free_i32(desc); } /* 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 = tcg_const_i32(simd_desc(oprsz, maxsz, data)); + TCGv_i32 desc = tcg_constant_i32(simd_desc(oprsz, maxsz, data)); a0 = tcg_temp_new_ptr(); a1 = tcg_temp_new_ptr(); @@ -252,7 +247,6 @@ void tcg_gen_gvec_2_ptr(uint32_t dofs, uint32_t aofs, tcg_temp_free_ptr(a0); tcg_temp_free_ptr(a1); - tcg_temp_free_i32(desc); } /* 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, uint32_t bofs, int32_t data, gen_helper_gvec_3_ptr *fn) { TCGv_ptr a0, a1, a2; - TCGv_i32 desc = tcg_const_i32(simd_desc(oprsz, maxsz, data)); + TCGv_i32 desc = tcg_constant_i32(simd_desc(oprsz, maxsz, data)); a0 = tcg_temp_new_ptr(); a1 = tcg_temp_new_ptr(); @@ -277,7 +271,6 @@ void tcg_gen_gvec_3_ptr(uint32_t dofs, uint32_t aofs, uint32_t bofs, tcg_temp_free_ptr(a0); tcg_temp_free_ptr(a1); tcg_temp_free_ptr(a2); - tcg_temp_free_i32(desc); } /* 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, uint32_t bofs, gen_helper_gvec_4_ptr *fn) { TCGv_ptr a0, a1, a2, a3; - TCGv_i32 desc = tcg_const_i32(simd_desc(oprsz, maxsz, data)); + TCGv_i32 desc = tcg_constant_i32(simd_desc(oprsz, maxsz, data)); a0 = tcg_temp_new_ptr(); a1 = tcg_temp_new_ptr(); @@ -306,7 +299,6 @@ void tcg_gen_gvec_4_ptr(uint32_t dofs, uint32_t aofs, uint32_t bofs, tcg_temp_free_ptr(a1); tcg_temp_free_ptr(a2); tcg_temp_free_ptr(a3); - tcg_temp_free_i32(desc); } /* 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, uint32_t bofs, gen_helper_gvec_5_ptr *fn) { TCGv_ptr a0, a1, a2, a3, a4; - TCGv_i32 desc = tcg_const_i32(simd_desc(oprsz, maxsz, data)); + TCGv_i32 desc = tcg_constant_i32(simd_desc(oprsz, maxsz, data)); a0 = tcg_temp_new_ptr(); a1 = tcg_temp_new_ptr(); @@ -338,7 +330,6 @@ void tcg_gen_gvec_5_ptr(uint32_t dofs, uint32_t aofs, uint32_t bofs, tcg_temp_free_ptr(a2); tcg_temp_free_ptr(a3); tcg_temp_free_ptr(a4); - tcg_temp_free_i32(desc); } /* Return true if we want to implement something of OPRSZ bytes @@ -605,9 +596,9 @@ static void do_dup(unsigned vece, uint32_t dofs, uint32_t oprsz, || (TCG_TARGET_REG_BITS == 64 && (in_c == 0 || in_c == -1 || !check_size_impl(oprsz, 4)))) { - t_64 = tcg_const_i64(in_c); + t_64 = tcg_constant_i64(in_c); } else { - t_32 = tcg_const_i32(in_c); + t_32 = tcg_constant_i32(in_c); } } @@ -648,11 +639,11 @@ static void do_dup(unsigned vece, uint32_t dofs, uint32_t oprsz, t_val = tcg_temp_new_i32(); tcg_gen_extrl_i64_i32(t_val, in_64); } else { - t_val = tcg_const_i32(in_c); + t_val = tcg_constant_i32(in_c); } gen_helper_memset(t_ptr, t_ptr, t_val, t_size); - if (!in_32) { + if (in_64) { tcg_temp_free_i32(t_val); } tcg_temp_free_ptr(t_size); @@ -660,15 +651,14 @@ static void do_dup(unsigned vece, uint32_t dofs, uint32_t oprsz, return; } - t_desc = tcg_const_i32(simd_desc(oprsz, maxsz, 0)); + t_desc = tcg_constant_i32(simd_desc(oprsz, maxsz, 0)); if (vece == MO_64) { if (in_64) { gen_helper_gvec_dup64(t_ptr, t_desc, in_64); } else { - t_64 = tcg_const_i64(in_c); + t_64 = 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); @@ -680,24 +670,23 @@ static void do_dup(unsigned vece, uint32_t dofs, uint32_t oprsz, if (in_32) { fns[vece](t_ptr, t_desc, in_32); - } else { + } else if (in_64) { t_32 = tcg_temp_new_i32(); - if (in_64) { - tcg_gen_extrl_i64_i32(t_32, in_64); - } else if (vece == MO_8) { - tcg_gen_movi_i32(t_32, in_c & 0xff); - } else if (vece == 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 == MO_8) { + in_c &= 0xff; + } else if (vece == MO_16) { + in_c &= 0xffff; + } + t_32 = tcg_constant_i32(in_c); + fns[vece](t_ptr, t_desc, t_32); } } tcg_temp_free_ptr(t_ptr); - tcg_temp_free_i32(t_desc); return; done: @@ -1247,10 +1236,9 @@ void tcg_gen_gvec_2i(uint32_t dofs, uint32_t aofs, uint32_t oprsz, if (g->fno) { tcg_gen_gvec_2_ool(dofs, aofs, oprsz, maxsz, c, g->fno); } else { - TCGv_i64 tcg_c = tcg_const_i64(c); + TCGv_i64 tcg_c = 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 = maxsz; } @@ -1744,16 +1732,14 @@ static void gen_addv_mask(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b, TCGv_i64 m) void tcg_gen_vec_add8_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b) { - TCGv_i64 m = tcg_const_i64(dup_const(MO_8, 0x80)); + TCGv_i64 m = tcg_constant_i64(dup_const(MO_8, 0x80)); gen_addv_mask(d, a, b, m); - tcg_temp_free_i64(m); } void tcg_gen_vec_add16_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b) { - TCGv_i64 m = tcg_const_i64(dup_const(MO_16, 0x8000)); + TCGv_i64 m = tcg_constant_i64(dup_const(MO_16, 0x8000)); gen_addv_mask(d, a, b, m); - tcg_temp_free_i64(m); } void tcg_gen_vec_add32_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b) @@ -1837,9 +1823,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 = tcg_const_i64(c); + TCGv_i64 tmp = tcg_constant_i64(c); tcg_gen_gvec_adds(vece, dofs, aofs, tmp, oprsz, maxsz); - tcg_temp_free_i64(tmp); } static const TCGOpcode vecop_list_sub[] = { INDEX_op_sub_vec, 0 }; @@ -1897,16 +1882,14 @@ static void gen_subv_mask(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b, TCGv_i64 m) void tcg_gen_vec_sub8_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b) { - TCGv_i64 m = tcg_const_i64(dup_const(MO_8, 0x80)); + TCGv_i64 m = tcg_constant_i64(dup_const(MO_8, 0x80)); gen_subv_mask(d, a, b, m); - tcg_temp_free_i64(m); } void tcg_gen_vec_sub16_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b) { - TCGv_i64 m = tcg_const_i64(dup_const(MO_16, 0x8000)); + TCGv_i64 m = tcg_constant_i64(dup_const(MO_16, 0x8000)); gen_subv_mask(d, a, b, m); - tcg_temp_free_i64(m); } void tcg_gen_vec_sub32_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b) @@ -2017,9 +2000,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 = tcg_const_i64(c); + TCGv_i64 tmp = tcg_constant_i64(c); tcg_gen_gvec_muls(vece, dofs, aofs, tmp, oprsz, maxsz); - tcg_temp_free_i64(tmp); } void tcg_gen_gvec_ssadd(unsigned vece, uint32_t dofs, uint32_t aofs, @@ -2076,18 +2058,16 @@ void tcg_gen_gvec_sssub(unsigned vece, uint32_t dofs, uint32_t aofs, static void tcg_gen_usadd_i32(TCGv_i32 d, TCGv_i32 a, TCGv_i32 b) { - TCGv_i32 max = tcg_const_i32(-1); + TCGv_i32 max = 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); } static void tcg_gen_usadd_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b) { - TCGv_i64 max = tcg_const_i64(-1); + TCGv_i64 max = 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); } void tcg_gen_gvec_usadd(unsigned vece, uint32_t dofs, uint32_t aofs, @@ -2120,18 +2100,16 @@ void tcg_gen_gvec_usadd(unsigned vece, uint32_t dofs, uint32_t aofs, static void tcg_gen_ussub_i32(TCGv_i32 d, TCGv_i32 a, TCGv_i32 b) { - TCGv_i32 min = tcg_const_i32(0); + TCGv_i32 min = 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); } static void tcg_gen_ussub_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b) { - TCGv_i64 min = tcg_const_i64(0); + TCGv_i64 min = 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); } void tcg_gen_gvec_ussub(unsigned vece, uint32_t dofs, uint32_t aofs, @@ -2292,16 +2270,14 @@ static void gen_negv_mask(TCGv_i64 d, TCGv_i64 b, TCGv_i64 m) void tcg_gen_vec_neg8_i64(TCGv_i64 d, TCGv_i64 b) { - TCGv_i64 m = tcg_const_i64(dup_const(MO_8, 0x80)); + TCGv_i64 m = tcg_constant_i64(dup_const(MO_8, 0x80)); gen_negv_mask(d, b, m); - tcg_temp_free_i64(m); } void tcg_gen_vec_neg16_i64(TCGv_i64 d, TCGv_i64 b) { - TCGv_i64 m = tcg_const_i64(dup_const(MO_16, 0x8000)); + TCGv_i64 m = tcg_constant_i64(dup_const(MO_16, 0x8000)); gen_negv_mask(d, b, m); - tcg_temp_free_i64(m); } void tcg_gen_vec_neg32_i64(TCGv_i64 d, TCGv_i64 b) @@ -2570,9 +2546,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 = tcg_const_i64(dup_const(vece, c)); + TCGv_i64 tmp = tcg_constant_i64(dup_const(vece, c)); tcg_gen_gvec_2s(dofs, aofs, oprsz, maxsz, tmp, &gop_ands); - tcg_temp_free_i64(tmp); } static const GVecGen2s gop_xors = { @@ -2595,9 +2570,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 = tcg_const_i64(dup_const(vece, c)); + TCGv_i64 tmp = tcg_constant_i64(dup_const(vece, c)); tcg_gen_gvec_2s(dofs, aofs, oprsz, maxsz, tmp, &gop_xors); - tcg_temp_free_i64(tmp); } static const GVecGen2s gop_ors = { @@ -2620,9 +2594,8 @@ void tcg_gen_gvec_ors(unsigned vece, uint32_t dofs, uint32_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 = tcg_const_i64(dup_const(vece, c)); + TCGv_i64 tmp = tcg_constant_i64(dup_const(vece, c)); tcg_gen_gvec_2s(dofs, aofs, oprsz, maxsz, tmp, &gop_ors); - tcg_temp_free_i64(tmp); } void tcg_gen_vec_shl8i_i64(TCGv_i64 d, TCGv_i64 a, int64_t c) @@ -3110,9 +3083,9 @@ static void tcg_gen_shlv_mod_vec(unsigned vece, TCGv_vec d, TCGv_vec a, TCGv_vec b) { TCGv_vec t = tcg_temp_new_vec_matching(d); + TCGv_vec m = tcg_constant_vec_matching(d, vece, (8 << vece) - 1); - 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); } @@ -3173,9 +3146,9 @@ static void tcg_gen_shrv_mod_vec(unsigned vece, TCGv_vec d, TCGv_vec a, TCGv_vec b) { TCGv_vec t = tcg_temp_new_vec_matching(d); + TCGv_vec m = tcg_constant_vec_matching(d, vece, (8 << vece) - 1); - 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); } @@ -3236,9 +3209,9 @@ static void tcg_gen_sarv_mod_vec(unsigned vece, TCGv_vec d, TCGv_vec a, TCGv_vec b) { TCGv_vec t = tcg_temp_new_vec_matching(d); + TCGv_vec m = tcg_constant_vec_matching(d, vece, (8 << vece) - 1); - 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); } @@ -3299,9 +3272,9 @@ static void tcg_gen_rotlv_mod_vec(unsigned vece, TCGv_vec d, TCGv_vec a, TCGv_vec b) { TCGv_vec t = tcg_temp_new_vec_matching(d); + TCGv_vec m = tcg_constant_vec_matching(d, vece, (8 << vece) - 1); - 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); } @@ -3358,9 +3331,9 @@ static void tcg_gen_rotrv_mod_vec(unsigned vece, TCGv_vec d, TCGv_vec a, TCGv_vec b) { TCGv_vec t = tcg_temp_new_vec_matching(d); + TCGv_vec m = tcg_constant_vec_matching(d, vece, (8 << vece) - 1); - 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 ad1348d811..1cadfe070c 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -1474,6 +1474,14 @@ TCGv_vec tcg_constant_vec(TCGType type, unsigned vece, int64_t val) return temp_tcgv_vec(tcg_constant_internal(type, val)); } +TCGv_vec tcg_constant_vec_matching(TCGv_vec match, unsigned vece, int64_t val) +{ + TCGTemp *t = tcgv_vec_temp(match); + + tcg_debug_assert(t->temp_allocated != 0); + return tcg_constant_vec(t->base_type, vece, val); +} + TCGv_i32 tcg_const_i32(int32_t val) { TCGv_i32 t0; From patchwork Thu Jan 14 02:16:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 362812 Delivered-To: patch@linaro.org Received: by 2002:a02:ccad:0:0:0:0:0 with SMTP id t13csp76307jap; Wed, 13 Jan 2021 18:37:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJz97hGCWz+i3pdACho5KDoq0rckx0HowiUavxox0ylEEYdTdz/nLA7nMTC7NFbXvxbkfQdV X-Received: by 2002:a25:584:: with SMTP id 126mr7515536ybf.112.1610591841888; Wed, 13 Jan 2021 18:37:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610591841; cv=none; d=google.com; s=arc-20160816; b=e1/mgDLW/YnvBgEgEXNzh9rx/cN2SJWmP7WpFRQpNDUcMP1LapOsFhIK2TCF9G1y4U 7n1YCgpG+tBKmO7BEBJrPC0W5bq8CjYDbsdJifCPQT7QwxtofLRQ5pU3Ff41S5L54S1n YyyGB5+dkhSocpQmY1IUiMVGg99HgBRW9JtAAqHD6IaaC37hFUoyn/HXUoPr2HmOikPf Ya8klmm1L8CIz6eD94OUtqtmU8XyN1YpfyCG7ygG3+SLYTy2MHmwtdEPPMhnvKBhfISw 3H/8U1tlpT3P3AP5WTeJZ52nraBiDSepE8tj16v8aq02EiqZLDvRH5KS8Sw6fr6JM6Wu j71Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=Hx+ccawlJdzu7GbQDl+NdiAx6KUHgVaeD5cM1vlFohs=; b=koGYjMAd19nriXiRD2PpyYlcuKLmbN5NmHnhuZdddAS2tEHJ//fGDV+RospBHceP5K zYacqHVpdqkGVERJ9Mu5cmj1HBNk0mUu/ECzHfjEzR8X4n1fLKvMVoykrkff8jMLLvZ3 LIRtv7GxphZ2din5n/XU5kU+Mm2TBBWT1cTCnUn1ONlR7+rlTsCrDbEtnbBCzW3/g1sT CTwKng1XfAWgaiujyny+23oUFFLbpKRNzOf9Ventxgt3phVEYWHzYZF5CZExMDJYgLRM uFQlU3GOf9MlIMQU6D+HpNycGuzL6IKhkfN8/2eGeVJ/vEGaMzIy5QHevaWUkPh/UTzi 7ioQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ioEcRVLD; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id n132si3762702yba.482.2021.01.13.18.37.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 13 Jan 2021 18:37:21 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ioEcRVLD; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:34082 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kzsVl-0001yD-Ew for patch@linaro.org; Wed, 13 Jan 2021 21:37:21 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60434) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kzsCe-0003ji-I9 for qemu-devel@nongnu.org; Wed, 13 Jan 2021 21:17:36 -0500 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]:42929) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kzsCc-0003Vk-5V for qemu-devel@nongnu.org; Wed, 13 Jan 2021 21:17:36 -0500 Received: by mail-pf1-x42f.google.com with SMTP id h10so2448690pfo.9 for ; Wed, 13 Jan 2021 18:17:27 -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=Hx+ccawlJdzu7GbQDl+NdiAx6KUHgVaeD5cM1vlFohs=; b=ioEcRVLD562KYCAuiTBp9NS1P2W/RaGzMMNHWfEEl6OUCwSCCfMZZ2hFMOrK94wB4m 0C0/xQ9SCFNtFOqrgeXQrbpUEN0HqRUab/8QPSCpr0dDXM7+9YbllFLTl8p+/nrCxVX1 uGrz4gFbr41Fd3EFbAkwWb8+ainfRwOoHqoc+BxM39X6gezp3NEaJkjyaV+nVeqtRVLt GyKbnWiLZTTmOKFOACj6FIrJdzgg+zRWnAyLEYb9VEH//HJdJDGCUNGl3kKQnW7LWtdm FS0gfXSR5uhFj/br8xkoWVZMzFSkXZmwjS1HeX8OxqvLloBXrc7QeCPSN9mnjvO//4j4 0V5w== 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=Hx+ccawlJdzu7GbQDl+NdiAx6KUHgVaeD5cM1vlFohs=; b=Y1ckNDsAptrA6avzhf7h9UWb5F5hIuO79wUfJlX+AJOGHTsRyg0mw1vo+QwJtD/ZwK 1TtLlSapNwLo/P4uJC8/2EJeS5fiY0Y2lFuMEfum17gsGvNKtN6s+vMtK5h9rRJZn5rn iGBi8bQIJpoT1keH2Z7YrNQ5Qv0yBeS7yQaa8aRKfKcmmbxWSUcB8rjajF6c3QJlgqYb 5fsTwkC5fGz8a6QApkv3ryRe5h3AeQhpvFW7gQu7wIb7A52u5YTXavKbDtyi72nFJio6 WNokC5ybKQBQfVVUxZzxVFTGg73/P7Rqhc8LGGJrYVcGBfuX+MeQRAiMWVXp8yPv5X07 RAKg== X-Gm-Message-State: AOAM530bLVMYmA1ooxAMjrV2Vatp8G5haaPlodl+s981sL4LADT+H8ec Rud34dftK7fvlDloxcu47uyI6eqNCjAqmA== X-Received: by 2002:a63:5526:: with SMTP id j38mr4995652pgb.177.1610590646706; Wed, 13 Jan 2021 18:17:26 -0800 (PST) Received: from localhost.localdomain (rrcs-173-197-107-21.west.biz.rr.com. [173.197.107.21]) by smtp.gmail.com with ESMTPSA id i7sm3771687pfc.50.2021.01.13.18.17.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jan 2021 18:17:26 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 17/24] tcg/tci: Add special tci_movi_{i32,i64} opcodes Date: Wed, 13 Jan 2021 16:16:47 -1000 Message-Id: <20210114021654.647242-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210114021654.647242-1-richard.henderson@linaro.org> References: <20210114021654.647242-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42f; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42f.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: peter.maydell@linaro.org, =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The normal movi opcodes are going away. We need something for TCI to use internally. Reviewed-by: Alex Bennée 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(-) -- 2.25.1 diff --git a/include/tcg/tcg-opc.h b/include/tcg/tcg-opc.h index 70a76646c4..43711634f6 100644 --- a/include/tcg/tcg-opc.h +++ b/include/tcg/tcg-opc.h @@ -278,6 +278,14 @@ DEF(last_generic, 0, 0, 0, TCG_OPF_NOT_PRESENT) #include "tcg-target.opc.h" #endif +#ifdef TCG_TARGET_INTERPRETER +/* These opcodes are only for use between the tci generator and interpreter. */ +DEF(tci_movi_i32, 1, 0, 1, TCG_OPF_NOT_PRESENT) +#if TCG_TARGET_REG_BITS == 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 2bcc4409be..2311aa7d3a 100644 --- a/tcg/tci.c +++ b/tcg/tci.c @@ -593,7 +593,7 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env, t1 = 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 = *tb_ptr++; t1 = tci_read_i32(&tb_ptr); tci_write_reg32(regs, t0, t1); @@ -864,7 +864,7 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env, t1 = 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 = *tb_ptr++; t1 = 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 d5a4d9d37c..e9e5f94c04 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 = s->code_ptr; uint32_t arg32 = arg; if (type == TCG_TYPE_I32 || arg == 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 == TCG_TYPE_I64); #if TCG_TARGET_REG_BITS == 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 From patchwork Thu Jan 14 02:16:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 362801 Delivered-To: patch@linaro.org Received: by 2002:a02:ccad:0:0:0:0:0 with SMTP id t13csp68915jap; Wed, 13 Jan 2021 18:25:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJwo4gQ/wGITSrKzw77rn7OPYg86p/X0C7QAzHr78eRwpMFIYl+F0Bs27yq2aspvJy+00msg X-Received: by 2002:a25:ca97:: with SMTP id a145mr7754117ybg.221.1610591117571; Wed, 13 Jan 2021 18:25:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610591117; cv=none; d=google.com; s=arc-20160816; b=0bXk3ggTBkfYYL3hjhWPmpFLDujQdHsy73X9rBozoIXFPssn1Pw7S6XjOplL2shbcL zCc9pxiZan0GWhdOU1u20MmN+NM6ayTnZA2bwiq44yjnSHTRbxixqig4JqPgKbDqheKs esKywPHAV2naGppfcFFg9R/C/FzbiaAC5beOyPp3OXm3puVUnOJmA47b70oMbJ5Iy6cu Xkz3evlTaFu6vW7hsZTQKYDFnAC6WLY1G4GkrY3jw2UGGzfnVE6vw6EFHiN7bqBpKtzx 21az7+3qcSVn+9/SbTh7Z6qeUa7kzHp/TmFGVdBXyeMF0fRVsHVHR3hJ2Xs0HwPLSdcT COxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=PUT18bxTLpzRRRoEviVs6pgnmvprIFhDnDdP6GN/+R0=; b=SeMCyAk+RZICMhI4vhs9IgGHkjE9T4ILq48wxR+KsXTqARBAhG5J1kBYZUMpahB+xF ujBDeHV2KPIr2S9L/srgwsVzHS23rW+HYXx0LROTr0icJb7tnhNXFknm4xmLzKzvimqb NzCIItmjdR1GASnYEo/ivIlAmY2RSMfXLn0jv42dQSKF0IuRF8p0bfxG2FWLT5fT5Nju Jl/8URdvonGL6zhMJfMB8bW5OAFt832BBgGO+HhK/YGeVWXYDhZzYlAvbOsE7xXYUUHa +xoImccxFbx7FMTgleKAihtp9W5/i9TzbqSsKvq0W8eCp14HYALLldnMONC5bbP7zAZs nLjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=CJ29DlFX; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id t1si3658003ybf.392.2021.01.13.18.25.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 13 Jan 2021 18:25:17 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=CJ29DlFX; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:58704 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kzsK5-0005L2-36 for patch@linaro.org; Wed, 13 Jan 2021 21:25:17 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60424) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kzsCe-0003j7-Cw for qemu-devel@nongnu.org; Wed, 13 Jan 2021 21:17:36 -0500 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]:37908) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kzsCZ-0003Vw-VE for qemu-devel@nongnu.org; Wed, 13 Jan 2021 21:17:36 -0500 Received: by mail-pj1-x1034.google.com with SMTP id j13so2363662pjz.3 for ; Wed, 13 Jan 2021 18:17:29 -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=PUT18bxTLpzRRRoEviVs6pgnmvprIFhDnDdP6GN/+R0=; b=CJ29DlFXaa8qsmnRxBgGnHRhSXs5y9ewPy876/3DmOP8gZnO0VjzmNIOCybP7ZqCDk MOBoKtv+N1NcGvgs6Bg4oA9HQOl5TyiQe3ipfhlG4UI/RqZ4xaUFIX3EF4gwaWF/WEz0 pWscH8bFTfLqiOES8a9qg11PxIrVCWBd3UKO+o6Ff83Cuetm4/3A12Hfp9zpZBJQTCOM Sdlh+8lmFfj2uNfNoHG3Vb5Z0/rEnJwfz7YuNeihyfJTMB2nCo0hk4dFC46Rr5OUCYcT sL1FEVPS5g+ZR6/RlhLtQ4SWu3xlbW9iBoILcnTyhUKD2P6HnsoVhlLb4ODQiVOZJEWl fWlQ== 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=PUT18bxTLpzRRRoEviVs6pgnmvprIFhDnDdP6GN/+R0=; b=JnQML6b2+or5kgYiDNdORhB/mOSDPdhUo3IckCgOOnkWk7kcSWzhiI2AsZEehUmjhV eU5jb7btz0s2afIx7AKJ4JfT/gtqCKRH7nZUyGRVF66ZUxLFpONnus1pDy0p5nWIrpYQ xBIbmHecs9k6GeNVTHveSfDFzyNEOXd3DViZInsCKcy1aY+1o+ME67Hlh7KwxNGWAXkW kFmaOfIWnBcWFoSOGKdtVzPjmIsajG7O/t+A+GLuHuJKZC5LhhB1Ow4HdORlevoWyCM/ 6pgG3+T9DCQs4pi0YnlE+t4vlCHeoBNpizqIxvZFXB9sAV+lDncNKKW9+L5sfCpoL756 96dw== X-Gm-Message-State: AOAM530iharnFl8DeCq0f4uI6KSomYgAsabrQzaR9JDhIxvGSjHTkIlS Rz5O1TGczsSVOCc7VWumVmQB9PNiDva+bA== X-Received: by 2002:a17:902:b213:b029:db:3a3e:d8ad with SMTP id t19-20020a170902b213b02900db3a3ed8admr5439403plr.73.1610590648612; Wed, 13 Jan 2021 18:17:28 -0800 (PST) Received: from localhost.localdomain (rrcs-173-197-107-21.west.biz.rr.com. [173.197.107.21]) by smtp.gmail.com with ESMTPSA id i7sm3771687pfc.50.2021.01.13.18.17.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jan 2021 18:17:27 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 18/24] tcg: Remove movi and dupi opcodes Date: Wed, 13 Jan 2021 16:16:48 -1000 Message-Id: <20210114021654.647242-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210114021654.647242-1-richard.henderson@linaro.org> References: <20210114021654.647242-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1034; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1034.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: peter.maydell@linaro.org, Aleksandar Markovic , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" These are now completely covered by mov from a TYPE_CONST temporary. Reviewed-by: Alex Bennée 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(-) -- 2.25.1 diff --git a/include/tcg/tcg-opc.h b/include/tcg/tcg-opc.h index 43711634f6..900984c005 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) 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)) 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 */ @@ -221,7 +219,6 @@ DEF(qemu_st8_i32, 0, TLADDR_ARGS + 1, 1, #define IMPLVEC TCG_OPF_VECTOR | IMPL(TCG_TARGET_MAYBE_vec) 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) DEF(dup_vec, 1, 1, 0, IMPLVEC) DEF(dup2_vec, 1, 2, 0, IMPLVEC | IMPL(TCG_TARGET_REG_BITS == 32)) diff --git a/tcg/optimize.c b/tcg/optimize.c index dbb03ef96b..37c902283e 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -1103,10 +1103,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; 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 1cadfe070c..5b0e42be91 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -1564,7 +1564,6 @@ bool tcg_op_supported(TCGOpcode op) return TCG_TARGET_HAS_goto_ptr; 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: @@ -1658,7 +1657,6 @@ bool tcg_op_supported(TCGOpcode op) return TCG_TARGET_REG_BITS == 32; 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: @@ -1764,7 +1762,6 @@ bool tcg_op_supported(TCGOpcode op) 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: @@ -3670,7 +3667,7 @@ static void tcg_reg_alloc_cbranch(TCGContext *s, TCGRegSet allocated_regs) } /* - * 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_life, @@ -3693,14 +3690,6 @@ static void tcg_reg_alloc_do_movi(TCGContext *s, TCGTemp *ots, } } -static void tcg_reg_alloc_movi(TCGContext *s, const TCGOp *op) -{ - TCGTemp *ots = arg_temp(op->args[0]); - tcg_target_ulong val = op->args[1]; - - tcg_reg_alloc_do_movi(s, ots, val, op->life, op->output_pref[0]); -} - /* * Specialized code generation for INDEX_op_mov_*. */ @@ -4481,11 +4470,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 be6d3ea2a8..e370b7e61c 100644 --- a/tcg/aarch64/tcg-target.c.inc +++ b/tcg/aarch64/tcg-target.c.inc @@ -2257,8 +2257,6 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, 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(); @@ -2466,7 +2464,6 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, break; 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 0fd1126454..c2b26b3c45 100644 --- a/tcg/arm/tcg-target.c.inc +++ b/tcg/arm/tcg-target.c.inc @@ -2068,7 +2068,6 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, break; 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 9f81e11773..1706b7c776 100644 --- a/tcg/i386/tcg-target.c.inc +++ b/tcg/i386/tcg-target.c.inc @@ -2666,8 +2666,6 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode 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(); @@ -2953,7 +2951,6 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, break; 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 add157f6c3..7293169ab2 100644 --- a/tcg/mips/tcg-target.c.inc +++ b/tcg/mips/tcg-target.c.inc @@ -2141,8 +2141,6 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode 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 d00ec20203..1fbb1b6db0 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -2977,8 +2977,6 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, 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(); @@ -3326,7 +3324,6 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, return; 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 c60b91ba58..71c0badc02 100644 --- a/tcg/riscv/tcg-target.c.inc +++ b/tcg/riscv/tcg-target.c.inc @@ -1563,8 +1563,6 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, 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 d7ef079055..8517e55232 100644 --- a/tcg/s390/tcg-target.c.inc +++ b/tcg/s390/tcg-target.c.inc @@ -2295,8 +2295,6 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, 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 922ae96481..28b5b6559a 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, 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 e9e5f94c04..15981265db 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, const 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(); From patchwork Thu Jan 14 02:16:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 362809 Delivered-To: patch@linaro.org Received: by 2002:a02:ccad:0:0:0:0:0 with SMTP id t13csp74042jap; Wed, 13 Jan 2021 18:33:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJztsCJqzL7llrzWnbIzG9nvsovOjwax1LyDOLDeWfT02XQOvcH0Fp6e1b3mgHREH+AqxeLe X-Received: by 2002:a25:68c4:: with SMTP id d187mr674668ybc.371.1610591612794; Wed, 13 Jan 2021 18:33:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610591612; cv=none; d=google.com; s=arc-20160816; b=osW9p6Kcp7I4zKlLV99sDDXwcdz3CZYoC8hNTpllyKyjJSFn10embL7alVGp0k9I3Z RxVOiCXkWluBoR6v0B1QNvGEsBJGDzikT8cX7ZAKkEDOh/kSYETaYD8kKDnuFQoHOtgW hQbgN4GfBIRD8DD+SGVg9T4mEIiHNpYuEwZhIrmvrcyb2J9zUt/q0hmCb4rYXqY/32U6 yFbLIR+mDFs2v3ISATUxd6RwSMVgiuRuXbuwJ1GacwfgxQyCDk2XNZ6a/k5QKZOM7Hzv HIVLcon4be5i/44QOgPdo4cpl/glVQAgnKMAOnUdEa/xRqu0hTN6XonmfuM62L7VqMp5 ngdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=rT+Iuuo6F5MmSbW+tCwYHH0uffarzjIWxAQZUPXloBE=; b=MlSO3a0cDwac08zhmZJ51aTec4PIGKa2SzSCWRnqEN4DGGD8FxWs2579ry1hdiJIDn i2L0+0VSwGenup+I0J5lmeMcmzzdq6KBc22cyMcsgCs+jfQBld5xJuPJyOtWOElXMU3k bnAqM6fmSzsfiNv0991XTcXikFSTJnilfTOidJy9kWlvQhqZcRV5lY0pbjCpPUH+khqL A6qcDLuZlIA+DMrpfRDP7zN3MiaQWO3y3k6iFIFe7vlTvmM41ZBjmXoFM/NcCTJ8np6U Ba0KvEEnzq1gAOsBvA7Dk5eZk2jSQ9I9GCNbdDO8maepsIxoGfdPOJNwIEggplw9qK+5 c+cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Y6hG41jd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id m74si4843649ybm.161.2021.01.13.18.33.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 13 Jan 2021 18:33:32 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Y6hG41jd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:51058 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kzsS4-0005gR-BF for patch@linaro.org; Wed, 13 Jan 2021 21:33:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60414) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kzsCe-0003iE-0A for qemu-devel@nongnu.org; Wed, 13 Jan 2021 21:17:36 -0500 Received: from mail-pg1-x52e.google.com ([2607:f8b0:4864:20::52e]:44813) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kzsCc-0003W5-5B for qemu-devel@nongnu.org; Wed, 13 Jan 2021 21:17:35 -0500 Received: by mail-pg1-x52e.google.com with SMTP id p18so2719673pgm.11 for ; Wed, 13 Jan 2021 18:17: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=rT+Iuuo6F5MmSbW+tCwYHH0uffarzjIWxAQZUPXloBE=; b=Y6hG41jdqPNKzMoC6o/aASUZ9GhUjfgMebpnBtllxYk0dBWH5lmjkrHCXaehtKFGi3 NBmDITjKTkHejB0u8MYEsXVOH7YqLlEwD/YrZTXebxcQUDxTqGheuWYaT7X/OL1l6Qz6 8TZGc90q1AfYR4NyiavkJD272aW+JqGtCU+bLIZ5suITPROL+q6Z2FHaYoIBn0Qr5x49 G46c74ZpykSul82qMcrLO6eCiMUx5ekqapsxgN25M8Dc8DdhXKOt9EAr5tiGir/UQ3qz fFXZKC/SeJX9bF0Dk62H5VsjF/wU+ru+//CqlEnvPhJ5S+NNkxd0Eg6rz7LRgKqan0QV t8SA== 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=rT+Iuuo6F5MmSbW+tCwYHH0uffarzjIWxAQZUPXloBE=; b=N9kgkBO7XTwOgrRlYnuN6s/nA76bIYwNl1FwtTLoKFtaa8CrNNI53TWtRkfHPS0HC9 ZDEwKfX0k6jhYVwF8awVmWRkZXxFt9HGcx5O/eS6Rr6NFbTDiyrGD5DU35z7OeT8Pp9Z W4Pl/CBNxEBPdJ/4UmA+y/EG8tk0GZ79cZQ7MzS0Mm7IBXdZ2yUtlN7ygXDxbcYiQTaB c4SIbtKlopcGQkYZnegp4WrD28S9HVP1OkYQyju+rxq+2Avjm+zFpfS+CGYyH9Z9fw1x k0nCxeTqv/DTtmmv0WPKvvJmYDePmtfPaSktMnlqEieLnj0ZbBEEIQNOFmaVV+JhodGn 8r8w== X-Gm-Message-State: AOAM530GG5/ywl0LnCbAx39v7CNjrAMUJ8gKFG92P4L3oA0HAsWIDr3I GuQpbfuE2eMolM3LFNH/ZiUFIawkFMBRcA== X-Received: by 2002:a63:5d7:: with SMTP id 206mr5118347pgf.384.1610590650093; Wed, 13 Jan 2021 18:17:30 -0800 (PST) Received: from localhost.localdomain (rrcs-173-197-107-21.west.biz.rr.com. [173.197.107.21]) by smtp.gmail.com with ESMTPSA id i7sm3771687pfc.50.2021.01.13.18.17.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jan 2021 18:17:29 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 19/24] tcg: Add tcg_reg_alloc_dup2 Date: Wed, 13 Jan 2021 16:16:49 -1000 Message-Id: <20210114021654.647242-20-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210114021654.647242-1-richard.henderson@linaro.org> References: <20210114021654.647242-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52e; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52e.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: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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(+) -- 2.25.1 diff --git a/tcg/tcg.c b/tcg/tcg.c index 5b0e42be91..8f8badb61c 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -4084,6 +4084,98 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op) } } +static bool tcg_reg_alloc_dup2(TCGContext *s, const TCGOp *op) +{ + const TCGLifeData arg_life = op->life; + TCGTemp *ots, *itsl, *itsh; + TCGType vtype = 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 == 32); + tcg_debug_assert(TCGOP_VECE(op) == MO_64); + + ots = arg_temp(op->args[0]); + itsl = arg_temp(op->args[1]); + itsh = 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 != TEMP_VAL_REG) { + TCGRegSet allocated_regs = s->reserved_regs; + TCGRegSet dup_out_regs = + 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 == TEMP_VAL_REG) { + tcg_regset_set_reg(allocated_regs, itsl->reg); + } + if (!IS_DEAD_ARG(2) && itsh->val_type == TEMP_VAL_REG) { + tcg_regset_set_reg(allocated_regs, itsh->reg); + } + + ots->reg = tcg_reg_alloc(s, dup_out_regs, allocated_regs, + op->output_pref[0], ots->indirect_base); + ots->val_type = TEMP_VAL_REG; + ots->mem_coherent = 0; + s->reg_to_temp[ots->reg] = ots; + } + + /* Promote dup2 of immediates to dupi_vec. */ + if (itsl->val_type == TEMP_VAL_CONST && itsh->val_type == TEMP_VAL_CONST) { + uint64_t val = deposit64(itsl->val, 32, 32, itsh->val); + MemOp vece = MO_64; + + if (val == dup_const(MO_8, val)) { + vece = MO_8; + } else if (val == dup_const(MO_16, val)) { + vece = MO_16; + } else if (val == dup_const(MO_32, val)) { + vece = 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 == itsh && itsl->base_type == 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 = itsh; +#else + TCGTemp *its = 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 @@ -4501,6 +4593,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 opcodes. */ tcg_debug_assert(tcg_op_supported(opc)); From patchwork Thu Jan 14 02:16:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 362806 Delivered-To: patch@linaro.org Received: by 2002:a02:ccad:0:0:0:0:0 with SMTP id t13csp71838jap; Wed, 13 Jan 2021 18:29:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJz+3tn6GlIf4vmv+FiMyU4MJMNPIaQXhLLkmaZqXs/pCCKNjFHRtPdByEiwQLFsHOdZ8z4q X-Received: by 2002:a25:d257:: with SMTP id j84mr6702068ybg.479.1610591392202; Wed, 13 Jan 2021 18:29:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610591392; cv=none; d=google.com; s=arc-20160816; b=x3hbz3i4gsyngtU1ruF0f+fJoGqdelzm8d6pTPTyUuDT0bpLyN2HS5gFCaTLnZce/N 0Kn3WmnZfeqQKMz4q+03ny6NdUXCilRrTMRxWaSKTzb+VbPHQjL1kp+KNGAqx6dBrf+u zH9P2J6Q6+IAqIz6m/hR+/2tq1/2ucyrpvB/nlbV3H2i+Ynlmg5Vp/bPe37cgSqu4xTC HDCgB96IC7SjEJ8Ols6CcUYCToTHbRJ+I/b77VS7YZAiHr8/E/zXNeNoNqPAAehB2ocG embqtLzkMk7HsSlAuhhgHFG8Q0g/5BackjZ5HI7uQgRKpNGaAixolH1lYPtnaQ6mZgWb 13FA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=n4Y1AVJg0zWvq5Giznzup81YTmaTrkJ+QjTkRk5gpqc=; b=wgdqtmVWi8F1P5Jr/hCai0/RK7qc6pfMNoUZmWRRIWEnWL7rFdizjfGCgWgnq2+z0e WNbU3bO1FQPW1UNgWwY3iZgfDvMixPZaTgPfmInVf2QD5nUQok+w4C7YPXx71TsUe65j FQNekdvXQP8xMG3ZD+d2u1oM9UHWQ8ptpOL8Y9s2qnNKcLOVSe9oLgHi9SP51liFIUu0 wlCwBc9I+aeL/KXj1RpnFz6KcshQDXUZx2gp25F/+ROD3Mpu+ZYuGO79rXy+huCTLZ6c pjWbQRafifdcDhCgjDXJMTOf7bCUgxTl3A10imDKUxPYZn9hBTQfBe5MNS56ceQyt8GF lQlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QfRBrb54; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id t8si4181789ybi.60.2021.01.13.18.29.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 13 Jan 2021 18:29:52 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QfRBrb54; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:43886 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kzsOV-0002Zg-LN for patch@linaro.org; Wed, 13 Jan 2021 21:29:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60458) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kzsCf-0003m9-B0 for qemu-devel@nongnu.org; Wed, 13 Jan 2021 21:17:37 -0500 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]:33549) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kzsCc-0003WG-5I for qemu-devel@nongnu.org; Wed, 13 Jan 2021 21:17:37 -0500 Received: by mail-pj1-x1034.google.com with SMTP id w1so3916930pjc.0 for ; Wed, 13 Jan 2021 18:17:32 -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=n4Y1AVJg0zWvq5Giznzup81YTmaTrkJ+QjTkRk5gpqc=; b=QfRBrb54j2hOKreeNYKKU3jPKY3GHyu0wileE9XG9/TMjATdl3karBYt9pS9jQdqLx /m5R98xDyhblur2LzzG6EYV8NeCdobNrkMaApW9aL8rhNah0zxrYIXRSlRHz5cSffk7i fVbyceE53SsRou6ncwQnReTMx9/h1ycVgTKkMR0hDQibpR0rmpC0UE5Yi+qd10LRMtKF p+Z5wNi6dl0NA07kNsvme4aZp827z6eWG8tU8Lmm6VVyEPiX47TY0v/GJ2N1/oXXi+CR J0QjV6tIBXVpu5Kld/28kP+WKZY91LgSzr9WM/6UCGEla8NibGTCn27TsoJ1wzrS5oqF N4rg== 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=n4Y1AVJg0zWvq5Giznzup81YTmaTrkJ+QjTkRk5gpqc=; b=b2ZeEkdp6urn+RwBSTYWoQ5r8rQ8TutOsBTOffRRl8+K5DSQ+x7a6aJ6ysjT/854Jk tZL8dC9MikQjkBiXfHg+8QJDXgmd1/nTQojrzrxVtOGvjlDI60xZsk3pSH04zmf6JwaR Nnaa9Lv2wX07Fa+jRF5YTRFD9y4HMNbQBnqIHTSH1iItmYKbjXGu26R40z4TFQd0yXX2 bclvOFJtbLD15Qnz572XbW0HzsJSnaHPLeUsf9RM+Bp7CMBvL3b/08la/F+p0pNMz34S ehFTGIdZH/q1dF/SybCOCsnXbMM3fDizLhHue55SHDC+A8CNgjybzNBcwLD9Kydv4zfF S3Ig== X-Gm-Message-State: AOAM532tj+QT5aXG2aBmgP/W9X1dUy/D6bCIo5h8aq3e/AyrlpRaLmM/ 8UhPsXkiCq2etrlDLnOMdjkCkePKksUA4g== X-Received: by 2002:a17:90a:bb83:: with SMTP id v3mr2484171pjr.28.1610590651681; Wed, 13 Jan 2021 18:17:31 -0800 (PST) Received: from localhost.localdomain (rrcs-173-197-107-21.west.biz.rr.com. [173.197.107.21]) by smtp.gmail.com with ESMTPSA id i7sm3771687pfc.50.2021.01.13.18.17.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jan 2021 18:17:31 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 20/24] tcg/i386: Use tcg_constant_vec with tcg vec expanders Date: Wed, 13 Jan 2021 16:16:50 -1000 Message-Id: <20210114021654.647242-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210114021654.647242-1-richard.henderson@linaro.org> References: <20210114021654.647242-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1034; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1034.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: peter.maydell@linaro.org, =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- tcg/i386/tcg-target.c.inc | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) -- 2.25.1 diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc index 1706b7c776..050f3cb0b1 100644 --- a/tcg/i386/tcg-target.c.inc +++ b/tcg/i386/tcg-target.c.inc @@ -3486,7 +3486,7 @@ static void expand_vec_rotv(TCGType type, unsigned vece, 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; tcg_debug_assert(vece == MO_8); @@ -3504,11 +3504,11 @@ static void expand_vec_mul(TCGType type, unsigned vece, case TCG_TYPE_V64: t1 = tcg_temp_new_vec(TCG_TYPE_V128); t2 = tcg_temp_new_vec(TCG_TYPE_V128); - tcg_gen_dup16i_vec(t2, 0); + zero = 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, @@ -3523,15 +3523,15 @@ static void expand_vec_mul(TCGType type, unsigned vece, t2 = tcg_temp_new_vec(type); t3 = tcg_temp_new_vec(type); t4 = tcg_temp_new_vec(type); - tcg_gen_dup16i_vec(t4, 0); + zero = 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); @@ -3559,7 +3559,7 @@ static bool expand_vec_cmp_noinv(TCGType type, unsigned vece, TCGv_vec v0, NEED_UMIN = 8, NEED_UMAX = 16, }; - TCGv_vec t1, t2; + TCGv_vec t1, t2, t3; uint8_t fixup; switch (cond) { @@ -3630,9 +3630,9 @@ static bool expand_vec_cmp_noinv(TCGType type, unsigned vece, TCGv_vec v0, } else if (fixup & NEED_BIAS) { t1 = tcg_temp_new_vec(type); t2 = 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 = 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 = t1; v2 = t2; cond = tcg_signed_cond(cond); From patchwork Thu Jan 14 02:16:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 362807 Delivered-To: patch@linaro.org Received: by 2002:a02:ccad:0:0:0:0:0 with SMTP id t13csp73877jap; Wed, 13 Jan 2021 18:33:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJx2AvmN/zwTZBGuJkozZdU+AfUONESvcuisTfIhu99qChxZKPKBkARZxbYGadzDMC/5rzwK X-Received: by 2002:a25:99c6:: with SMTP id q6mr7464811ybo.408.1610591592910; Wed, 13 Jan 2021 18:33:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610591592; cv=none; d=google.com; s=arc-20160816; b=ZENSF5n2Zl+9VT1TCcMfPMhJV6j7Tvj7xAZT7HgW1uqxajHxih5A1MmUZ4Awla0Hy+ Ne5QNDVdWkNarGR+ZU5ii2vuvU4vMDTR5KEK8nucXwOeAQ7NQTeBtnmXjCj+tWYP7bdE tZIsfix5u24TaQ+uGvj6eFll0NHXoxNaSObJlNd7EhmMQc4mSq704vnA0rTcDNrvholv bCDD3HuUvuy8nJi0qxEPHjJJA8SAlzPKk56QB7C83mrMzXa9Lpl4XA6V64+zWn2g6J6d IVZ56ALmupdr0CKHiKliq0ltDARpPYfCuffO5l46TXLTxpDB49DkrlYao1btEEfV1/Jn k9eQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=0x8eNDWEM7nOVHNLi9Be+OYkh0XXgSMfT6fpLIKIzjI=; b=pBK6Ymt6yZT/bVGB63JkBDdeTUzRmftvGf2jVmabDjXmubJEhjHe0CxOtueb2HX91g pCDyZhDjUPeMbu5jCTbuVWnYFGma9z4EAjydxfo9T97Fe3V7cItWO3oI+19ehpXbqm2v Um8dO/D56mVDjKoYIbD5eKaLUsCti07mtK4Qp6ZSj9SK5I/Z+NBFsi2NDpPlMxQL8wsK 7EDPX+XXdF24LGjWNZ46dnWMRTED42/EK4V+vXM9cTB2P6xsOozb36BGhflRfwE20xqU B8UaTWPG7eMkoV8/dMkIq8IXk74nKpvx3gs4gCqO7FDh222supiTKHLy9h/A4XqjgScU 3OMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jRTi7E63; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id v64si3500418ybv.307.2021.01.13.18.33.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 13 Jan 2021 18:33:12 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jRTi7E63; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:49998 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kzsRk-0005GG-DX for patch@linaro.org; Wed, 13 Jan 2021 21:33:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60468) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kzsCf-0003na-PP for qemu-devel@nongnu.org; Wed, 13 Jan 2021 21:17:37 -0500 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]:36457) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kzsCc-0003WM-Sr for qemu-devel@nongnu.org; Wed, 13 Jan 2021 21:17:37 -0500 Received: by mail-pl1-x632.google.com with SMTP id j1so2150490pld.3 for ; Wed, 13 Jan 2021 18:17:34 -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=0x8eNDWEM7nOVHNLi9Be+OYkh0XXgSMfT6fpLIKIzjI=; b=jRTi7E63sV8eOiHYjjzTxpKZp6ltG7JJ1kNrYDUu43VrfL913ONuRPey9sEJzAKgnl PkZeYmnrBEPzd4od21G7pvXCT4qjwU4apLZIr+VlkyQ3Q4Ts5RbE6okZEKc+AIU6D5KB SbOkKkhzdiIowcCJ9IWKnJre3pKcTKlNQI4Gha0LnHxw3gV03NOnLCxsQcHmHwhoeUxU cqYscZGQDi7+TLsyu6u1GJYTglffeQL2RFL2hg49iSOlqkBbRwH9bYsdodDfRHJDx9c+ gOvZTFieqiwKWEW5QcVMVzLOo6b3lBwEsUlkOhS3a0fCEmY39Bi6EXNlY0qR+38CBe72 JrjQ== 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=0x8eNDWEM7nOVHNLi9Be+OYkh0XXgSMfT6fpLIKIzjI=; b=fThCNB1qxlizKvq6guqCWLMGg0EEyUaQgqW81Lhf1xGS4uaxcwLGOVoCfLkhwKCtyv 55odApCeqVNlbahERsomrvTgYF1j+lJkg58XyklLMFWeXJVGUiVmlQnaygi4dHmZK1mq sctDCuUKM0hMhptWDwgkC4p1CHB192k/Eydmq4+JQFZsWMTVycOksthT/t6R+/XE24dj wA4xKlbqnRCjYbebCFx5e4v+lbnZmsAu8y5WH8BV/y7Ji4PQrDq8L2Dzgz9bAjaTBm6G XBhVgN0BOcuRuDBBB0a+Wl/SJDKnMGAJKc/zBRelx6T475K6XsWZEsEhhJQnwC8QsdvO qhBQ== X-Gm-Message-State: AOAM532Jki30kIa9c4zTVh0MpYVkxFw5EIRp2OxaRkT11ACleXPz366g 74K6XY247IvIYNeqxodPEP/of8K17Zus8w== X-Received: by 2002:a17:90a:df12:: with SMTP id gp18mr2448439pjb.43.1610590653364; Wed, 13 Jan 2021 18:17:33 -0800 (PST) Received: from localhost.localdomain (rrcs-173-197-107-21.west.biz.rr.com. [173.197.107.21]) by smtp.gmail.com with ESMTPSA id i7sm3771687pfc.50.2021.01.13.18.17.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jan 2021 18:17:32 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 21/24] tcg: Remove tcg_gen_dup{8,16,32,64}i_vec Date: Wed, 13 Jan 2021 16:16:51 -1000 Message-Id: <20210114021654.647242-22-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210114021654.647242-1-richard.henderson@linaro.org> References: <20210114021654.647242-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::632; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x632.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: peter.maydell@linaro.org, =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" These interfaces have been replaced by tcg_gen_dupi_vec and tcg_constant_vec. Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- include/tcg/tcg-op.h | 4 ---- tcg/tcg-op-vec.c | 20 -------------------- 2 files changed, 24 deletions(-) -- 2.25.1 diff --git a/include/tcg/tcg-op.h b/include/tcg/tcg-op.h index ed8de045e2..2cd1faf9c4 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_long); -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); } -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 = tcgv_vec_temp(r); From patchwork Thu Jan 14 02:16:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 362813 Delivered-To: patch@linaro.org Received: by 2002:a02:ccad:0:0:0:0:0 with SMTP id t13csp76397jap; Wed, 13 Jan 2021 18:37:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJyOg8njaPucgkJxdVY3HdD9Z6UTT54Bcbm4WNxMT7OCxH7Aemd6inqbokc1q8/8YfaBJBaq X-Received: by 2002:a25:d014:: with SMTP id h20mr7953161ybg.149.1610591850506; Wed, 13 Jan 2021 18:37:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610591850; cv=none; d=google.com; s=arc-20160816; b=h97fWRahddtUGYX8+3Lr+LIxJpxdFkBO2vbMtu+Q2PSe9Fhxk+BS+6t1IKqluLtSmq fBAHprmHznfggmUyXhbtUpavQFrjcEzqRAsN7U4fM7+OC6oJPsKLdVB7bKWH56Sng13w 0r4Bs2KdMu/PXIDHhYTwRG41cgFUHw+jFUOOLHW5H0EBtp+M7+517K12OzoEUg9qju9X Tny1AO3jIJ4jRBxqWhuT5CFku9ghChddADedaIQ01U2hJXBXqaN+jsqtlEb67YHNB3HX vTwDamX4V2x9wrU5S/W2zv12SkR8KZ2VuUUY7vr7dmy5lSpvIFORgind09HeDCXLirok Z9iA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=VLAvWvNnNgLaMZdiybYsc0aBns7VEvbUJaVjvegbPqs=; b=pGmkuQcpkeksg+CRLoASC7D5XhdXHXs9sZ22OEKrUrI6TZ+O9dsqA15IMTZmabVXSQ 2FWoAMvZW5OsBarR1ZRNgdt2v1rEMgk0BbXmC8DrLV90ROicEdRUDB9KF+2fC/NHIk+u yIKIl+m6r3U6m7+bCjP3g7B/Spvw/XGlTiIwdR/gI0riXtAnI1ybzDEY4e6HnqYYJDmG vLzSK3Ri3liS+y21WguLX5MhD5buOK6s2wCXB9vIk9SL4p0ByDdX+JmDz5AdOyVK1idp lduOGAV+GMc5+iDuWN+Lm2rAQHSmW/w+j2L8vlfevye/hjctV+AmUyTITRDwvv1lj5mH yltw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aYd53ngV; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 7si3805082ybe.234.2021.01.13.18.37.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 13 Jan 2021 18:37:30 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aYd53ngV; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:34218 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kzsVu-00021a-1V for patch@linaro.org; Wed, 13 Jan 2021 21:37:30 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60478) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kzsCg-0003pv-Gz for qemu-devel@nongnu.org; Wed, 13 Jan 2021 21:17:38 -0500 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]:52229) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kzsCe-0003XX-Hi for qemu-devel@nongnu.org; Wed, 13 Jan 2021 21:17:38 -0500 Received: by mail-pj1-x102e.google.com with SMTP id v1so2268169pjr.2 for ; Wed, 13 Jan 2021 18:17:36 -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=VLAvWvNnNgLaMZdiybYsc0aBns7VEvbUJaVjvegbPqs=; b=aYd53ngV6wfm5jjjG/WurHCSMJusyT+eChAvMuNuoJvsn2meXeh1Cprt44rG/xvj2h xDqbpVgJlO/4vJ8X+kV7zs1tApu/7kar4Ex03Lz+QLNtSNgDuj1aCCSaDTHGbxX8hFMJ bKtryzcpxhlyuyhgPIDxlECNEzU+75z5QYNkHkWHXaPVwGyY3rQo8eOFtqm4fGlDmP45 KO8CV3r9Wcyk32XX5DRjCHk8HkDRWKmuzxpdp31GBWt10OJ/5YXaKr/9YIFs6CzIvs8R Ds4weEcIGGDTFKsUEFaEDA47DAc59P916EuDNN3jPuaHGfv7HasgQ9hKHQhrcLDdCpIs iYJQ== 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=VLAvWvNnNgLaMZdiybYsc0aBns7VEvbUJaVjvegbPqs=; b=N/IPTxoUZG4YpH+JOmRSL5Wphr9/pkrYDDPquIcgg8nE3GJ8ffjCkbr0gyFFlgRhaW PwFO6JEaUEmbsS9YorL+BL4TbLP7hluEAjAGo6ZVu99ZKOSvoaqAHCg/v7bd5dTyOEoP NV/dpXM/6CAwzatFFSpuyHS9n2HA67r4Jq6vRDdKjYRejlzjRTAq7Yc7lqdLj7zl7RPw RFovJOSfW6kXnLd37F6FCjG6ctiYcLcE3Z9gL5cZ0G/mp7c5Q5ifYwAxqJ1Oe/Lx3BGc ypntdOjmxY5ezBd/wg6fSqDXP2TWpI4S2/Wh4kENUVte3FfsXmxamkme7H8Er4uXMmHM FNHw== X-Gm-Message-State: AOAM531ZolYJQbfauAnfQ3FEspBoro4aEutAelitGzj1cxVvubHnCr64 x00zmFqovCL/uBsBQ9PJuF8zOznHo5YAlQ== X-Received: by 2002:a17:90a:528b:: with SMTP id w11mr2428672pjh.73.1610590655007; Wed, 13 Jan 2021 18:17:35 -0800 (PST) Received: from localhost.localdomain (rrcs-173-197-107-21.west.biz.rr.com. [173.197.107.21]) by smtp.gmail.com with ESMTPSA id i7sm3771687pfc.50.2021.01.13.18.17.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jan 2021 18:17:34 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 22/24] tcg/ppc: Use tcg_constant_vec with tcg vec expanders Date: Wed, 13 Jan 2021 16:16:52 -1000 Message-Id: <20210114021654.647242-23-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210114021654.647242-1-richard.henderson@linaro.org> References: <20210114021654.647242-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102e; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102e.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: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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(-) -- 2.25.1 diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index 1fbb1b6db0..cf64892295 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -3336,13 +3336,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 = tcg_temp_new_vec(type); + TCGv_vec t1; - /* Splat w/bytes for xxspltib. */ - tcg_gen_dupi_vec(MO_8, t1, imm & ((8 << vece) - 1)); + if (vece == MO_32) { + /* + * Only 5 bits are significant, and VSPLTISB can represent -16..15. + * So using negative numbers gets us the 4th bit easily. + */ + imm = sextract32(imm, 0, 5); + } else { + imm &= (8 << vece) - 1; + } + + /* Splat w/bytes for xxspltib when 2.07 allows MO_64. */ + t1 = 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); } static void expand_vec_cmp(TCGType type, unsigned vece, TCGv_vec v0, @@ -3400,7 +3409,7 @@ static void expand_vec_mul(TCGType type, unsigned vece, TCGv_vec v0, { TCGv_vec t1 = tcg_temp_new_vec(type); TCGv_vec t2 = tcg_temp_new_vec(type); - TCGv_vec t3, t4; + TCGv_vec c0, c16; switch (vece) { case MO_8: @@ -3419,21 +3428,22 @@ static void expand_vec_mul(TCGType type, unsigned vece, TCGv_vec v0, case MO_32: tcg_debug_assert(!have_isa_2_07); - t3 = tcg_temp_new_vec(type); - t4 = 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 = tcg_constant_vec(type, MO_8, -16); + c0 = 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; default: From patchwork Thu Jan 14 02:16:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 362798 Delivered-To: patch@linaro.org Received: by 2002:a02:ccad:0:0:0:0:0 with SMTP id t13csp68095jap; Wed, 13 Jan 2021 18:23:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJzFS0yGjGe0C3lV6ZQTrFZlgnfpozKwhVkStXwo9iPcFTVT37zAMxWFKqt4Mp50zg6693Og X-Received: by 2002:a25:1182:: with SMTP id 124mr7239133ybr.154.1610591033079; Wed, 13 Jan 2021 18:23:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610591033; cv=none; d=google.com; s=arc-20160816; b=WISrcBM2qaK/whVCtS4062M2fc7IwModoWSkY1V4M+MkLk2o2S5x6OEoWM9a9eXTsA E7QpfNdkQX6NsxWAeEY+YDwiqzCvfoPrr7Ge8skLvll67O9gWm38iBOrt6sLzAaalE3L R9/lB2mmufElqsMj2cJNTbHyESVf3JvZxbWkZw/THUt8LIY4Z29AELerpA4PYuEgRSzP nUW4uheN+UOiknpfEFeDE32YEm89jPugmG11B5jCNkMJrY1No6wfje/c/Gxb87y1H+xe 6QWlhaMjrFojDIrlD02EUj/d3+V6JSluKMESs8+l8vcUylNNrZ10LNChZiFTFSUAPsb9 0ZRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=iIaMM78IeHTe5CD2a93HOKAFcWJMpXbVz88KGEPcLL4=; b=iAjeHgWyIyn0u7IdD1yAIpDY12y5rCBhu/N3NCYu8R9Z3kpjg/Ta6jritPI2dezXjf IIhR/4Q4TsGE2CNSMLX7grlm0AaTQvj+yll99DRT/UcfqGlvvsvGSAcZcLwDZd312itg aUogdxrGI7/RTApZWXrk9WqqgMkmrRDTM4QtRmPdDvyUWfPhuKbOwhajgifayY28JL/o yFhVHsqZA1oQLs5NFB2KpCw9hFkP/R6JhHZfHgnLJk00Z1Kn90WZcI2GYAXFxE29Gcwl 2LFSqwRMWK8FiqO8IRjOCHtl0r6/Z5lt+cccJks2i6XUIomEvF6Ai+hfa4zSTkljE8II AoEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=k3u5wUwC; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u12si3565732ybj.345.2021.01.13.18.23.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 13 Jan 2021 18:23:53 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=k3u5wUwC; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:54164 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kzsIi-0003Ta-ID for patch@linaro.org; Wed, 13 Jan 2021 21:23:52 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60498) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kzsCh-0003rp-Mo for qemu-devel@nongnu.org; Wed, 13 Jan 2021 21:17:39 -0500 Received: from mail-pg1-x529.google.com ([2607:f8b0:4864:20::529]:36920) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kzsCg-0003YA-2o for qemu-devel@nongnu.org; Wed, 13 Jan 2021 21:17:39 -0500 Received: by mail-pg1-x529.google.com with SMTP id z21so2747968pgj.4 for ; Wed, 13 Jan 2021 18:17: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=iIaMM78IeHTe5CD2a93HOKAFcWJMpXbVz88KGEPcLL4=; b=k3u5wUwCwjOPW7JGYT/DFyEanMUvjUKXyKbbIp74A+rMV3WP1d7gKHWPGiBOBIPFEU 2Ji5c9EddqF5CPSkC8+6YxmsEO/vNrVgyqHCweVoxcy6JFzwlF0FoCvdAywVtJO1Haxr 7I9HvvdIW0LPovd/obTQTEE6aWh19BTsv5v8OsiDtFEIUuLgS5Bpyta74Lm1u8ZAUNjv 0b3tYmf0+x/J3ZxHhTNgeRuy9bonoW1FPJqeApyMLcCb+ZBINPIUmvpyHCsfNyJA0r2K mydg/IkbOYAyxoHYKKWXBiWrCC84lVn81foA31ZoEtGRuQGWlrRiZkGvGV1y1jQrkiVa 7rPA== 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=iIaMM78IeHTe5CD2a93HOKAFcWJMpXbVz88KGEPcLL4=; b=VhbyEunf8gniT1/JbO5z5mU04gBatSqzS+gbuLwMjswQObW8We+DvW+lnjbDeHYdkA zRAYHIjxYY2P7oAI510tQaDr7ax+3OPO7Ltd1x3vJ0/uTQmceGdWF6fJX4F3S2rnm6x7 VW2Tyzat7pffhMCBQOEDVej9KYRe7AJxjx10DR1mITPV5NIMUFOCmPo5mxr3GD2SrFYO c8LhB2AdU0uesL6WqFZpWPkgvZrKqc23bNol5EPHvN7SBdzu+U9aVb3IhrIgV7lN0rkg 6n6r/oIdO5LfTzWvB4DzsJ/Pm5DlYj4jbqwslQ+buJVR/WUb9mbrRNQpoXdePNRcqwnK 2SqQ== X-Gm-Message-State: AOAM531Et2AqA9J+2sEKsCQLZenEOeVxxM6ZVi3NQl/tN01qXCwnROtu YUSOYerA0X9CojJuydmaowT92NvCkI32GA== X-Received: by 2002:a62:5a86:0:b029:1ae:6b45:b6a9 with SMTP id o128-20020a625a860000b02901ae6b45b6a9mr5041478pfb.7.1610590656490; Wed, 13 Jan 2021 18:17:36 -0800 (PST) Received: from localhost.localdomain (rrcs-173-197-107-21.west.biz.rr.com. [173.197.107.21]) by smtp.gmail.com with ESMTPSA id i7sm3771687pfc.50.2021.01.13.18.17.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jan 2021 18:17:35 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 23/24] tcg/aarch64: Use tcg_constant_vec with tcg vec expanders Date: Wed, 13 Jan 2021 16:16:53 -1000 Message-Id: <20210114021654.647242-24-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210114021654.647242-1-richard.henderson@linaro.org> References: <20210114021654.647242-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::529; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x529.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: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Improve rotrv_vec to reduce "t1 = -v2, t2 = t1 + c" to "t1 = -v2, t2 = 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(-) -- 2.25.1 diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc index e370b7e61c..23954ec7cf 100644 --- a/tcg/aarch64/tcg-target.c.inc +++ b/tcg/aarch64/tcg-target.c.inc @@ -2516,7 +2516,7 @@ void tcg_expand_vec_op(TCGOpcode opc, TCGType type, unsigned vece, TCGArg a0, ...) { va_list va; - TCGv_vec v0, v1, v2, t1, t2; + TCGv_vec v0, v1, v2, t1, t2, c1; TCGArg a2; va_start(va, a0); @@ -2548,8 +2548,8 @@ void tcg_expand_vec_op(TCGOpcode opc, TCGType type, unsigned vece, case INDEX_op_rotlv_vec: t1 = tcg_temp_new_vec(type); - tcg_gen_dupi_vec(vece, t1, 8 << vece); - tcg_gen_sub_vec(vece, t1, v2, t1); + c1 = 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)); @@ -2562,9 +2562,9 @@ void tcg_expand_vec_op(TCGOpcode opc, TCGType type, unsigned vece, case INDEX_op_rotrv_vec: t1 = tcg_temp_new_vec(type); t2 = tcg_temp_new_vec(type); + c1 = 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)); From patchwork Thu Jan 14 02:16:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 362811 Delivered-To: patch@linaro.org Received: by 2002:a02:ccad:0:0:0:0:0 with SMTP id t13csp75457jap; Wed, 13 Jan 2021 18:35:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJwFQEk/afyzcn2LBxVam7JRtsFPAkr+n2BJJFVKldyqYYAMjn/Y4HsZ++E47Vg4OXCzfl2R X-Received: by 2002:a25:c095:: with SMTP id c143mr7388853ybf.119.1610591757665; Wed, 13 Jan 2021 18:35:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610591757; cv=none; d=google.com; s=arc-20160816; b=rzx2Tlhrggow9sToq6Ae7pktG5jbJsqVPpGTvQfIFq+lrfLgkpEYwJLKjw1h7zgH5t YxRrAKr8cjIvep3QyUG9iDibiA8RiQHYHO2d8cZf5outf6KKCD9AlLrXqanX6oj4yrjo NQykZQkufV7aJtgH1ghpggx+P3Ih722xYwUm+XBaSQG26r7WTuzqS30u6c3Fd8f69Zia EV7VuyUn1pOqrqED+9HE9lTZHJkBTIsznLMEeSUwkGRtK9VzVYtc3mHduPJ2kcojzH0r RzZPmQ84J5iNGAzU2gZBfS2LS/2awSBiC+NOdUYJ/wwhXS4O7AJLxHDVWTX9eyaqoNrT mdgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=BFho4U3fob4m3gWpchyMGBLbmRuOR0wIULlt2gnx2gA=; b=GGCn+0LeaoEZGJnT7lTYTmm91kBgdt8qgOo7B1Cthq+UJ/hDYlnP4nkVcUwumL0til sxGgiXKhJfmGHPfppLZPp0isGe2zA8oVR6Tv2coxe8/zwJhiCBtEwRuT97mgjZk2pIGH EVWKjl8VvV3DCrlSxbGUCdpDGweUA+5MLXyNJOdn/yyOEQrhLzKtQ8A8DnX3axIrMZH9 gf50BZvoIcxeL+chx8j6mOy/ppcZGGm0CAxbvl1lGT+1MuL0C4KrUOnBwrQ+yH/WglVZ hg/sElNKvmykaeuY2nlZeH7E6uZ4qPrZiWEc0UsPOJmNzoEEtl6HbY2ifggpq/M9gP8L FFxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=P8AsBAjC; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d14si2556147ybj.19.2021.01.13.18.35.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 13 Jan 2021 18:35:57 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=P8AsBAjC; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:58578 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kzsUP-0000Ov-4c for patch@linaro.org; Wed, 13 Jan 2021 21:35:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60520) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kzsCn-0003ve-Sj for qemu-devel@nongnu.org; Wed, 13 Jan 2021 21:17:45 -0500 Received: from mail-pg1-x52a.google.com ([2607:f8b0:4864:20::52a]:36921) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kzsCh-0003Yu-Sh for qemu-devel@nongnu.org; Wed, 13 Jan 2021 21:17:45 -0500 Received: by mail-pg1-x52a.google.com with SMTP id z21so2748006pgj.4 for ; Wed, 13 Jan 2021 18:17: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=BFho4U3fob4m3gWpchyMGBLbmRuOR0wIULlt2gnx2gA=; b=P8AsBAjCe1GbV/I2MyFKU+agoFuPCHOPymRwWQTXv2nvPqpqL9GU5Pcc35iufRjyGH 1Kirl1N2o9muhkqmfR9GPr9e2n1bfx2M8e7vigBCTScsOGs7GdsqQhBAkW8dGlgun8HG 1hygl/1M3Osn9roA64CdeurAdfay9+h2ousHY1Y4dsE7tPdOE2996gQyuJDiUCKjr/NX qabzgdu11LZG4RlWYimXkHS+R155yMGpf8Qq2J6mkfKVTmzQOABoDhKPkDvOVrpQ+gzy RCjScl1lgifWQCbFPOuwjXVpU/pbufYJKtCgbrauIQxUqbujRLjzDNm9iDtteicPxmaO RmoA== 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=BFho4U3fob4m3gWpchyMGBLbmRuOR0wIULlt2gnx2gA=; b=DeMwNja62hDFRYsZx13SLJgF50e1lq0oiLUsMXZRlDZ4H4aGsFouOBG3JkR6xCca1l qD5r/H4l/fHlo24jyP4gdeID31Asrjmq2SIDTlakRyDuJvxbFOdB2zWPnq/TPEYL+RUz AJ4p8ujmKLtRN6OYJa3ueaNqnjVLu2IcgqAZvVUQjNJvlHj9I4EXuw01zLdbWbY2bI1P Em4GC2Ng9SXcbZDAgqQWidSu7fuswub0qh37b0sRWzDP3pBvLUdpi9EJ+bopsqDjz0q8 6h5tsSov5WCFBTrZjMgn0e2rObck7PaBGxQilSZobFpzMayR0S/vg/u0RjInAFKH4PLf ehiA== X-Gm-Message-State: AOAM530tZ9+4Pea6s5ghiQeSnyOBzxOhD4cgAbD6PA1ssJkvTyiCC1Tv tbOYUeHA+2gxMJ3nPN+gbe2Tdg7IdwPObQ== X-Received: by 2002:a65:4347:: with SMTP id k7mr5024198pgq.186.1610590658332; Wed, 13 Jan 2021 18:17:38 -0800 (PST) Received: from localhost.localdomain (rrcs-173-197-107-21.west.biz.rr.com. [173.197.107.21]) by smtp.gmail.com with ESMTPSA id i7sm3771687pfc.50.2021.01.13.18.17.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jan 2021 18:17:37 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 24/24] decodetree: Open files with encoding='utf-8' Date: Wed, 13 Jan 2021 16:16:54 -1000 Message-Id: <20210114021654.647242-25-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210114021654.647242-1-richard.henderson@linaro.org> References: <20210114021654.647242-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52a; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52a.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: peter.maydell@linaro.org, Yonggang Luo , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Eduardo Habkost Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé When decodetree.py was added in commit 568ae7efae7, QEMU was using Python 2 which happily reads UTF-8 files in text mode. Python 3 requires either UTF-8 locale or an explicit encoding passed to open(). Now that Python 3 is required, explicit UTF-8 encoding for decodetree source files. To avoid further problems with the user locale, also explicit UTF-8 encoding for the generated C files. Explicit both input/output are plain text by using the 't' mode. This fixes: $ /usr/bin/python3 scripts/decodetree.py test.decode Traceback (most recent call last): File "scripts/decodetree.py", line 1397, in main() File "scripts/decodetree.py", line 1308, in main parse_file(f, toppat) File "scripts/decodetree.py", line 994, in parse_file for line in f: File "/usr/lib/python3.6/encodings/ascii.py", line 26, in decode return codecs.ascii_decode(input, self.errors)[0] UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 80: ordinal not in range(128) Reported-by: Peter Maydell Suggested-by: Yonggang Luo Reviewed-by: Eduardo Habkost Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20210110000240.761122-1-f4bug@amsat.org> Signed-off-by: Richard Henderson --- scripts/decodetree.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) -- 2.25.1 diff --git a/scripts/decodetree.py b/scripts/decodetree.py index 47aa9caf6d..4637b633e7 100644 --- a/scripts/decodetree.py +++ b/scripts/decodetree.py @@ -20,6 +20,7 @@ # See the syntax and semantics in docs/devel/decodetree.rst. # +import io import os import re import sys @@ -1304,7 +1305,7 @@ def main(): for filename in args: input_file = filename - f = open(filename, 'r') + f = open(filename, 'rt', encoding='utf-8') parse_file(f, toppat) f.close() @@ -1324,9 +1325,11 @@ def main(): prop_size(stree) if output_file: - output_fd = open(output_file, 'w') + output_fd = open(output_file, 'wt', encoding='utf-8') else: - output_fd = sys.stdout + output_fd = io.TextIOWrapper(sys.stdout.buffer, + encoding=sys.stdout.encoding, + errors="ignore") output_autogen() for n in sorted(arguments.keys()):