From patchwork Thu Dec 17 14:51:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 344954 Delivered-To: patch@linaro.org Received: by 2002:a17:906:4755:0:0:0:0 with SMTP id j21csp1310567ejs; Thu, 17 Dec 2020 07:20:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJyvoy7RdhywgE7vaJvlUu1R3eMieaKg9QtPIfoatxZMWizf/qYXWfe5uNC9D59haEM3QeZq X-Received: by 2002:a25:d788:: with SMTP id o130mr59375968ybg.245.1608218400773; Thu, 17 Dec 2020 07:20:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608218400; cv=none; d=google.com; s=arc-20160816; b=qzRl6PITGJJ0cIHjgDqlzi3qugm1WKWqAi54KFj+ICMzsFthCWOKnCDqsDTAm0RiuP 4dePNb+Ijppd8FfRN33KO05FEj4Y3naNy2ObJjOIBkGXmp3+KQ7lCC5uMZEpusLHOX0J /c9dmdkD68oB0eJadWDMdUPpEyaoTiztSx+2fQf7B4DDbkUv27rtR8CBFaTvaIs8aru4 V2rTC2sj5CiFwkKi3ypC13cAOz42W322TawF6hNuEdJAU1x2x4ucKFLsi1NpwW39kuOA 9F8zHWpI4vHmG28qhv2PWRKM7K1o9KhSQuE8mz5VXB/P5dhSMDog+1cvRba0bka/1Ex8 NUmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=KysIP4SxxPHUzbaJQ7kkTPCy9I7LKQnOtelCJefhblY=; b=SKL5fmMTz6ATtmfzOEneg4a6NbN+GJLDCFRn3cvRM354183M9OxvmJkAIvm7nFj9ZZ 3g7wGJng9OtB6HL0ZcHmDHWmlVTtUlIZzyxZIB0AnxAMYT8dOfNXs1AH4ZaVW9QKm4cb WU49PQFNQNRV+EkEGoXTZN+7OPSIeY+Ai4Y+kl+DC3+FbFLQiY9vahYPpV0Na0Lbp5ol k5CpJ2MnAohs98sMTe205JzrxxfEWrIQ1TAWrnG1KRW535M9R7fZOAllpNuZXxu149dM 2Hu8WsdydabvRxlfsPHU5zTFfcf3VhdOsSuxf40YE1OPDQbqyMP60BSN+27WQ1ABBiLT TeQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yIKD49JA; 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 p71si4888252ybg.346.2020.12.17.07.20.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 17 Dec 2020 07:20:00 -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=yIKD49JA; 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]:49072 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpv4S-0003qH-3Y for patch@linaro.org; Thu, 17 Dec 2020 10:20:00 -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) 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-Received: by 2002:a4a:6c45:: with SMTP id u5mr13203208oof.61.1608216745352; Thu, 17 Dec 2020 06:52:25 -0800 (PST) Received: from localhost.localdomain (fixed-187-189-51-144.totalplay.net. [187.189.51.144]) by smtp.gmail.com with ESMTPSA id x130sm1136342oif.3.2020.12.17.06.52.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Dec 2020 06:52:24 -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 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+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 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; 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]; @@ -1221,14 +1221,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; @@ -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 = 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)) {