From nobody Fri Dec 19 17:42:06 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1608248079; cv=none; d=zohomail.com; s=zohoarc; b=jgHYLSG6hY6ljytG39jRvtLtZqyvhbYuMntH+UYZaVlr4Rlf2JLzCTHrICfuUpd7/sBeGKLMVEzvvxq7Acrl016JCIvZk70+RAMBiEumxB5ZCveHT7pympIwfNUZB+0RObLfbv9JlTrvMv62B94jgHUqfvsTcO0vLyrpqzSD1BI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608248079; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=KysIP4SxxPHUzbaJQ7kkTPCy9I7LKQnOtelCJefhblY=; b=USdQec/hLpc5gKU/KmkZePE9d+AlDrAJI2F3zxgrI9WH2R4+YrECgNgLZagoVDrHYPGESoZ8CWBJkrvxJlDef/N6NVVCq6+NzfEYhtGhEIdhcE+GWhtPooFWNe9JBEhPk39W2kwi0mrhEzt7g+/xwod2PB1rIrlKf40Yj7JLlp8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1608248079974328.3012252685995; Thu, 17 Dec 2020 15:34:39 -0800 (PST) Received: from localhost ([::1]:51936 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpv4q-00051i-Kr for importer@patchew.org; Thu, 17 Dec 2020 10:20:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33262) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpudx-0003Pa-S5 for qemu-devel@nongnu.org; Thu, 17 Dec 2020 09:52:37 -0500 Received: from mail-oo1-xc31.google.com ([2607:f8b0:4864:20::c31]:42133) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kpudn-0004uS-VD for qemu-devel@nongnu.org; Thu, 17 Dec 2020 09:52:37 -0500 Received: by mail-oo1-xc31.google.com with SMTP id x203so6868878ooa.9 for ; Thu, 17 Dec 2020 06:52:26 -0800 (PST) Received: from localhost.localdomain (fixed-187-189-51-144.totalplay.net. [187.189.51.144]) by smtp.gmail.com with ESMTPSA id x130sm1136342oif.3.2020.12.17.06.52.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Dec 2020 06:52:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=KysIP4SxxPHUzbaJQ7kkTPCy9I7LKQnOtelCJefhblY=; b=yIKD49JAu+6AueDqQFIaf02ddPzsHKJ54J+oQYJJYI7EAB875UO8mMJvzJNmDFCcVS +abi1Nu9XI+QU/MzII5299JymmjCEgNKuzEoYq3jpfzcRhsq3/F67dYjh4U8agAtcn7W zdENWOTlSi0ES2jfGah5rTbJfy9U/RnVJFuZYBcT3U/0x3FxrViAeopQAnHKxvuU3afc Z2irNilExahD2gecsuMaGa6KFvUBjVsiLXhg3yeLwQS52iE5U2J1dS3aaWV+c+BX8PJ6 mEY8ES8Lg0yY8jaAaHrwBnBChDwe7YDmpGRYo6pXngsccDzyOf3+FNMt5jNabt9c24Zd ojCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KysIP4SxxPHUzbaJQ7kkTPCy9I7LKQnOtelCJefhblY=; b=ROD/J04/nXaTiqokTwnGdkGF/uUz9wa8iXH0j0lPSjCvo0QjBhQkeQBgZeQRFDRp0X z5DpGOD9UgNnSnOTxhG6ydigBejaGRcIV8nuMuyTOURuNfHMWqCsMilRqwdkSFQCEfCA cnimqCN+xsPM1/CrgNgwJXMPmcAn69/3I7fWW3vXov0BxDzCTRdeoExF4MOTkTkAi9AH XPJO/zvYKcEE5ljwhRN9a3dS1uON5v3GLxeMH7wVHVfUyeglt5avaKSPt+lMWj8E/dLi 5QN0co5j8/K/YN+ekS0yPvZR1J78N2F4kSlsfDK8RQug+0DBPqpIHwmLPgqkXMom7Uph 1xXQ== X-Gm-Message-State: AOAM531YZb3JTHcItKCIjwvVyw1HAIyqE1e3scjB93PF0ocSoOWddVS5 zldApR2xDIN3KW+oKqoH8mQ+GLoks+O6nXlM X-Google-Smtp-Source: ABdhPJx7cw/RRdbNjjHgIsxZqMN1CB4FuLYzb1Sv9s+rE5t1Uz4ySEXN8gkAZiAfU36HgItADfbuWg== X-Received: by 2002:a4a:6c45:: with SMTP id u5mr13203208oof.61.1608216745352; Thu, 17 Dec 2020 06:52:25 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 07/23] tcg: Expand TempOptInfo to 64-bits Date: Thu, 17 Dec 2020 08:51:59 -0600 Message-Id: <20201217145215.534637-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201217145215.534637-1-richard.henderson@linaro.org> References: <20201217145215.534637-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::c31; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc31.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" This propagates the extended value of TCGTemp.val that we did before. In addition, it will be required for vector constants. Signed-off-by: Richard Henderson --- tcg/optimize.c | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index 81faf7cf10..33d1fc8f87 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -39,8 +39,8 @@ typedef struct TempOptInfo { bool is_const; TCGTemp *prev_copy; TCGTemp *next_copy; - tcg_target_ulong val; - tcg_target_ulong mask; + uint64_t val; + uint64_t mask; } TempOptInfo; =20 static inline TempOptInfo *ts_info(TCGTemp *ts) @@ -166,11 +166,11 @@ static bool args_are_copies(TCGArg arg1, TCGArg arg2) return ts_are_copies(arg_temp(arg1), arg_temp(arg2)); } =20 -static void tcg_opt_gen_movi(TCGContext *s, TCGOp *op, TCGArg dst, TCGArg = val) +static void tcg_opt_gen_movi(TCGContext *s, TCGOp *op, TCGArg dst, uint64_= t val) { const TCGOpDef *def; TCGOpcode new_op; - tcg_target_ulong mask; + uint64_t mask; TempOptInfo *di =3D arg_info(dst); =20 def =3D &tcg_op_defs[op->opc]; @@ -204,7 +204,7 @@ static void tcg_opt_gen_mov(TCGContext *s, TCGOp *op, T= CGArg dst, TCGArg src) const TCGOpDef *def; TempOptInfo *di; TempOptInfo *si; - tcg_target_ulong mask; + uint64_t mask; TCGOpcode new_op; =20 if (ts_are_copies(dst_ts, src_ts)) { @@ -247,7 +247,7 @@ static void tcg_opt_gen_mov(TCGContext *s, TCGOp *op, T= CGArg dst, TCGArg src) } } =20 -static TCGArg do_constant_folding_2(TCGOpcode op, TCGArg x, TCGArg y) +static uint64_t do_constant_folding_2(TCGOpcode op, uint64_t x, uint64_t y) { uint64_t l64, h64; =20 @@ -410,10 +410,10 @@ static TCGArg do_constant_folding_2(TCGOpcode op, TCG= Arg x, TCGArg y) } } =20 -static TCGArg do_constant_folding(TCGOpcode op, TCGArg x, TCGArg y) +static uint64_t do_constant_folding(TCGOpcode op, uint64_t x, uint64_t y) { const TCGOpDef *def =3D &tcg_op_defs[op]; - TCGArg res =3D do_constant_folding_2(op, x, y); + uint64_t res =3D do_constant_folding_2(op, x, y); if (!(def->flags & TCG_OPF_64BIT)) { res =3D (int32_t)res; } @@ -501,8 +501,9 @@ static bool do_constant_folding_cond_eq(TCGCond c) static TCGArg do_constant_folding_cond(TCGOpcode op, TCGArg x, TCGArg y, TCGCond c) { - tcg_target_ulong xv =3D arg_info(x)->val; - tcg_target_ulong yv =3D arg_info(y)->val; + uint64_t xv =3D arg_info(x)->val; + uint64_t yv =3D arg_info(y)->val; + if (arg_is_const(x) && arg_is_const(y)) { const TCGOpDef *def =3D &tcg_op_defs[op]; tcg_debug_assert(!(def->flags & TCG_OPF_VECTOR)); @@ -613,9 +614,8 @@ void tcg_optimize(TCGContext *s) infos =3D tcg_malloc(sizeof(TempOptInfo) * nb_temps); =20 QTAILQ_FOREACH_SAFE(op, &s->ops, link, op_next) { - tcg_target_ulong mask, partmask, affected; + uint64_t mask, partmask, affected, tmp; int nb_oargs, nb_iargs, i; - TCGArg tmp; TCGOpcode opc =3D op->opc; const TCGOpDef *def =3D &tcg_op_defs[opc]; =20 @@ -1221,14 +1221,15 @@ void tcg_optimize(TCGContext *s) =20 CASE_OP_32_64(extract2): if (arg_is_const(op->args[1]) && arg_is_const(op->args[2])) { - TCGArg v1 =3D arg_info(op->args[1])->val; - TCGArg v2 =3D arg_info(op->args[2])->val; + uint64_t v1 =3D arg_info(op->args[1])->val; + uint64_t v2 =3D arg_info(op->args[2])->val; + int shr =3D op->args[3]; =20 if (opc =3D=3D INDEX_op_extract2_i64) { - tmp =3D (v1 >> op->args[3]) | (v2 << (64 - op->args[3]= )); + tmp =3D (v1 >> shr) | (v2 << (64 - shr)); } else { - tmp =3D (int32_t)(((uint32_t)v1 >> op->args[3]) | - ((uint32_t)v2 << (32 - op->args[3]))); + tmp =3D (int32_t)(((uint32_t)v1 >> shr) | + ((uint32_t)v2 << (32 - shr))); } tcg_opt_gen_movi(s, op, op->args[0], tmp); break; @@ -1267,9 +1268,10 @@ void tcg_optimize(TCGContext *s) break; } if (arg_is_const(op->args[3]) && arg_is_const(op->args[4])) { - tcg_target_ulong tv =3D arg_info(op->args[3])->val; - tcg_target_ulong fv =3D arg_info(op->args[4])->val; + uint64_t tv =3D arg_info(op->args[3])->val; + uint64_t fv =3D arg_info(op->args[4])->val; TCGCond cond =3D op->args[5]; + if (fv =3D=3D 1 && tv =3D=3D 0) { cond =3D tcg_invert_cond(cond); } else if (!(tv =3D=3D 1 && fv =3D=3D 0)) { --=20 2.25.1