From patchwork Wed Sep 9 00:16:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 249414 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp5017576ilg; Tue, 8 Sep 2020 17:27:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzY2DwFhgCmbxpEaNZrdxOI2wwZT9ZFQ51kBV/OiZvXIu7QSMCfci3TQXvkX4F36Fpe2ah0 X-Received: by 2002:a05:6902:725:: with SMTP id l5mr2102851ybt.430.1599611229792; Tue, 08 Sep 2020 17:27:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599611229; cv=none; d=google.com; s=arc-20160816; b=I3TgEUxESmoO1R9o9RckUPuJiuiVLZF3DGfUvU9xuw7cMEvog5VVcUlcZrjpl0QHsj 6HBP0lYxsRzt33KwMhoxntTMP5+ZB0ZdC+PtVWfXeyMfmPiwOHCGB6Ask0pHdmzMuNMT ngcVgoNCHfceVxYSfYPbxGGujo9Wn5fAgyqbmw2VWkOeLkxD8O2ufBfhluxyB0Ua14Og LG+TM5iAxHJZXX09PQDpAaj+Bz83x7wq6TdJ2RcAxfUIlu4mH/FjbQVn/RjMDZvB29fA nFPMJTepfwLE13AvMxgdtPBc5Y0/zDPAlgnw0YL99OHn02McigK5ad6KfR+OnHULDNf1 f0pQ== 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=yZJX2be36C9JPLv2HEqoUWBv7WbNXBR9XUMuMZnoxf7vxsdir/S1NxbTrMDkxKNpq7 X4G4dgJXOdCnsGg4YcAOE225Z8K7eXcOuna5FSJNjnuMWgKMzPlZ3C7pcGOWEr4Ktpao mlQ+bgUmK2G6zft/XfhP8jBiIgQ07s4D6FXpF32rsnEeBhslIAeTPybIeSaJMvwdKxM8 ZBtHDt1cjYmDgEIHhwgCDtSJN63OyXqlAmnRg18U38cFx5ijarbjK6aMAiicCC1kkEQn iGT8HTDfkLisp/ntc7j8IoRVufuEvQgm+rGCAzV3shINfRjRLpATmKeAIfopGAeSP8NQ SciQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="b/P7kCuS"; 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 f93si1044040ybi.316.2020.09.08.17.27.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 08 Sep 2020 17:27:09 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="b/P7kCuS"; 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]:54094 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFnx7-0005zE-A4 for patch@linaro.org; Tue, 08 Sep 2020 20:27:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37478) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFnnV-0008Hq-Ty for qemu-devel@nongnu.org; Tue, 08 Sep 2020 20:17:13 -0400 Received: from mail-pj1-x1041.google.com ([2607:f8b0:4864:20::1041]:39474) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kFnnU-0002Er-67 for qemu-devel@nongnu.org; Tue, 08 Sep 2020 20:17:13 -0400 Received: by mail-pj1-x1041.google.com with SMTP id s2so425989pjr.4 for ; Tue, 08 Sep 2020 17:17:11 -0700 (PDT) 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=b/P7kCuSh9/H8RhlUz9a78L1IC69pDlYZWiEE+l0xBf1cH9SaWTney3lVRJvu9Ryjk TwKwFqj2v31+NsdwLW6iviAY1TwybGJenVfYNWASVK9mwlh5p64EgtPAMW/H4+iHAD9E DTUQnPFMECMxevhIy7ulftsDPebrPTinJlCD7p1Mjnp4i0Z1WdOpZ0uDNWKajp7ua868 2p9S1a2n8lRh1HsCPtrUpH06d4Bg5X+nRkRQWMcwDHpKCCt1kk20DF7rMpN7iF1dz8MB Lfx6iMLBXV4CwjmZdOKuX16IdvDSi99H0IcbFYKYoyvEGBYLTNepmBtI+EuB+tTPOalV Vbsw== 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=rstfZ1/GIdMYS4v8vugWWPQHqvoJ1e+J65jsLsQp16gN24JAzckEl5KZuDpsb8vot4 tJ+U15/pHdraUcfRByETBYA5IY4/DZEgSnA0fZAbVucvQFP193Bf8imlDKIki/1SHkHg IR0s99wsoi9j+f2k+pUm6OsboukO8L5Lg3BHYxNb4L+2bLBKs2Z32h3PFUekcxVaBEuG 1qU0tRvQ2kzR9oNc3Vyp4EgMc48DGp6A3A12sRV+scl5Q2F6JnTHUx4UfD5+dN46luPN f7x6Fyu8ehnRSbTBqQgi038z5gUoLn8U+uqy1XYOwiepkgLOpz1Ocqv1dgjc6Q6u17Oq mubg== X-Gm-Message-State: AOAM531NPSVvE+klQRnq3Q9EUflxujMwrcFk4+n1iZG+xGqvSW19qOXP 8WltSWdXSpq00Jp7fKnKyIW4UDSnEP8AdQ== X-Received: by 2002:a17:90a:c907:: with SMTP id v7mr1192959pjt.204.1599610630489; Tue, 08 Sep 2020 17:17:10 -0700 (PDT) Received: from localhost.localdomain ([71.212.141.89]) by smtp.gmail.com with ESMTPSA id 137sm505437pfu.149.2020.09.08.17.17.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Sep 2020 17:17:09 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 17/43] tcg: Expand TempOptInfo to 64-bits Date: Tue, 8 Sep 2020 17:16:21 -0700 Message-Id: <20200909001647.532249-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200909001647.532249-1-richard.henderson@linaro.org> References: <20200909001647.532249-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1041; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1041.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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)) {