From patchwork Fri Dec 20 04:10:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13916189 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 56C0BE77188 for ; Fri, 20 Dec 2024 04:20:12 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOUM5-0008Ko-2J; Thu, 19 Dec 2024 23:11:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOUM2-0008Jj-Vu for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:11 -0500 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOUM0-0006Fr-3Y for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:10 -0500 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-2166022c5caso12521185ad.2 for ; Thu, 19 Dec 2024 20:11:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734667866; x=1735272666; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=i8y2SP5gsVRd2DDyIzSjHzTbblUtHqyMo6MFtQTYJr0=; b=y9dOPg+Ji83v30rY70HGLg5/rEjIeA+YGg4GGS+6YhSRr3k1kkDrRiME7BSWw0q14n dy/xwiHrYyBL5Pbo3WFKoEJvJBfz5J4jE9yeE1InMnjmqgWRHvOF6q3f1OTcNqopRKA1 s8WQGUl1rdTMmi1ppwugeJrSCFbnQSUnkq/uXJjth/y+xuG9NmhFbaByLVkCvhS7jNf/ aVvBCN3HtDjcR0oSOOPJxaNWsc4KeydyqBH4CKS/k/8M3ufRBrCxPkJcdK42OcYwKTM1 Yi2ac11VQhX0qfOC4+acwIXBHajnTaEQe9YOuM/Ixnglj41eJZ+/VxyOqg+lxA0OM+DY +H8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734667866; x=1735272666; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=i8y2SP5gsVRd2DDyIzSjHzTbblUtHqyMo6MFtQTYJr0=; b=NGH3pxFVgePta61xL94uPuy3LTQwAz8yZt973m1semMsmqLA8XMN/1MeMq11uiKDHJ Iw3L6uI3HuypDtDhg1RC4xMHfbVgaACPk5c1a4uoGudJdJRlveSR9HGI+DYF4u2bGvu+ 4QXqDULYgLiwezj4z7ALpKVGzGde3CT4KqTD3YWRpQ+3FCjBwGyyfh69J7VKk6Z9rVv8 fUUflUuEwPPnAtZC9Im+3xgsBECTbs6buS0RW5XX6fYK8cIhIEcwTeOW3wcfuOEuutlV CNl3N9qVgEuXrP5FR9g8j6KVywjDosJMXCKvxesM1Xeen+tKHQ6JuFR19+WjcBEj9162 p38w== X-Gm-Message-State: AOJu0YzG9c9zXvX+Ip5hK7uxigcgdgf4AYUROIbGDEnLh0OY1NYNYnJu Sf8OAfg4WdSqWQoX6E8+GcAwHpJH+Tn3u7xBGrZOh66e85ubYY+qF2Q947BGd490yNh+GoOqKTn O X-Gm-Gg: ASbGncviRD/W2WblnlEJ4oWmy6Ib0Hix+pYsBZcAkHymjTYDW5m1EFMtNuJltbi19F9 eR/HQyH1tNrDjcLDcsEGlsxUEZKZGuZ13R6A8XEA3NxpQn2X3CIGTozFQFGCoZvrCmOjkIJQxdg b8LBvM8cBcX4/M5vx0fZ3BmZlsESedl4mKrCdtLpm0Kb2zhDY8A3L6zfXs0OTCG6ZwjsvMeuYKf R8qkSF5VWD5/WXE43XsSv+FtEqqZmFlIAczz8PQv2p41KZpRXLbBo6n+kQMH4k= X-Google-Smtp-Source: AGHT+IGDUAPPF8eayva0pbLRcYAzPJ+BP9D8YRCS1S7KcW8+QTTZ6ODmVJVvyjsgwa2MHot7ao75og== X-Received: by 2002:a17:90a:d448:b0:2f4:43ce:dcea with SMTP id 98e67ed59e1d1-2f452ee5e95mr2088579a91.25.1734667866161; Thu, 19 Dec 2024 20:11:06 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f2ee26fc22sm4165260a91.51.2024.12.19.20.11.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 20:11:05 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PATCH v2 01/51] tcg/optimize: Split out finish_bb, finish_ebb Date: Thu, 19 Dec 2024 20:10:13 -0800 Message-ID: <20241220041104.53105-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220041104.53105-1-richard.henderson@linaro.org> References: <20241220041104.53105-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62f; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62f.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Call them directly from the opcode switch statement in tcg_optimize, rather than in finish_folding based on opcode flags. Adjust folding of conditional branches to match. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- tcg/optimize.c | 47 +++++++++++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index e9ef16b3c6..453e8c43bd 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -964,24 +964,25 @@ static void copy_propagate(OptContext *ctx, TCGOp *op, } } +static void finish_bb(OptContext *ctx) +{ + /* We only optimize memory barriers across basic blocks. */ + ctx->prev_mb = NULL; +} + +static void finish_ebb(OptContext *ctx) +{ + finish_bb(ctx); + /* We only optimize across extended basic blocks. */ + memset(&ctx->temps_used, 0, sizeof(ctx->temps_used)); + remove_mem_copy_all(ctx); +} + static void finish_folding(OptContext *ctx, TCGOp *op) { const TCGOpDef *def = &tcg_op_defs[op->opc]; int i, nb_oargs; - /* - * We only optimize extended basic blocks. If the opcode ends a BB - * and is not a conditional branch, reset all temp data. - */ - if (def->flags & TCG_OPF_BB_END) { - ctx->prev_mb = NULL; - if (!(def->flags & TCG_OPF_COND_BRANCH)) { - memset(&ctx->temps_used, 0, sizeof(ctx->temps_used)); - remove_mem_copy_all(ctx); - } - return; - } - nb_oargs = def->nb_oargs; for (i = 0; i < nb_oargs; i++) { TCGTemp *ts = arg_temp(op->args[i]); @@ -1351,8 +1352,11 @@ static bool fold_brcond(OptContext *ctx, TCGOp *op) if (i > 0) { op->opc = INDEX_op_br; op->args[0] = op->args[3]; + finish_ebb(ctx); + } else { + finish_bb(ctx); } - return false; + return true; } static bool fold_brcond2(OptContext *ctx, TCGOp *op) @@ -1443,9 +1447,12 @@ static bool fold_brcond2(OptContext *ctx, TCGOp *op) } op->opc = INDEX_op_br; op->args[0] = label; - break; + finish_ebb(ctx); + return true; } - return false; + + finish_bb(ctx); + return true; } static bool fold_bswap(OptContext *ctx, TCGOp *op) @@ -3037,6 +3044,14 @@ void tcg_optimize(TCGContext *s) CASE_OP_32_64_VEC(xor): done = fold_xor(&ctx, op); break; + case INDEX_op_set_label: + case INDEX_op_br: + case INDEX_op_exit_tb: + case INDEX_op_goto_tb: + case INDEX_op_goto_ptr: + finish_ebb(&ctx); + done = true; + break; default: break; } From patchwork Fri Dec 20 04:10:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13916173 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1DF17E7718A for ; Fri, 20 Dec 2024 04:17:07 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOUM4-0008Kk-Sq; Thu, 19 Dec 2024 23:11:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOUM2-0008Jg-UK for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:11 -0500 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOUM0-0006Fx-9a for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:10 -0500 Received: by mail-pg1-x530.google.com with SMTP id 41be03b00d2f7-820b825cbfcso2157999a12.1 for ; Thu, 19 Dec 2024 20:11:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734667867; x=1735272667; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Y9RnxHpN0x96A+UA+qFx0eOiDNd9nU3BGhNBeQSd/Rg=; b=D3SizqZj5QjBT23cabkwuoVRwwYUlfoii6kzMCoxp5kJTUg5wGinVdRNk6VK14AwJt qYxy/FVYy/90BZs/eIPa6esIri1Fn8JuzLaeriyo1OqKOQpmt+w2wbwttfBKGBKFYZlU 3NlNGjLmRIKnIaPP0TlPkrS5LbD+OLhpkEUxJJSrzLGbdgx3OmGgIZ7nHT4xm7vE9ewc PZ6yMH3SD5OWkwGCWHC7KmD+7eJDWSmJ9eazmhqqgDJHxQbr7cobfSXyotOw0Hi0SzLe ChnHEKhHWH2UY2l6NDSz6NdW2S6Q3KiyTagMYj38k850w1yUxECjiI1DZl6Pmlro396K SFYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734667867; x=1735272667; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Y9RnxHpN0x96A+UA+qFx0eOiDNd9nU3BGhNBeQSd/Rg=; b=ktSwLajhOiexh6uaIruhGsis/+Eyx5NGjPWXPF56q/vUmU64in8BLSzTHMzX5YPOdC Pzh1A/bY34Ep66pfM+D7HeeEZev3AsrBWFfDgxSQkEHKTMCdByX97b3jRMadpTpwxgNE h2g/BA87sgp9JkYGQ8vxW+p3ISBkUk5ef5DaBxF7tjs38Mb9GV0S6J3M+L72+fVZXKJ0 IqyNs8gC7hhcdjovpWoVVnkhGGQw7h9kC9O/k+sb0lefS0m7KeC3k+IwlmfbwflmUXI7 uwi4siDcLWKW9UfBqTOBFZAG6E4vbJGNZ+RfGEsPfGLUG6osjN4B7TzSUMm+RoNY7Cjn vvbg== X-Gm-Message-State: AOJu0Yyv4RJwX8ZVNxTWY5smaACE3j74ZtvdyNZulEqXL2WOJ28K06o4 PPIv9yg18BVFEHudGK/1Q2oM4Tw1T5Y5B4mKFF7VloMX1lF1aaH3dxEYL2NpNWgn2axfZxtc4K8 o X-Gm-Gg: ASbGncuz5iLgT1Wfli7IUhUw5FugoBCeZ/kkilov0PpKzKXedpljRr0njZOCbZ15+ce 3rrwtO+cnmoQU1VPuNZlhzCsF5wZEKKyMUNR4Odry7/BNk2SjpTjSM9N7gLkk9d7Nl4Pme74UGO R8jtHfY5l8MQj+BjVa0WYWew75YCgPlwwmskjttdtIhKsvbdZHzLq57nUoIJHY0udyGtKk0vUlj OBi+r5ovzpJjPtSQsqPDawcapMpS8QohzWiesYITHl9mjjy/cMWK18zxD4mWWI= X-Google-Smtp-Source: AGHT+IGb9957OjpSfK5DpeQmJQVhPEoDu917eXQbfXzS6jGXJVLsMNWDZS42XZhPdbHigtlqjQH1Ng== X-Received: by 2002:a17:90b:3a43:b0:2ee:94a0:255c with SMTP id 98e67ed59e1d1-2f4536d25fcmr2140111a91.13.1734667866749; Thu, 19 Dec 2024 20:11:06 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f2ee26fc22sm4165260a91.51.2024.12.19.20.11.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 20:11:06 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 02/51] tcg/optimize: Split out fold_affected_mask Date: Thu, 19 Dec 2024 20:10:14 -0800 Message-ID: <20241220041104.53105-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220041104.53105-1-richard.henderson@linaro.org> References: <20241220041104.53105-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::530; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x530.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org There are only a few logical operations which can compute an "affected" mask. Split out handling of this optimization to a separate function, only to be called when applicable. Remove the a_mask field from OptContext, as the mask is no longer stored anywhere. Signed-off-by: Richard Henderson Reviewed-by: Pierrick Bouvier --- tcg/optimize.c | 42 +++++++++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index 453e8c43bd..6757fe0036 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -64,7 +64,6 @@ typedef struct OptContext { QSIMPLEQ_HEAD(, MemCopyInfo) mem_free; /* In flight values from optimization. */ - uint64_t a_mask; /* mask bit is 0 iff value identical to first input */ uint64_t z_mask; /* mask bit is 0 iff value bit is 0 */ uint64_t s_mask; /* mask of clrsb(value) bits */ TCGType type; @@ -1047,7 +1046,6 @@ static bool fold_const2_commutative(OptContext *ctx, TCGOp *op) static bool fold_masks(OptContext *ctx, TCGOp *op) { - uint64_t a_mask = ctx->a_mask; uint64_t z_mask = ctx->z_mask; uint64_t s_mask = ctx->s_mask; @@ -1059,7 +1057,6 @@ static bool fold_masks(OptContext *ctx, TCGOp *op) * type changing opcodes. */ if (ctx->type == TCG_TYPE_I32) { - a_mask = (int32_t)a_mask; z_mask = (int32_t)z_mask; s_mask |= MAKE_64BIT_MASK(32, 32); ctx->z_mask = z_mask; @@ -1069,6 +1066,19 @@ static bool fold_masks(OptContext *ctx, TCGOp *op) if (z_mask == 0) { return tcg_opt_gen_movi(ctx, op, op->args[0], 0); } + return false; +} + +/* + * An "affected" mask bit is 0 if and only if the result is identical + * to the first input. Thus if the entire mask is 0, the operation + * is equivalent to a copy. + */ +static bool fold_affected_mask(OptContext *ctx, TCGOp *op, uint64_t a_mask) +{ + if (ctx->type == TCG_TYPE_I32) { + a_mask = (uint32_t)a_mask; + } if (a_mask == 0) { return tcg_opt_gen_mov(ctx, op, op->args[0], op->args[1]); } @@ -1305,8 +1315,9 @@ static bool fold_and(OptContext *ctx, TCGOp *op) * Known-zeros does not imply known-ones. Therefore unless * arg2 is constant, we can't infer affected bits from it. */ - if (arg_is_const(op->args[2])) { - ctx->a_mask = z1 & ~z2; + if (arg_is_const(op->args[2]) && + fold_affected_mask(ctx, op, z1 & ~z2)) { + return true; } return fold_masks(ctx, op); @@ -1331,7 +1342,9 @@ static bool fold_andc(OptContext *ctx, TCGOp *op) */ if (arg_is_const(op->args[2])) { uint64_t z2 = ~arg_info(op->args[2])->z_mask; - ctx->a_mask = z1 & ~z2; + if (fold_affected_mask(ctx, op, z1 & ~z2)) { + return true; + } z1 &= z2; } ctx->z_mask = z1; @@ -1709,8 +1722,8 @@ static bool fold_extract(OptContext *ctx, TCGOp *op) z_mask_old = arg_info(op->args[1])->z_mask; z_mask = extract64(z_mask_old, pos, len); - if (pos == 0) { - ctx->a_mask = z_mask_old ^ z_mask; + if (pos == 0 && fold_affected_mask(ctx, op, z_mask_old ^ z_mask)) { + return true; } ctx->z_mask = z_mask; ctx->s_mask = smask_from_zmask(z_mask); @@ -1777,8 +1790,8 @@ static bool fold_exts(OptContext *ctx, TCGOp *op) ctx->z_mask = z_mask; ctx->s_mask = s_mask; - if (!type_change) { - ctx->a_mask = s_mask & ~s_mask_old; + if (!type_change && fold_affected_mask(ctx, op, s_mask & ~s_mask_old)) { + return true; } return fold_masks(ctx, op); @@ -1819,8 +1832,8 @@ static bool fold_extu(OptContext *ctx, TCGOp *op) ctx->z_mask = z_mask; ctx->s_mask = smask_from_zmask(z_mask); - if (!type_change) { - ctx->a_mask = z_mask_old ^ z_mask; + if (!type_change && fold_affected_mask(ctx, op, z_mask_old ^ z_mask)) { + return true; } return fold_masks(ctx, op); } @@ -2482,8 +2495,8 @@ static bool fold_sextract(OptContext *ctx, TCGOp *op) s_mask |= MAKE_64BIT_MASK(len, 64 - len); ctx->s_mask = s_mask; - if (pos == 0) { - ctx->a_mask = s_mask & ~s_mask_old; + if (pos == 0 && fold_affected_mask(ctx, op, s_mask & ~s_mask_old)) { + return true; } return fold_masks(ctx, op); @@ -2843,7 +2856,6 @@ void tcg_optimize(TCGContext *s) } /* Assume all bits affected, no bits known zero, no sign reps. */ - ctx.a_mask = -1; ctx.z_mask = -1; ctx.s_mask = 0; From patchwork Fri Dec 20 04:10:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13916156 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 102F1E77188 for ; Fri, 20 Dec 2024 04:14:23 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOUM4-0008KJ-DT; Thu, 19 Dec 2024 23:11:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOUM2-0008Jf-UN for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:11 -0500 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOUM0-0006G5-OJ for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:10 -0500 Received: by mail-pj1-x1031.google.com with SMTP id 98e67ed59e1d1-2f43d17b0e3so1413195a91.0 for ; Thu, 19 Dec 2024 20:11:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734667867; x=1735272667; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=kwAmrbK+z6InFUYOYJQouqu9jlEe2zkE3MrW95sabRA=; b=kJFQp3XDcUGaPuOK4fvrDeNPGWVUsOhxI6bHVAYiSaroStM1WCEOK41N+MFyWJoa2Y 6Oi8d2O6hr+dt5SDwXH9pP3IAs9X7MxApYEFbPy2beYC/XcWbBJgVv3vFoPHzGO/i5z/ HHqSoQxA77+DIQIOT9b4NN+O+lzwZu1xCXQdISD7AMJT18dA41ZHZnjG8BJ0Nj+PDmWW Iw5cWk2KVX97aHXugwxjODWWu1DVIg3vjeEHx/jL8l4pRW2a2uFuGnDzjU7OBaosiWIM Fwh+TuZ624PlWYR6KkrC3epaiCV/n77WOLAGlJqIqFC/aYad6yjobKQzeNxQcsI6R9CQ 0Yuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734667867; x=1735272667; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kwAmrbK+z6InFUYOYJQouqu9jlEe2zkE3MrW95sabRA=; b=L+mEMhQpb7ceqUusMre14WV1UebCi6Qb9o/UePeqsBcsxHBxOIRpbsxyNri5TUcu9C //gjlwfdsHXL9/U2hhWKIfLxIGn7YOehXmWm6fC3etYJBxe8mX2EdBswOCaJ1a3pGK1s jsYQfRIITjrEdyjTkQmYk4ucrHnctBYGvZdAHmROGDx9/8IEIN25HfYQQrPyZViNB3By 31uL7IFw+oRtUZyV/dd+lo6KvkJ5DqDXxqFSNxAumHC9kLEWs51dXLmr6oxUq+qjaCsc X8vHoOww6Qf2EQ/UYt/WstMT7havPzzovgS0FPNMsAg/5kk9HctcirLzW5bI1mBAor5N N+wA== X-Gm-Message-State: AOJu0Yyk20jHNis5LOut7mlfgkdC6c3g0H3y0xEAOPXIEXtuEuwlnprQ Q12fTDJByuuH8wOEfsfaPoeCRJd9bwenN9mXjftwVrq/PBlVz9DuUmLjQuS010LovDuRAiVYbB+ b X-Gm-Gg: ASbGnctuv+nL35KCr3buSvUigeDWeQfUvYwl0M8INuBV2okhuAz1Vy0jrw1lpFdD8rP WeilGphkB1c1vdycOSsQkkdQmO3grPJs5dlcO2n1ORHHwU2Wg69hGXW1673HLlSJxxd+V5GV4IL lBezSUEYVIBqujIpOQqua/g5JcS3OQEJ3ttrgV+fh/YcjQWR0vM9/rESS4cj6QZkdaFUJhtQ8wF j3Uq6LBM3gZ+Du6W/e/aV0jO+vJi9SDSnY55JZYmKFe+2xrxqLrvU4d+gi9zoA= X-Google-Smtp-Source: AGHT+IEV34fxF/0bTZuo/01YeuxSshEYE/h/B5W7IC/YiloAcbGVqA8Pyg4LxcmFXP6TWLEE3jR2pA== X-Received: by 2002:a17:90b:50c3:b0:2f2:a664:df20 with SMTP id 98e67ed59e1d1-2f452def241mr2418160a91.7.1734667867386; Thu, 19 Dec 2024 20:11:07 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f2ee26fc22sm4165260a91.51.2024.12.19.20.11.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 20:11:07 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PATCH v2 03/51] tcg/optimize: Copy mask writeback to fold_masks Date: Thu, 19 Dec 2024 20:10:15 -0800 Message-ID: <20241220041104.53105-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220041104.53105-1-richard.henderson@linaro.org> References: <20241220041104.53105-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Use of fold_masks should be restricted to those opcodes that can reliably make use of it -- those with a single output, and from higher-level folders that set up the masks. Prepare for conversion of each folder in turn. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- tcg/optimize.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index 6757fe0036..2aa57afd64 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -1048,6 +1048,12 @@ static bool fold_masks(OptContext *ctx, TCGOp *op) { uint64_t z_mask = ctx->z_mask; uint64_t s_mask = ctx->s_mask; + const TCGOpDef *def = &tcg_op_defs[op->opc]; + TCGTemp *ts; + TempOptInfo *ti; + + /* Only single-output opcodes are supported here. */ + tcg_debug_assert(def->nb_oargs == 1); /* * 32-bit ops generate 32-bit results, which for the purpose of @@ -1059,14 +1065,19 @@ static bool fold_masks(OptContext *ctx, TCGOp *op) if (ctx->type == TCG_TYPE_I32) { z_mask = (int32_t)z_mask; s_mask |= MAKE_64BIT_MASK(32, 32); - ctx->z_mask = z_mask; - ctx->s_mask = s_mask; } if (z_mask == 0) { return tcg_opt_gen_movi(ctx, op, op->args[0], 0); } - return false; + + ts = arg_temp(op->args[0]); + reset_ts(ctx, ts); + + ti = ts_info(ts); + ti->z_mask = z_mask; + ti->s_mask = s_mask; + return true; } /* From patchwork Fri Dec 20 04:10:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13916178 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 621E7E77188 for ; Fri, 20 Dec 2024 04:18:31 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOUM5-0008LL-HY; Thu, 19 Dec 2024 23:11:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOUM2-0008Jh-Ua for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:11 -0500 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOUM1-0006GB-8y for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:10 -0500 Received: by mail-pj1-x102b.google.com with SMTP id 98e67ed59e1d1-2ef748105deso1061362a91.1 for ; Thu, 19 Dec 2024 20:11:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734667868; x=1735272668; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Y0pidgR3zAliJqOpHhhNlBry8ChrLsZBHd/pCpZ2Pbk=; b=YgUHrzMzInai9xuc6TdAvvukC/5HyxgPOXxBEc6S252TQe1nqjZOo8RhCbUz0doJZu iIPAvPCL/jB87RAUMhAux1Kj2nfPPetOUot8Ysaqxk1cTdEgXwzBWUWQaPdGLrsBxQUK uHhCEulMlh8m3Lnq9qnfxoz2Jf/mYMPRR5rtw5JgIlxmvt7FyNc7iIhhFx9IzmUTUG7G b0E1T0y7Kd0+W4V5iMJWHqWDHQyHKYw4QkMcHR+u3O/fXUYI/5Fm3rFU8FqmK62X0pPa /VIOL1eugfebX4wQhwViG6s7+65tuiT6fTyPb9AZ10atP9mtEVDaWYaoD/cxGt6Vr2XN JapQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734667868; x=1735272668; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Y0pidgR3zAliJqOpHhhNlBry8ChrLsZBHd/pCpZ2Pbk=; b=oG3xBoaso61mGxCf/d1akj4xqbeyfrNzWYvAUIbEYAKgPgQkqsOwPG4hnpG7+0cVkr ImdSVhJoVunWtQiPX9HGT7Pjrd6vqwM4bo87iFXfs21fUDd4kyf95UoOkgKbzBUQah9C TR3wAa9VLgV9ORrjxUAE0SA7Qfhv6ztesiJYdkGVWVUp0QcqpBlNJggWRi0uXWOby60q I61pAnZgh3tDm0+1scDjRplLFTpEtOZ5S7pZukd1dYzv2GMbW0sZNIPxspMFN+T9KT82 /g+pQjmhH4uu/el0OnekMJMNcA146oYuT1Z/AbzKZO02UKHJT9FSk5XjNep6rAbN/gnb AIfQ== X-Gm-Message-State: AOJu0YxONXK+1Z23PEcoImbfWDlNCAxCIaYcTY1YVvyujQhmvObo+A7k nbRHKhVJQlDp/Eo4WVE/5Ro0AcoV84/qtu2xpy2aHKo3AqmoxlbTSOnEeadgGJsvqsime+PoVjg X X-Gm-Gg: ASbGncsDnYC6xRSovlgtjm4lm0PNPfUeeNbwjFK3HDlQIprgwhlkZkLVVQxHUak/a82 coBfU3ZUlW3i/Cwmern6lTLX4tmJBEYRDjMDP6kMCb8+7dZH/ekbvYBJW9Sl9dYBOK6dRNYCYi8 P8XyGMfAxKszqsQ2zQ2gvw3JU3gOp5LtRThx28VA/Ad9opBQrpEY+mdbCCdnW7Mq3uPa3X+SpwU QaKmSexgT3Q0br0sk0UpDDS97+9bFCuIYP/ymUaZ2+hw6Sdgfk8Kvnd6rp2ca4= X-Google-Smtp-Source: AGHT+IEGzYWomHSTtYnhctPAu7pTbkRtoakLz1wcnx+PxlG0YqFLv5bKbMH3+ukJ/YritMmkej5xVw== X-Received: by 2002:a17:90b:53c7:b0:2ee:b2e6:4275 with SMTP id 98e67ed59e1d1-2f452ee7147mr2000231a91.26.1734667868016; Thu, 19 Dec 2024 20:11:08 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f2ee26fc22sm4165260a91.51.2024.12.19.20.11.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 20:11:07 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 04/51] tcg/optimize: Split out fold_masks_zs Date: Thu, 19 Dec 2024 20:10:16 -0800 Message-ID: <20241220041104.53105-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220041104.53105-1-richard.henderson@linaro.org> References: <20241220041104.53105-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102b; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102b.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Add a routine to which masks can be passed directly, rather than storing them into OptContext. To be used in upcoming patches. Signed-off-by: Richard Henderson Reviewed-by: Pierrick Bouvier --- tcg/optimize.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index 2aa57afd64..d70127b88d 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -1044,10 +1044,14 @@ static bool fold_const2_commutative(OptContext *ctx, TCGOp *op) return fold_const2(ctx, op); } -static bool fold_masks(OptContext *ctx, TCGOp *op) +/* + * Record "zero" and "sign" masks for the single output of @op. + * See TempOptInfo definition of z_mask and s_mask. + * If z_mask allows, fold the output to constant zero. + */ +static bool fold_masks_zs(OptContext *ctx, TCGOp *op, + uint64_t z_mask, uint64_t s_mask) { - uint64_t z_mask = ctx->z_mask; - uint64_t s_mask = ctx->s_mask; const TCGOpDef *def = &tcg_op_defs[op->opc]; TCGTemp *ts; TempOptInfo *ti; @@ -1080,6 +1084,11 @@ static bool fold_masks(OptContext *ctx, TCGOp *op) return true; } +static bool fold_masks(OptContext *ctx, TCGOp *op) +{ + return fold_masks_zs(ctx, op, ctx->z_mask, ctx->s_mask); +} + /* * An "affected" mask bit is 0 if and only if the result is identical * to the first input. Thus if the entire mask is 0, the operation From patchwork Fri Dec 20 04:10:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13916171 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5A044E7718A for ; Fri, 20 Dec 2024 04:16:46 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOUM7-0008Mh-SU; Thu, 19 Dec 2024 23:11:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOUM4-0008KL-64 for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:12 -0500 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOUM2-0006GQ-7c for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:11 -0500 Received: by mail-pj1-x1036.google.com with SMTP id 98e67ed59e1d1-2ee786b3277so984832a91.1 for ; Thu, 19 Dec 2024 20:11:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734667869; x=1735272669; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=+TJ5IfnYTy94xBh6uHrxnvEXKZnmCMvGdvkeZvXUxGM=; b=L3EaXDcGu71FElBWglDSqRiBfD6ek4SopLanQzCV7mOSdiKOd94fw6NhYzVxF2+Eis +TsrQ9Qa4OHEjn11q4pKDrPNscqtb8rRqnyuilP7sjMjZlD5yU6bhScUihAYHUctVrh6 Tc34RAMoS3UGyVGRfLySU5MqXLXA/SwBzkrUXS7ZdHzHFMaDG3zrxskiwhp794LMROEp 9I2/Uq4n5Bm7f+XE1odEQLe1RjIlkQBW4XV9To4KGqHAdCIY2PERBna44V68JLdoJI+P ONteupoPkLY7CWB06xaWxa/9OzLxcwAS1eDS+HQI0/8CfX8gpxLjal/33VJk/dGc1zKM i4pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734667869; x=1735272669; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+TJ5IfnYTy94xBh6uHrxnvEXKZnmCMvGdvkeZvXUxGM=; b=KOgLotv4mzFgNSzqr9qEAu9Ym3UscTRX+Rk/vFU+XJED/zQDmMDyLY9pztV9ZzcJpS 9N1RAY/Z11H/OycHyJo1He03SqRHWy7QGUBrLgJxUdiKQDeQmL+4nk1qgv7xlBzcdYFw Cg2tLAMcAHqtOAny4cTZmVrStT4u1poEoNy/JZHkpeLHVREkMlouWsm/62DnLYtb/8DV 8y0OnLfZ1/IlcwY1b6g9/kyHYHsbVF1AhjJcxLhfK0sQdaqbH+TiFuCwXFOplYxMT9Ux XiVDgV0vxesCrsOFDZtLu1Kz8lXtbOnHLctRXWemTnLrGwjFlI4Ykbb5g+qRMhN3iZHL QgBg== X-Gm-Message-State: AOJu0Yz8dfxqaN6PYuOi7iDTiMIo8UlIOvfFEgCEx7AQ/iN5JI0eugYB OSkW8HgFlm6yc8+GdXaLJxNkLEtXWrcHpdgAcufJl6Z5W44yQ33RY5HBf8XdNgfWQuBfoohjC7q C X-Gm-Gg: ASbGnctNy63y1eRzrW12IgLidpxrUMMkt0dO3f2Ntw2bynpHDz3zCDAqVKoEbsEXz6G 5PnQK/8+QAT7+hA2/FMboyBuVxyyDeEBjN8ZdFO9QBxQ9ar4S+OY0wrAcW6pVx2pxWvq0P3sfII DhUlZAlOMLxiVmz6W7kfYg22AlzXLEWZr1WMfA2pm9kfCuZavDXPziaFJEEXmnydxor8JataiYP 71u4lzxVLr1STC0m+59ypv7GDLazUsIZi1ZOgFkCrxiau4BhpBATdZigo2/Bc8= X-Google-Smtp-Source: AGHT+IGFvR7zeq7kxnnsbuSCTs3wnRQz0o35HpYaW+ox7SBZSptoNFKN9NC+bm+bemq9vgdf9jow3w== X-Received: by 2002:a17:90b:5184:b0:2ee:d824:b594 with SMTP id 98e67ed59e1d1-2f452eeb56cmr1929180a91.31.1734667868786; Thu, 19 Dec 2024 20:11:08 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f2ee26fc22sm4165260a91.51.2024.12.19.20.11.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 20:11:08 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 05/51] tcg/optimize: Augment s_mask from z_mask in fold_masks_zs Date: Thu, 19 Dec 2024 20:10:17 -0800 Message-ID: <20241220041104.53105-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220041104.53105-1-richard.henderson@linaro.org> References: <20241220041104.53105-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1036; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1036.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Consider the passed s_mask to be a minimum deduced from either existing s_mask or from a sign-extension operation. We may be able to deduce more from the set of known zeros. Remove identical logic from several opcode folders. Signed-off-by: Richard Henderson Reviewed-by: Pierrick Bouvier --- tcg/optimize.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index d70127b88d..17b72fe759 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -1048,6 +1048,7 @@ static bool fold_const2_commutative(OptContext *ctx, TCGOp *op) * Record "zero" and "sign" masks for the single output of @op. * See TempOptInfo definition of z_mask and s_mask. * If z_mask allows, fold the output to constant zero. + * The passed s_mask may be augmented by z_mask. */ static bool fold_masks_zs(OptContext *ctx, TCGOp *op, uint64_t z_mask, uint64_t s_mask) @@ -1080,7 +1081,7 @@ static bool fold_masks_zs(OptContext *ctx, TCGOp *op, ti = ts_info(ts); ti->z_mask = z_mask; - ti->s_mask = s_mask; + ti->s_mask = s_mask | smask_from_zmask(z_mask); return true; } @@ -1519,8 +1520,8 @@ static bool fold_bswap(OptContext *ctx, TCGOp *op) default: g_assert_not_reached(); } - s_mask = smask_from_zmask(z_mask); + s_mask = 0; switch (op->args[2] & (TCG_BSWAP_OZ | TCG_BSWAP_OS)) { case TCG_BSWAP_OZ: break; @@ -1534,7 +1535,6 @@ static bool fold_bswap(OptContext *ctx, TCGOp *op) default: /* The high bits are undefined: force all bits above the sign to 1. */ z_mask |= sign << 1; - s_mask = 0; break; } ctx->z_mask = z_mask; @@ -1605,7 +1605,6 @@ static bool fold_count_zeros(OptContext *ctx, TCGOp *op) g_assert_not_reached(); } ctx->z_mask = arg_info(op->args[2])->z_mask | z_mask; - ctx->s_mask = smask_from_zmask(ctx->z_mask); return false; } @@ -1625,7 +1624,6 @@ static bool fold_ctpop(OptContext *ctx, TCGOp *op) default: g_assert_not_reached(); } - ctx->s_mask = smask_from_zmask(ctx->z_mask); return false; } @@ -1746,7 +1744,6 @@ static bool fold_extract(OptContext *ctx, TCGOp *op) return true; } ctx->z_mask = z_mask; - ctx->s_mask = smask_from_zmask(z_mask); return fold_masks(ctx, op); } @@ -1851,7 +1848,6 @@ static bool fold_extu(OptContext *ctx, TCGOp *op) } ctx->z_mask = z_mask; - ctx->s_mask = smask_from_zmask(z_mask); if (!type_change && fold_affected_mask(ctx, op, z_mask_old ^ z_mask)) { return true; } @@ -2354,7 +2350,6 @@ static bool fold_setcond(OptContext *ctx, TCGOp *op) fold_setcond_tst_pow2(ctx, op, false); ctx->z_mask = 1; - ctx->s_mask = smask_from_zmask(1); return false; } @@ -2455,7 +2450,6 @@ static bool fold_setcond2(OptContext *ctx, TCGOp *op) } ctx->z_mask = 1; - ctx->s_mask = smask_from_zmask(1); return false; do_setcond_const: From patchwork Fri Dec 20 04:10:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13916168 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 078B8E7718B for ; Fri, 20 Dec 2024 04:16:34 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOUM8-0008Mx-Gr; Thu, 19 Dec 2024 23:11:16 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOUM4-0008KT-E7 for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:12 -0500 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOUM2-0006Gh-Vi for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:12 -0500 Received: by mail-pg1-x536.google.com with SMTP id 41be03b00d2f7-7feb6871730so964035a12.2 for ; Thu, 19 Dec 2024 20:11:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734667869; x=1735272669; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=IKiuA+O0PzoDklDp6nENMYQ6rVNeilXqGGPdsOwMo3c=; b=BrR1h7FksGwxQEEX9bWYnW9LXtB1VsbzPa21OoIKCw2h5XAGjZvYnnWA70DO+QkhnA wQueOII8tPQfCnY+1GkhA51qL0euJrpkWQxGuPstw3B7ventN3T4wY3sOG1Sn10CneWi 4X270mUzGdkeuFz/NqEIYoKjFipi4EF0BXI5QtQaxXD1QjryvpDNT+B6HjU+yIaPosw5 YeWZijhjnJD+WI2C3SJZXW5xg3FKDjXl4XYlVQ5iHR0rAT++rO2+ADfyx3+cKuY5rTfQ wSeTgPBdItZbqeoluUehL9bPQ0MMZBWVQ0QH5wj1cDGAkhirA9ak71/PH0veAq2VkNwD k7/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734667869; x=1735272669; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IKiuA+O0PzoDklDp6nENMYQ6rVNeilXqGGPdsOwMo3c=; b=jFTuAh9pkKXzbsE0XNqY6YWvVfWoR3dsAkqaK82nEuaTsiVQMPTzO7KFgO9JGmi7XC e1t/NV+zncoasiPSZ7JRKjZpUw6uM0laZeCpBiVSDxx5KvK3Bsdq0NBPagJhqS6aBKZJ IZnikIWazSuFnhO36TGOm0yFUeNi81gY85UqrCwT3dw2bcCmS/GwEf+mDAgdNMHv5DQq jnrZi/BQDAzoUGVVik2xWkuO5lbv6OQ+LiNJ9b2xWai2DlY8snmv1C5mnI+TnnT2RNsv cQUBuBiAxz7aLzfn42U/UB/vgqPAuBse9eW80L7H3JofHb3yu8StvSdrF4bV2JrCluNz Sing== X-Gm-Message-State: AOJu0YwTdZ6k1g0SxW/Z/s1nPFrhW+o+Ayc2AddJVohYCKfp+aPuCq5E u60OLGxIR2ZfaFTzRdO8GIdOW5+pmLzi0zerD/FqzJURYHebmyae4UljDKNEdqWpb8FJA5LXZBm g X-Gm-Gg: ASbGnctuooXTWTcf58oBTvT0ZO6u2XKZoC84xk0PzQnKiFgYkhdpQPZJ8ZcwekFb9CM HKYOWEEaAZE/rJwPCE8hIq3UIwYVU3K4F5evUzlBBfrq/KOBz+ygD+87kDuJghph6M4ovNAlHJk y+B+uhUWLGYVUvTM3Vv6vmLJE38HJfo/BxOfCzPkvC/A1lysebTNIlOOhPWJXox7KX9BqhtltRT GacpuhY5uFNYP8/a3b1tLE5C02+fHoIE8MQC0BUagyOs32wcgcAotVOqO8rZgo= X-Google-Smtp-Source: AGHT+IEy2P89cbnZ2Esj6YifdJxkld27YuEqpl/3/6NdhhUJq+6gkhL8Sj1BXWSlYEM4gcjckanO+A== X-Received: by 2002:a17:90b:2dc8:b0:2ee:c797:e276 with SMTP id 98e67ed59e1d1-2f452d3000cmr2701038a91.0.1734667869508; Thu, 19 Dec 2024 20:11:09 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f2ee26fc22sm4165260a91.51.2024.12.19.20.11.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 20:11:09 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PATCH v2 06/51] tcg/optimize: Use finish_folding in fold_add, fold_add_vec, fold_addsub2 Date: Thu, 19 Dec 2024 20:10:18 -0800 Message-ID: <20241220041104.53105-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220041104.53105-1-richard.henderson@linaro.org> References: <20241220041104.53105-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::536; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x536.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- tcg/optimize.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index 17b72fe759..41fd69365b 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -977,7 +977,7 @@ static void finish_ebb(OptContext *ctx) remove_mem_copy_all(ctx); } -static void finish_folding(OptContext *ctx, TCGOp *op) +static bool finish_folding(OptContext *ctx, TCGOp *op) { const TCGOpDef *def = &tcg_op_defs[op->opc]; int i, nb_oargs; @@ -995,6 +995,7 @@ static void finish_folding(OptContext *ctx, TCGOp *op) ts_info(ts)->s_mask = ctx->s_mask; } } + return true; } /* @@ -1221,7 +1222,7 @@ static bool fold_add(OptContext *ctx, TCGOp *op) fold_xi_to_x(ctx, op, 0)) { return true; } - return false; + return finish_folding(ctx, op); } /* We cannot as yet do_constant_folding with vectors. */ @@ -1231,7 +1232,7 @@ static bool fold_add_vec(OptContext *ctx, TCGOp *op) fold_xi_to_x(ctx, op, 0)) { return true; } - return false; + return finish_folding(ctx, op); } static bool fold_addsub2(OptContext *ctx, TCGOp *op, bool add) @@ -1298,7 +1299,7 @@ static bool fold_addsub2(OptContext *ctx, TCGOp *op, bool add) op->args[4] = arg_new_constant(ctx, bl); op->args[5] = arg_new_constant(ctx, bh); } - return false; + return finish_folding(ctx, op); } static bool fold_add2(OptContext *ctx, TCGOp *op) From patchwork Fri Dec 20 04:10:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13916165 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8E0A9E77188 for ; Fri, 20 Dec 2024 04:16:24 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOUM7-0008Lu-4W; Thu, 19 Dec 2024 23:11:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOUM5-0008LN-Gf for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:13 -0500 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOUM3-0006Gt-Ep for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:13 -0500 Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-21628b3fe7dso13176365ad.3 for ; Thu, 19 Dec 2024 20:11:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734667870; x=1735272670; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=W9/02VItWnKuXE48s/sX8jbBZgUlVlj7VS3J2PwQvow=; b=hwNDdDIeHUwsokUfkP+ivW7VYxRqUcF7j1LFin2cAn/OGPuBTOkYED6j+J0EaBAFPo 9edP4U+NfZCekYUh4p7Yxv83/uMxzeGHz2bSnVdpchc7eVljesD1Au0yLu+XOleT6wCO VmDZi1lVoAaA5pgM0YcUkVgZpz4qGNQ9jJyJjwAkJzYHyt6cqPSHGzBQkAQs9aHrgsRb kOdnEYp6Gezdrf/GsdW2wSNREMyuQbgkU65Dn05S58fewBQkLy2tbtZ+RT28Z0tROMjW 32eVxnMUj9IuaDr/vodIeZMJThn/0c3YReL9+MFwPVg+Znz+IXKAIfEXBY9e9DIDaRU0 1Pxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734667870; x=1735272670; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=W9/02VItWnKuXE48s/sX8jbBZgUlVlj7VS3J2PwQvow=; b=gQ6KMyX6zXP2yTS/yrNQm0ipwKzn8D0s/Sdn2ZlPIZT75kbfQVlgMFwdx772oXeBjj e73DhqVXcJeUGRJvp4Wi4jLxNnvgCWyxGE9HeeXYFczNwGcs6yQNVDAumHl7NYa7wzbY GvK2AYHJhROTTNJ2SjIcToojukNdqp6UaMrx05ZIS/fkLhuj3iMoqJrhhA/mK1nb1eex ai0/1JqHjSj84nCaW6m9Kn0kbHLiQhDLYrE4rvtmbxN/Jy2km0n8IkZpChLSAZ9t61VI nP69J4ibGEqKcrz+7yEhBPURV7uTdd2QlGmbKybLmdJePsruvZC5Mk3EpPdvmfQAP2Ap HxKg== X-Gm-Message-State: AOJu0YzwNJ3DZCpE+MRFET5VxsbYm/aa5Oh7DzRzZ4ZNxdR1A1u19DFh yJ6ZDkYDqSXVj/vefqGxMTuywlGwMPjfJJmyN6RDBHIT3xbYF07jS4M0K3X6lbX7m49RHkPtg9y N X-Gm-Gg: ASbGnctgcO+X80dl/HbX0XM9GDMgqbi3sslmW3UKDmSEUCUc3KMsYtDlbpQ+IARAsKN co8E2QCEb+WtxlgdXm2LYasCPd2i9kvBlCTcKUWO0flVTKz1/r5FAzSTjgUhH7qK7SXW5PSW3z0 t0m/TEA27b/IIH/9cAc12Yizp+Ik0DIu4VLyzsbn6qjS40Al26S58bgPNuasH1U1oYWEYfS4WF3 iRpmwIhffFw/9+nPK05/76C3pfIm7hKoWxeGW2tdZAL0E1NIpPAynOjwx8bD8Y= X-Google-Smtp-Source: AGHT+IGl3FjmRdwUD2Hq9QFLUu+eNQRkiXS4Id2z+jWJd/zDVV57nZOqcJ6ukDOdGEoXsJveW8bPBQ== X-Received: by 2002:a17:90b:514d:b0:2f1:2fa5:1924 with SMTP id 98e67ed59e1d1-2f452ec1ceemr2003756a91.26.1734667870127; Thu, 19 Dec 2024 20:11:10 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f2ee26fc22sm4165260a91.51.2024.12.19.20.11.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 20:11:09 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PATCH v2 07/51] tcg/optimize: Use fold_masks_zs in fold_and Date: Thu, 19 Dec 2024 20:10:19 -0800 Message-ID: <20241220041104.53105-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220041104.53105-1-richard.henderson@linaro.org> References: <20241220041104.53105-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62a; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62a.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Avoid the use of the OptContext slots. Find TempOptInfo once. Sink mask computation below fold_affected_mask early exit. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- tcg/optimize.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index 41fd69365b..52c785472f 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -1313,7 +1313,8 @@ static bool fold_add2(OptContext *ctx, TCGOp *op) static bool fold_and(OptContext *ctx, TCGOp *op) { - uint64_t z1, z2; + uint64_t z1, z2, z_mask, s_mask; + TempOptInfo *t1, *t2; if (fold_const2_commutative(ctx, op) || fold_xi_to_i(ctx, op, 0) || @@ -1322,27 +1323,28 @@ static bool fold_and(OptContext *ctx, TCGOp *op) return true; } - z1 = arg_info(op->args[1])->z_mask; - z2 = arg_info(op->args[2])->z_mask; - ctx->z_mask = z1 & z2; - - /* - * Sign repetitions are perforce all identical, whether they are 1 or 0. - * Bitwise operations preserve the relative quantity of the repetitions. - */ - ctx->s_mask = arg_info(op->args[1])->s_mask - & arg_info(op->args[2])->s_mask; + t1 = arg_info(op->args[1]); + t2 = arg_info(op->args[2]); + z1 = t1->z_mask; + z2 = t2->z_mask; /* * Known-zeros does not imply known-ones. Therefore unless * arg2 is constant, we can't infer affected bits from it. */ - if (arg_is_const(op->args[2]) && - fold_affected_mask(ctx, op, z1 & ~z2)) { + if (t2->is_const && fold_affected_mask(ctx, op, z1 & ~z2)) { return true; } - return fold_masks(ctx, op); + z_mask = z1 & z2; + + /* + * Sign repetitions are perforce all identical, whether they are 1 or 0. + * Bitwise operations preserve the relative quantity of the repetitions. + */ + s_mask = t1->s_mask & t2->s_mask; + + return fold_masks_zs(ctx, op, z_mask, s_mask); } static bool fold_andc(OptContext *ctx, TCGOp *op) From patchwork Fri Dec 20 04:10:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13916140 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0E4D8E77188 for ; Fri, 20 Dec 2024 04:13:09 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOUMF-0008PU-3f; Thu, 19 Dec 2024 23:11:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOUM5-0008LS-Ls for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:13 -0500 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOUM4-0006Hk-2j for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:13 -0500 Received: by mail-pg1-x536.google.com with SMTP id 41be03b00d2f7-7fd49d85f82so1124696a12.3 for ; Thu, 19 Dec 2024 20:11:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734667871; x=1735272671; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=kFw3rpA76sVRd/4s7BeQ7vzsn5gYxdrWXruIEcEABL0=; b=llCCBWhqGNz1YgPThs3Eczh2dFPXiZXYhzndh2p0HK9ENYmVBPIR65rWm3rkmOqi1+ xIm2YQIMkEymCaoYs72lEcyLZ2mShflQO1+7z8zBVTyRDi3HYZzqLkec9B+NI6eWna/I NVpsLylsfpk+A+wJKGO0WTpDagPYVrE0+B0RoGvvextapPufYEdfQK+a94b38IWVb9Vb VLL7GtqVawTXiD6REMCmXyoi6BLR4N2AGYwqTNF2m/pq3TFkp83QXv3MEBRTdeFA9AWk UVTVhD0EQgok7Qxyw3GFnz0pigPFon4S/ezNQfoFf356pKypI3LJfR1KRT6iXgTGJ5av Llgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734667871; x=1735272671; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kFw3rpA76sVRd/4s7BeQ7vzsn5gYxdrWXruIEcEABL0=; b=HiOIwOdzeE3hOnKCjZlBT36FQT151ugCNKOZ+Q/2fLnj+Uw6jycBDPosWpiFHVnnbf wVNlwfftOcyD0JKSWXneLWegML8OSdpsnPKlFdNzCTPvkeHsaXij+CY4jyBmZgT72/FF jP2XTmOGTRW5wDj1VUadR48YN7cx673asuIjF52GQA/MXx+EvcBJ4WVntMGEWjnRM4hD LA/2vNBBY6TvyPGZfpqgC2rQRAN1PNTqKNar0dhXDdh4zwrvPbvGFB8Ur/jQel2T0/JP HkdeGhcDcMkKp3vd4Fqn5yAwbRoDcJbbiRayAzioF2xIO4zXUuNzxswWp90ThEMn4kHN DOvQ== X-Gm-Message-State: AOJu0YwDNBllGR4avAz26wHm63Mz9bp4SwR9+8PIz+zaey8FNc8l1pmh ixpcDzYAsmRboGW1G0cy05FJANeMo3Yor2k04ZOkRgUDhym0SzlI7Eoaa4UX5f1YWc/DMc1o+x6 H X-Gm-Gg: ASbGncvuscegGQGOunuSnOYeo3iOQ/skVe4xgdRCIegUFkc8+HCkTYfIPye0n2+rWy3 6t5j8RQuIcKnMwukmv8jEVAhxYGZKnd+XXPAchgDFxRPkGGJTAdqhNs3jZzeqThBd9HSDbM2E0B YI0lewlQkKHg0AYT/L7EjhXWgi/ftRBp4gWbSe9TjHAcl2imcb/Mo37GB4jsTni2Cy26s2ge5mA WllUnMxgl5Ns4rWbi8rUaYeKWpZYw6X/God8JLmt11UvuGFjQzpcS1eFG21EWw= X-Google-Smtp-Source: AGHT+IFuOjtu+5gXoQajxKigCrm53l7CmTLwhO0r7AFgG7i3Eab4SmrmkdcSc31XUIhblWsPVDalSw== X-Received: by 2002:a17:90b:2551:b0:2ee:b0b0:8e02 with SMTP id 98e67ed59e1d1-2f452eca3bbmr2132026a91.28.1734667870852; Thu, 19 Dec 2024 20:11:10 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f2ee26fc22sm4165260a91.51.2024.12.19.20.11.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 20:11:10 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PATCH v2 08/51] tcg/optimize: Use fold_masks_zs in fold_andc Date: Thu, 19 Dec 2024 20:10:20 -0800 Message-ID: <20241220041104.53105-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220041104.53105-1-richard.henderson@linaro.org> References: <20241220041104.53105-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::536; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x536.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Avoid the use of the OptContext slots. Find TempOptInfo once. Avoid double inversion of the value of second const operand. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- tcg/optimize.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index 52c785472f..c73410232b 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -1349,7 +1349,8 @@ static bool fold_and(OptContext *ctx, TCGOp *op) static bool fold_andc(OptContext *ctx, TCGOp *op) { - uint64_t z1; + uint64_t z_mask, s_mask; + TempOptInfo *t1, *t2; if (fold_const2(ctx, op) || fold_xx_to_i(ctx, op, 0) || @@ -1358,24 +1359,23 @@ static bool fold_andc(OptContext *ctx, TCGOp *op) return true; } - z1 = arg_info(op->args[1])->z_mask; + t1 = arg_info(op->args[1]); + t2 = arg_info(op->args[2]); + z_mask = t1->z_mask; /* * Known-zeros does not imply known-ones. Therefore unless * arg2 is constant, we can't infer anything from it. */ - if (arg_is_const(op->args[2])) { - uint64_t z2 = ~arg_info(op->args[2])->z_mask; - if (fold_affected_mask(ctx, op, z1 & ~z2)) { + if (t2->is_const) { + if (fold_affected_mask(ctx, op, z_mask & t2->val)) { return true; } - z1 &= z2; + z_mask &= ~t2->val; } - ctx->z_mask = z1; - ctx->s_mask = arg_info(op->args[1])->s_mask - & arg_info(op->args[2])->s_mask; - return fold_masks(ctx, op); + s_mask = t1->s_mask & t2->s_mask; + return fold_masks_zs(ctx, op, z_mask, s_mask); } static bool fold_brcond(OptContext *ctx, TCGOp *op) From patchwork Fri Dec 20 04:10:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13916138 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 941FDE7718A for ; Fri, 20 Dec 2024 04:12:25 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOUMC-0008Oi-JZ; Thu, 19 Dec 2024 23:11:20 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOUM6-0008Li-ES for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:14 -0500 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOUM4-0006Hs-QH for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:14 -0500 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-218c8aca5f1so16998485ad.0 for ; Thu, 19 Dec 2024 20:11:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734667871; x=1735272671; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pTlIt3yFdh4Ary2wfKIiByPP+3BeXY1y055wil8BQG4=; b=KIhTgOVKsSd22foZ9vs/aHRxaxE48BQcZ0Vt+bs5mvbrsu2UD0MoQfA7Ytqizkg7nc XAJWUPR4KokSXNlfvWpPl53xWjyA9gJ2yhixGFwjSHcbHTEI89tY9VmUXEUnmDJ865FM fgaWYDks5kmkWNk34dUjPOBRcDv9nivrF+oHWNsYt+WYdF0uMpdxCn2xdY3z2PsYySTc NxY6hwc+nwWjIVEY0w3asPx0QGb/G3iFQ8KMEexOTPMU8otSmq+k5QPHui4iCeHtlthe cwRl8n3pr0zaYST2CJohTse/TEsWS6UrY3F1HTGULs0Xu+Y1uJVhkU/Yz3KZ4Zl+qWDo WetQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734667871; x=1735272671; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pTlIt3yFdh4Ary2wfKIiByPP+3BeXY1y055wil8BQG4=; b=qdstZ0LvFZRxY4uMTKbxENqVVhwTlk1ufZTAPQO6FHxEAkRoG+xbSzOkn7qHS58Ld+ VUagd7HEEEnGSX5+m81jF4WHx8oVYQabl/53kT7PDiu9o/7GZHo3vuVngs422UliEeHx V/bCS40ueaEwxVRutIF7zto1iLjWkiD9x/3G0b1z0X7OccjQb0cFaaH/H5T9+J/e4LQx LyWsLeuhuZrX47s2jB+FVutnmxR/flrNmyyBHvc6yi1dyE2elfTwJz6gTuWdSKdoMq63 /C3CzpbSpd62JyMprEUa0C4WFVcwRG5V9XTEd76hLgO01++1+XOgoai04oUbZ1KatX1i DqPA== X-Gm-Message-State: AOJu0Yw5FGmxH/D3sf8meP3yFlJbeOK1X5Pf3Xf9Oha+le/KgBtGe+zn wH/Z4JVIOa8sJfGqTRVjua7M7ZrIvQ5qyMAhrMXda7WnAg5unr9jPsRK+3i9sXpW1zbOlBVtfUk 6 X-Gm-Gg: ASbGncv06wc+ct/w5qOxpSJHpJ/7oY/3Kism5AqbWqNWKfNNJoFDiItmUeRUJpBUwbH f5V+1KTrNNQ0ofTjUvXKAaAQlE5pcJEFMvxiEOQojyydzofo+vMJoOQZWUEO+BSgHOcOETUGsEX CuLB7sg6YhZZm/pIj98Co1Li7R2OnaiVVhz5bxT4F9cYYg+W0f2wKedYhOGk0Qi04fqZfVoD7Xr gv/7v10NvpwgbqCmB5GXejS3yBa4BcS7si3r96jsdfmfYpUWbCeVrvncjvtN2c= X-Google-Smtp-Source: AGHT+IErVWvRssLTHoUjaQpMD6UvykhWjrOCrC43l8VUNG5IfnOijDAmYT3MgMl2RR0XUJgFDYyDIg== X-Received: by 2002:a17:90b:2543:b0:2f4:432d:250d with SMTP id 98e67ed59e1d1-2f452e372edmr2051809a91.21.1734667871434; Thu, 19 Dec 2024 20:11:11 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f2ee26fc22sm4165260a91.51.2024.12.19.20.11.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 20:11:11 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PATCH v2 09/51] tcg/optimize: Use fold_masks_zs in fold_bswap Date: Thu, 19 Dec 2024 20:10:21 -0800 Message-ID: <20241220041104.53105-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220041104.53105-1-richard.henderson@linaro.org> References: <20241220041104.53105-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::634; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x634.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Avoid the use of the OptContext slots. Find TempOptInfo once. Always set s_mask along the BSWAP_OS path, since the result is being explicitly sign-extended. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- tcg/optimize.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index c73410232b..b8e9ded821 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -1495,16 +1495,15 @@ static bool fold_brcond2(OptContext *ctx, TCGOp *op) static bool fold_bswap(OptContext *ctx, TCGOp *op) { uint64_t z_mask, s_mask, sign; + TempOptInfo *t1 = arg_info(op->args[1]); - if (arg_is_const(op->args[1])) { - uint64_t t = arg_info(op->args[1])->val; - - t = do_constant_folding(op->opc, ctx->type, t, op->args[2]); - return tcg_opt_gen_movi(ctx, op, op->args[0], t); + if (t1->is_const) { + return tcg_opt_gen_movi(ctx, op, op->args[0], + do_constant_folding(op->opc, ctx->type, + t1->val, op->args[2])); } - z_mask = arg_info(op->args[1])->z_mask; - + z_mask = t1->z_mask; switch (op->opc) { case INDEX_op_bswap16_i32: case INDEX_op_bswap16_i64: @@ -1532,18 +1531,17 @@ static bool fold_bswap(OptContext *ctx, TCGOp *op) /* If the sign bit may be 1, force all the bits above to 1. */ if (z_mask & sign) { z_mask |= sign; - s_mask = sign << 1; } + /* The value and therefore s_mask is explicitly sign-extended. */ + s_mask = sign << 1; break; default: /* The high bits are undefined: force all bits above the sign to 1. */ z_mask |= sign << 1; break; } - ctx->z_mask = z_mask; - ctx->s_mask = s_mask; - return fold_masks(ctx, op); + return fold_masks_zs(ctx, op, z_mask, s_mask); } static bool fold_call(OptContext *ctx, TCGOp *op) From patchwork Fri Dec 20 04:10:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13916163 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7F9D5E7718A for ; Fri, 20 Dec 2024 04:16:13 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOUMV-0008VJ-01; Thu, 19 Dec 2024 23:11:39 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOUM7-0008MS-GZ for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:15 -0500 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOUM6-0006IK-0f for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:15 -0500 Received: by mail-pj1-x1034.google.com with SMTP id 98e67ed59e1d1-2ee74291415so1115334a91.3 for ; Thu, 19 Dec 2024 20:11:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734667872; x=1735272672; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=e83Kh8y33SsGtp3mBjjq9S+0kBQxVM7UcwxTwkf4goA=; b=FqGhC9IQTSb+lCy5X1v9uNYawfosSiIV4QhBMWwta49UW6817RzPkPvkoRenWAt/9n 2PplIaGL+sFF2AFdOE5vHLa8sO/EzT0qKhpfLArCNNv9GBfl+qqTlV1N69WboRTmcM39 IPrjUeb6NFqafXvVZP5kJR1Hsg0VDiJOSk+ME3wMNolOudK3c3PjmVDWOYFrx3FrrmWR PYB3W0AABbfC/T4o1ghtZ1VI1Up9dpq2LE98sR3tvRQGvK/QlE3NZiLQ3kaAuMyk9o/o rgyizQPEXCBqCy3efG54XrYKkbkpOmFnu6wRtGaFrI0Z59MOyExSKiWtLFlfqNiKHzBi VqOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734667872; x=1735272672; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=e83Kh8y33SsGtp3mBjjq9S+0kBQxVM7UcwxTwkf4goA=; b=RQRPdL5ZxYnDur3QtWNzywoTn/aCtng8FIQk/2mcE/dpesqT7jlUON14tUfg9BJ+00 /1x1R/Y4S1ojXA+eM+kqjflgo1UjkESTu4hbw8kak/X9fdmBwnCZuOmbpqjHuPNN/4Fx wPIAMZOrd4O4ZpE0t6cDfSDPGHW43EMERbSWRZLqxybaIMd1EQGjakLiHyuebN4kR4/b R0vEoquSsfr2dAe4fbhc2SKj+lUFLtV1ZcTgz2NIA4XYpx06iBRY0BhEyDJbXx34fcpR 29YiMVZmeUsdLKE6LdjGs9YWFR+rF6RLBtFZQPo4xm0AfP6aMR8hp9u0sJ4RdJ1LGJOO Zx/g== X-Gm-Message-State: AOJu0Yxg3cV3Rvtb9HwYlNojZ/yUJM3GgBo19LjBY3auKoWO8TEz2REr 89kGmfOS+ToVn04xdL9W8i4gLH5zQ05c12Rdss2PORnlUUOVc3xoyGor/+hs74Pjm32WmU2dzxY S X-Gm-Gg: ASbGncs469RgKAfKUsuM5SBlpqYmDdfTgnDxCzH2AmLpcSEt94+aKvoO6uspq2P778/ Go1kJ8mKBQBosm1e29M7ZinUgclUryPmVxeEu57W8y637xKmrY8nj4f8GEtHq0juOA2xd5YdArt 1z6jYcOZw5ttCay6lDa/mnThfynYukFq8s3qAIAj37o33rhm0WK28uM8PVPE9cEGarkySzedfZA NK7wrSmI/N0Ql/zJdugRhup2vyFxfbSHcD3eI+UvjZuThihvuUc1ZZJRSeQk8E= X-Google-Smtp-Source: AGHT+IEWPQG6KFnFxtWgqNYw96/PRJMPiSLGLlawbaAA+ieHUeRo0Wqd95R6OgDakwAOb7dc3q4p7A== X-Received: by 2002:a17:90b:2b8e:b0:2ee:3cc1:793b with SMTP id 98e67ed59e1d1-2f452ec6ed2mr1985899a91.26.1734667872223; Thu, 19 Dec 2024 20:11:12 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f2ee26fc22sm4165260a91.51.2024.12.19.20.11.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 20:11:11 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 10/51] tcg/optimize: Use fold_masks_zs in fold_count_zeros Date: Thu, 19 Dec 2024 20:10:22 -0800 Message-ID: <20241220041104.53105-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220041104.53105-1-richard.henderson@linaro.org> References: <20241220041104.53105-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Avoid the use of the OptContext slots. Find TempOptInfo once. Compute s_mask from the union of the maximum count and the op2 fallback for op1 being zero. Signed-off-by: Richard Henderson Reviewed-by: Pierrick Bouvier --- tcg/optimize.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index b8e9ded821..270051acd1 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -1583,10 +1583,12 @@ static bool fold_call(OptContext *ctx, TCGOp *op) static bool fold_count_zeros(OptContext *ctx, TCGOp *op) { - uint64_t z_mask; + uint64_t z_mask, s_mask; + TempOptInfo *t1 = arg_info(op->args[1]); + TempOptInfo *t2 = arg_info(op->args[2]); - if (arg_is_const(op->args[1])) { - uint64_t t = arg_info(op->args[1])->val; + if (t1->is_const) { + uint64_t t = t1->val; if (t != 0) { t = do_constant_folding(op->opc, ctx->type, t, 0); @@ -1605,8 +1607,11 @@ static bool fold_count_zeros(OptContext *ctx, TCGOp *op) default: g_assert_not_reached(); } - ctx->z_mask = arg_info(op->args[2])->z_mask | z_mask; - return false; + s_mask = smask_from_zmask(z_mask); + z_mask |= t2->z_mask; + s_mask &= t2->s_mask; + + return fold_masks_zs(ctx, op, z_mask, s_mask); } static bool fold_ctpop(OptContext *ctx, TCGOp *op) From patchwork Fri Dec 20 04:10:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13916137 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 021B9C3DA4A for ; Fri, 20 Dec 2024 04:12:00 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOUM9-0008Nu-9c; Thu, 19 Dec 2024 23:11:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOUM7-0008Md-OH for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:15 -0500 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOUM6-0006Id-9i for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:15 -0500 Received: by mail-pj1-x1032.google.com with SMTP id 98e67ed59e1d1-2efe25558ddso1055759a91.2 for ; Thu, 19 Dec 2024 20:11:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734667873; x=1735272673; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Wg8rqRAgWRCDilgaz5IPxRaaVO9cOj5AUka7Masx2ag=; b=dzUQCSS01mB6O3F2CekUidvje6/ZkNftRophfv8T31HeWLqmx2muuH33XJ3gWgFGHb in1/oo/Q4o0/7Nq1HDhNx/IqHc1d/3iMaoV7/5Jhm5L1y4w7FfDVpZFbE39R5pPhpgfd LagNBuibreD5xbQokApJ8mf7TbDb9GQE65zWsQ28mm1V7O81LbOKdxCtPDphukYGMMa0 NBwN5K/tXtl1UxoG89HxuTV6xwMfKrAZDGOI6cBh4Y2jNBJTh8NjHL6gEkQx8uS0MALP Sc1r1C7vktSWqbd+hxwrmavrotNWdDu42W30enbOmmguwF67UHtUGXV3FO2XYm435GPC wYyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734667873; x=1735272673; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Wg8rqRAgWRCDilgaz5IPxRaaVO9cOj5AUka7Masx2ag=; b=F/ZEQmzC7bI8aFLKjoBizB1Unflmti/kG/YS80RoZMMXaMbMT47Ud0OtlQm5kXdIHj X5fxvYl+1bBhVjV9yAzojHwk4JQSzk84Yi1786aafLRQI4RWn7oZl7b0kDxCdneLvUNR CE2Jkh2s/EYR7jHvfm00+fBprKqoR3I++TCIzjJP4tc4NjzHBFklFOLD4TxCdKTTpGJU AOUdylbuYHFrJZOrmPYnjZyoaktl5mil1SpTLNp5Xc8zSgjMzJM0scJbZpQJG/DSMZJb SRVhYZGwFCfRuO84aWnxHS8ze6Fg9MJMNtbVWC5HPB0R0JvgLSjjwmu+9xWyPmVU0ISv 08Eg== X-Gm-Message-State: AOJu0YwHe62WVufPuI3movs4nHkKSMLtphOtV2aTncVoKw6hPkQd7LMT 5zzVK5T4VnGf6A6fe427CAMnJXOuHtLA3m3iqzzdRL7dIrmszD/E8nngXPNWNq02HnhVQ6LfJ+x k X-Gm-Gg: ASbGnctidfklxkjY5TmGu+99rBMH+UWivMslEh19ttxjd0FxFCM1YrXJqNoKxRV8Fdj WHLU/sCi0POBi4ZoIHeBIg4m+7U7sRFmb+1JBlTth2yKwQCftnldaupuKJ7dQFz32P+1AuSNLdh SBBZQ7ntdoiqxKZTNKzxLmEGS/GpwwIq0uoPk5MZ37CQ5XMlVFKYbclZEUdYPgxRi2fPVn77VMO nf5zu+nTG+W1KjjFi83Alhw71vLUddd0gzzF9J8Wb3sN0Ip/hi2Ep8+r+KySl8= X-Google-Smtp-Source: AGHT+IGCarUgOP+jfEAYr/9Yazq590U7Uiesh/nSGWqJTj0ogOStCHvfsbTgq93hkI5eoH7w1JduFw== X-Received: by 2002:a17:90b:51c1:b0:2ee:8031:cdbc with SMTP id 98e67ed59e1d1-2f452ee634bmr2053664a91.23.1734667872955; Thu, 19 Dec 2024 20:11:12 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f2ee26fc22sm4165260a91.51.2024.12.19.20.11.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 20:11:12 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PATCH v2 11/51] tcg/optimize: Use fold_masks_z in fold_ctpop Date: Thu, 19 Dec 2024 20:10:23 -0800 Message-ID: <20241220041104.53105-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220041104.53105-1-richard.henderson@linaro.org> References: <20241220041104.53105-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1032; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1032.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Add fold_masks_z as a trivial wrapper around fold_masks_zs. Avoid the use of the OptContext slots. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- tcg/optimize.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index 270051acd1..af7111c98c 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -1086,6 +1086,11 @@ static bool fold_masks_zs(OptContext *ctx, TCGOp *op, return true; } +static bool fold_masks_z(OptContext *ctx, TCGOp *op, uint64_t z_mask) +{ + return fold_masks_zs(ctx, op, z_mask, 0); +} + static bool fold_masks(OptContext *ctx, TCGOp *op) { return fold_masks_zs(ctx, op, ctx->z_mask, ctx->s_mask); @@ -1616,21 +1621,23 @@ static bool fold_count_zeros(OptContext *ctx, TCGOp *op) static bool fold_ctpop(OptContext *ctx, TCGOp *op) { + uint64_t z_mask; + if (fold_const1(ctx, op)) { return true; } switch (ctx->type) { case TCG_TYPE_I32: - ctx->z_mask = 32 | 31; + z_mask = 32 | 31; break; case TCG_TYPE_I64: - ctx->z_mask = 64 | 63; + z_mask = 64 | 63; break; default: g_assert_not_reached(); } - return false; + return fold_masks_z(ctx, op, z_mask); } static bool fold_deposit(OptContext *ctx, TCGOp *op) From patchwork Fri Dec 20 04:10:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13916141 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 41DA6E7718A for ; Fri, 20 Dec 2024 04:13:09 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOUMK-0008Pn-C8; Thu, 19 Dec 2024 23:11:30 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOUM9-0008Nk-5R for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:17 -0500 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOUM7-0006J1-3F for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:16 -0500 Received: by mail-pj1-x1036.google.com with SMTP id 98e67ed59e1d1-2f43d17b0e3so1413250a91.0 for ; Thu, 19 Dec 2024 20:11:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734667873; x=1735272673; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=C5r1sayG0Y/5s05OtCkYtZE41zRfSkyjZqixbgF1qiw=; b=zL+DdcsWJUbuHWxmCQQLBcjyQRLlc1NTgNZLrxcl0ZA2xmIyuL/6gRUuWzVtAVyd9G LByucI/7xi+pTrI4ayaPaM1hxBa0EJvqliheeKjUlyU0IwdFl0Sjfid3lvTg8XsF0cKh JEtedady+9fmxkTqeX9EltLHE0kfk9edKuBeqyj1T+T2cinaglGq2HCtFKd8YI/uzg0t 0RqEBAoZA/TTMKbTq3IxUuNEDqsFc9hvxfM2pHOQjgrAW/JgvXevULLAge0f7P1/i9Wq PhmA16a/vWB07EfdLJTtWgYpl9N6A5aiU7hTWPBn5S1CQVt78u0SvW4U0fmEjZxA96dp tFFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734667873; x=1735272673; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=C5r1sayG0Y/5s05OtCkYtZE41zRfSkyjZqixbgF1qiw=; b=RJr4A9ttcUKHBW+2oxjR7NDIMqXYOYJWkBpt7USPvVSOaPvGIkIhP8xWaWQyqhetn6 98pXMAh3Xqz8BX5xvOtVk4fMBLntVajqwrCKVmEhsxeNK53/qKHbiB47v1BcHkC+ypUT 0MEG3o15H+7uirJQ/3Qhqwf0D6wpN4ylxFdGbzY25mha+Tys8uEBciM7RYLoK5E5hQT3 F4Spc3DkUaB1QcXcysWI8xe2YmX3HmTSGVfbfKYk2oGvnrprRlc8mV7P8R0twxXsMzXc c4C2Q1YISemKHNxsUf4VPkQCN4+SGvHQR549OTQfein8rl8GZrrL1VOmwPgmD1QtjtPG ZAqw== X-Gm-Message-State: AOJu0Yz8/quTRiY1bPONQaec9cHAjv+/bQI5+1UAfF+LuTuaQR6noWD+ 1pMgpo0rmLJ1K4YSU2xtvU6/rm/kcKxmB5gz8BjUci5briV8svAZ8s40EJOnkDCh5NdjZVXVims y X-Gm-Gg: ASbGnct22XFz297YYt62EzQPHH3+KBGUYqYuQhkRad1XFGFtHR6oW7xTm3Q2koxBMmJ HIK3ZZW8J+sDAfAWQgTR71goo3WRRBPwYPxFl75y1jCVBleev/gXkE/Ki2qjod5zL+IVj9w3Byd 1TrmFq48d3L35C/0VmNu7wSutVj+A783zWSAh0d1WJLK7owlLDtV+mSE9fYJ2Dooxe7WxTtOzw2 J677nD5hHkni4mOeg2l6m02cIfSxo+yjODZt6yn42fjZFkPhJYisuRD1YUgB/M= X-Google-Smtp-Source: AGHT+IH1ruqrvCtfrE/Hxcn+n/SW6NxmVQi7x47e931cHoPZxLdTssPPdlIS/rsneMhz/tfmoCX31Q== X-Received: by 2002:a17:90b:51c2:b0:2ee:9e06:7db0 with SMTP id 98e67ed59e1d1-2f452e1d3f9mr2311897a91.11.1734667873645; Thu, 19 Dec 2024 20:11:13 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f2ee26fc22sm4165260a91.51.2024.12.19.20.11.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 20:11:13 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PATCH v2 12/51] tcg/optimize: Use fold_and and fold_masks_z in fold_deposit Date: Thu, 19 Dec 2024 20:10:24 -0800 Message-ID: <20241220041104.53105-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220041104.53105-1-richard.henderson@linaro.org> References: <20241220041104.53105-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1036; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1036.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Avoid the use of the OptContext slots. Find TempOptInfo once. When we fold to and, use fold_and. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- tcg/optimize.c | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index af7111c98c..de32cc0323 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -1642,14 +1642,16 @@ static bool fold_ctpop(OptContext *ctx, TCGOp *op) static bool fold_deposit(OptContext *ctx, TCGOp *op) { + TempOptInfo *t1 = arg_info(op->args[1]); + TempOptInfo *t2 = arg_info(op->args[2]); + int ofs = op->args[3]; + int len = op->args[4]; TCGOpcode and_opc; + uint64_t z_mask; - if (arg_is_const(op->args[1]) && arg_is_const(op->args[2])) { - uint64_t t1 = arg_info(op->args[1])->val; - uint64_t t2 = arg_info(op->args[2])->val; - - t1 = deposit64(t1, op->args[3], op->args[4], t2); - return tcg_opt_gen_movi(ctx, op, op->args[0], t1); + if (t1->is_const && t2->is_const) { + return tcg_opt_gen_movi(ctx, op, op->args[0], + deposit64(t1->val, ofs, len, t2->val)); } switch (ctx->type) { @@ -1664,30 +1666,26 @@ static bool fold_deposit(OptContext *ctx, TCGOp *op) } /* Inserting a value into zero at offset 0. */ - if (arg_is_const_val(op->args[1], 0) && op->args[3] == 0) { - uint64_t mask = MAKE_64BIT_MASK(0, op->args[4]); + if (t1->is_const && t1->val == 0 && ofs == 0) { + uint64_t mask = MAKE_64BIT_MASK(0, len); op->opc = and_opc; op->args[1] = op->args[2]; op->args[2] = arg_new_constant(ctx, mask); - ctx->z_mask = mask & arg_info(op->args[1])->z_mask; - return false; + return fold_and(ctx, op); } /* Inserting zero into a value. */ - if (arg_is_const_val(op->args[2], 0)) { - uint64_t mask = deposit64(-1, op->args[3], op->args[4], 0); + if (t2->is_const && t2->val == 0) { + uint64_t mask = deposit64(-1, ofs, len, 0); op->opc = and_opc; op->args[2] = arg_new_constant(ctx, mask); - ctx->z_mask = mask & arg_info(op->args[1])->z_mask; - return false; + return fold_and(ctx, op); } - ctx->z_mask = deposit64(arg_info(op->args[1])->z_mask, - op->args[3], op->args[4], - arg_info(op->args[2])->z_mask); - return false; + z_mask = deposit64(t1->z_mask, ofs, len, t2->z_mask); + return fold_masks_z(ctx, op, z_mask); } static bool fold_divide(OptContext *ctx, TCGOp *op) From patchwork Fri Dec 20 04:10:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13916161 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4042EE77188 for ; Fri, 20 Dec 2024 04:15:21 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOUMP-0008Sq-Rg; Thu, 19 Dec 2024 23:11:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOUM9-0008Nv-A6 for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:18 -0500 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOUM7-0006JD-Lf for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:17 -0500 Received: by mail-pg1-x536.google.com with SMTP id 41be03b00d2f7-7fc88476a02so1174240a12.2 for ; Thu, 19 Dec 2024 20:11:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734667874; x=1735272674; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=0rhYtVOEwyu15py/YrAnbR2XfkR4Vy3WymLT2+T9y40=; b=jqNujmXzXkhAasEjuhyN5Q1ZTethUrM47fN5QApZHrsuFSAXszPswy1P8T535H7T5T KrcY7vjSpp1r/h+zhnkqWE8ZNa4lP1AurAebkBY/PZt02TRil/QbroD3LFFwOZm0NO08 R6JFIbRrRPFxBntootqifybz+UP0ZOnQcKyA2XIEXGhLxdbJXK31DZR5tXE+phBiDHSL cF3ren9m5jI273myJGSXBWz2wOJoAempYHlN+EIyffqrWW+9YA8psgspv6Y6/DqcwrBm 0JBb7qdA4bKEZ3M8vWKlQRtlGaA9pvWg5k5sptjNUVKGUWBAHM+EkZmFfhEqQ5uGvoJ1 CHAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734667874; x=1735272674; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0rhYtVOEwyu15py/YrAnbR2XfkR4Vy3WymLT2+T9y40=; b=Ytw4G1wmiMJHY197CaUrx95muEJkVWafjj6c3bOeOh6ctL+Zw446bnoiiJ3lQSMeHW oML7wlsZgHd1QVKr3cxRPoSQ3/2TEumrfjlxY5CEX8Gxq9Dc8QTYO96/ShEx2JFLHkzh 0TECqUkttE1rfNaJV75AOpwm2Hn9alddOPW0h3u1ZJq3rGYy/wxhAYZ3Q3PJB+Vcp/sI rGVrBA0LYCuRN7dusA1IP3veoPwphZuGnStBbHz+3wn1gsLR19ZmR+s8hUUlrF+H36sD hXWRG/bA3Q+2Nf/PcoNlDqPbeqHTvCLwStxfkr9isWMvRXXvndh3CgARowvaXBBZxdDb 6W7w== X-Gm-Message-State: AOJu0Yy6XGrlXyjp/fCgIYfX2oFPTi6XaBOjLjmq6+tpa5qz7Uoy60Mq Tmu0E+whY1NO+vrOtcQRaQ8e4xQV19vzbX2bDGVhUEf5AkbRVNVCvL5TyqosC7j9YEBSY0CGkWd / X-Gm-Gg: ASbGnctIp8dFcGJANFk94zsDP8SEUSrzaMK24+w3M2SIkpQSvJJzzDRTOj2cNG5HUAr fgYeQX4kF5iK1YMZnFtn8yvHh/2bgjq6odElk3qqzva2R/IkExShAte8wRvKtWbFtPlmZJarvyt aGN3gNvquXXh/6GgsXeBi4Y7oimKZRH0anz107M7jGFgUeDGTk5JcWfXUbhxVTHMcBvh+uW+huc wopvXSbhgJugkrOqO2cHgWZAdx5iK8X0bH3EyIEzRK4OLsUa4s5p1WKVrHNsqY= X-Google-Smtp-Source: AGHT+IH1V9tct6NOShDI924xOoqgSAQWJhGFToq3EpOZSGm3yx7W/Ltk3357o7iB7l6SB6lcmRQrog== X-Received: by 2002:a17:90a:cf97:b0:2ef:1134:e350 with SMTP id 98e67ed59e1d1-2f452f02689mr2383973a91.35.1734667874433; Thu, 19 Dec 2024 20:11:14 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f2ee26fc22sm4165260a91.51.2024.12.19.20.11.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 20:11:14 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 13/51] tcg/optimize: Compute sign mask in fold_deposit Date: Thu, 19 Dec 2024 20:10:25 -0800 Message-ID: <20241220041104.53105-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220041104.53105-1-richard.henderson@linaro.org> References: <20241220041104.53105-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::536; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x536.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org The input which overlaps the sign bit of the output can have its input s_mask propagated to the output s_mask. Signed-off-by: Richard Henderson Reviewed-by: Pierrick Bouvier --- tcg/optimize.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index de32cc0323..e4f68241ce 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -1646,8 +1646,9 @@ static bool fold_deposit(OptContext *ctx, TCGOp *op) TempOptInfo *t2 = arg_info(op->args[2]); int ofs = op->args[3]; int len = op->args[4]; + int width; TCGOpcode and_opc; - uint64_t z_mask; + uint64_t z_mask, s_mask; if (t1->is_const && t2->is_const) { return tcg_opt_gen_movi(ctx, op, op->args[0], @@ -1657,9 +1658,11 @@ static bool fold_deposit(OptContext *ctx, TCGOp *op) switch (ctx->type) { case TCG_TYPE_I32: and_opc = INDEX_op_and_i32; + width = 32; break; case TCG_TYPE_I64: and_opc = INDEX_op_and_i64; + width = 64; break; default: g_assert_not_reached(); @@ -1684,8 +1687,15 @@ static bool fold_deposit(OptContext *ctx, TCGOp *op) return fold_and(ctx, op); } + /* The s_mask from the top portion of the deposit is still valid. */ + if (ofs + len == width) { + s_mask = t2->s_mask << ofs; + } else { + s_mask = t1->s_mask & ~MAKE_64BIT_MASK(0, ofs + len); + } + z_mask = deposit64(t1->z_mask, ofs, len, t2->z_mask); - return fold_masks_z(ctx, op, z_mask); + return fold_masks_zs(ctx, op, z_mask, s_mask); } static bool fold_divide(OptContext *ctx, TCGOp *op) From patchwork Fri Dec 20 04:10:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13916135 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F3006E7718B for ; Fri, 20 Dec 2024 04:12:00 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOUMO-0008RH-AT; Thu, 19 Dec 2024 23:11:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOUMA-0008OH-8x for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:18 -0500 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOUM8-0006JU-Mi for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:18 -0500 Received: by mail-pj1-x102b.google.com with SMTP id 98e67ed59e1d1-2ee397a82f6so1398045a91.2 for ; Thu, 19 Dec 2024 20:11:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734667875; x=1735272675; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=m5rs4vqPumew13A8ZSX+8VQdxJZqMApYfWlhr06K4Zg=; b=s/rDZ9KKJbgirDDL8FUf/SJdmpdN3IOwpNEsgnA5Iu3NyqJhIwGBdGcpsH7Gk5BPe4 m9fNHiaMpyXKICMxYA0Gvk9ZLFkNVm8CZf0Rei0XnLgLcCe6eMjhzYFm+upUzpjk0Ipj k779AAwwP8N270KUH27yLLecmA3EvIWsgwQHnlfmboN7SQa0hGOpdWV4gJr/5TSypc5t FDfC0VSb+YEF5G2fPG9X8QkTsleUMaL5bmB2rDhPr8/S1i/X7VksSPrIzBjVBnqoK/S6 emOJIAVC0c+OkrR92td4s2080RPe/2UOzCfEuDFs3Hz0FamoSOkukVb5nDx2Y9dv1jTD UhqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734667875; x=1735272675; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=m5rs4vqPumew13A8ZSX+8VQdxJZqMApYfWlhr06K4Zg=; b=CZ4t7kLImjRbKO57wR1Mk31WEvOdZleo3bW3/ZH2HmMCk2AS4sUmCXy32NSR3h8eGl X2F9UMkHRqOBp5oi7RoUZHKJCZ+fYsahBofKM87CHxxyTuyHunjiiJanQE+Xo0ZsoBqN TMdPPgRspEeW1Px75K9v8yGcWEOzDjDaYsU4giOrqOu4n32+LP6Y2mPxJQ8TOCC/r+mD gac/+I/5uOGqRhtWugKr+5u7Ko1FuZVzKZdSpmKtAXYyP3QxF5LP5cP6aQ5DPg8O83FQ Z8BJS0y+mfbF7Hgp2UvKV942cq0kBoIH+np9dt1MNrpyLItgLcB3ntpkuLaduVfZHMJz IzSw== X-Gm-Message-State: AOJu0YzSH366/nP/BRkxVSYQ+GZ3UOiT3SJdoJLB7Wu6AuEdYhHQlHbh EpTM7XlVwBfz4V2NM9DVzV43e6rL4gF6qWKtq8z+vej6e9oXJvZPkVVQo0FusrM6g7EGkN2nnhd w X-Gm-Gg: ASbGncum51r/1jRK2mHbyHwyxds5r0HlEmS+E0Vm21cOCzVAAVbQx0cfqsyYE1YqAsp OQH5XFhaUlzU94fTWUMgDDB03dXdtY9Y91w5E5rjaEUba7BLYA7DKID/shaCnzhcEaTamUMuuay fv0HgDQvVbTZEP0uGTkWzDfNqYX6/jteLv6Aoeo1th7S1taCz6a3AH0wKukyb7iYlM9D0YmeRMT 9g263gcqZIDqVgtxMitUyV5c0x0OLv3rIDODosNcLfJOC1Gj0cgXH3h0KX34IM= X-Google-Smtp-Source: AGHT+IEEsEgp5pLsb9HDGntalkPQvXsBQrwYoRNhzWNHpKbMr6820mLVrGm81g1qiYmxcfAKgI3njA== X-Received: by 2002:a17:90a:c2d0:b0:2ea:8aac:6aa9 with SMTP id 98e67ed59e1d1-2f452e3ed33mr1988000a91.21.1734667875192; Thu, 19 Dec 2024 20:11:15 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f2ee26fc22sm4165260a91.51.2024.12.19.20.11.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 20:11:14 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PATCH v2 14/51] tcg/optimize: Use finish_folding in fold_divide Date: Thu, 19 Dec 2024 20:10:26 -0800 Message-ID: <20241220041104.53105-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220041104.53105-1-richard.henderson@linaro.org> References: <20241220041104.53105-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102b; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102b.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- tcg/optimize.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index e4f68241ce..0ae96f34e5 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -1704,7 +1704,7 @@ static bool fold_divide(OptContext *ctx, TCGOp *op) fold_xi_to_x(ctx, op, 1)) { return true; } - return false; + return finish_folding(ctx, op); } static bool fold_dup(OptContext *ctx, TCGOp *op) From patchwork Fri Dec 20 04:10:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13916150 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 33311E7718A for ; Fri, 20 Dec 2024 04:14:05 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOUME-0008P0-Gz; Thu, 19 Dec 2024 23:11:22 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOUMA-0008OI-IL for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:18 -0500 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOUM9-0006Jk-7v for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:18 -0500 Received: by mail-pg1-x530.google.com with SMTP id 41be03b00d2f7-7f46d5d1ad5so1069668a12.3 for ; Thu, 19 Dec 2024 20:11:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734667876; x=1735272676; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=prpZjgFsa/vChv6dl20aQjC+mL9aG1wh+Y/YSCIlCzQ=; b=xoH+6XJtGRf9SyAxg+nTYlG0OmcorQR4SdVcPygihM+elcZh7KujXZEujWWNHsiWi2 dQlhTLRp04N8Ms/C5D0n2jW3MKe6m1ivF/1nF6hpp8bjil9ej1SJAvV0tYEAAMZNbVlq 121PjHSeLJgKyuv1HgbfD3V+Vf8cY30hwPUBiyQF1/RFkCZtTWf/bvulxul2irV4flr1 BFXX9SKTS3MY6R7LsFQVR02DpqussF+dCAYJNXuzZ18AzByAOKh02Y4MxIW8KVMS8639 3YE0+MvGRe6XhgBdATMsGuNEBLhDf/qV1zy3PddLiUXnAIKnL3r2sZZFS0HKUeULolAa 2/jA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734667876; x=1735272676; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=prpZjgFsa/vChv6dl20aQjC+mL9aG1wh+Y/YSCIlCzQ=; b=I1tzgHUv69NGdo6F6hiIi1ehvWHt4lGySO1TR5gdB+K+PgiibBFRA4DbyOdZMlPG72 I+8RCqIMLzrRiL57rMSKEHH1NZfniNjQEauWIbmM+4Q9kaxcSORtby2rXxo/Ng57bVAf yFZf0uM48pu1SzZZPejl48rhBuOy1e7BnenSfbeKwMXC295JuEul3B3wWEPQG3E3yJpD HRNXClfsc8mQdMNq+o5RKaKjcxit6SwscVXuFJwN8fUOngBbz8SVCceSiQl+2RNqh/qS uzxaQPNuRSU2XmhuxXfIIwWtmQEde9y4Dteq4mmEA2UQ2gjhGZ44jgkAjZrEUmCvDRvE 88Gw== X-Gm-Message-State: AOJu0Yw900hcrmAXQpRMMa88zhkr5gurE38u0RWCZwxzMnecru/uVQHw 77XTRDumrJqGpTuEBAdpMS6iLjR3kIoxkxSUxRQTH04F/CaD51LKPDAYY2i8O6i/YlErGjqIw30 M X-Gm-Gg: ASbGncvNgDRfsU1WisTLwH5S8MhVMYYLaRryypnKz/voozabuBrjs2AYMFopqnz7RM/ KTPE1JxUGtGc6g0RxZhBx0ieWX4m/beSzkjHfdNZm2+MnvrLpjve6QsyKA4h3hBQx4xRz7o28Ti ZSacBW29NNL/VyTmXay7rLAU4amMKlzeTtXAckbdBa+TeEJ9yy3aXbdzVlJ3iuLwePw3MHWxAuu IKRrrfrOiQrN0meaYn0zeHBHwayTtRJ8axD69x09XJhJjg6urxByAWlCuJfwdQ= X-Google-Smtp-Source: AGHT+IEWnGOZGKmwoNL9C2i6G2ZsLw9V8P/jPAAh8ki6to5d586jEA9ZR1sZtwy1wZBuisJS1x6OlQ== X-Received: by 2002:a17:90b:520e:b0:2ee:b0f1:ba17 with SMTP id 98e67ed59e1d1-2f452ee8cdfmr2337945a91.37.1734667875875; Thu, 19 Dec 2024 20:11:15 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f2ee26fc22sm4165260a91.51.2024.12.19.20.11.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 20:11:15 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PATCH v2 15/51] tcg/optimize: Use finish_folding in fold_dup, fold_dup2 Date: Thu, 19 Dec 2024 20:10:27 -0800 Message-ID: <20241220041104.53105-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220041104.53105-1-richard.henderson@linaro.org> References: <20241220041104.53105-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::530; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x530.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- tcg/optimize.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index 0ae96f34e5..0232fa852e 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -1714,7 +1714,7 @@ static bool fold_dup(OptContext *ctx, TCGOp *op) t = dup_const(TCGOP_VECE(op), t); return tcg_opt_gen_movi(ctx, op, op->args[0], t); } - return false; + return finish_folding(ctx, op); } static bool fold_dup2(OptContext *ctx, TCGOp *op) @@ -1729,7 +1729,7 @@ static bool fold_dup2(OptContext *ctx, TCGOp *op) op->opc = INDEX_op_dup_vec; TCGOP_VECE(op) = MO_32; } - return false; + return finish_folding(ctx, op); } static bool fold_eqv(OptContext *ctx, TCGOp *op) From patchwork Fri Dec 20 04:10:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13916188 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 14954E7718A for ; Fri, 20 Dec 2024 04:19:25 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOUMQ-0008TD-47; Thu, 19 Dec 2024 23:11:34 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOUMB-0008Ok-Pm for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:20 -0500 Received: from mail-pg1-x52a.google.com ([2607:f8b0:4864:20::52a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOUMA-0006Jy-3L for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:19 -0500 Received: by mail-pg1-x52a.google.com with SMTP id 41be03b00d2f7-825c6570a80so925244a12.2 for ; Thu, 19 Dec 2024 20:11:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734667876; x=1735272676; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7nPSOr42G4L6zld5O7HAmbijFDz7S6mbvQ4Sk1BkFg4=; b=M4Vlu4PStqhW/b02tje/lBg6wC/P5EsJIP7d1KTIwa8EmhzOxGR5pwPofKJ9EMI8wu YjkgCfYOoVSTqNJieEFq7il+E0dACA25XyY2eofFAKRrGWLqDtZEsYYzEZe5a/YPAnuZ uXQF7og/lJRpJPlJq0SpvKX0vVVtNKt8PqiPphUFxwX7u9yes5PGLBtfV+r5KDkvomy9 iL4rvRyjqDr42/iBKQdScwNp2WgMffCGuaH0T9flRgtN4qtpa8D2ZwXdGrQ+EAVA2wlH 4v65tckcDfvjHoz4xL8DtlVq52B8R7HVKOzedeB26L/5hGODtEnpCeU6eoEOB9R/Qzd/ Znrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734667876; x=1735272676; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7nPSOr42G4L6zld5O7HAmbijFDz7S6mbvQ4Sk1BkFg4=; b=sUWh3XIhXPad/WAORql9eqeBA6iBYE23k0yV6IdC8sFvUYO7h3DAIM7f8qdqKenzbx wX+CpYzzIRlPaG/nxbBi6juLgnxvS3pBqaYAuwlebN0RgJi9nPEG3vLgNiejcxblSVmG zFULjpL/arEhKb+tQ1OqF91mcNavxDwwda3NiJY2/1JaiwjbrlT+XaMyv6/TJITvGIMC qyT9Q7B4NqdL8Xvg7SpVn8Hg0ZdKKovP6LuYLm/ZUuXhxukQcZOSt8pUrt3FDB7XGoNx ZIO1WnqVKNdFOQ1XU75Tjd0GRvPh+llgKDnTiccCqhPb0YOWKvhyI99utb8DbRdsI8Mg 1F0Q== X-Gm-Message-State: AOJu0Yz4uDa8NVSFyzZ/ihJgr8L4xGDLvhArEDuTXqXbkA4k0W3Mwsro h2SwFCSZspQFBiQe5k9hGE4efQVCCv8S6juGSqifeMTn0pYkuc+9s8ERB5GFLptp8kjqkgOnjKp i X-Gm-Gg: ASbGncs2pS2jp7DSiaQphK1VsxNrW2fogaNwJ5AiuLUT8U2wqEOrboVA+wyR0zuJ5z3 Jspqf3ELQrzXAWW174LAYc99TCJwFaQkF/uc4RmXSHRIr3WhRvl+9K2xCuYbTROrZss+h5R/p3Q 9Z6V5ezd4hrQ1jlOrxRGuTihd15ygIONhuflvKJo/M3wYSS0CWtdGw6mXsUl9HxTqRtEguC/CEi S4xjh1iAJ8/tJwtp/qO0SY4dsc+0cjymoRnR50nv/U7lPnxPWMwtQ+RCls311Y= X-Google-Smtp-Source: AGHT+IF00VMoCH7GEtQJV8kYywar2tKyg/pNEpsrH13Uh9XRPNDDWA/qleDMEggdzxbGu6yIcrofzg== X-Received: by 2002:a17:90a:d646:b0:2ee:ab29:1a63 with SMTP id 98e67ed59e1d1-2f452dfccb7mr2109201a91.3.1734667876601; Thu, 19 Dec 2024 20:11:16 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f2ee26fc22sm4165260a91.51.2024.12.19.20.11.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 20:11:16 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PATCH v2 16/51] tcg/optimize: Use fold_masks_s in fold_eqv Date: Thu, 19 Dec 2024 20:10:28 -0800 Message-ID: <20241220041104.53105-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220041104.53105-1-richard.henderson@linaro.org> References: <20241220041104.53105-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Add fold_masks_s as a trivial wrapper around fold_masks_zs. Avoid the use of the OptContext slots. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- tcg/optimize.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index 0232fa852e..56043a02e0 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -1091,6 +1091,11 @@ static bool fold_masks_z(OptContext *ctx, TCGOp *op, uint64_t z_mask) return fold_masks_zs(ctx, op, z_mask, 0); } +static bool fold_masks_s(OptContext *ctx, TCGOp *op, uint64_t s_mask) +{ + return fold_masks_zs(ctx, op, -1, s_mask); +} + static bool fold_masks(OptContext *ctx, TCGOp *op) { return fold_masks_zs(ctx, op, ctx->z_mask, ctx->s_mask); @@ -1734,15 +1739,17 @@ static bool fold_dup2(OptContext *ctx, TCGOp *op) static bool fold_eqv(OptContext *ctx, TCGOp *op) { + uint64_t s_mask; + if (fold_const2_commutative(ctx, op) || fold_xi_to_x(ctx, op, -1) || fold_xi_to_not(ctx, op, 0)) { return true; } - ctx->s_mask = arg_info(op->args[1])->s_mask - & arg_info(op->args[2])->s_mask; - return false; + s_mask = arg_info(op->args[1])->s_mask + & arg_info(op->args[2])->s_mask; + return fold_masks_s(ctx, op, s_mask); } static bool fold_extract(OptContext *ctx, TCGOp *op) From patchwork Fri Dec 20 04:10:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13916136 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EEF7DE7718A for ; Fri, 20 Dec 2024 04:12:00 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOUMP-0008Rt-Cs; Thu, 19 Dec 2024 23:11:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOUMD-0008Oy-0v for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:22 -0500 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOUMA-0006KL-Uj for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:20 -0500 Received: by mail-pg1-x52b.google.com with SMTP id 41be03b00d2f7-7fd35b301bdso1245588a12.2 for ; Thu, 19 Dec 2024 20:11:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734667877; x=1735272677; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pYuC+YHXS7R+2bMWumhxixewSDDRoEnZD362H6THvd0=; b=T19GeWlWwO+8frr3L2RM4FGFtIb2S8RldA8yT8RlGx8IQ7vCqqk1J4l0xdnQmyLOfY Xczxrw2FKgEdZzdYGMs1Q/1OWTuh2xlBQJsIpPNC/tPUNSgcl6Pp+hGBj8XnZLPZKz3H 9PezAS+iUL6LE8fE+HFe8cXWQ7hOn8FLgY3yZGCOySPrirp8EtE0+SIbpekTV7YWGzSa c9I/slwGF8jvQr+9mJ4z8McL0kmw7NTY58SNuPNcZLfGODAsET70IPENj1mZVYMLGVfF 46g/W0rDTks6tkfnXQGhjETvtDSwQHcESe0Gm0Gc/hbUu/R5DUtnenjoIOZrmiJCCuHl YSKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734667877; x=1735272677; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pYuC+YHXS7R+2bMWumhxixewSDDRoEnZD362H6THvd0=; b=o0lD4SV9D9F3EggvR9YSj7dWxUcaP4TpFxS0giQQKRXuwAisQDCOYa2nTbtOI10wfo Zwh+OP50JL3NMFL8t9sA72mGjzU35bRFVeEuz1PtAbC5Z2g9Eqmi3aBm9C42IIRUst5+ 9KeT/PyqYTC4d9jLWLAko9bKwKzI7+VDq7FDUsRYgkjGAz51UzhIUrg934Wi8yXpPbIP AP+1shaQaW+rwuQdaylAHLsYbFCavusu3v4cXXoR4ppYhoTwPDrHG+h0LjaEv4NnhSd4 nx4whfCYdBIhEROZvSszQOzRPYEuE06WcEBMCiWoOM30GZ6vvLzYGxnqq3zC7ILhLFkV BOPw== X-Gm-Message-State: AOJu0YyqGefKEXOiCcEhCzmr2ZkleiOTwMaoON9SEN7Ad2ZtJJM/kgAa GD4Yh5gvBxNYzJMO2OxKOBc9gI3Ubl3Iv3qCp5wga+mpo/En5nwbPYBuy781qK+kxyYyWl9qGVt f X-Gm-Gg: ASbGnctl4dImm9AGJZi6Fzzc6hshF6v0lJJQhMxk2eACRL/O6Ve4YvK/CPSK37d8NXV g5nln4l0vP2HoeNnYlHAYKm8y5tkJgH7DEXX6rC68jCFm4Ik7Am92S1fdbJ71oR8uI1u7nVgj3X 9g5MH5AYaBFboL/JE28BzrRrVusr3GDRncrrGm5SX1AUJGFQ/WqlRu+DZptUsmex+PZHsR229b6 SG0sgbcn8xOue9k29eu7jTbtzOTSMB+btnBtpe6j8Ep4XM1EeXiHqIWHCN4LaM= X-Google-Smtp-Source: AGHT+IH7e8S4eyWlb3ERXkwe9Yc5QTrMBWKO26w7CfUIfZ1z8JJkkegL5kSyFGWKhsUG96gJnWJLJQ== X-Received: by 2002:a17:90b:2f45:b0:2f4:434d:c7ed with SMTP id 98e67ed59e1d1-2f452e1cc5cmr2464537a91.16.1734667877385; Thu, 19 Dec 2024 20:11:17 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f2ee26fc22sm4165260a91.51.2024.12.19.20.11.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 20:11:17 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PATCH v2 17/51] tcg/optimize: Use fold_masks_z in fold_extract Date: Thu, 19 Dec 2024 20:10:29 -0800 Message-ID: <20241220041104.53105-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220041104.53105-1-richard.henderson@linaro.org> References: <20241220041104.53105-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52b; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52b.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Avoid the use of the OptContext slots. Find TempOptInfo once. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- tcg/optimize.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index 56043a02e0..6f7166414f 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -1755,25 +1755,22 @@ static bool fold_eqv(OptContext *ctx, TCGOp *op) static bool fold_extract(OptContext *ctx, TCGOp *op) { uint64_t z_mask_old, z_mask; + TempOptInfo *t1 = arg_info(op->args[1]); int pos = op->args[2]; int len = op->args[3]; - if (arg_is_const(op->args[1])) { - uint64_t t; - - t = arg_info(op->args[1])->val; - t = extract64(t, pos, len); - return tcg_opt_gen_movi(ctx, op, op->args[0], t); + if (t1->is_const) { + return tcg_opt_gen_movi(ctx, op, op->args[0], + extract64(t1->val, pos, len)); } - z_mask_old = arg_info(op->args[1])->z_mask; + z_mask_old = t1->z_mask; z_mask = extract64(z_mask_old, pos, len); if (pos == 0 && fold_affected_mask(ctx, op, z_mask_old ^ z_mask)) { return true; } - ctx->z_mask = z_mask; - return fold_masks(ctx, op); + return fold_masks_z(ctx, op, z_mask); } static bool fold_extract2(OptContext *ctx, TCGOp *op) From patchwork Fri Dec 20 04:10:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13916166 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 090E3E77188 for ; Fri, 20 Dec 2024 04:16:30 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOUMW-0008WN-IR; Thu, 19 Dec 2024 23:11:40 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOUME-0008P4-Dj for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:22 -0500 Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOUMC-0006Ke-Pu for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:22 -0500 Received: by mail-pg1-x52d.google.com with SMTP id 41be03b00d2f7-7ea9739647bso967896a12.0 for ; Thu, 19 Dec 2024 20:11:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734667878; x=1735272678; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=m3AWL6HxtV2uFTdmZozJUF3KalTOisLiJ8sjQ5ZB2Vs=; b=scUzPaISNr7yqA9e0UJGGEfGGJSbhYp2MVgn9Yynjy337Q1Cvjhm/WDe/TKJsYDdpX 5qHUoYyrm8duvN2OeuuZOJrtjOubR3K3s9dxMP4o86GjupFkpWHXBS4dTaUSyhMDEH5i YMrW7eKoPlJb8hMwosTxo3y8AOND1BnBFw1xli8Y19q3rAL2n4+wIaIT/UYIeYPHt5Ir pzZADyvJW7ZUXeyFmvNHq+YvmILnq1hKItQHQ4K06iP5E1QIixn8UOH/enpLtTv1bufE hDaWAhrvkh9lT1IefV5WsHrfD/MxpvygXVqqkyrzYtXMQ9pvhChVeKiUHnW3MFjVZe8R GAtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734667878; x=1735272678; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=m3AWL6HxtV2uFTdmZozJUF3KalTOisLiJ8sjQ5ZB2Vs=; b=JvARlqc3oQaRKkZzBs0BRToJX08/XoOl3X20YuDGX6WZ2frIRonFBcPFFGYDuewxOQ oEdCFF/qFuDYjJTxMCw5PI8BpNjdmwoteC9meH419C4Grh9SOUxvEdkTnHPYdtgthgQ7 tzfmDebzL7IWuZLApiqO2COJcelB1ayDBJKw5Wmc/7iURshll4PAwD3Jy/GPuZEJghUN xfroJSmrOkwYQl7vuQJ1YYgyRcAPuTxT+aDXWCvROECZk4gK+gsdYBnhkJCaTj8IXE4u xbL5vn7MSKshioyEiz7gORIYC+UQdVE2WHQran34dtSecChCM/pHBq/0Cqq0yry7foan zTHw== X-Gm-Message-State: AOJu0YzjPv9YghGSQWvACS3MWKBqoKdME//QORqU1lJcnSQ/m6cMHAQZ 5ITeB7ajcDQ6tMJRxD0mXMFRLfztRDVhEvPzGB7VBJyF8h4hXievUEfz9N9bNvCaRaKxzSBBw8u k X-Gm-Gg: ASbGncvYBb7JxFajeK7TXUc3JXhVFQMytf7keai99A/COei1nl/TEnxBi78MT8r9LOa Qh5jj4Fgd8B3pmT/4s2Kobl9b1wU1a3SMKVfPQFmZnutd7VlgRvOmxKa3/CmjBXMKmP2wG6qaxA 2Rzmo/5SeXj/gB70qlWo/R+rpuR92vEQ6xfC48NZfbEm2AeVaso6LMssQMzRSMnXB1lN7Zo27Yc f9scuj4u4qOu4jB9hNsu9bQxgDAbKpKaGkGdFMeiyTjmwHAbo18m8cb+xTaceI= X-Google-Smtp-Source: AGHT+IE4H+EYoCowirJF6/SSZUuv48qI7Bgi0t/rnS+KFE/Femva1HMZUf0FH+07w1ChzhzBcXi1/A== X-Received: by 2002:a17:90b:2e4a:b0:2ee:ab04:1037 with SMTP id 98e67ed59e1d1-2f452e36956mr2448055a91.17.1734667877991; Thu, 19 Dec 2024 20:11:17 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f2ee26fc22sm4165260a91.51.2024.12.19.20.11.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 20:11:17 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PATCH v2 18/51] tcg/optimize: Use finish_folding in fold_extract2 Date: Thu, 19 Dec 2024 20:10:30 -0800 Message-ID: <20241220041104.53105-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220041104.53105-1-richard.henderson@linaro.org> References: <20241220041104.53105-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52d; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52d.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- tcg/optimize.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index 6f7166414f..30bce33ca6 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -1789,7 +1789,7 @@ static bool fold_extract2(OptContext *ctx, TCGOp *op) } return tcg_opt_gen_movi(ctx, op, op->args[0], v1 | v2); } - return false; + return finish_folding(ctx, op); } static bool fold_exts(OptContext *ctx, TCGOp *op) From patchwork Fri Dec 20 04:10:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13916172 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5D6E0E7718A for ; Fri, 20 Dec 2024 04:16:49 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOUMT-0008Uy-Kh; Thu, 19 Dec 2024 23:11:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOUMF-0008Pc-AS for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:24 -0500 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOUMC-0006Kq-QD for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:23 -0500 Received: by mail-pj1-x1033.google.com with SMTP id 98e67ed59e1d1-2f43da61ba9so1178865a91.2 for ; Thu, 19 Dec 2024 20:11:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734667879; x=1735272679; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3uGMa5ilZclwRxAxELWf+zCLQJhdJ3SzUWO/11Vp97M=; b=PXBak6qEcNBrHs/6j008BNxaJEoUumNiZCLxrB7UYXIDgkHQPdZSUYu7liAlmn2Wge khwghgFDSGynujFDg7TBE9JUvKKNtTI50F4m6gtHerHd5vWFeEIJ5XJGsUH3Me7S44xq csir2jUT1y6Fusl4LmQpTWHLuWqrPbenGH5juHbJRYDtkiwz8+GPhvnHJ0jawf1pG+bG jiBIQfzN6iAL9lSMlVUyW71CG6D/vFvVyHnsQnGk3OetA3d5BANaqnfKTcW5Um6Ez6Wi pkOHILpnvpFDlbgbqH26uQ5CweAomCVleKdKaXDgRN0EzUUpjtSOHFs3c25rC0aUCED+ 5Eng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734667879; x=1735272679; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3uGMa5ilZclwRxAxELWf+zCLQJhdJ3SzUWO/11Vp97M=; b=Cst6efL0qXoEzUdFXTD0LYxryTOPlbIhyGI6x4zJkO4nYI6mS9GwVjaDMrEayjWA3V ZNqmkvZJVU1t4WxHhOMt10XFzdt+5T7qOgAa3yEaPhSLDmEgybu4lmPscvlKCaffQI8J BJhr2UolzIpGoVw0ZL2CFIXQucvzC22JUEKMIRBN6uBik0lkXPBgXSwvFBZAKdo3GWOQ qKIz6CIkv68pZ5eXjZFFEByY9MCixEJzg4KtgOx5vDESqSEI+CZpEjwLFeJBmsa8Uc0Y 7JuGlCoIQH5/HIEYQVOrrixeW8ucHfiHoB9aiGVq4OB5EMYyqqqa5jHkLWXvMWrithXG Ql6w== X-Gm-Message-State: AOJu0Yz6o13xFPaVuG/QwjU4mqk5W9hqsRuau/jQm/Sj22n9eLHX7uWn I5MO3sMqu1TGZJ0L+bQrCoiNG6ELsmNQswHR9DVZY2Os9U+yYDhhsl5ZWweZ1XNJXiQt4fMndCE T X-Gm-Gg: ASbGncvV2D6faCPU9IfvRBAi5MrEGzQl7meroLqTceqUM5mdO47L3CIaCcWlOTNSdK1 87K6/pkUx13FtKFzp2yZ5uW+XakRJ80IfY0LIPe49pJuFpjv2BRBfeapliFkOccVOkzL7BEOjHc 3bHN2/EXmd2GFLCO3OQyAkTdBpetoWQhsUfyty1R4lKHoRmwGxMw51gvc8Bs/xQSTv2KoGKDJUF fZR0wY+8CWYISbrN4gTSaX+N4joxzm29buR7QEEu+qkTi757UHSm6VifruUQMU= X-Google-Smtp-Source: AGHT+IHEHii6PfPfZVn7yw9BbM2Ukjl0jDlGdKkC9ws/agScjwl7+k5ubDX2wdgOQB2RdzJPlWmOzw== X-Received: by 2002:a17:90a:da88:b0:2f1:4715:5987 with SMTP id 98e67ed59e1d1-2f452e1e7b4mr2348647a91.9.1734667879112; Thu, 19 Dec 2024 20:11:19 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f2ee26fc22sm4165260a91.51.2024.12.19.20.11.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 20:11:18 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PATCH v2 19/51] tcg/optimize: Use fold_masks_zs in fold_exts Date: Thu, 19 Dec 2024 20:10:31 -0800 Message-ID: <20241220041104.53105-20-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220041104.53105-1-richard.henderson@linaro.org> References: <20241220041104.53105-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1033; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1033.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Avoid the use of the OptContext slots. Find TempOptInfo once. Explicitly sign-extend z_mask instead of doing that manually. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- tcg/optimize.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index 30bce33ca6..659190dcd8 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -1796,47 +1796,43 @@ static bool fold_exts(OptContext *ctx, TCGOp *op) { uint64_t s_mask_old, s_mask, z_mask, sign; bool type_change = false; + TempOptInfo *t1; if (fold_const1(ctx, op)) { return true; } - z_mask = arg_info(op->args[1])->z_mask; - s_mask = arg_info(op->args[1])->s_mask; + t1 = arg_info(op->args[1]); + z_mask = t1->z_mask; + s_mask = t1->s_mask; s_mask_old = s_mask; switch (op->opc) { CASE_OP_32_64(ext8s): sign = INT8_MIN; - z_mask = (uint8_t)z_mask; + z_mask = (int8_t)z_mask; break; CASE_OP_32_64(ext16s): sign = INT16_MIN; - z_mask = (uint16_t)z_mask; + z_mask = (int16_t)z_mask; break; case INDEX_op_ext_i32_i64: type_change = true; QEMU_FALLTHROUGH; case INDEX_op_ext32s_i64: sign = INT32_MIN; - z_mask = (uint32_t)z_mask; + z_mask = (int32_t)z_mask; break; default: g_assert_not_reached(); } - - if (z_mask & sign) { - z_mask |= sign; - } s_mask |= sign << 1; - ctx->z_mask = z_mask; - ctx->s_mask = s_mask; if (!type_change && fold_affected_mask(ctx, op, s_mask & ~s_mask_old)) { return true; } - return fold_masks(ctx, op); + return fold_masks_zs(ctx, op, z_mask, s_mask); } static bool fold_extu(OptContext *ctx, TCGOp *op) From patchwork Fri Dec 20 04:10:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13916144 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 61EAEE7718B for ; Fri, 20 Dec 2024 04:13:47 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOUMS-0008Ty-Hk; Thu, 19 Dec 2024 23:11:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOUMF-0008Pa-9Z for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:24 -0500 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOUMD-0006L1-99 for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:23 -0500 Received: by mail-pj1-x102d.google.com with SMTP id 98e67ed59e1d1-2ef6c56032eso980322a91.2 for ; Thu, 19 Dec 2024 20:11:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734667880; x=1735272680; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=c/ah1dWGqejqWrs6MT+NkiuxSvH28n+inVu2cC1XbF8=; b=pPFas3z2KDvEOYTzIqa/ZJyJkaSOJvyqDPmo8+7t1P9P+YjkGDJHVO7DeO7fA/qM+/ VdgRKkZQIV0kqflrx/OVkmbPnzzXRwOTrUHNm5gOjXAPmTObE7IUz8OOXJNmdVEeOSEv FKTKHYoCR5Fw0zbC2No88L3SRMJTesVRMPxpSeTm2NfuSAGkw++zeo9rFaGx56mmR0Lg UCARvv13ZOf2vQd0H3Luij1ZQe+ZV2D5PyJeI8tLGLmQR9ZH9BmsT3rvWGYIE3ZCsDFh 8VwTQMb2DAxnGNFPu9DKg20TyDpOwBNAS7qLaAkQb3ONgBy/Xi78wgM2n4UE6CoN4JDp pFEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734667880; x=1735272680; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=c/ah1dWGqejqWrs6MT+NkiuxSvH28n+inVu2cC1XbF8=; b=ixPCbQKe+Lcn8+Q3l8KTr7p79udsthQUen8D6WjZaN/9FprrbA1fDIm5egxfrDRl+i hNZodKaYj8x6EANqgJNPsT7Fsfn1zBb/Dh0qIPFaDAt3rjyW9muLMJ3woIwSRBqvsJ/B 4X086y8pxJvJhqd2Zr1WC4ANUs48HXgWZ4+zlon+ZbgaS78gh+3A+rCGDrHtbnwagYSo Otz15YjKeaCJ/z6Oyc1eGqEQ6+RI0OcPS57bpyv3OsDneXIQLlwJTT54nIPgCnV0Nokj G0nzwaVcVvLdvB0DGJ8N4vTrgZdXvn1SVz2Jlb32tX8S5UUpv8oByasTIzJRw1jPAfPd JIEg== X-Gm-Message-State: AOJu0YzWBWm6inZX6LatpfcSA71t8InmIYQhuTD3xseKlVnd0+RFlVNS jvw0MTJfvQlUYwMhC0ah7z4wPB9TM16nzTm/UNHsU8EZ4TpvQhJfe3qMtOLHU2hYpvfkHB3H0/4 e X-Gm-Gg: ASbGncsC3pPj7Xyr0vAdej7Yw/q/HO4P2ktvK1+mk8Yk2Nwa8JJu/bChUFpWX03bshO z1fuPcpXKOZ9JEstDj8BbzDIt/GpkOHYj7gzqyQ6Ck2Nsc+eS2U5baRXe4BYLoNUFOp5klxmchk yYQZmdtEF09gQHcFYyzLL4Ibmrv98Otmcb/D0s4Oa8XdkH6BSRw3hMgILDbLG9eUmd5P3/N8YHJ medh3rdZfV1oWU4/YNqDFGfgAP5YiPbnc7VRBcNIWTbZF8IQGTKZDBtsnnkHJo= X-Google-Smtp-Source: AGHT+IE7pDtLeLH7lEIFJbUq+uUHc4igYPb9+7PzmFyZm8bR4Xd+2ecCuHI5nqkKDva+oVQfcL9L3g== X-Received: by 2002:a17:90b:518d:b0:2ee:c04a:4276 with SMTP id 98e67ed59e1d1-2f452dfcd8amr2404191a91.5.1734667879863; Thu, 19 Dec 2024 20:11:19 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f2ee26fc22sm4165260a91.51.2024.12.19.20.11.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 20:11:19 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PATCH v2 20/51] tcg/optimize: Use fold_masks_z in fold_extu Date: Thu, 19 Dec 2024 20:10:32 -0800 Message-ID: <20241220041104.53105-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220041104.53105-1-richard.henderson@linaro.org> References: <20241220041104.53105-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102d; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102d.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Avoid the use of the OptContext slots. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- tcg/optimize.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index 659190dcd8..85e6dcdb26 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -1868,11 +1868,11 @@ static bool fold_extu(OptContext *ctx, TCGOp *op) g_assert_not_reached(); } - ctx->z_mask = z_mask; if (!type_change && fold_affected_mask(ctx, op, z_mask_old ^ z_mask)) { return true; } - return fold_masks(ctx, op); + + return fold_masks_z(ctx, op, z_mask); } static bool fold_mb(OptContext *ctx, TCGOp *op) From patchwork Fri Dec 20 04:10:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13916142 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 40A0BE77188 for ; Fri, 20 Dec 2024 04:13:13 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOUMX-000052-41; Thu, 19 Dec 2024 23:11:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOUMF-0008Pd-B4 for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:24 -0500 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOUMD-0006LA-K6 for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:23 -0500 Received: by mail-pj1-x1033.google.com with SMTP id 98e67ed59e1d1-2ee46851b5eso1121756a91.1 for ; Thu, 19 Dec 2024 20:11:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734667880; x=1735272680; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=M3YEuh2xqNooYYBq4iR7eWG+DbYvG5silVCxI+MmVcs=; b=F2IspAkYSsoD1nG405XCrWgPQAqtExRmh3d4dY0mJkRoZj80ItdZVzauuymNoLvsge 5UgtBd9UtQ2KCv6AkEH3/Su3oJ/nYciED0wzRedKcnE5qXch+eq2cTXEr5L5zbUF98k5 OHMbV397YhqzM4i1aQmaQL/semp7oThX+eRkevp1ycI9FTPBJOpc1GIYAt70xjaoLvQv PV5wAPTpLeuKNFqoh6SZ27Z/k0cFHUJEoMJ8vbIbK2nSdzREecNmVmuYQVxal1RBdjzp fkZCYHHt7LY3RPldrELRBpyxYuq4OUkTX4VFgZjXAgE+iP/84I+DJ83vX682ZaIAnNkw ukXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734667880; x=1735272680; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=M3YEuh2xqNooYYBq4iR7eWG+DbYvG5silVCxI+MmVcs=; b=bn5jGi/PBgCrXAEk/cB32BtM5scy8bkyQ+c871EtG5Z+fDGM/G0FNAK48AOuE5O2il 4o6pslCMUH5qaU0o4VFXTWqCE0Z+L9+SrZPoCcF7Xye5lhrBksBhnQ/gQmu3zlpcmCL0 /A4tIIPOAGSZqhPC6HCQ5ezIjXJxeo0l/LpyOD1P7kaj4Ys976z7vap0FDnf7IoDPYm+ aQ20KI5Zeuk/Q6ntKGDhsj43wMafkvZaX0AarrGpQQ+3QRa4e14tX0i2MSPYDbXW9qeA syZt8EJy4UP1D3hpH/IK/toSA0SFbCZkeTArYy63ueHkgA+wb2qs3fCISLRd28ZQjX/E meNw== X-Gm-Message-State: AOJu0YzoK5xOeoA0HpeIdtAO5yQTcqqSN9VyeAko15kTbgoqDACs18Q8 rp0oSV68QwV6v/9FL4hDKizKmTRvmEF8xKdKxg7kKw/8Q3nTnF3/FktFx6U1NCgyoVFs+QJCIym Z X-Gm-Gg: ASbGncuAVHX9DnWZhiVj/X7d+vgSd7Aky9hsLvso25FnuGUAIbyYYNr7pUfsAuS+MO6 afiRSuFvJVtoMnlwVtg0QfEI1PlLQyotUymQvuNq8B53FdJdiqxreueCwXlJbizudDgzM/Naijf 5h2+KgvwyIoKmYAvrKBMYQqlkD4lX8L3ipFK8xtyXJec2GfzlUFqAnnUoRd+qggPIVEcumKTFXj S67m/YV0rXzfjVRzpfsOm6f1I6jOdH/esdgjRYhORYBnJiT8tSL1FGNcx23TEY= X-Google-Smtp-Source: AGHT+IGg6vpG8Kge+dgWmadUUesCGOHjq/yhrp09JZXHPxwEyKtnlEC1gLYEtR+0I9ENdSIsr22irA== X-Received: by 2002:a17:90a:d64d:b0:2ee:b2fe:eeee with SMTP id 98e67ed59e1d1-2f452e3021cmr2623306a91.15.1734667880491; Thu, 19 Dec 2024 20:11:20 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f2ee26fc22sm4165260a91.51.2024.12.19.20.11.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 20:11:20 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PATCH v2 21/51] tcg/optimize: Use fold_masks_zs in fold_movcond Date: Thu, 19 Dec 2024 20:10:33 -0800 Message-ID: <20241220041104.53105-22-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220041104.53105-1-richard.henderson@linaro.org> References: <20241220041104.53105-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1033; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1033.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Avoid the use of the OptContext slots. Find TempOptInfo once. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- tcg/optimize.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index 85e6dcdb26..e00d86ab2c 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -1906,6 +1906,8 @@ static bool fold_mov(OptContext *ctx, TCGOp *op) static bool fold_movcond(OptContext *ctx, TCGOp *op) { + uint64_t z_mask, s_mask; + TempOptInfo *tt, *ft; int i; /* If true and false values are the same, eliminate the cmp. */ @@ -1927,14 +1929,14 @@ static bool fold_movcond(OptContext *ctx, TCGOp *op) return tcg_opt_gen_mov(ctx, op, op->args[0], op->args[4 - i]); } - ctx->z_mask = arg_info(op->args[3])->z_mask - | arg_info(op->args[4])->z_mask; - ctx->s_mask = arg_info(op->args[3])->s_mask - & arg_info(op->args[4])->s_mask; + tt = arg_info(op->args[3]); + ft = arg_info(op->args[4]); + z_mask = tt->z_mask | ft->z_mask; + s_mask = tt->s_mask & ft->s_mask; - if (arg_is_const(op->args[3]) && arg_is_const(op->args[4])) { - uint64_t tv = arg_info(op->args[3])->val; - uint64_t fv = arg_info(op->args[4])->val; + if (tt->is_const && ft->is_const) { + uint64_t tv = tt->val; + uint64_t fv = ft->val; TCGOpcode opc, negopc = 0; TCGCond cond = op->args[5]; @@ -1973,7 +1975,8 @@ static bool fold_movcond(OptContext *ctx, TCGOp *op) } } } - return false; + + return fold_masks_zs(ctx, op, z_mask, s_mask); } static bool fold_mul(OptContext *ctx, TCGOp *op) From patchwork Fri Dec 20 04:10:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13916187 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 852BAE7718B for ; Fri, 20 Dec 2024 04:19:24 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOUMT-0008Us-HX; Thu, 19 Dec 2024 23:11:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOUMF-0008Pe-Ob for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:24 -0500 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOUME-0006LJ-CN for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:23 -0500 Received: by mail-pj1-x102e.google.com with SMTP id 98e67ed59e1d1-2ef6c56032eso980328a91.2 for ; Thu, 19 Dec 2024 20:11:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734667881; x=1735272681; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=50pAv+oMelKz+SzYeaXvQfHyrSKx1AQ4ZmtRaoZUtTM=; b=kKy4gNfTaxIQyGmZGBlAAPkJZkQdBXTuUiJDMjDt0duvX01TRW+cwi+vBqts6gRH8L Jpj8a9wmU7L2MajcbWTqmnBz39nb0SrKIkqrj1dr1yrMfJen3L/XoA1HQ12P4ZkBrmkV tyqVBTPRRMID2SX14OFFneYUGuFvqyI7FGq6NwCAIg6PpfCwZxXluoH8pVwLDJzRkshm s9xB6cfrJJNsm2o032oh0kNP+KVYPQDlX20rnU1CGS5kKsW0iV71tx5WbnJj5pBkkE4f wbGulM3X+KDjhHUcO2O05uMt2Z7NpV0Zi/8cOKhz9WydSrftbnvnYBtI3ed0WCwJD7Ig k5pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734667881; x=1735272681; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=50pAv+oMelKz+SzYeaXvQfHyrSKx1AQ4ZmtRaoZUtTM=; b=GXsd8ncuLtKgpTn3hNJ002Dx5CxKugUC+ysT0THG1HTjJPTxHSANG2/Leow9rErB6F lA5IpCTC5YPjXWrczSQdXBChBq7gxsVrFpxs4zRyKX03y8HckkI3B1/DI2DVJRnwco1f F7XbC9AWhhiZ4ZGnLkHf22NBeQthmNFL+Y1UXe1QHcOYxFwr07mGr+CvWbYZ/w45SQzO 64Mx51WFFZhwiwnbyp1eO62UI/MUkyzWW75H0tdcZ+umxjf/c6//Lpsj/A8FRRDku2hN KNec7sJ3WVpd3jaJ5hw4Q0BPrzyWNqhsSWvA9aaESwym1LdWp+fA8mmGrQPK4yUscoBr cvLQ== X-Gm-Message-State: AOJu0Yx4/pXYpEmQ9hbXTAomjdijUgumaX+/LZu4mw4iRxEqtXdTZJnZ Vins6ouXGlyyCEzCQyjniOQ6c2OFASnphUYQREUgDfFBdMsf26WjOZPPngCir3g4fUHl34F5oCq h X-Gm-Gg: ASbGncv0lICakVNNKHGd6JCtuki+SgIFM1hA3GUTOexsnjqKRdbC4ww7xHieUkDxarB +pRWSOEp7BQzGZWkjHAoqtgJCY684u+N1ltWcmHAHACcJ8VMVzEqOP5l+gx443zK/qoMoebRQ9e g5RLYPEBG/5zNE+++L3XK5OHB0qV97zyGDpI4jVBwSJcN9LiqSYeeVGrRw/+Vye4qYl0ceat1js WlFSB/uFxmQRX5j6MbMOlH/el4qDTpkZMEVsBinqfvheYyox21HuMyt675ymfg= X-Google-Smtp-Source: AGHT+IHt0mAXMafq9lJqLO3M+QuO/3xYISfRgTBiUK44zqvE4aFipdy9X8jQmoHzZsou6GttaMTM5w== X-Received: by 2002:a17:90a:c2c8:b0:2ee:b2be:f390 with SMTP id 98e67ed59e1d1-2f452ec3780mr2098079a91.28.1734667881024; Thu, 19 Dec 2024 20:11:21 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f2ee26fc22sm4165260a91.51.2024.12.19.20.11.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 20:11:20 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PATCH v2 22/51] tcg/optimize: Use finish_folding in fold_mul* Date: Thu, 19 Dec 2024 20:10:34 -0800 Message-ID: <20241220041104.53105-23-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220041104.53105-1-richard.henderson@linaro.org> References: <20241220041104.53105-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- tcg/optimize.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index e00d86ab2c..5b71a98cc7 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -1986,7 +1986,7 @@ static bool fold_mul(OptContext *ctx, TCGOp *op) fold_xi_to_x(ctx, op, 1)) { return true; } - return false; + return finish_folding(ctx, op); } static bool fold_mul_highpart(OptContext *ctx, TCGOp *op) @@ -1995,7 +1995,7 @@ static bool fold_mul_highpart(OptContext *ctx, TCGOp *op) fold_xi_to_i(ctx, op, 0)) { return true; } - return false; + return finish_folding(ctx, op); } static bool fold_multiply2(OptContext *ctx, TCGOp *op) @@ -2040,7 +2040,7 @@ static bool fold_multiply2(OptContext *ctx, TCGOp *op) tcg_opt_gen_movi(ctx, op2, rh, h); return true; } - return false; + return finish_folding(ctx, op); } static bool fold_nand(OptContext *ctx, TCGOp *op) From patchwork Fri Dec 20 04:10:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13916145 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9A611E77188 for ; Fri, 20 Dec 2024 04:13:49 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOUMS-0008UC-LD; Thu, 19 Dec 2024 23:11:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOUMG-0008Q4-Hs for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:26 -0500 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOUME-0006LX-S7 for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:24 -0500 Received: by mail-pg1-x530.google.com with SMTP id 41be03b00d2f7-7feb6871730so964103a12.2 for ; Thu, 19 Dec 2024 20:11:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734667881; x=1735272681; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=R+Y+Gl05V5R9wO/k+rBUGjrtuN3gf4BK1vVOJZqpHsQ=; b=qJbAnaNYEx7xkAyd8YS5D8HzA99DH5FPjCz8+5qBMNIZsSVyZi2Hq1KmyNkHj6VljX 3fmmSRMBlYrcd3WSWAry4XZDRHGDu2BOnW73lCTeIqqTy/Yjb7WCMVgkc0G3RY8cr9uH vwA6BMkTwSc8oljBVZeCFyf2yJxV+wDNmRRVvXQJC/cB2b4YmZ/UIHZ0wJBuGK/TBwfE fF76to/k63N8qpgN/SrZQRWmZZ2mMYVEsxPN6T8GUQL5mL8NmH0eFNtwlBNcgGdH/9ZN 5nF8mYWJX0JhnS29O+l7al+qg1uJzCh83iJ36QVljyVqf/UdAYljeByJ3FGE9w0GST5G rLrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734667881; x=1735272681; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=R+Y+Gl05V5R9wO/k+rBUGjrtuN3gf4BK1vVOJZqpHsQ=; b=Q66kyOoBbDB8ijKHwHVEqOdA/90BD3r9bcKdtpUCb7xP8AmS5VrjpgUnJ/4PZ2PY7m 5mluDWiwtpHud6OoyXw6v8Cp9wwANl1YJJcvKBQnFr9m3ttwBouAP5wm7BX6xz09UM4S KyTunFV42cyGTHSLiBCrF73pdvs9KqFWYeVA8NUWJQtaCJAM3vmf52CaU4IxRJVmAooC yuJ0ZDFSQIBM/WqCl+7k2+iHtiFOfB/g6J5oyL2NlLHwXCWBoJLNgJIbbwJTmBafXY53 +bYB4Y3bnHc/deBRr3alJSY0CcfOKN1JJExj37IXGt7fnK6iLEtu4XWQgEKwoHgFIBli eFag== X-Gm-Message-State: AOJu0YyvsSaZWNogo/i6ZEMAsPA2aDRKDZRG8Z3qMnHWTFh1oMCV2mTC O9ai4GxIq3Y6njisoWu1gMaSIm+1OV/EQ1khya7c8kLef4lYQfyD8WSeEvH+y62ypnFNCowdkju y X-Gm-Gg: ASbGncsquK6KQda9p4/nqhZxYmzUXrhtJWd/Jf6R1eWVvrcKZ0YmoHPaNu032Dr5L/m fkDWMcGZKtrGagHAi849x+EmS+krtLDN2fNUz6P/Q28q/W8lLSMRjaOnVS0Az/jKKwSWhtekd6j Vs5Crh9S9Fay1GWIiV28AEWLFmtQk+hF3mz5yAysqYC4zQG5CF0UqNXle4nKkhqJCcHyGph0X2b V0lRmz8B3VzzdFNHPpde9H0p7ztFV5iJfS7nr2Q/3+3jOn70xvKNIIHaUX6gNM= X-Google-Smtp-Source: AGHT+IFvQFTrhIllXQxSHElY+PhL6g9fQdjsArZSQW7pvCxFZIgsX7XP2t0tFIqjDcaNFxD/5rJdpQ== X-Received: by 2002:a17:90b:54c6:b0:2f4:434d:c7f0 with SMTP id 98e67ed59e1d1-2f452e22c43mr2788986a91.12.1734667881629; Thu, 19 Dec 2024 20:11:21 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f2ee26fc22sm4165260a91.51.2024.12.19.20.11.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 20:11:21 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PATCH v2 23/51] tcg/optimize: Use fold_masks_s in fold_nand Date: Thu, 19 Dec 2024 20:10:35 -0800 Message-ID: <20241220041104.53105-24-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220041104.53105-1-richard.henderson@linaro.org> References: <20241220041104.53105-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::530; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x530.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Avoid the use of the OptContext slots. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- tcg/optimize.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index 5b71a98cc7..c206c0f40d 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -2045,14 +2045,16 @@ static bool fold_multiply2(OptContext *ctx, TCGOp *op) static bool fold_nand(OptContext *ctx, TCGOp *op) { + uint64_t s_mask; + if (fold_const2_commutative(ctx, op) || fold_xi_to_not(ctx, op, -1)) { return true; } - ctx->s_mask = arg_info(op->args[1])->s_mask - & arg_info(op->args[2])->s_mask; - return false; + s_mask = arg_info(op->args[1])->s_mask + & arg_info(op->args[2])->s_mask; + return fold_masks_s(ctx, op, s_mask); } static bool fold_neg_no_const(OptContext *ctx, TCGOp *op) From patchwork Fri Dec 20 04:10:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13916146 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D0E6CE7718B for ; Fri, 20 Dec 2024 04:13:50 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOUMU-0008VA-CU; Thu, 19 Dec 2024 23:11:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOUMH-0008Q6-0m for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:26 -0500 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOUMF-0006Lo-Lk for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:24 -0500 Received: by mail-pg1-x536.google.com with SMTP id 41be03b00d2f7-7fd2ff40782so1278039a12.2 for ; Thu, 19 Dec 2024 20:11:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734667882; x=1735272682; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9O0R53WBozPK/I6haxAxuHnNfQ0ZmBvA6nPgwPPpwik=; b=piVosxdpT6WLwOZs8QxDhzHhPI8KxA8qWCBExNg16MbW/sc6SWhMj7R9DUXMdco5ql E3kADkR5D/oM77YnytrA6rYbDYV374RghkO1Jyrz8HWL8juzE8YrDoyUrJJWK2pCPCb/ eh9jnahdKVFGtmJyeauDYpsyoA1rGIKmos1Y5gAH1CxUbUVLcPKLYTR3wyycDvkpqgxA QJgju0Sls7dVSYYm0BbM4nu0KPEXqUPDT+ICLY24q8ueKbKVhvRQxVw2WNeW7GG0Geb8 TXc+jrf0x2XTiLCelFrtHoE+6yw5eJoBiQeyJhXarUX0gjE3GAYJ33+Ws6wf+zJXqcKj YxUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734667882; x=1735272682; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9O0R53WBozPK/I6haxAxuHnNfQ0ZmBvA6nPgwPPpwik=; b=LgH1gEP1HXLNVc7PjiKrsvvWd+I677RRL5eokR0JDvD1yCb9iwRToOf4kVgrDsRgVA TEY6keszZNWtIEVrSE5VTdz5charwHVzsjaM0D+n+BkNU9xPVPuutjImDEqIcEfqTv4s GUsFL4JkSywH3HJnFP6aKAr1bqgOdB6/9GjK+Oe4+SSHlwOhZ5fs9YDmjYQLEe3MzDr0 w1dIP+2M71juXCbB0NKMdwqJbXJas4BWDZjvSuQf6QdWdy4gyZvQNXDrYUNip9U0qlIZ VOvxWAW8pRhRQmwlsMIFwu1M5xGRmRZYVgIHcOssc+7Ew595ODjmS0oFEZvRVBKj9Oow 7oOQ== X-Gm-Message-State: AOJu0YzG2fHRqft+EEyGZMywy6b1dBdMgCA/O/pdg0F3IErm0QSwznMc FDFyn/OEMfxdEKTQN7RqECXM8PrV/spg+6rStKZTLLUch97i0JjRoCROIpxlSdyzArpG+eVLgJq m X-Gm-Gg: ASbGncuBz5QoiU5jUyZCybz1tf+2XanCNegRwtxi25LE+bTFjg27XdjdP9lgVoDsz/4 ze/fCSRQlGtZ8b9QA4WHDChaARPKRp9nDDfUYPfah1BuUj5V2CDbeStJupwHLtuGQz2Eu7n8kMv SG4m2YP0ZVsQnG7xzqhsc1IktHpq5W3pcaT/2YXPUoFjFBbnCTnsahTTXUwku6stxhZOmaBuCft rP861NOqscMOUGFa4xZLBn9EszGQItHoploHoYmQOYMcFD2aVcxbpijWXc1Xgk= X-Google-Smtp-Source: AGHT+IEd8C1N8uBkeX24a5/gVcchpvtipU8dtfpuwnSuqI+ag4wfq0dtTFgJIQpKmXZBfCkYWIyQXw== X-Received: by 2002:a17:90b:2e0b:b0:2ee:c4f2:a76d with SMTP id 98e67ed59e1d1-2f452e4ce1amr2034024a91.21.1734667882366; Thu, 19 Dec 2024 20:11:22 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f2ee26fc22sm4165260a91.51.2024.12.19.20.11.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 20:11:22 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PATCH v2 24/51] tcg/optimize: Use fold_masks_z in fold_neg_no_const Date: Thu, 19 Dec 2024 20:10:36 -0800 Message-ID: <20241220041104.53105-25-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220041104.53105-1-richard.henderson@linaro.org> References: <20241220041104.53105-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::536; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x536.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Avoid the use of the OptContext slots. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- tcg/optimize.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index c206c0f40d..baf545df24 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -2061,14 +2061,9 @@ static bool fold_neg_no_const(OptContext *ctx, TCGOp *op) { /* Set to 1 all bits to the left of the rightmost. */ uint64_t z_mask = arg_info(op->args[1])->z_mask; - ctx->z_mask = -(z_mask & -z_mask); + z_mask = -(z_mask & -z_mask); - /* - * Because of fold_sub_to_neg, we want to always return true, - * via finish_folding. - */ - finish_folding(ctx, op); - return true; + return fold_masks_z(ctx, op, z_mask); } static bool fold_neg(OptContext *ctx, TCGOp *op) From patchwork Fri Dec 20 04:10:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13916160 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 70869E77188 for ; Fri, 20 Dec 2024 04:14:41 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOUMg-00009x-JG; Thu, 19 Dec 2024 23:11:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOUMI-0008Q8-K6 for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:28 -0500 Received: from mail-pg1-x52f.google.com ([2607:f8b0:4864:20::52f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOUMG-0006M4-99 for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:25 -0500 Received: by mail-pg1-x52f.google.com with SMTP id 41be03b00d2f7-7fd17f2312bso1114379a12.0 for ; Thu, 19 Dec 2024 20:11:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734667883; x=1735272683; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=etPXGBNUHIHB3heMgrLuh2eOx7VVtNwo2nGUXXUzJtc=; b=zFzXk1GY/Pyl6WwV2fbNnk9P4+W2Bm37pQu8KIgpeQWdgacck9P3bFVTF8V8j0JKNu vrVOiKtaHO2pJAlFRXKuUOACeTKUzKfPEPts30qnI+eynkkZIpjm2pdqk06OpVpglU6M vCcpYogeOQ2h9pXPZ+4O/whpcDnaYbpmPjSI7IHQMQFr8RYR5UnA8ro8LeTUBoWuPvfI ZSmBYcj4ptlbP+prKgIwYLJCFtFa9zWUK624N05knZrRxCIoS2BVIxuaFO/PZ4v5fWoc Vv0dNLTOgvNYH1/i+LLrJLwo6sEpx1XZayBA2R2NIIqiLaP9XIcrVEIZRbnCRrc7144j ZAJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734667883; x=1735272683; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=etPXGBNUHIHB3heMgrLuh2eOx7VVtNwo2nGUXXUzJtc=; b=L3PkP4AHg3kLXDN2ckygyWnSUKkU4gb60/phEvgSGSeXJdnC7Moz3zGMaPhmcKCDR4 vsPnRNHSuqsl/64ox8OdIY/uRkLdhBcprPw6m4EWEkkt/9c6qVkRyOKg7RMSecJdj8rR mKlw16VpivkPn/n0UjyGWczO5S88dbqtzEX7wd3F3seLFfIO4f77JIXYtjCxdR04lxD/ LzpSYG3r5/7zYP88RJXQTnmIrBC8fPickRt8BlINV1E2D9qkmjvMJnGr5QrW/KqD5e5L CYtdnF8svNu9o4s3s1/gmVurMSjKlwTTpx2QbksoiVBetXNhORr2d9f9pVeCiWuZBX73 T+UA== X-Gm-Message-State: AOJu0Ywhx/iyogTTJDw3Ag0tdPX1obltPfkysrAZyZeRqVt5Hvfi0zi9 sCbmzmw7HChn3dnJvqLkrS94XD+1qfv3tdMxGX6O+5y3AU6wg/4eUVYmV6xnO8Uxj8cF1Bqjqri 2 X-Gm-Gg: ASbGnctrE7PzbX81rRKafMggJb8xUrUIC4JSCE2aphdRZoCF32ebAn+NPbgxQABIVjx 59AW2xQWLDAfOQQV+1VQOk/uu5gLoMmfTOgTb3k4/eIDGvjNGz6hIy2lTWbi8jVTmnMMQbo2MDJ xHHyvu8NPCTESu5JFPDnYGfwTg6/zE3E2NKkcWyh4wPMWuHSgT7WrlfaOa8Mc6oEnjpuVbfl9sj tronDFZfWZuLUKSG0SttX79D8DRY/r0V5pVkcg+UB/HFSZuL6KOuexo3yZFvhM= X-Google-Smtp-Source: AGHT+IG5tseq7Kcn+oaT/Rj96/k6woRY4VgcJ8GIZfuuASON/w9+CJuyd/irCv3+lrW9tT17JJDfnw== X-Received: by 2002:a17:90a:fc4f:b0:2ea:5054:6c44 with SMTP id 98e67ed59e1d1-2f452eeb641mr1914839a91.31.1734667883027; Thu, 19 Dec 2024 20:11:23 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f2ee26fc22sm4165260a91.51.2024.12.19.20.11.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 20:11:22 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PATCH v2 25/51] tcg/optimize: Use fold_masks_s in fold_nor Date: Thu, 19 Dec 2024 20:10:37 -0800 Message-ID: <20241220041104.53105-26-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220041104.53105-1-richard.henderson@linaro.org> References: <20241220041104.53105-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52f; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52f.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Avoid the use of the OptContext slots. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- tcg/optimize.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index baf545df24..04f0f8b9d2 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -2073,14 +2073,16 @@ static bool fold_neg(OptContext *ctx, TCGOp *op) static bool fold_nor(OptContext *ctx, TCGOp *op) { + uint64_t s_mask; + if (fold_const2_commutative(ctx, op) || fold_xi_to_not(ctx, op, 0)) { return true; } - ctx->s_mask = arg_info(op->args[1])->s_mask - & arg_info(op->args[2])->s_mask; - return false; + s_mask = arg_info(op->args[1])->s_mask + & arg_info(op->args[2])->s_mask; + return fold_masks_s(ctx, op, s_mask); } static bool fold_not(OptContext *ctx, TCGOp *op) From patchwork Fri Dec 20 04:10:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13916191 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8D64FE77188 for ; Fri, 20 Dec 2024 04:20:43 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOUMV-0008Vt-Lu; Thu, 19 Dec 2024 23:11:39 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOUMJ-0008QD-Pf for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:28 -0500 Received: from mail-pg1-x529.google.com ([2607:f8b0:4864:20::529]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOUMI-0006MI-Aj for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:27 -0500 Received: by mail-pg1-x529.google.com with SMTP id 41be03b00d2f7-801c081a652so2049670a12.0 for ; Thu, 19 Dec 2024 20:11:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734667883; x=1735272683; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wYogLE2cJhonKzxn/dJxhdWBVbT5TGD35lyasdR9UTA=; b=zPxi7xfQrSJrOS68OxzZFZLwbAxMyUdtO1j+S0Kr9We6XhdhWLSJxg96WTx1ymYYdQ Vc9jYq51G3l7JT00AopT2M0LsdfU16sVzJMvxT9yRy63KJT1bo6N1FfypC67PmBvyZzJ mY0KZd80pdGa3FWMqmelyuZKehnNksk5T/Ke6mqSN6FaCnKJ56ASplORfve3107jR3l/ /RNEAXtZ8WeEQcYZ5Yh9i339t8eVdXJjM3a5AgLJyTMPCIUVAlUTSzrJGfS0LOqp1j9x SQk0ug/CS/XcpetYWj1WKwfKbRXtzChn6vTR3t0g/ZwSOKdIU3YFQa32apJdZQh3PdZF J7dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734667883; x=1735272683; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wYogLE2cJhonKzxn/dJxhdWBVbT5TGD35lyasdR9UTA=; b=MTlCLSWe/8RcQLSGTEaZRkTWEjQc3KkQJs0Kxo/Snf7NybxCvSDrD6/z9TsG1ZaMmz VWDBOTbvxO9M3pvrkiqvWngHcQIkBrwBUEHWrLcciF2392fzEpNpt7of4XOQSYLuUqC/ vVV8Mn5Fu1KdCalQf1rG3l98ealA7yAMT1o7bsanyRtyDDQIMvYA5G2gaGDhdqHGy1RW gj+uKSU1N9jaKT9EbNDAHLncZqc5sIBIZ/0NyAj5yiyno2uZIcPG50uwikLHNPQeDmUz lWQNdltPXDRr80cCMyjU3gpfaL+pP4/eml1bd8xu+yfvQCVYA/DhxcFERe2bwtJ95abT xh6A== X-Gm-Message-State: AOJu0Yzoxhx9VR02Qe/V7cOuoxq9HpWkAFVmJuZyhZwpELq59u8pavoG TVbyv5sR9zxfnUiY1z560KzR2/OnQfFgZnxK5g5YgyMbUyur5zZFBviuX7cyMP5ejS1uygBDywf / X-Gm-Gg: ASbGncus0e3g21/JB0Wg/mTYSKE4w/HlCqbHGEKITFdUdSHq5MQfNwqRMBlrzDpxcyK xqXowLvS5cFpHHelodOs0c0ZItjkueluh9kiPL4Tk2zyYFtML6pe1FFecYy/StVQ5CHUHaAxnIm f8u8ALpPs8QsrdFbUbfuuFhe6ijrJYHa55/EqNdXsyOiwkK3R79Fx5bOe57dUhHoJ6sPu9bInN8 yCz0jpEp4467CybTAkw+ZvQ8NEaJbi1O25VJlcpU6dLXzU1kWcEL0H2A7+KofM= X-Google-Smtp-Source: AGHT+IFM/1YsrxP2O5pY3oLmdWIbEbgeehzJceHG1PsImHy8r4ItsbGuJepipngSpmRedL5qWztk9w== X-Received: by 2002:a17:90a:d502:b0:2ef:ad48:7175 with SMTP id 98e67ed59e1d1-2f4438e4b30mr8648213a91.15.1734667883597; Thu, 19 Dec 2024 20:11:23 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f2ee26fc22sm4165260a91.51.2024.12.19.20.11.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 20:11:23 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PATCH v2 26/51] tcg/optimize: Use fold_masks_s in fold_not Date: Thu, 19 Dec 2024 20:10:38 -0800 Message-ID: <20241220041104.53105-27-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220041104.53105-1-richard.henderson@linaro.org> References: <20241220041104.53105-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Avoid the use of the OptContext slots. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- tcg/optimize.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index 04f0f8b9d2..6af23f8512 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -2090,12 +2090,7 @@ static bool fold_not(OptContext *ctx, TCGOp *op) if (fold_const1(ctx, op)) { return true; } - - ctx->s_mask = arg_info(op->args[1])->s_mask; - - /* Because of fold_to_not, we want to always return true, via finish. */ - finish_folding(ctx, op); - return true; + return fold_masks_s(ctx, op, arg_info(op->args[1])->s_mask); } static bool fold_or(OptContext *ctx, TCGOp *op) From patchwork Fri Dec 20 04:10:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13916190 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DA40FE7718B for ; Fri, 20 Dec 2024 04:20:12 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOUMV-0008VK-1o; Thu, 19 Dec 2024 23:11:39 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOUMJ-0008QB-NK for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:28 -0500 Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOUMI-0006MX-BV for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:27 -0500 Received: by mail-pg1-x52d.google.com with SMTP id 41be03b00d2f7-7fc99fc2b16so882570a12.3 for ; Thu, 19 Dec 2024 20:11:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734667884; x=1735272684; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ubZIvSbsmGCFHv6oeJRswF5HFflaseUD+CX++cK93ls=; b=vx7im5Azh6gFryvr2+baTl0wZg6WDN2nA+s/wWU5aZCiymdvnRIvXYZrtmIE70yoCu D3ov0bTSTFnBclgJsNB0MEUHHHWAYUvv9A0LHhuf5fFB40on7EBx3TF24jACzh5cLbQz rtmW5iueghSQytwelggvdDvU7oojNc3Wj+QvZUXxuPbTFwtz7Zdcf9rbasc7M6TX95ap IjK6yjaKwyJAWPuvb4tqT9gC9Lot0AwxgEBF14V16k+oQW0+UaHdV+EEKB/Y6aaC+Ek4 jpK/Q8NSNoOI6Yp0/CKOEalsaGcAYym+DBq+nO+IMDEQ9X6Y/htsOMnGYpIfTR0hH6gY +YBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734667884; x=1735272684; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ubZIvSbsmGCFHv6oeJRswF5HFflaseUD+CX++cK93ls=; b=gM5J6HJmzai7nDXDe0TxMLJs66AiBvH5tO4yf4xO811wzLt44McFHPds9SX69EiVZQ UqubHxT5MXS26za1/fqu3J8XJ4bdFtbsIgnwT04iDaIOI077lgBHbR5aDS5MXb0WembD qm57mrRbteOc9JqR/oZskPIfo7yfv0hC2AKTZFesiEFHZwGTC5hiaiUlG+odJAvGF9rC pFoBSaISu0Dd7eUQK/W3G03ceoY+VZWGEf7/sB+ZLj78ZGBVQkH+VdmT/XJyYGer4zmA aszAiy24LPVzlQiCRsQENXeXWjHPWvfpQSi+IZseJiP4oUUKhCZyAUwikcb/gguaJlix Ddjg== X-Gm-Message-State: AOJu0YxEe+lwGB4qKXenYc1r/PRZNLZU5PnsvfXZXyA9CW4wkp/1suKP tS6p8ihbdXQVUsMyhploIVFfctpCeZpWToST/EptRBYoPukRIcKTDijLDbx9CSL+9dkEnzBqSH7 W X-Gm-Gg: ASbGnctdGIl5VyBwC4fr9sdU9q3VvazmTajMxgwSZwpy34Cp5XDO4hNCORoxNCqi8W1 +UH+GIGe6L6hcnf8tLOZE5e0w2gLyruDrPXGcEAJFT8pK+fs5XiZuJmmg7UJpNNmiFk7ZNqbfUp DPvBEqNq8zMuqErHY2cX75z9uqFOTLLw2I33z7YgEQ/ujrAk7vqVaKDO7CP0+7clDG2McOPfE8j j5xjhQTePiF4+FRjldXhN2NrrKJZA1J26EFQk05VH+D9z1tveE5m1SqF5xfM40= X-Google-Smtp-Source: AGHT+IEoSuBnWYygaaxBt5FZh1ykpzYxPOmAhRrQ5XC0zQhbEvFWj+A47qlpnYfpPQsE7wXUmcFdag== X-Received: by 2002:a17:90b:2b86:b0:2ee:edae:75e with SMTP id 98e67ed59e1d1-2f452e0a44dmr2296450a91.13.1734667884228; Thu, 19 Dec 2024 20:11:24 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f2ee26fc22sm4165260a91.51.2024.12.19.20.11.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 20:11:23 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PATCH v2 27/51] tcg/optimize: Use fold_masks_zs in fold_or Date: Thu, 19 Dec 2024 20:10:39 -0800 Message-ID: <20241220041104.53105-28-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220041104.53105-1-richard.henderson@linaro.org> References: <20241220041104.53105-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52d; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52d.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Avoid the use of the OptContext slots. Find TempOptInfo once. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- tcg/optimize.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index 6af23f8512..9b351f0521 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -2095,17 +2095,20 @@ static bool fold_not(OptContext *ctx, TCGOp *op) static bool fold_or(OptContext *ctx, TCGOp *op) { + uint64_t z_mask, s_mask; + TempOptInfo *t1, *t2; + if (fold_const2_commutative(ctx, op) || fold_xi_to_x(ctx, op, 0) || fold_xx_to_x(ctx, op)) { return true; } - ctx->z_mask = arg_info(op->args[1])->z_mask - | arg_info(op->args[2])->z_mask; - ctx->s_mask = arg_info(op->args[1])->s_mask - & arg_info(op->args[2])->s_mask; - return fold_masks(ctx, op); + t1 = arg_info(op->args[1]); + t2 = arg_info(op->args[2]); + z_mask = t1->z_mask | t2->z_mask; + s_mask = t1->s_mask & t2->s_mask; + return fold_masks_zs(ctx, op, z_mask, s_mask); } static bool fold_orc(OptContext *ctx, TCGOp *op) From patchwork Fri Dec 20 04:10:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13916157 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 77456E77188 for ; Fri, 20 Dec 2024 04:14:25 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOUMg-00009q-1l; Thu, 19 Dec 2024 23:11:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOUML-0008Qa-3A for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:30 -0500 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOUMI-0006N2-DL for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:28 -0500 Received: by mail-pg1-x531.google.com with SMTP id 41be03b00d2f7-7fd17f2312bso1114388a12.0 for ; Thu, 19 Dec 2024 20:11:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734667885; x=1735272685; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=C1oOVeQtXZQwGm0E7MKnqUzsP3l72cl2b6h7Zprs2aQ=; b=Q3e7tRkHrbuftw3DhY964Z9YGRCSGkL9gsPAJjQGn76d99gdwXj7dMqTOWvUSv+24c TShaZA2VEuVI+R93E16nHKE6cXM+SUtNoy3C1dMwoIthhCWYZcL2TFLqLf2SvvbxGYlP 6hokPUpNpighxgUi0AFO60sv1+VdzyE1AL5cmJbJBVsv3m1nHKeisrJg7TdgfVlTdQKu hZo0nI/xIVKcgNqXlhJTxh4haYiMQCdbr1K8pof6WeKE1jUp85b3WFr2zINg7Vawo3pk 7VTJUf9h53yFJjC+WaGniTfxcP6ilFmfNTy6yBrJPXyIjGiuk4CAJgzhWAPXwfMP6CLY kzrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734667885; x=1735272685; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=C1oOVeQtXZQwGm0E7MKnqUzsP3l72cl2b6h7Zprs2aQ=; b=rcFztXZxPpVmAKORWfruzMBuHiF5cqOg31WOVhgMkdswDdF5cQjmWpdL/nPCy6WLON lIx4KUHZ+Fo1o2S8cNVOavk6KpiCikrJU8DkczQq3UEdFUEGtGyZmNGJDelHvbkMjvG8 vEpfL/HOFbmqMiMFYiW0Pefpps62KIsZ/3McRSEzsHgRYnBm8HfsqXmRkeaM05lMIGyj g/8nA9PH2NCmifTcS9IKej4H/bMN3ZZCGrroOYvk0F+cHLJEoT1CqfS9qXjKDDvRGygs GncpMc1NOnKVNhDvP75j97gCAGHWTCdusBm+JnstYR5yy4J3UG47xalcNbxQE4w+M/j3 YP7Q== X-Gm-Message-State: AOJu0YwqWvN3pJKSKVXSqu6tHEFEs2MIGzEun42jKsMfVuFUvutBhV3A XY7PChGIVL7LL3PMt/eyma24FSqC0JfuicDrWWNtvJH5pouSxrffUYgHLOMVdkCLNB2yhKm/HMk 5 X-Gm-Gg: ASbGncvVX/jI0k1gU/mPl4SAEczjwL8supj1pDT08pOu6taGQfuTVzVNumcY7KuPI1i /DwJi4fKvXMnLeLfKx1WDyKoepnzcmCXW7evaKG04lGwS3ONR8FTnJ6cE4nITrF4HbeT61Jm/MR XwwciZ1qzz4im5gTGU5/UW9CZ2hJJ8XTiPGvPTQg+PihKGue45c4XuXelGuST34PwiYeQ6njgUs jAMT0DcUiqJt+wqAjNR6RsuKkXaCpEpLwrsZc+2eW+SLC+/Qu0G9fQGCaBqFbU= X-Google-Smtp-Source: AGHT+IGxlQUH//I6G62f7pg6rmB7hQbNTs6jnEnA4//6Rpa/StTTfsaSgCItsLkSALLKYbr0Yph2cw== X-Received: by 2002:a17:90b:53c5:b0:2ee:74a1:fb92 with SMTP id 98e67ed59e1d1-2f452dfd236mr2228302a91.6.1734667884834; Thu, 19 Dec 2024 20:11:24 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f2ee26fc22sm4165260a91.51.2024.12.19.20.11.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 20:11:24 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PATCH v2 28/51] tcg/optimize: Use fold_masks_zs in fold_orc Date: Thu, 19 Dec 2024 20:10:40 -0800 Message-ID: <20241220041104.53105-29-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220041104.53105-1-richard.henderson@linaro.org> References: <20241220041104.53105-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::531; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x531.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Avoid the use of the OptContext slots. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- tcg/optimize.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index 9b351f0521..da9c8c4669 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -2113,6 +2113,8 @@ static bool fold_or(OptContext *ctx, TCGOp *op) static bool fold_orc(OptContext *ctx, TCGOp *op) { + uint64_t s_mask; + if (fold_const2(ctx, op) || fold_xx_to_i(ctx, op, -1) || fold_xi_to_x(ctx, op, -1) || @@ -2120,9 +2122,9 @@ static bool fold_orc(OptContext *ctx, TCGOp *op) return true; } - ctx->s_mask = arg_info(op->args[1])->s_mask - & arg_info(op->args[2])->s_mask; - return false; + s_mask = arg_info(op->args[1])->s_mask + & arg_info(op->args[2])->s_mask; + return fold_masks_s(ctx, op, s_mask); } static bool fold_qemu_ld(OptContext *ctx, TCGOp *op) From patchwork Fri Dec 20 04:10:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13916162 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 751EBE77188 for ; Fri, 20 Dec 2024 04:15:41 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOUMW-0008WP-Sd; Thu, 19 Dec 2024 23:11:40 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOUML-0008Qb-44 for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:30 -0500 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOUMJ-0006NK-Fe for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:28 -0500 Received: by mail-pj1-x102f.google.com with SMTP id 98e67ed59e1d1-2ef8c012913so1054897a91.3 for ; Thu, 19 Dec 2024 20:11:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734667886; x=1735272686; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=ldx4yMmQFQdLg1ALYs2lWhfuOJE12kF68SKOPYDg5SQ=; b=bvLq/s5JfCs1NkoAb1aCalZqxyRL+o8qqfbJXzzAAJYMUbm2kZvPyZEyqWmzVWKaqY d8Vha3zcWqvI2ALZbDjdkbIWBDDbN+gMR12LFAR8StNsZHSBHmgwsyiXGxYlpbJGI/90 9WQKh9ewVh8OjkuT2qMXfDAT4p3e3FN74If3qh5Kt6N+AUW/yfalThNFnSLYh3jSwKNi 1gW9ejSprM8OjteMdd+HGdWAO7146BRduYp9GzmRLJeM3R9llk4/PPCx0dsPf7UISCsu vgLlVBK06wknS77qfZ6Q686Jeza7cxYWFeiTZu10/d582HXuCnZIiPwaLnOvJsKSIoPq Q3XA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734667886; x=1735272686; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ldx4yMmQFQdLg1ALYs2lWhfuOJE12kF68SKOPYDg5SQ=; b=oNI2SJoTVXeqFmXettgFQkEKW4A61T4VRBGC42QvQRlD9IZpVuiQ2n9OCm7sTnVRix i04aZxOeOZz1XHy9grR9e5AClnhvx4MmFiYfkhaOAjhtOVLJ1U4xUuEzPtc33PODwSfB HM2elDXpnjDlLWO2ExrL2TDoYUNoidmQ/XZWEMSSjghQGEyLQ1EwT6JtT/aR0pt67HVX RjogAq6O3/2zybULKn3PpT765/wjhuCNvbdZVU5YjaSyxJTmjj5MRRzRwKh8prc11AmV fF4USkQTcTDc/JHxRYMo6NDtTXLpp8+jSikwXa6ncAD4RXWVvE6Prwg6Dk+2EBS+SsOe S68Q== X-Gm-Message-State: AOJu0YzPt9VfqgPfrmqQGAzRWC7T2a1Bi6tbsA4XStdQReqXUOad4GWV A5PzX6uakbmXk33HWhDc0RfRLODxFyKvPCN48z8RYUT+YXwc3YG2tIQk5pb+7Vcr1IAnlouquBo n X-Gm-Gg: ASbGncsnt1kOb25bDKtbtw3zACuJMkIC0OLq5v+ihjL8mRKqCKrXuKwJ9ynYk/o03nX k8nhNyaMdLVJbFqxDtW7rB4KSpvHeiP4CXJtt1utC0ekn9X4KyxgU17PinpFz8y142copuTBmpA k1HlcfTWCv96BhrFMw83JJlfum4aE3zQsej7kH1KQIIRZ8xkoY+gr6TnII7eOXPC2Hnd09uhLRa UIyR8ZncgZVwfsRcVqkG3BizCq5Kg2rPbGWC5BOAnBUH+MP/XkwGWINl4bOtT4= X-Google-Smtp-Source: AGHT+IG4WYhJVYctHfnJdousc887mFC0tbwXAqCza/WASVZJcqKzO8/ZsS0WZlJyue91rbPGaMzYiw== X-Received: by 2002:a17:90b:548f:b0:2ee:8aa7:94a0 with SMTP id 98e67ed59e1d1-2f452f014f1mr2106427a91.32.1734667886205; Thu, 19 Dec 2024 20:11:26 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f2ee26fc22sm4165260a91.51.2024.12.19.20.11.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 20:11:25 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 29/51] tcg/optimize: Use fold_masks_zs in fold_qemu_ld Date: Thu, 19 Dec 2024 20:10:41 -0800 Message-ID: <20241220041104.53105-30-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220041104.53105-1-richard.henderson@linaro.org> References: <20241220041104.53105-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Avoid the use of the OptContext slots. Be careful not to call fold_masks_zs when the memory operation is wide enough to require multiple outputs, so split into two functions: fold_qemu_ld_1reg and fold_qemu_ld_2reg. Signed-off-by: Richard Henderson Reviewed-by: Pierrick Bouvier --- tcg/optimize.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index da9c8c4669..b01929fccf 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -2127,24 +2127,33 @@ static bool fold_orc(OptContext *ctx, TCGOp *op) return fold_masks_s(ctx, op, s_mask); } -static bool fold_qemu_ld(OptContext *ctx, TCGOp *op) +static bool fold_qemu_ld_1reg(OptContext *ctx, TCGOp *op) { const TCGOpDef *def = &tcg_op_defs[op->opc]; MemOpIdx oi = op->args[def->nb_oargs + def->nb_iargs]; MemOp mop = get_memop(oi); int width = 8 * memop_size(mop); + uint64_t z_mask = -1, s_mask = 0; if (width < 64) { - ctx->s_mask = MAKE_64BIT_MASK(width, 64 - width); + s_mask = MAKE_64BIT_MASK(width, 64 - width); if (!(mop & MO_SIGN)) { - ctx->z_mask = MAKE_64BIT_MASK(0, width); - ctx->s_mask <<= 1; + z_mask = MAKE_64BIT_MASK(0, width); + s_mask <<= 1; } } /* Opcodes that touch guest memory stop the mb optimization. */ ctx->prev_mb = NULL; - return false; + + return fold_masks_zs(ctx, op, z_mask, s_mask); +} + +static bool fold_qemu_ld_2reg(OptContext *ctx, TCGOp *op) +{ + /* Opcodes that touch guest memory stop the mb optimization. */ + ctx->prev_mb = NULL; + return finish_folding(ctx, op); } static bool fold_qemu_st(OptContext *ctx, TCGOp *op) @@ -3033,11 +3042,18 @@ void tcg_optimize(TCGContext *s) break; case INDEX_op_qemu_ld_a32_i32: case INDEX_op_qemu_ld_a64_i32: + done = fold_qemu_ld_1reg(&ctx, op); + break; case INDEX_op_qemu_ld_a32_i64: case INDEX_op_qemu_ld_a64_i64: + if (TCG_TARGET_REG_BITS == 64) { + done = fold_qemu_ld_1reg(&ctx, op); + break; + } + QEMU_FALLTHROUGH; case INDEX_op_qemu_ld_a32_i128: case INDEX_op_qemu_ld_a64_i128: - done = fold_qemu_ld(&ctx, op); + done = fold_qemu_ld_2reg(&ctx, op); break; case INDEX_op_qemu_st8_a32_i32: case INDEX_op_qemu_st8_a64_i32: From patchwork Fri Dec 20 04:10:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13916148 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 729FDE7718A for ; Fri, 20 Dec 2024 04:13:53 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOUMU-0008VI-VE; Thu, 19 Dec 2024 23:11:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOUML-0008Qk-JT for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:30 -0500 Received: from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOUMK-0006NU-2C for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:29 -0500 Received: by mail-pg1-x534.google.com with SMTP id 41be03b00d2f7-7fdc6e04411so961560a12.2 for ; Thu, 19 Dec 2024 20:11:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734667887; x=1735272687; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Owo9Xj6Jzu8SsqWkFVwwmR6pwZl5kA1ujeah6WfrAwM=; b=W3liBIQQrdphS1iQ7G7WK8237imhTiAvZS5h1dAHduracyt1eDHNXJr4Vmu2ft+mnO 5YFVJFnTttbMrR66zCKUkOIHgxt5ebFAIyg6YbwFhbu1ldUPTZFbIQ4yOrPsR6+0PzV+ O7yKBTM7s/+mFrtn2KzxHZYfqz7L9vopYuivufv1DfsHdbA9YkoPTSIkBZYkdTMTm+91 dz6q0k0gsKD5egVfaW7DmcYQbjxRJhZ2xQuxGKia/i1svajEhCunx7IwpKdveavgIRVj Lwb5T4lyts8uQuuEqVg9INz/REXkIiKs3kkAQX+hcuc2DWje7DhJKnT7T1XOWzQRot5g jZkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734667887; x=1735272687; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Owo9Xj6Jzu8SsqWkFVwwmR6pwZl5kA1ujeah6WfrAwM=; b=kyvmOAR+QZSclbO+M5b2BbZ70c5tolCc4WCAz0NjHHzHnZ1u9M5uOx2afzwh2p6Few umRuv8fToJSCn1dXgewBNPchV9TtUTy47XeCSUVXX1HNZMJSU/23jcLHHvc0rn/u2e+2 0OrZtXypFHtPbqZVF5xBM3YKRTrsQG/kpOXKUwnhAzRm98787Q2NJEUujiI80Oh/bQ73 rm3K6TTtMnCtmEMOaeyBzIUdnsD/W9OOwHwiA3ZaeTDt9ONEwWRB3mcM2IsqIzl7wdSH YdSjby0JW85Zb4/n9tFI4udHCy59WgktOPiBmG1fcxI89SWH66lYgLxp9EuR1iWBI66q ujwg== X-Gm-Message-State: AOJu0Yw0t7/bCp5Z+SkFW7jAcKREopzXWdprWkAICLESFmNy8cu/BDbV RqFILFm/tGucag48sJ3nK9MJcgtVoMVtddYzWiqY5HOQCO86rXlvAeP7PRe1B1fBvvJLBujkTnX L X-Gm-Gg: ASbGnctqDT/iSRrA6fV38QQh2AvSubyNy3ylRe5dPQjcyBd1CNOY5RVaGCGkS7gPUMo ShPxI61kty6BosiFriASSb1KFmiIzuOF/ynFxZRBKk0O/yCBKH8NLYUZQpzdz78btN6U1L4I5fm VnDoi4+nRho9oMSIP9le2y9FZYm45rSQ0e1BXtCvIqASzQUOW4sdgNL+N2xO5U+utZm7DDimniR RvPkQeDpcOT5G8rUgXte0RZBLVt6dur046tx81zbgU5/acezgkOP1WLmHO4ny8= X-Google-Smtp-Source: AGHT+IHdquqh/0ul/n7Ljpqg7DLtY5opT6KST7qsCXkX3rUUgSQSTmO0KFzWJ4zMlJ+PCZ7s6Zc+Lg== X-Received: by 2002:a17:90b:2dc2:b0:2ee:bbe0:98cd with SMTP id 98e67ed59e1d1-2f452def731mr2477881a91.7.1734667886796; Thu, 19 Dec 2024 20:11:26 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f2ee26fc22sm4165260a91.51.2024.12.19.20.11.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 20:11:26 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PATCH v2 30/51] tcg/optimize: Return true from fold_qemu_st, fold_tcg_st Date: Thu, 19 Dec 2024 20:10:42 -0800 Message-ID: <20241220041104.53105-31-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220041104.53105-1-richard.henderson@linaro.org> References: <20241220041104.53105-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Stores have no output operands, and so need no further work. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- tcg/optimize.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index b01929fccf..a5a57bb914 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -2160,7 +2160,7 @@ static bool fold_qemu_st(OptContext *ctx, TCGOp *op) { /* Opcodes that touch guest memory stop the mb optimization. */ ctx->prev_mb = NULL; - return false; + return true; } static bool fold_remainder(OptContext *ctx, TCGOp *op) @@ -2727,7 +2727,7 @@ static bool fold_tcg_st(OptContext *ctx, TCGOp *op) if (op->args[1] != tcgv_ptr_arg(tcg_env)) { remove_mem_copy_all(ctx); - return false; + return true; } switch (op->opc) { @@ -2751,7 +2751,7 @@ static bool fold_tcg_st(OptContext *ctx, TCGOp *op) g_assert_not_reached(); } remove_mem_copy_in(ctx, ofs, ofs + lm1); - return false; + return true; } static bool fold_tcg_st_memcopy(OptContext *ctx, TCGOp *op) @@ -2761,8 +2761,7 @@ static bool fold_tcg_st_memcopy(OptContext *ctx, TCGOp *op) TCGType type; if (op->args[1] != tcgv_ptr_arg(tcg_env)) { - fold_tcg_st(ctx, op); - return false; + return fold_tcg_st(ctx, op); } src = arg_temp(op->args[0]); @@ -2784,7 +2783,7 @@ static bool fold_tcg_st_memcopy(OptContext *ctx, TCGOp *op) last = ofs + tcg_type_size(type) - 1; remove_mem_copy_in(ctx, ofs, last); record_mem_copy(ctx, type, src, ofs, last); - return false; + return true; } static bool fold_xor(OptContext *ctx, TCGOp *op) From patchwork Fri Dec 20 04:10:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13916158 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D9DF6E77188 for ; Fri, 20 Dec 2024 04:14:29 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOUMY-00005H-2Z; Thu, 19 Dec 2024 23:11:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOUMM-0008Qm-6W for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:31 -0500 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOUMK-0006Nm-Rd for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:29 -0500 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-2166022c5caso12522155ad.2 for ; Thu, 19 Dec 2024 20:11:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734667887; x=1735272687; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ErYpV3fIN2iyazMtPdzOw45/hYntXah9WvXb1jyxFPI=; b=d3HyqZhtCkyNL1COP30X4hxu8ldFWEuQjj1f3lmsP0vlB3Cn8J5IzZznhu+PGDQgIr wbeLyPkE8lHWzUXU/sX+o3mzTttFDVNZU7Nlqm5ODQ9Vp215gt6NFI4Rxg4/1ngJajZ6 lTV05ecwWnLrv08/iLcbTT5m+UVyWDRMIqu7v/4y/WfTPgjRoaoom2aJHvW7Ai2JEnKn aDt7WyGt98FH5hPZ6Hsqfn1kDBeEDzVFZtZMqEa97ccPHyAeOGUZ4iY82nMtBIroS3ug 5Rmj4xSf7I+C76pJeyLdvmnLjsnRaRVPV6euQaL14YIO6VUSUHjkT++qFR6HowS84wWE 10yA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734667887; x=1735272687; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ErYpV3fIN2iyazMtPdzOw45/hYntXah9WvXb1jyxFPI=; b=CQBkkMME3/K4JImjIeLeDz0QvY4jJcJkq2YP04L7Xje1b6HiOpdManqw7NbJudMMJZ IjlvrPSmuzY24FkEGSosBc/qWbeHxQuB9W+W4kiOOs3JhNeWDhq0V83R7Ym8t7MHHZJ8 JNDsX2ddbwI8BjTV6JDcP386JDmKQrYCKWniTDOt4bLfrdP1qteBHIvMiDH8aAiZENJd olGWYuxJ1Z05N9hdm+8KaegzelMStbILH7rLX2KCEV7mo6xeCyHid5l8PrsOUWnHQw/2 cn3pABFs6mq+dzRiUJmpueBt1WWqUlEYkzFOar6RreZ57M0eHuPflSYHpzStyox4YMrT hRbA== X-Gm-Message-State: AOJu0Yx/hnl+z4BQZp+5OlYkCQrrbN+6UFPpxk139a/yTuTQT6PHKong Tg3UNFC1iw+6UhssT37CNqoqHzIEZjJ4EnKbN92VWyJTgab6XxqekZZvjKMUijirNv37RpRhReH a X-Gm-Gg: ASbGncvUTjpsEr6xv5wl9JZS2gIOayh8iO/2u0qFDNvOewPy7nEb2DkirQbOaHlag/z 5DOTmtlri5dQvonEbzW1+iy53GVmi4wZU6LGWJUzNKL7x6bDm0PosOk/0KXeBIAPAeJQaTX+Enm jisNlbJl3dd8GWLX7T3dY93JELSfjvjnN57d1Vqun4Cna/dwcxHbJ3bt3rhijSDOKGcLwnYFemS LzcEzjVxfnpMKrX1iY7dNqoZOCsNtEtQIBNApbUI1pYeWdwbBqnaPM7/4FaaH4= X-Google-Smtp-Source: AGHT+IEb//GitLKJCqdwDf/ha844alGaz4hey3hRe88hgd7qJTvn8qWRx6W8iMc9Wjj6/K7EYP7PdQ== X-Received: by 2002:a17:90a:da84:b0:2ee:863e:9fe8 with SMTP id 98e67ed59e1d1-2f452e38005mr2149258a91.18.1734667887428; Thu, 19 Dec 2024 20:11:27 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f2ee26fc22sm4165260a91.51.2024.12.19.20.11.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 20:11:27 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PATCH v2 31/51] tcg/optimize: Use finish_folding in fold_remainder Date: Thu, 19 Dec 2024 20:10:43 -0800 Message-ID: <20241220041104.53105-32-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220041104.53105-1-richard.henderson@linaro.org> References: <20241220041104.53105-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62f; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62f.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- tcg/optimize.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index a5a57bb914..868da884f1 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -2169,7 +2169,7 @@ static bool fold_remainder(OptContext *ctx, TCGOp *op) fold_xx_to_i(ctx, op, 0)) { return true; } - return false; + return finish_folding(ctx, op); } static bool fold_setcond_zmask(OptContext *ctx, TCGOp *op, bool neg) From patchwork Fri Dec 20 04:10:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13916159 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 53DCBE7718A for ; Fri, 20 Dec 2024 04:14:31 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOUMX-00005F-Fp; Thu, 19 Dec 2024 23:11:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOUMM-0008RA-MW for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:31 -0500 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOUML-0006Nv-8o for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:30 -0500 Received: by mail-pj1-x102b.google.com with SMTP id 98e67ed59e1d1-2eeb4d643a5so1396874a91.3 for ; Thu, 19 Dec 2024 20:11:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734667888; x=1735272688; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7JAIS9jf3/vTegmrONjuLySkdEA9/VNp6mDNTKWpQWM=; b=slaoGemb8D/JFK6Y0RQRY1qbDCCY7LlSm8Plal28dzYfEabxD4ETi4yIrAbzSTJhO+ w/dW6MbC3gt9WDi+bL6c9PXww95P7JnwbbNfRxWpRLx2vZw9BcmF2gtzYKmFAy1x7gwc worx/cwe5CH6BH9/F8V4+rWtyeM/MtR3yGQ9StOOKSW/DhINsz5XfZFTe9zFJXIaDX6H h1+HPlw7sbZLn7TyH1cMFvQYDJ8uwwWXp1eExuuLnWuiy9zJXKM4oC3a68G39GRKQNAs 9JX91qlvmpthilKPi7K0KmF6R0nyXktlWWgtD7uDdIxtjveq23szPzIJzsm0eBEhW8Wa YFWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734667888; x=1735272688; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7JAIS9jf3/vTegmrONjuLySkdEA9/VNp6mDNTKWpQWM=; b=nkd/oxW0GvzG/TdUbvK0RF6mcU6b70E0LomR4yj7stDdNmTLIugptoPjwhbpCZknIe F7kv+3GlP3ZW4r3fYycu4y2vsB1CADCwpSStFXDEvEkYUSwpcLfKJAk97Tg40BzcR5YO +3kRf/L/O/+Xe3tf4B4bYg/W5QeMbw145joUoRSlmUmIGFNWkgWYcbduROQINUBpDnY6 UaCqq2LhsnQKCe4N1bXu78s5+aKOvcXSrqQQtkBMcjD3yDs8FtJlK7BWdpvBh3ipFLbz 7qzH2uZ7OdEhS+19B1YUJygw9M54BoSPBK6Qi3jhpGjyMoG/W++e1658IAPTzBxpmcCN ehLQ== X-Gm-Message-State: AOJu0YyNl7jxuitpSgcuEnrxJpsZ7rtWnrLcia1w9QyVkuVL3mzWrm54 ipLrk67K0d3x2PG+lQETdfkcmxksBQMUXOj4xms4qMf0NOalygfoCB+UqZmPvTX/pgdgst9Pkvh 7 X-Gm-Gg: ASbGncvv/z2eqU1grh613N67F1/TVESa3s/ji16T2yHe5YhQwiPgQnRv8Lj9cKRYsvt Dh7JuG9BJXpHxWEz4XvM+2y7gxn9vleD7x4Rdd3u5L5+GQSbI+3CIIOvSqCZi46gqus4BsNtEXu Woo372yfgqapgwPlWplDHKkjBVwhjvt6lvsmYOpRbO7Jt08ukV7U5Jbtu5DwxV82Etmr5qA1EG6 w2Ha9ocNtqzm2SPZ36eYAINNXu+48pToiwD/XfGz7WyEDFZp0nnbj19dQyyvm4= X-Google-Smtp-Source: AGHT+IHKwLryWjmnVnge3EsIQ4REYoZTY6MXDsUBgCOyRC0pMOWkBjqLav4aj2voSjSsyk4z4utL1A== X-Received: by 2002:a17:90b:2545:b0:2ee:74a1:fba2 with SMTP id 98e67ed59e1d1-2f452e3e83cmr2253204a91.20.1734667888075; Thu, 19 Dec 2024 20:11:28 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f2ee26fc22sm4165260a91.51.2024.12.19.20.11.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 20:11:27 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PATCH v2 32/51] tcg/optimize: Distinguish simplification in fold_setcond_zmask Date: Thu, 19 Dec 2024 20:10:44 -0800 Message-ID: <20241220041104.53105-33-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220041104.53105-1-richard.henderson@linaro.org> References: <20241220041104.53105-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102b; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102b.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Change return from bool to int; distinguish between complete folding, simplification, and no change. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- tcg/optimize.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index 868da884f1..9c4bb1fb91 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -2172,7 +2172,8 @@ static bool fold_remainder(OptContext *ctx, TCGOp *op) return finish_folding(ctx, op); } -static bool fold_setcond_zmask(OptContext *ctx, TCGOp *op, bool neg) +/* Return 1 if finished, -1 if simplified, 0 if unchanged. */ +static int fold_setcond_zmask(OptContext *ctx, TCGOp *op, bool neg) { uint64_t a_zmask, b_val; TCGCond cond; @@ -2267,11 +2268,10 @@ static bool fold_setcond_zmask(OptContext *ctx, TCGOp *op, bool neg) op->opc = xor_opc; op->args[2] = arg_new_constant(ctx, 1); } - return false; + return -1; } } - - return false; + return 0; } static void fold_setcond_tst_pow2(OptContext *ctx, TCGOp *op, bool neg) @@ -2376,10 +2376,13 @@ static bool fold_setcond(OptContext *ctx, TCGOp *op) return tcg_opt_gen_movi(ctx, op, op->args[0], i); } - if (fold_setcond_zmask(ctx, op, false)) { + i = fold_setcond_zmask(ctx, op, false); + if (i > 0) { return true; } - fold_setcond_tst_pow2(ctx, op, false); + if (i == 0) { + fold_setcond_tst_pow2(ctx, op, false); + } ctx->z_mask = 1; return false; @@ -2393,10 +2396,13 @@ static bool fold_negsetcond(OptContext *ctx, TCGOp *op) return tcg_opt_gen_movi(ctx, op, op->args[0], -i); } - if (fold_setcond_zmask(ctx, op, true)) { + i = fold_setcond_zmask(ctx, op, true); + if (i > 0) { return true; } - fold_setcond_tst_pow2(ctx, op, true); + if (i == 0) { + fold_setcond_tst_pow2(ctx, op, true); + } /* Value is {0,-1} so all bits are repetitions of the sign. */ ctx->s_mask = -1; From patchwork Fri Dec 20 04:10:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13916147 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 514B4E77188 for ; Fri, 20 Dec 2024 04:13:53 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOUMZ-00006H-FX; Thu, 19 Dec 2024 23:11:43 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOUMO-0008Rf-5C for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:32 -0500 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOUML-0006OP-Rb for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:30 -0500 Received: by mail-pj1-x102e.google.com with SMTP id 98e67ed59e1d1-2efe25558ddso1055840a91.2 for ; Thu, 19 Dec 2024 20:11:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734667889; x=1735272689; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TJ5jaLrHM0v89QaKJI8z+UOp7RGcZR7YVrz2twbR1Jw=; b=iO47zXw74+UnBaidqkFyTzrLQjjL+w56LW2dJBnWCsVHgr5W+z/E6JJYGnSOefp4Q2 L1YfxU5oP48gwdj2MK0MnMuUjcITxI2RsfaE7nK7+xIQamS199VEHy3Obq+WgXeEq1Ko s7ugLCr2JJqthUHGEU0FDkc5BEkvxQ2l62IpZod+UQurp6Rue1A8LeKlZIBOjJmvN2HQ NzwTSYUv2FCtGDfgC+2wFmNyBCoLO+7H30pVGtdNUIm6XTJNNPIDpyR60oJaLg03H0im pwE7yYBFzRXhxWQ7A9zz1DeikhSD+QsNsDfuq4QwiTgNgaARo0KNaUEzN/CjuvfIloOR 5YSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734667889; x=1735272689; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TJ5jaLrHM0v89QaKJI8z+UOp7RGcZR7YVrz2twbR1Jw=; b=Y7tVyZEpRE0trT71wAhcaieDvLsmEVWwNXX/Xq8jTDP1+Yx+j3irjj7WOdGjI0hE0Y 73e1JADH+g04pHITTS93gLdvB85M4pRCqiaiERpLR31KswJDVTczbZytwL5e9YiPStDg KgBOU4IzTLuG1MGVdFZWulWyZ2JmE2BWYdx14Mmu8afxDaeBUxszSFRGW/HxsaMY5Yea pHJSU3mpryUdE4ayJ12hnDDi7+YjKWlS2JqSMHTH/GeF3ye7K0pDg/aaTZsFC2E98m04 XFZ5CGnxdW/2W14sazC5oogx902orzYM9zrlkuIDCZvixPkZEDSKmnV+Cc4LR+TCV1HD m+UA== X-Gm-Message-State: AOJu0YwsuhJlVYLh3hs2qiwPOB4X1U9lgKUQpsM2D/QbFdtKEsUjoyWZ DEHNCxUIeF0ierO7/cypKrxEB8fB3HWhhzt8OIHeCCD9KK1w4Cuq5nelo1/c/VfXIqi5aagBiEA W X-Gm-Gg: ASbGnct1kKPGAKo7q6bEiwfjqUBstQQ/vWZD1GYdSwMpY67DjEaM2xDqdVct/8wUr0+ uuziIisi8evP/C/aTH/MrTcVq9aFcOQmtl+vAco5YImnRSn63joPNNXNX2AJ4PTmpzpBMscRS8P dgvSZGgCEq/6zP4hFCS3ey0pTxJtqzWUt+GcaJuHgj1XXOLvy1Hoe+zZB4oQodrcfkju7G50nW3 coU+sTYcR2FFJ6rhpBbOY6smFYLDrOvoJSIvg1eBV66SDV3mzDVs8Si9VWy1OQ= X-Google-Smtp-Source: AGHT+IEhUSwzL93Db5paJ6QEUAp56ruLf/ObvkF0jv0q4yIQr+u0X+JrKC5u9sQfe+UGDpuLuKAlXA== X-Received: by 2002:a17:90b:2dc2:b0:2ee:acb4:fecd with SMTP id 98e67ed59e1d1-2f452e044damr2339553a91.9.1734667888677; Thu, 19 Dec 2024 20:11:28 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f2ee26fc22sm4165260a91.51.2024.12.19.20.11.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 20:11:28 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PATCH v2 33/51] tcg/optimize: Use fold_masks_z in fold_setcond Date: Thu, 19 Dec 2024 20:10:45 -0800 Message-ID: <20241220041104.53105-34-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220041104.53105-1-richard.henderson@linaro.org> References: <20241220041104.53105-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Avoid the use of the OptContext slots. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- tcg/optimize.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index 9c4bb1fb91..079b5b82ba 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -2384,8 +2384,7 @@ static bool fold_setcond(OptContext *ctx, TCGOp *op) fold_setcond_tst_pow2(ctx, op, false); } - ctx->z_mask = 1; - return false; + return fold_masks_z(ctx, op, 1); } static bool fold_negsetcond(OptContext *ctx, TCGOp *op) From patchwork Fri Dec 20 04:10:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13916139 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C1D4BE77188 for ; Fri, 20 Dec 2024 04:13:03 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOUMZ-00006I-Fn; Thu, 19 Dec 2024 23:11:43 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOUMQ-0008TX-B9 for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:35 -0500 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOUMN-0006Oq-Ul for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:33 -0500 Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-216634dd574so10044195ad.2 for ; Thu, 19 Dec 2024 20:11:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734667890; x=1735272690; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Ln9D/mx3EiGh8lpioXoPks5hCwXKzkMo/aAb3sVv8V8=; b=c08SWE+4t97wrT2eeC3SyquMtkvoFQO78UM/g1q6fvY0qe3lKhS6nXJZinFSpZ7z5V BdYZPHV2Vdms8qTYQy9tONtd2c6FLVvHKLPZMPgQAqR7NRjzRdA5+R8YSCvd5BpZvS5a 1kUmK2cVtJhbLq82cvZg65ud5udJEmCv5cNtlfgRGWl00rexVSan7zOEf870q8MgUz2Z ROe6TpkWc7+/W8B8FRBL2BQMVQmB5ixkU8foJFJCh9m1Eokwyue4XL8Aovl3DbJA24PD zDx29Ihcku7euO9VDNKzFFiKIRRyauPyjHnlQp9fB1Et7LIlrFnrSL6sneQAVa3tGKim mhLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734667890; x=1735272690; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ln9D/mx3EiGh8lpioXoPks5hCwXKzkMo/aAb3sVv8V8=; b=LvkCWmCCfqgsLCwfThNLmoeGDgmfxuh/HTG9JY3BoCdyp0k4GZdGYdIQtucfgz/w9p vrNuWdHdFT+JwcAVTNWuNCZ73oayrw17uyZJCHEo48T50u/2xAifzhQPiRHHChrcWNZr bFmgpvJ9wIZpLTfQWyEmGksEEjLW6vl72l7dADzw/v4XsWKnXCUoV4gRoO2zB2Px2M5A WR0MQue0RXXzIovMLhZ1fuQkNh1VFPO/bUOsvc1rm49hHGMLNn3foIk4g8YXRPBHTVRw nyer2+dTV96bzvIutBxmYP0Zu3Wn+GiVA1TnxWT9HDoWNL5qQ9AVIENWiLGFIvpkcqGy AA7w== X-Gm-Message-State: AOJu0Yy69EsFAv875LEm2hLy4apSIcEYpU8bLROj42/yjWVy2DH9fYfz XhkOgQ4QN0VFpJUkXTpWtKDPmGKl7ETXoK5XvUb5vuHExNZQfCoctmA0Enf1RsksigTC0L2JRx+ b X-Gm-Gg: ASbGnctSL+03z2rnl1hit3Tk2NH6tOb0qCGg+TY/1UONMEOqKffVgCxl5SwfrkM9mIq J0jjJAsyHWNSlsfN6kxxb3RWKCRNXw0R2LbU0XRYsSCQSDGNiGjpiM4F+RqrC3xGZslc7A8z16k Jcyr5q0s2/RGnVYjTL6FewJfRH/H76+MaZfckRuPi//fRoQJ1N0lD57lr8UgzC/Hvt1+21ArlNZ MktiCjCmne1LZt5wmtuMfQAY+RzSsIHeIvuq1F5ymAbPEXl4vyzlWA6wbUlzEc= X-Google-Smtp-Source: AGHT+IEuOIKpw/U94OpcRjNTdfFjukpkoPR96CmT5WIwc3O2Pe2dPS/EOHNCIvP2aE3nolAStiBZiA== X-Received: by 2002:a17:903:2c9:b0:216:18f9:528b with SMTP id d9443c01a7336-219e6eb63c2mr17343375ad.26.1734667890473; Thu, 19 Dec 2024 20:11:30 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f2ee26fc22sm4165260a91.51.2024.12.19.20.11.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 20:11:30 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PATCH v2 34/51] tcg/optimize: Use fold_masks_s in fold_negsetcond Date: Thu, 19 Dec 2024 20:10:46 -0800 Message-ID: <20241220041104.53105-35-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220041104.53105-1-richard.henderson@linaro.org> References: <20241220041104.53105-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::629; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x629.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Avoid the use of the OptContext slots. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- tcg/optimize.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index 079b5b82ba..5bfcb22a0e 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -2404,8 +2404,7 @@ static bool fold_negsetcond(OptContext *ctx, TCGOp *op) } /* Value is {0,-1} so all bits are repetitions of the sign. */ - ctx->s_mask = -1; - return false; + return fold_masks_s(ctx, op, -1); } static bool fold_setcond2(OptContext *ctx, TCGOp *op) From patchwork Fri Dec 20 04:10:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13916149 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1A842E77188 for ; Fri, 20 Dec 2024 04:13:57 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOUMb-00008P-Oh; Thu, 19 Dec 2024 23:11:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOUMR-0008Th-DM for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:35 -0500 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOUMP-0006Oz-DF for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:35 -0500 Received: by mail-pg1-x52b.google.com with SMTP id 41be03b00d2f7-7fd2ff40782so1278122a12.2 for ; Thu, 19 Dec 2024 20:11:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734667891; x=1735272691; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Z99TKxTEO+476nesx2pjqXvWwDVBvcXM5vBpRSH/Ths=; b=YHTvwHIk49WuFrORr5yw5HK0/QCnWVo9Z/DV74BdwQdutqOro9R5Z0Zu/zaXE61g9Z mDQtRnzTTQgCJjK45lrersxxoFSGDZul12WjyqKZB2DySCPejev0CvE5QHw7mj3YldcU CzhxO3lqSclh3zGhmL4cgUGgj81hEuVuOJ+5YDW8iH9LsvOJm4Mx6zjVirQs1ztCMH8E frqJWdDftcpu7jfOi4DU/TJD9gkO/vj5hd6GHrWeirEs/XsSvRpOBOM/wMxNPXopB2Ag cP0LfV4oNiipxncNoV9eyCWI9qY9NdRmJ+6GkPu3bQJ0ayImvjaNAcUgjCdZ24U33Z6R WYuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734667891; x=1735272691; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Z99TKxTEO+476nesx2pjqXvWwDVBvcXM5vBpRSH/Ths=; b=JKOcuq2Csx7AU81DfPZaTpu1vrnYAEBTpyAci0PhUWcEqebI1/kirlStKrnJI+BUu8 O/doQ398L4TAfPisN8a7p1Kd4njPEDS1AZP91bCChU0VYYGZsrjVpGrZ+kgMaWzyraIW Wa7ruU3g38MHM8eAScQhsieTrpYfflPX6T6jhas8nmnWZsuBE+ASCyrUEsVTI+zsDr+q VROH5NhwoN+mSL1u8LwkcmAaa+ucu0yvAjpbc3UxwfNIJ+duThVsyQL5EFhQfGKXrKOo zLQ3344+gnlRUA+IRruvw7v/qvFriPQwROWVaHKKKLh4+7lq0v2pUllneS8UxmvOn7CP p96A== X-Gm-Message-State: AOJu0YwltoGcqC6n9eKRd0+KZJmveL0uhR+iLznDgo25rvxlgJQH/N8q /X4h+Cp0g7hjVY8jCr6+0LAiAeuHFuS493T3isEEXEyFVRpaI91+r7iT5l+uc8ku9xWlYnSXk9S 5 X-Gm-Gg: ASbGnctYKbvk/miU7XlYmnxbH/MC9sumMHyV9jlqRGGtvV4uZIJh1OeXh9jFM+kajTh oy4Owq47gyR+No3f9pal7oFKKlp1XQZOCyS2XaKbd83i3E8T5z/gJ5LaDRrN6l5fxAsEnbR7OOR qKVWMNLvgbCn05jKitJiH2pA1yj/k0cmgNC/qIl2iVjBsUYHuxNcYZhIgw/F1TSXJPeCublSpdm L6LiZU8/NWFyBmLHnOcAAYNVXQ5C5RmDuZfkV6lHxKa3Cg0KOjubt0tjQ7uLgM= X-Google-Smtp-Source: AGHT+IH5HbTnsoPsvkbu0Z/cCRPmWlx0QWpa9AQXTR5X0stO5En8W1J6fFF4tTmTnyMl4xnsKl5pkQ== X-Received: by 2002:a17:90b:2c84:b0:2ee:d797:40a4 with SMTP id 98e67ed59e1d1-2f452dfccacmr2654171a91.8.1734667891145; Thu, 19 Dec 2024 20:11:31 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f2ee26fc22sm4165260a91.51.2024.12.19.20.11.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 20:11:30 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 35/51] tcg/optimize: Fix sign mask in fold_negsetcond Date: Thu, 19 Dec 2024 20:10:47 -0800 Message-ID: <20241220041104.53105-36-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220041104.53105-1-richard.henderson@linaro.org> References: <20241220041104.53105-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52b; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52b.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org The sign mask is about repetitions, a la clrsb64(), so the lsb itself can never be a repetition. Thus ~1 not -1 is correct. Signed-off-by: Richard Henderson Reviewed-by: Pierrick Bouvier --- tcg/optimize.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index 5bfcb22a0e..63f80efeec 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -2403,8 +2403,8 @@ static bool fold_negsetcond(OptContext *ctx, TCGOp *op) fold_setcond_tst_pow2(ctx, op, true); } - /* Value is {0,-1} so all bits are repetitions of the sign. */ - return fold_masks_s(ctx, op, -1); + /* Value is {0,-1} so all bits above lsb are repetitions of the lsb. */ + return fold_masks_s(ctx, op, ~1); } static bool fold_setcond2(OptContext *ctx, TCGOp *op) From patchwork Fri Dec 20 04:10:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13916175 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7FFF5E77188 for ; Fri, 20 Dec 2024 04:18:09 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOUMa-00007Z-Vj; Thu, 19 Dec 2024 23:11:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOUMR-0008Tt-Fc for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:35 -0500 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOUMQ-0006PB-13 for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:35 -0500 Received: by mail-pj1-x1029.google.com with SMTP id 98e67ed59e1d1-2ef89dbd8eeso991730a91.0 for ; Thu, 19 Dec 2024 20:11:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734667892; x=1735272692; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=EyALDr2SSgMlWiOhgKYyIJNrGLip7wIlDdGWsxU+U4Q=; b=DdUv2GFDSgcWEy4Vlz8F5x+VkFOLYT99Wq0rNbml40tuNJqbCDUJtHwqGHLMNJ1Wwe S+6oCqhj7iqh+iL3IRKjfWS+ENaC6P9MWSjh158X2Wc5OCmGKdHSS+Zip8S9Q5PiO8A0 YEUiUhE8YF7tCK7+tTdl/xI6UmCQRWFgs3LJM6BxbDJG5NsEukQovGnG8lHmsV3HKx3J 16iaYzlwRSCE7b9HpageL2dasvgSvSp8CHpF+DwMTKv/OUZyYIUeu4NQkLTSmtF0KRyp IddW6fcnWM3ealtDRAbY2JnqkfPb9+A0JNcrjHElFJS93XzmA3lA7cN7YA2IyGpEFDzx drrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734667892; x=1735272692; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EyALDr2SSgMlWiOhgKYyIJNrGLip7wIlDdGWsxU+U4Q=; b=bzDSQ3uMDiecm3hLBGej/E5c7a8xORs8rMq+ANQIS51pHC1Hy6CNV93Z8kvjjv8Af7 JUJvTpRVOYh7NJagoxTmXlArIiUqYecTT6qezCbnwpjQiVJbsnxto0YyIqgxD0pTmztg 4k6DYOO62Ja2e7J/S+1OHiNFSIZNPwX9QHKRx6eZ7f6PsymMer2w13CZ9hp3sTd4pi9Q LrbnZwCU9cTaPxvBU0GPhoAGjCRWAGR5tCbJmK9YbN8emhLyHhcfmO5x3Fxor0HTTXVO 4OcKbESxDeam4+zeho33O0fny+wzZu89eqB6o23Q2Ekbaz7sQZh4P+LIdPNQX89sdZM4 t91g== X-Gm-Message-State: AOJu0YyU5htGblIzxQT121Q3TJrj4wWprL8elvyFsXX0oa9SwKpKOmry zxCu89CwtGwqRJNEGTL08PCOC10Twq61GcyXqgY8UH8bLrlhvgZM3nTQTr5DvPVUMG8bQ5i/qxK m X-Gm-Gg: ASbGncurF9aRbkFFrO4nzt9qh1UOUvmAyj94Yn5n9x8pU71tcqqglQAmm5hoybfmIqd KqxNwYWtgO5AyeHFCtPkvXsfl/1fp6rMYsZt8hgxe5qxut6Vj54qorEuBA5Q5+NAnpQ38I7J8rX BFkCiJf/ePsoaEFM2z8rXU2cFKqrbRPexm5NmKZg7a5rtMpidV42HDRrlZoqOGQHe0jg92eJblE Sv6AWWGy/8ui8G8tkNWz7JDpyavDxdcZ3Gv/ig2541bw50LePezn9F6RI8k9OY= X-Google-Smtp-Source: AGHT+IHtjW+xuZwdZxhbDNRhtgSUinLpwcfBprWo1TaXNHBd/lUB3xKgVwkSBgkVIlAnVXKhkUKJ4g== X-Received: by 2002:a17:90b:54cb:b0:2ee:d7d3:3019 with SMTP id 98e67ed59e1d1-2f452e22555mr2825610a91.12.1734667891830; Thu, 19 Dec 2024 20:11:31 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f2ee26fc22sm4165260a91.51.2024.12.19.20.11.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 20:11:31 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PATCH v2 36/51] tcg/optimize: Use fold_masks_z in fold_setcond2 Date: Thu, 19 Dec 2024 20:10:48 -0800 Message-ID: <20241220041104.53105-37-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220041104.53105-1-richard.henderson@linaro.org> References: <20241220041104.53105-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1029; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1029.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Avoid the use of the OptContext slots. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- tcg/optimize.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index 63f80efeec..a7f37a1e6e 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -2485,8 +2485,7 @@ static bool fold_setcond2(OptContext *ctx, TCGOp *op) return fold_setcond(ctx, op); } - ctx->z_mask = 1; - return false; + return fold_masks_z(ctx, op, 1); do_setcond_const: return tcg_opt_gen_movi(ctx, op, op->args[0], i); From patchwork Fri Dec 20 04:10:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13916155 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A229AE77188 for ; Fri, 20 Dec 2024 04:14:20 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOUMY-00005N-Mp; Thu, 19 Dec 2024 23:11:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOUMS-0008UD-ND for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:36 -0500 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOUMQ-0006PJ-1o for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:36 -0500 Received: by mail-pg1-x536.google.com with SMTP id 41be03b00d2f7-7fd17f2312bso1114430a12.0 for ; Thu, 19 Dec 2024 20:11:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734667892; x=1735272692; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=z2JQONporu2R9RbXK5tPk1t1tzVQToa5YMeaL9LgHVo=; b=PZQE8AGzzQbaEgQWDnat1m2lgEqvG8gGAYQEG/odWBTvn/VpbIiApuQti/751qyMwy FYzPZWutRbhHqouPegiRgVzznwMWL3HA7VjvIC5qc63aYSB5jAzpwRoAnnF/aj3wZR4s mh9fLNoDeNiMq/I9yOTfVt8UqZkGPcFpJqcZcBMisRjX598v4KpgKJ0m8KELt9gDtkGM 1O0TmClGpZIBvQiAlkXjgZ6CB3TDtsQsPpAH/eMg7DaSKg5svrfJ7cNWW7LtfFgQljfw kxUqEsQ25bZCnvVbl2l0F6i/YZHcMDGaoXXDH2fPaHJzyCJiJhkq37wlNICp+30cvHdS dGag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734667892; x=1735272692; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=z2JQONporu2R9RbXK5tPk1t1tzVQToa5YMeaL9LgHVo=; b=cr0OuuIngHbmzqqGlQlKpMn3qvtmbFOzaKtWjxZzGYs6puPElny7/3IYBxptvjy4M8 rZ4QBFqEt7/Pciwa2xPNwdcRgLPjIjstXRFQNwYhOvM2h5P5nHwtUxDZZRimEtZv0okP yiz5dAGn/oT4sSXu0H4OVeVyYQ2AIE6rNw/J9VDeXKGfRnpd9DC50Dtfx7OrQ5I9eUTf SKqDeLyhSaPbdx2BVFVmwXAvA/b0V1J6BJ1W3G/IaMwLB6wCBJBrWA8VWsqSJqjXXjnt kovRxKsO2czgGMzR8nYNxrLpRADa1xqC4KSB+/USIMHeoxVnyBH9x5TQ7i+U3ZjUFs9U u6tA== X-Gm-Message-State: AOJu0Yz9hF0hgaNopwcRHp99seS3Pl98eJpT06jJjOviXT09TlJrKphP M5dka7oT1ZxIzyiw7MdRbDfsUzOPvFJWafq2bCF/S9ARZeCbgTzmo2Zc8OObcj96sRLHg8h/zrJ E X-Gm-Gg: ASbGnctrLD7mdQZU3CQqSFLskKN/8n2VSs9tApd2qyN2pKHOIh+sR3rq5R1l/0p9JFw f9UgZ6N4pjga7sA7rXqbmLHHA2gvaELEJJZS7Tohv3s0Qm3uM8FURYaj0MWz0DqKAi4OfkT3rux Jl54lR9hyRjGkEcKudKek4io6sPBOEmsjEXi2msBkOYtMblOoqyPhpKzEqVesGOCim7+TI6sqaI Lqdmmjoca/zjW3aCcgdgF8I8N3Ahc5ghWLyzsSglG9RqwFMsZPDBRsNv2Bk5Rw= X-Google-Smtp-Source: AGHT+IGuR2URfmYASE3inYk7se3IDxaxqUxQmfRhDExeYRqmYcQO1f/hGzIt/cMeHBlWVGGPG8A+GQ== X-Received: by 2002:a17:90b:2b8e:b0:2ee:3cc1:793b with SMTP id 98e67ed59e1d1-2f452ec6ed2mr1987033a91.26.1734667892455; Thu, 19 Dec 2024 20:11:32 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f2ee26fc22sm4165260a91.51.2024.12.19.20.11.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 20:11:32 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PATCH v2 37/51] tcg/optimize: Use finish_folding in fold_cmp_vec Date: Thu, 19 Dec 2024 20:10:49 -0800 Message-ID: <20241220041104.53105-38-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220041104.53105-1-richard.henderson@linaro.org> References: <20241220041104.53105-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::536; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x536.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- tcg/optimize.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index a7f37a1e6e..9ce90eee7f 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -2497,7 +2497,7 @@ static bool fold_cmp_vec(OptContext *ctx, TCGOp *op) if (swap_commutative(NO_DEST, &op->args[1], &op->args[2])) { op->args[3] = tcg_swap_cond(op->args[3]); } - return false; + return finish_folding(ctx, op); } static bool fold_cmpsel_vec(OptContext *ctx, TCGOp *op) From patchwork Fri Dec 20 04:10:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13916143 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5F683E77188 for ; Fri, 20 Dec 2024 04:13:46 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOUMY-00005O-NH; Thu, 19 Dec 2024 23:11:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOUMS-0008UF-NF for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:36 -0500 Received: from mail-pg1-x52f.google.com ([2607:f8b0:4864:20::52f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOUMQ-0006PS-Ad for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:36 -0500 Received: by mail-pg1-x52f.google.com with SMTP id 41be03b00d2f7-801986033f9so918232a12.1 for ; Thu, 19 Dec 2024 20:11:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734667893; x=1735272693; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=GGsAjj2auqRYQ8ARQDokv7gEPzbvdUhWdANXEAlpLeo=; b=N6JOlDCXlccrffIAFdi3gWcNtjIkJxvDCVq8ysKMvl5v42but4zJBqmpkqbqKNqdcm An+QkpaW9zlGJNxZPzKaJTgU9tvpiHYAF0rbgxwxSHdticqxN6W11PcjqWso6ZmQ7yxL C4yRdrWZy2IjCDy5ZSY7XK018uiOy+6HYbb0GmwNGwNjA6FrCu6Xrgi+TV62Nx7ltU2h rpoAMYir/EbG+H2zlMjaYCPLrnrAj96wdvycYR2QUdoIFpTV7+0cK+sSBmoVKWUHOc6h 7mULWAcBMJHg5MIE2EnzB+UFTVgjdJhVmiZqhkEVvj7M6tqgL6Hh9FvR2ZAinZIn5VvM 9YqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734667893; x=1735272693; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GGsAjj2auqRYQ8ARQDokv7gEPzbvdUhWdANXEAlpLeo=; b=BVt/b95K24DCZAImAAx3LHo1u+PFky77FgOHgIZvKbHfG1Gs6jzTrW71cxXFsOHAEY eB6klqHDz+4PM87xaR1DJJeHVv2TZ/8F0L45+Vy4UXr6ChKoXyEcvdiEhYqTmv2C90Rh mVnsZDwRVrDa68f79yoc82LYnrTwXoVP4XiySuJ93+VABLvqcZqKoY+lJcfTOygS3LUJ LBp3YSr+IZQuiT7yEFefRY4CRgsAx5KHYJxzzaLyO6ddJ/CLzy1c9t8mmtF/FX0GhzyU lglIu3kvsSpdP4glA9YxIPuKVbnTTxTGy3CeOyo1CrncttYUTMnPgAKjMVpdPgWmRmTC NsCg== X-Gm-Message-State: AOJu0YyIf/D6uScidJG5hzcX9NaqgKJhgW9NcUm5Y5r7krAJP+Kaa7By XERM43a6oSyBmF8SeiS8xdf2pXD3LZ2PiGT1AzimfOFYyqgYVtI+uPMCwAXxB8DYNuy9s7n0RCD M X-Gm-Gg: ASbGncsLrSYqYfL0dEVjksR5P55flED32GxuK7VkDPn6xPYFTDXTMbOUK+tlYtI8XpQ 3Xb1plzAJ5cZsg3OgHy89nNhAVlc/tkr1hjOz7tsc58xKEt6KvZ+ywGd0ir/uLA/73VB5QBSuzn IaDcpumpoKrMOizgnHx002WCYu3xkiviYXXxp4TBaZxgfkvN5QJUHLOAn8jzisof3qNoKyKYKHo Qj1wjiRwGgXtoY3VV831Xr7lsywIEgFsfN8XihtXuxqWXn6DtFO7s9SxtRvVS0= X-Google-Smtp-Source: AGHT+IElEknO/Y1EH7zELwhpM6m2w5qYr7DWBN6o73tdFM949cGh0hVh2iOpsDpZa/wgpQEOtdYXzA== X-Received: by 2002:a17:90a:d88d:b0:2ee:863e:9ffc with SMTP id 98e67ed59e1d1-2f452e4ace5mr2013631a91.21.1734667893134; Thu, 19 Dec 2024 20:11:33 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f2ee26fc22sm4165260a91.51.2024.12.19.20.11.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 20:11:32 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PATCH v2 38/51] tcg/optimize: Use finish_folding in fold_cmpsel_vec Date: Thu, 19 Dec 2024 20:10:50 -0800 Message-ID: <20241220041104.53105-39-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220041104.53105-1-richard.henderson@linaro.org> References: <20241220041104.53105-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52f; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52f.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- tcg/optimize.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index 9ce90eee7f..fae6a29685 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -2518,7 +2518,7 @@ static bool fold_cmpsel_vec(OptContext *ctx, TCGOp *op) if (swap_commutative(op->args[0], &op->args[4], &op->args[3])) { op->args[5] = tcg_invert_cond(op->args[5]); } - return false; + return finish_folding(ctx, op); } static bool fold_sextract(OptContext *ctx, TCGOp *op) From patchwork Fri Dec 20 04:10:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13916179 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C667FE7718A for ; Fri, 20 Dec 2024 04:18:44 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOUMW-0008WM-Bm; Thu, 19 Dec 2024 23:11:40 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOUMS-0008UE-NM for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:36 -0500 Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOUMR-0006Pb-8A for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:36 -0500 Received: by mail-pg1-x535.google.com with SMTP id 41be03b00d2f7-7fd4998b0dbso1172795a12.0 for ; Thu, 19 Dec 2024 20:11:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734667894; x=1735272694; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7Ic/XAXWDqyq8gqlT8LhIvS1MArK08ZpPNDJQ4rUACM=; b=hhA1kuzzQ6O1lfn/lE8/WNLuplL///QZgH5TodYOhSCsFqAUowQHDlzjsolw6+AcG4 EUcyV7gUqqBkb2bj4NnK7qOxFwmDceKvATsKxSL2YB+jYvUy017TbQWsPr+0lfAiobKG 4TK+iL2TaSt30KB5mq0UBxCd5R+XAn71BGALP0Fya5kifAS3s0Azzor4bWuYaXEfmcNW kH7QM8q3b5m2e5MaC4gDNbU3AIqm57jipZLrFSgP4pp51VZvCvrAGi6Qlk0d71teeIjH EP4D+izkbuL0x636GVOjms5HhqXlXqXxLH4iGnKxWetCxPeAGJcNDLxJ5a5afhZIQC5A 7nng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734667894; x=1735272694; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7Ic/XAXWDqyq8gqlT8LhIvS1MArK08ZpPNDJQ4rUACM=; b=S5sGiMiG3J0lLvJvmR5BePKOrY1OalhUsil6c4ktAnV9HJ+rDo4dMF+L5yDXZQAEym 0Wj7/14Zn0W81rt9TaGCHhCbxV9/LbUu8io3WQcFVLsC8FpQARFIIKA9cv5qfAT92RQN wbF1casD7mJgxTtkCbhIg417V8vRhjr8/hRFjfWSETRC5UR7nQY5ikfPbCCRvpUq5bxo OMDStKa+3ocpBBxKbDC8fyFIzYRyUOUbT4pXf7tOCX0bxt9Wc7yNRhKDxj8pO6y/26+U /OedF4e9Phn5gLKEZyYfed5WKgnP56zlgUdbWCBeFQh2yAnn6olxTBLLYa51cTrBEji5 VVZQ== X-Gm-Message-State: AOJu0YzcffRjfKKZvLr/J3OqGrnaGUGm6ZB1nT3Qq0Bki6g5bC0Hk/ei hsp/99kx6riwgXCqyt3STsz3vRh4iXOLcmmDCgl5AeOHWiYbewTyJ25in1evabgU/9JUzlCZvVw V X-Gm-Gg: ASbGncvWQLLFd2a2TEt5tJvp2lDak+7ro5hdvwmJgCrEqsxU1JS/+KKM41zuvOM31Ls aHZzj/W+U0FwKkJVsFqzpGD+wv6wZcLOfYYUfAzEjJzB0Q0Dnz/I+T19nLIT2Lp3Wq0OniCU92y kfVQbvUMaZLL6sKAtoq4q2TvnW1VQS8gK4Qwg2Q7Mph3+G6EU+W8VVUvw2o1CLRrsp3KZ4QaVgr esQGhHLhFCQu15Od3vnGAp1KcKjvkcTz7HWUw/g0uHU+j+MirnuqzgrHEsH1lg= X-Google-Smtp-Source: AGHT+IHzbP5UDfjXtI6qZUnEPkUii0wv7fvgbR1ZdVmcU9NDz4e9DhOI07pN6/ONRNh1vIVLtK9gnQ== X-Received: by 2002:a17:90b:2b8f:b0:2ee:f1e3:fd21 with SMTP id 98e67ed59e1d1-2f452eb3cecmr2111623a91.25.1734667893807; Thu, 19 Dec 2024 20:11:33 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f2ee26fc22sm4165260a91.51.2024.12.19.20.11.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 20:11:33 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PATCH v2 39/51] tcg/optimize: Use fold_masks_zs in fold_sextract Date: Thu, 19 Dec 2024 20:10:51 -0800 Message-ID: <20241220041104.53105-40-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220041104.53105-1-richard.henderson@linaro.org> References: <20241220041104.53105-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::535; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x535.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Avoid the use of the OptContext slots. Find TempOptInfo once. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- tcg/optimize.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index fae6a29685..d0a9ea1ee4 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -2524,31 +2524,25 @@ static bool fold_cmpsel_vec(OptContext *ctx, TCGOp *op) static bool fold_sextract(OptContext *ctx, TCGOp *op) { uint64_t z_mask, s_mask, s_mask_old; + TempOptInfo *t1 = arg_info(op->args[1]); int pos = op->args[2]; int len = op->args[3]; - if (arg_is_const(op->args[1])) { - uint64_t t; - - t = arg_info(op->args[1])->val; - t = sextract64(t, pos, len); - return tcg_opt_gen_movi(ctx, op, op->args[0], t); + if (t1->is_const) { + return tcg_opt_gen_movi(ctx, op, op->args[0], + sextract64(t1->val, pos, len)); } - z_mask = arg_info(op->args[1])->z_mask; - z_mask = sextract64(z_mask, pos, len); - ctx->z_mask = z_mask; - - s_mask_old = arg_info(op->args[1])->s_mask; + s_mask_old = t1->s_mask; s_mask = sextract64(s_mask_old, pos, len); s_mask |= MAKE_64BIT_MASK(len, 64 - len); - ctx->s_mask = s_mask; if (pos == 0 && fold_affected_mask(ctx, op, s_mask & ~s_mask_old)) { return true; } - return fold_masks(ctx, op); + z_mask = sextract64(t1->z_mask, pos, len); + return fold_masks_zs(ctx, op, z_mask, s_mask); } static bool fold_shift(OptContext *ctx, TCGOp *op) From patchwork Fri Dec 20 04:10:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13916176 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AEDB7E7718A for ; Fri, 20 Dec 2024 04:18:20 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOUR5-0003vG-Dv; Thu, 19 Dec 2024 23:16:23 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOUPN-00010q-TD for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:14:39 -0500 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOUPM-0006pI-E1 for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:14:37 -0500 Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-725e71a11f7so2030682b3a.1 for ; Thu, 19 Dec 2024 20:14:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734668075; x=1735272875; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=zHRYikYlUcGaNY1VZY67VXJBI/Xxa/TUZTqCG4A2qqU=; b=FPJMWxhx6//IBm9AMSVJvU6TskweitBpOHpNYz1/anR4t3HL0t428iqBfdGcKYUcZZ XRmIiHGlBo+aXINUap1mUKHFVxd1fwkCRm23TINRpJOa8gQ62RDuhfQjp05pEmXhhny6 9WNJ9R5uLB647DRx0IVSj+qI/DBz4ykONa+xAPWdnXEncvZZvohA9GZKYi5MUO5B2Fmp T7ubLFk1jVi/hKEdRh17PCOwkqaktiojOX6JsGU0Ai/riTTe+oQB/FdHtqPtrZzZ29BR /MUmzOhbbEgBNMPSFyBXOMdJS4cZvaqnGbw+JWePQMLAtW5D+xJccpxPLY3bmrcFNp8V JVVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734668075; x=1735272875; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zHRYikYlUcGaNY1VZY67VXJBI/Xxa/TUZTqCG4A2qqU=; b=IH6J+ml0Gyv97A+PurL99g+/FQdIlPuoDYjS1BCsKUG3Z0uLRudTQGLAv48/XypBzG O4p7YCe9zkJC3sSFVnA7kGLij6ydFw5CpMtzS0wEJYfmS+OL2/m+WLfe+jPobheKzb+L Fa+njOixcVdwMMj6FaTRSJLJTo8q7Mp/nJBCqWcm2Pn9cifjcVIL5r5pfpdWPxBaYxsu 1DnFpXwI2sR/CSUElAO4m1XUX5MmQMtlPSi3cVnfxt7/EFydpQvhOLSEQLGSVrwRpmMJ +lchRoeduT+o+hPIktVVIQ/cuSapzpBz6hyq/I7/SpNLDJm1MqyUMrVsH0KJq+a1p8tS E7ZQ== X-Gm-Message-State: AOJu0YwErfakSGA9SIP9oSh3iXthlVtQ+IrD3Lkv9Bxq3/yYRknjVS8l eXgi/p4FELeAFlqj8qRbNhjQrRiU4rXBWzPwBMgIBhd7l0fAIKQe7UwP2/kNQiNv7emW979woP5 b X-Gm-Gg: ASbGnctpDLG09OGJo5XKMe17/z01D/GAE+LDFmexSc9Hb/Aue1qZaL3g8WyMQbVAWEb RZKHjDSTLDS4L6T7ENnKYtWpXCllqojNBUAKHhJYJOxNDIEm9mspvDmcOLwICnllnpmnSUHGQSN mLIaL3uwMt1IEhZdHPd+q90B5A7l6FduSGxFSJFpzr0AtU1gQgCDnMBUFhQrV+QagIHyDqx9T6q seVyPtXDT73XIp5OBsUgoXETMR4F+/TP3R5/lF6sr477HzErUE9E2DDJaKtnjU= X-Google-Smtp-Source: AGHT+IEMM2Dio2c93q3uWmEsWyIMalPHfheUKiss0qaWryad2G+Uxhpappwlr3q+LmfrK6Q/j/vyJw== X-Received: by 2002:a05:6a20:7fa6:b0:1e3:c763:74d4 with SMTP id adf61e73a8af0-1e5c6d6b62dmr8829195637.0.1734668074876; Thu, 19 Dec 2024 20:14:34 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-8529e78a55dsm506952a12.80.2024.12.19.20.14.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 20:14:34 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 40/51] tcg/optimize: Canonicalize s_mask in fold_exts, fold_sextract Date: Thu, 19 Dec 2024 20:10:52 -0800 Message-ID: <20241220041104.53105-41-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220041104.53105-1-richard.henderson@linaro.org> References: <20241220041104.53105-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::435; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x435.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Simply or'ing the an input s_mask with the mask implied by the sign extension operation may leave disconnected bits to the right. Use smask_from_smask to canonicalize. Signed-off-by: Richard Henderson Reviewed-by: Pierrick Bouvier --- tcg/optimize.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tcg/optimize.c b/tcg/optimize.c index d0a9ea1ee4..8735dc0c9c 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -1827,6 +1827,7 @@ static bool fold_exts(OptContext *ctx, TCGOp *op) g_assert_not_reached(); } s_mask |= sign << 1; + s_mask = smask_from_smask(s_mask); if (!type_change && fold_affected_mask(ctx, op, s_mask & ~s_mask_old)) { return true; @@ -2534,8 +2535,13 @@ static bool fold_sextract(OptContext *ctx, TCGOp *op) } s_mask_old = t1->s_mask; + /* + * Use the sign mask from the input, force the repetitons from + * the sign extension operation, and canonicalize the result. + */ s_mask = sextract64(s_mask_old, pos, len); s_mask |= MAKE_64BIT_MASK(len, 64 - len); + s_mask = smask_from_smask(s_mask); if (pos == 0 && fold_affected_mask(ctx, op, s_mask & ~s_mask_old)) { return true; From patchwork Fri Dec 20 04:10:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13916193 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 532EAE77188 for ; Fri, 20 Dec 2024 04:21:06 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOUPi-0001cb-FX; Thu, 19 Dec 2024 23:15:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOUPO-00010u-Dj for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:14:39 -0500 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOUPM-0006pU-Ta for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:14:38 -0500 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-728f337a921so1602974b3a.3 for ; Thu, 19 Dec 2024 20:14:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734668075; x=1735272875; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0IWo/oKWpUsKxvLdqkhmOJJROWpNHlQx02FmK6Y4F68=; b=J6voWO2lWqdzHmsiCapVspq6Sj7RThGn7YIPHzF7FUIteCwg/WxRM05ygvtM+3hj1c +2EQ7jLT3XGLYry+HFBCL8iM0rgDmQ3BDEXFdnbel3vyXbmGFDRsicD3+Oqc4Adqb4eV GlhU17k3WWk2ly7S2wLh3GZ6VL8GkU3m+AFdyTgcnK+BI7p9weIFMnAYWclelL7UNy1C B8E4isRMmUh4rMpgi7UA91TxvAKsOAoB6rRWbX3rcBigwJJg3U1cIGyefMPLZPAQ3SLN b5vzx5GSjDiMoi1FX9ohwJ3W6ODeUKdebIBK1BCA/sBfIPdVS7wHvFYNSDmL7a9QBvEO +GXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734668075; x=1735272875; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0IWo/oKWpUsKxvLdqkhmOJJROWpNHlQx02FmK6Y4F68=; b=KWlf0ZVQBqVTLZTSc5Xqr5DAun2VvXlUO1ZfmMl/mQD9ykhKYLqSrYF/s56pnaSV96 4LkkUGfqFAqho2BjUQzWMcrhgy3eaHzj7sD3UAsaBEfFKY6i1Z+tQIPVF9PimiLIJuYs cU42wjVOa3pWvpsm4gon91MQM94s5C8hezX6h6YRGhACnyLktFyIyDbML1sNBzONwkFm uIpWQ+3m+iTqlASG9Gvl69wJZH9++aXpfGJyfXHotR5jup5tn2k4XyT+o0YvJ4pkX8W+ u1JimFGLTzeiyuaqQylPgLk3fyBLCTJNE+yA4gJZG1GfCPunmCIQ+QjcGh3k94ON/psH CCiA== X-Gm-Message-State: AOJu0Ywkdd4FdCGUhSBKnQYCJ/DPIPAzV5KhK8EGmzS4ALvxjlSvCsV6 67kG2RGxMBiAmaIpg4ZjAiD9BlbwGSF0GyomFEwX0iEdaSLrKbdlI+hVqM5kWlk2wu5ZqTfI2wN f X-Gm-Gg: ASbGnctzGZuVAhzTUzdywO9/vn3i7tVBlw7P2VKShPWnA8+KIBqQNkWk9Gjg+HJ9rbb n8JHaKqY9euwgTQ13KprlkHBUvyJamp6cqZB+kEd9Y+3NihG6r10DUGsNrZA7b1Fp1hXFh8/b+C QTzJmBBhAodbBNdh8vgaNgg1qo8Iz82cPigRGJdM3BONsWDXo9enC+rd+iaY3z8xgzbgly8nHST 0nbtFuqvd8eQFRqQ4CeSV/oapafWNJoV2+3a65RnYyWMlFbwrTCuX2YzLX1IkA= X-Google-Smtp-Source: AGHT+IGF5mpU3r+t4yPkVucNczxw9L7KD35WSrAxQ0eQLhdp04EXuW7leKGXQuvhOQlR+gcTjTehMw== X-Received: by 2002:a05:6a20:9d93:b0:1e1:ccfb:221 with SMTP id adf61e73a8af0-1e5e0846935mr2794862637.44.1734668075650; Thu, 19 Dec 2024 20:14:35 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-8529e78a55dsm506952a12.80.2024.12.19.20.14.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 20:14:35 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PATCH v2 41/51] tcg/optimize: Use fold_masks_zs, fold_masks_s in fold_shift Date: Thu, 19 Dec 2024 20:10:53 -0800 Message-ID: <20241220041104.53105-42-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220041104.53105-1-richard.henderson@linaro.org> References: <20241220041104.53105-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Avoid the use of the OptContext slots. Find TempOptInfo once. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- tcg/optimize.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index 8735dc0c9c..da48aadd12 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -2554,6 +2554,7 @@ static bool fold_sextract(OptContext *ctx, TCGOp *op) static bool fold_shift(OptContext *ctx, TCGOp *op) { uint64_t s_mask, z_mask, sign; + TempOptInfo *t1, *t2; if (fold_const2(ctx, op) || fold_ix_to_i(ctx, op, 0) || @@ -2561,18 +2562,19 @@ static bool fold_shift(OptContext *ctx, TCGOp *op) return true; } - s_mask = arg_info(op->args[1])->s_mask; - z_mask = arg_info(op->args[1])->z_mask; + t1 = arg_info(op->args[1]); + t2 = arg_info(op->args[2]); + s_mask = t1->s_mask; + z_mask = t1->z_mask; - if (arg_is_const(op->args[2])) { - int sh = arg_info(op->args[2])->val; - - ctx->z_mask = do_constant_folding(op->opc, ctx->type, z_mask, sh); + if (t2->is_const) { + int sh = t2->val; + z_mask = do_constant_folding(op->opc, ctx->type, z_mask, sh); s_mask = do_constant_folding(op->opc, ctx->type, s_mask, sh); - ctx->s_mask = smask_from_smask(s_mask); + s_mask = smask_from_smask(s_mask); - return fold_masks(ctx, op); + return fold_masks_zs(ctx, op, z_mask, s_mask); } switch (op->opc) { @@ -2581,23 +2583,22 @@ static bool fold_shift(OptContext *ctx, TCGOp *op) * Arithmetic right shift will not reduce the number of * input sign repetitions. */ - ctx->s_mask = s_mask; - break; + return fold_masks_s(ctx, op, s_mask); CASE_OP_32_64(shr): /* * If the sign bit is known zero, then logical right shift - * will not reduced the number of input sign repetitions. + * will not reduce the number of input sign repetitions. */ sign = (s_mask & -s_mask) >> 1; if (sign && !(z_mask & sign)) { - ctx->s_mask = s_mask; + return fold_masks_s(ctx, op, s_mask); } break; default: break; } - return false; + return finish_folding(ctx, op); } static bool fold_sub_to_neg(OptContext *ctx, TCGOp *op) From patchwork Fri Dec 20 04:10:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13916186 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4A27FE77188 for ; Fri, 20 Dec 2024 04:19:24 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOUQ7-0001z5-0O; Thu, 19 Dec 2024 23:15:25 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOUPP-000115-OO for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:14:39 -0500 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOUPO-0006pg-Be for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:14:39 -0500 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-725f2f79ed9so1245380b3a.2 for ; Thu, 19 Dec 2024 20:14:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734668077; x=1735272877; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=atQvaPE2FE0PiFVNmcXbnVbK/0bdfapYYtNsmIEQxj0=; b=gxIE6seK8VkIVMydtdQxUewAPF+3uItJm3rRtUUTT0fhOKok2Um0OorOEJ6tlHWvvK OmiqHfL+kxaySoEoSigZ0urSfzb30yGu7qfYAO1WCDyVPsxJEOylE7Yu1wX0ABe66Jxq vqCprHqqbXlSeNcSP8ZoBsZdR4zoAo91CERFYd+djJHBlkz5Vifcqz9VKL7Fyvgz55nC Bqwb4TJVrPfPpmH9yOhGri5T/jOzVZ467lGTJ1XzdiuOEusLG33PF5v0x52TmkwBrbf5 xJNR+TqEkjKUKWzLGfi8pBJp6GJAE/IKWPki9luSJzWf6no71ON7hsD8xDyyEVoofKGz SHpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734668077; x=1735272877; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=atQvaPE2FE0PiFVNmcXbnVbK/0bdfapYYtNsmIEQxj0=; b=aMdFu8cyBuLOORDebXC4/I/5sILw6lkrxGgQkSpARfrp8iitAfKRAEcK6JgxfMyJ3g czoxSu4IWZgSftfCUZjP4HoQuCUhlOkjQiyFhPYW+iHUrwaoxCiAD0SdSlF4CyYnPBEb UT6Nw8+tFzxzBo/C9+OR5o38W9NPra/Kh3Kft0DNN67xPe/DPNvIzf2SN780rUEB9NB3 o8qCYu69dze0kw965Yu+8p07zom5tUSdTwA4EHHlhEeruwfRqTmkeJqjuVrZzYYYCqMC HHQDkiGqHzx+WHL1M9umxJOjDq2DgEXDQBXw3UOB1aEOMe/Ez78N2K0aukE7kjG+jUKM nnNg== X-Gm-Message-State: AOJu0Yz36sX+I4F7X8/LEeEXK5rrE+Tz1xwZa2qIZcbBKo5+7tk+/Q6h fbAaKuyoa9N0NO3EUUvezyAj+UxXTB2eNcsVxP9aCB52nGQNSxtld562IvvOGsQwUJTWrJb6kT/ 1 X-Gm-Gg: ASbGncvfV3zY1UZ6cy8339B44JJ6x5zyp/F9aXfC1ZkW/SlR8tEcIx5ZI9kqEawMjss WvPXpG4BqeZR5bD8/V+eQYnFLatSct6CqT0Oftvwq6PuyFDSyUFekfwefl9ZIThlFIbi8jmEeAy 5082ASAQbwBpgan4CXBKH5a/wNrMu5C44zxG73km4c7OwkF95bU++BDp/N1+paPrUZJrjnO2oGi bXqlMtDTSWnYSdtoODWYqzfum3YXiK9M+FGs/qv2mQ4+zBHWg2AO8aL6rEVztE= X-Google-Smtp-Source: AGHT+IE8dPTk93IhqzS/ajh76BoRXEs/W0Df7bG2QH3W6L/g+HDw2AHsmpyGo1J8j6WTHly5W0vTeg== X-Received: by 2002:a05:6a21:3987:b0:1e1:dbfd:582b with SMTP id adf61e73a8af0-1e5e0461e18mr2930372637.15.1734668077050; Thu, 19 Dec 2024 20:14:37 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-8529e78a55dsm506952a12.80.2024.12.19.20.14.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 20:14:36 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 42/51] tcg/optimize: Simplify sign bit test in fold_shift Date: Thu, 19 Dec 2024 20:10:54 -0800 Message-ID: <20241220041104.53105-43-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220041104.53105-1-richard.henderson@linaro.org> References: <20241220041104.53105-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::432; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x432.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Merge the two conditions, sign != 0 && !(z_mask & sign), by testing ~z_mask & sign. If sign == 0, the logical and will produce false. Signed-off-by: Richard Henderson Reviewed-by: Pierrick Bouvier --- tcg/optimize.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index da48aadd12..7219415fe2 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -2590,7 +2590,7 @@ static bool fold_shift(OptContext *ctx, TCGOp *op) * will not reduce the number of input sign repetitions. */ sign = (s_mask & -s_mask) >> 1; - if (sign && !(z_mask & sign)) { + if (~z_mask & sign) { return fold_masks_s(ctx, op, s_mask); } break; From patchwork Fri Dec 20 04:10:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13916180 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 44098E77188 for ; Fri, 20 Dec 2024 04:18:45 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOUR8-0004M0-ES; Thu, 19 Dec 2024 23:16:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOUPQ-000137-Mk for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:14:47 -0500 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOUPP-0006q8-9M for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:14:40 -0500 Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-21670dce0a7so17574775ad.1 for ; Thu, 19 Dec 2024 20:14:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734668078; x=1735272878; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dwXMRrF7RgPRPzXWK+0ltvOBnUKyuGgifKCVeP7036w=; b=SjNF/u4hN2Bpc9PyzOojzVfB7McXW25v4qWoTlIVp9OUic+EdR+n9verzSXGJHADHR 5dNgj1vOPTdFeV8OV0Zyb2Fag4X0jCo6OT44zR9DoKIBJ6U2L/6TkKuVSjmFp4l442b+ aAaF/BKaSvvFMRZ+1pGNCPe91buL3LThtuIrJd/uwp87I4O1SjNNNmVRPqUXSz0ZMmWn HpS6ujLRxbF2fowSZ76iow9nK//hTmQWOjqozbr0KfmFmKMHkt5ReqDQYLJtS3Y4rCCv zoKDviIAYBAX86O0fBcqg0qzLDjClyO87Ewde1vmR59sPCt4UzneUWsySfTH2LhpLPCx V+xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734668078; x=1735272878; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dwXMRrF7RgPRPzXWK+0ltvOBnUKyuGgifKCVeP7036w=; b=NzFVNMKB6w7HAzVvACsm8EcqC6LZtYCM1XCJbrK7tWNr3FmPZWxaQtoc1QJtKaeIm7 f7hGruL7RAze/wDYiwT6R5btX6CCVhYKcuVrztBRajPxkr4iYcRAgBMt8mCu2Go4eSLG fQ/VtbM0YzGPZqrE3wdh/kLFLvtRwFndkAzBUCb7unyEn4o/wvabL7sX+5qsyNR/aZP+ 7d+2tynu0snnX/nuCerI5JhOHQ/g4hb8u2J3Ozc59MMbvFb4JyKaB9AB/CSjmYjjViSA L6AUdjlLezDt+2CakMHt0dtflalzBGfvvccYOITrMYnpRtEF7/fdm+sAvBiXTPRjElRg igYg== X-Gm-Message-State: AOJu0YxgEkeFMcw2H3EgNvMnhJ9wc/0bkmx4btVP/tTjsceN/BdkPu31 NGinuxShxdfViEpDPeS0XvBCFSCOtQJnYcmJG+4tx/NcGfQ6TAj0iaznGTnXGfNlGCQWM4ulFLN B X-Gm-Gg: ASbGncuT2496zKT3uaD1r6bSTSF7EUriU2ff/7uFtvF0I5ki4qRFQqdhRIQtWtt88zT 3vEH8uRPIJP0w9kEV14TAfQYM4oRPvOPrVwY9qmUfPjJhErS/JfkhTgPPavOEwBODDY9AmZ181S Smik7lYWYFvOOa1eQ4pYMmxaVOSE31l25Yc99riLVkdlbDO8As6qmx34D7/Fgd9vP5kpLU+VD9N qoxlUwr1e3FgAR6lsqT2BlsmY9e2c6kfTEft6NzNz06lCmUxT9iYHIK73Tm9XQ= X-Google-Smtp-Source: AGHT+IFHtz8e0cRRkxetDzAZmnuPVm/CKScSq7gMAk+VWFaY8rCWwUHf1zi2VLUuUzn7JvmsccUiyQ== X-Received: by 2002:a17:903:2c6:b0:216:3c36:69a7 with SMTP id d9443c01a7336-219e6f262admr18225605ad.45.1734668077958; Thu, 19 Dec 2024 20:14:37 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-8529e78a55dsm506952a12.80.2024.12.19.20.14.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 20:14:37 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PATCH v2 43/51] tcg/optimize: Use finish_folding in fold_sub, fold_sub_vec Date: Thu, 19 Dec 2024 20:10:55 -0800 Message-ID: <20241220041104.53105-44-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220041104.53105-1-richard.henderson@linaro.org> References: <20241220041104.53105-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62a; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62a.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Duplicate fold_sub_vec into fold_sub instead of calling it, now that fold_sub_vec always returns true. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- tcg/optimize.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index 7219415fe2..bfce2dcf60 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -2645,12 +2645,15 @@ static bool fold_sub_vec(OptContext *ctx, TCGOp *op) fold_sub_to_neg(ctx, op)) { return true; } - return false; + return finish_folding(ctx, op); } static bool fold_sub(OptContext *ctx, TCGOp *op) { - if (fold_const2(ctx, op) || fold_sub_vec(ctx, op)) { + if (fold_const2(ctx, op) || + fold_xx_to_i(ctx, op, 0) || + fold_xi_to_x(ctx, op, 0) || + fold_sub_to_neg(ctx, op)) { return true; } @@ -2662,7 +2665,7 @@ static bool fold_sub(OptContext *ctx, TCGOp *op) ? INDEX_op_add_i32 : INDEX_op_add_i64); op->args[2] = arg_new_constant(ctx, -val); } - return false; + return finish_folding(ctx, op); } static bool fold_sub2(OptContext *ctx, TCGOp *op) From patchwork Fri Dec 20 04:10:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13916169 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AA311E77188 for ; Fri, 20 Dec 2024 04:16:42 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOUPk-0001dX-PL; Thu, 19 Dec 2024 23:15:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOUPR-00018Z-Pe for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:14:47 -0500 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOUPQ-0006qL-99 for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:14:41 -0500 Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-216401de828so13652075ad.3 for ; Thu, 19 Dec 2024 20:14:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734668079; x=1735272879; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bjwaNKNFpgdbaIX3eqenSXZqLGMLSQbd2qnsL5aQqSM=; b=OKRbVJM2yGcTAm5YlyqIU8nScOE5OzoRHczxAN8n5sqJCP4z+diQWrkwfPhjVW7/hM t7DpQHpd5Nlqwjmk2f0zc+agmuRLRpjouohsNH17YbIN7p17v1cIp+crNpnkUq9DQTjH s/+1kM3pYAb2j8jcT9OppjeCWMO/rCeBtmMZxwDf2r7wenKZvdRIFpNiG6r9snz6rU46 tnlWyZrIaYEIUuRP0or0YwEFgtW1KD6VbhcPBtnX9ehc1+bOYn7cqkfVcyTv3C2XOzZo xyjBj2hDBQbWMYG5uNbXUgjgyVxbk4+o4QE/vnRi0913Jzu2CuZaL/oevQjC+hYWvxVn 7QzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734668079; x=1735272879; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bjwaNKNFpgdbaIX3eqenSXZqLGMLSQbd2qnsL5aQqSM=; b=ilY7Y59Z3i83IsTSQkBDVASrFi5QdSqvYwvR/LndVuGdoKvXaUh6u1dbh/WqMiBC3V KA3YxH5hpJUxZ0BJcjPw3UxpER+AFeiZhMRAZWuUL6zWOWhlcIEK4wY+jbxEBljnY2zE C9UC3B3ffDZrXt/sQjJ2NA10qyAcB+lXg7odD1Im0FxGzTxl0yZCcsvt864Hl8YK85IX 0Jrk19knGXGSuIfylgIkD9bRiBFgoclonZKMCmY4QsTiOMCTx8ZKomyuB5SXoyoX8YRB ekk3Fy1fBnchsAxOotpl76aPv8OJwzz/Jib7lZAMybtcP+COojwK1icOEada9ldM5e1p IXTQ== X-Gm-Message-State: AOJu0YxrHB+faeutZ4t5n4on4i/EvP4QRW0abVjYtgyUGkt5cGG9OUSC i0Ax5ojfcSW5kAx2h5xsQYDrRp818L/WaLf6tn5KNMFsT1OkrkYMe8rb9VpPo0iZA03H7FtSNYh 5 X-Gm-Gg: ASbGncvR/fMU/cPWhYu9ZK3gJAMz2BY3312QahXme6/C9OhmgcNzi5IL/2xSe+ZSq8j +efP+2y+XPKy7U3Clh5mHu8HM4CekYpGQxpze1V0x67NqSS+X0uABXV8Vfm8GPLSZKZklD2mc+g NTdu7kg0oy7gN5yUdBgBjm9+DfTPdDki1OoCwlGVwNiwhTMDCOQbBLdkyGXc2HCISHyrPCe7Laa BC4klJitiUQqjDNwp3hB+yAxoWwXCLU9mBwMYAP/v6SvW4c07ixRgywZSVrU/w= X-Google-Smtp-Source: AGHT+IExVnBX4OzA6CZ1RuM5ltYL9T/9IRn6+SJFtLm9KmloxN483QG4XwszJjIiAOFIQW8t5ISI4g== X-Received: by 2002:a17:902:d4c4:b0:216:7cbf:951f with SMTP id d9443c01a7336-219e6ea195cmr16677335ad.21.1734668078733; Thu, 19 Dec 2024 20:14:38 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-8529e78a55dsm506952a12.80.2024.12.19.20.14.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 20:14:38 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PATCH v2 44/51] tcg/optimize: Use fold_masks_zs in fold_tcg_ld Date: Thu, 19 Dec 2024 20:10:56 -0800 Message-ID: <20241220041104.53105-45-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220041104.53105-1-richard.henderson@linaro.org> References: <20241220041104.53105-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::631; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x631.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Avoid the use of the OptContext slots. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- tcg/optimize.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index bfce2dcf60..56bf3c1aaa 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -2675,33 +2675,35 @@ static bool fold_sub2(OptContext *ctx, TCGOp *op) static bool fold_tcg_ld(OptContext *ctx, TCGOp *op) { + uint64_t z_mask = -1, s_mask; + /* We can't do any folding with a load, but we can record bits. */ switch (op->opc) { CASE_OP_32_64(ld8s): - ctx->s_mask = MAKE_64BIT_MASK(8, 56); + s_mask = MAKE_64BIT_MASK(8, 56); break; CASE_OP_32_64(ld8u): - ctx->z_mask = MAKE_64BIT_MASK(0, 8); - ctx->s_mask = MAKE_64BIT_MASK(9, 55); + z_mask = MAKE_64BIT_MASK(0, 8); + s_mask = MAKE_64BIT_MASK(9, 55); break; CASE_OP_32_64(ld16s): - ctx->s_mask = MAKE_64BIT_MASK(16, 48); + s_mask = MAKE_64BIT_MASK(16, 48); break; CASE_OP_32_64(ld16u): - ctx->z_mask = MAKE_64BIT_MASK(0, 16); - ctx->s_mask = MAKE_64BIT_MASK(17, 47); + z_mask = MAKE_64BIT_MASK(0, 16); + s_mask = MAKE_64BIT_MASK(17, 47); break; case INDEX_op_ld32s_i64: - ctx->s_mask = MAKE_64BIT_MASK(32, 32); + s_mask = MAKE_64BIT_MASK(32, 32); break; case INDEX_op_ld32u_i64: - ctx->z_mask = MAKE_64BIT_MASK(0, 32); - ctx->s_mask = MAKE_64BIT_MASK(33, 31); + z_mask = MAKE_64BIT_MASK(0, 32); + s_mask = MAKE_64BIT_MASK(33, 31); break; default: g_assert_not_reached(); } - return false; + return fold_masks_zs(ctx, op, z_mask, s_mask); } static bool fold_tcg_ld_memcopy(OptContext *ctx, TCGOp *op) From patchwork Fri Dec 20 04:10:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13916192 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 647F9E77188 for ; Fri, 20 Dec 2024 04:20:58 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOUQA-000234-HF; Thu, 19 Dec 2024 23:15:28 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOUPS-00019J-Cc for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:14:47 -0500 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOUPQ-0006qY-ND for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:14:41 -0500 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-725dac69699so1341488b3a.0 for ; Thu, 19 Dec 2024 20:14:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734668079; x=1735272879; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HTDMls7e5F8COX2pnh1l1cFEzOeTN6vk1DRjDz2cVHM=; b=uc5FR20CKs8swpIdVSecAkQyUrWM6CWJMGWHc/Z6BsJMDWtsEOR+uFCY75ZzCKeklj Zf6d7EfPpShSRhXsGkmEtnb8UyuPo5bQwTlpGyKrlLgDYEQ/RYR+raNowFzd49xF7jc6 UpemXGcOVoTcXS+gXRio4O2esWWNNE6q1FuPWXTNOjIYuq3OZ/mjHKRDzngI1L5iI50d gFte+dP4HE+hsshRBALkdbu2Q/ZQ+UhWR6Q3C86NXNVGcnVxBkOnUYkCfw/ycQxMijdP o5LZ6nwdREh8p58sH4EygRelPRNQYNAanfyKNhQzM/MKTj+R1nI+yoJwaUdad5HK3GUa gUQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734668079; x=1735272879; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HTDMls7e5F8COX2pnh1l1cFEzOeTN6vk1DRjDz2cVHM=; b=i8iLrXcPUoXL2n6JynKpabZiwTXhl2CbbIdeErAJd3Lc2LKm+TYXreeB7PM1fXfR02 jICfsP7pEAvJxBkehhv/YJ4BzJlFXmZUH7A5xXtI9Pfb7K9HKJLnxBiyN4v10L7v2mEa z9q1zs4uqXFbWR1JQFzMJZhHjhSpYTymL2fBXksG1tf4+EkuolNvpwDLTLt09zmWWFrt C6ZOIkIcehdb1A4nER7VR6fFenYPS9mTvl9LRr0PXC71yKoXL+Lr4DIlYNyvXoCBLsvu tYxb9RJnIgYRBo+Jf5X4IKzJT5XklYg7eq1YDSEMIlqd3h1aN1/qTDEAMMB999Np9Ki0 c+Ew== X-Gm-Message-State: AOJu0YyyQzAJAB/TjuI35YFzoUIuKkB6/kAkZeLJ68E67t6IgBq32tlf A1Vy7UC1cRRZqPiiLydQsNmp38NASLUuuRBIYzxV8NQyCxviCgz3wYU/UM41vAqShJyy1ZKGMT+ b X-Gm-Gg: ASbGncs0H/rtREW9/yqcqJO8wC7NXDlbLZvz+WNvmmpJmSUi+/aRjXc/5Gmut2u9rHl SCGKIHVjaqbFgFJZo0QtzTxHXvMhIpJysJkDX2Xc2OIHWiP6L8lgQO/ZugoK60TlUDL+tr/XWnp Wi5wMhHppMONAe/L+H8y4hcJc/MLPIJEj5YMgGi9XjE0hBIp+CHMkcFpdq47GzQSRqjklUayzH2 IEimq2OS5KeYAMcDePl5d6WDAJ8tnzz0v3d9wJuZDFzdQ6FxQ/2gCmieibsKgA= X-Google-Smtp-Source: AGHT+IHnzHbHJIy1nS98CAtTEeTxdzl3rH0TAuG59hILFOmdQP9zRXTjU7AUj0O/rhnZFyZd+J5h9A== X-Received: by 2002:a05:6a20:7f87:b0:1e0:d0c8:7100 with SMTP id adf61e73a8af0-1e5e0447f07mr2859361637.7.1734668079560; Thu, 19 Dec 2024 20:14:39 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-8529e78a55dsm506952a12.80.2024.12.19.20.14.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 20:14:39 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PATCH v2 45/51] tcg/optimize: Use finish_folding in fold_tcg_ld_memcopy Date: Thu, 19 Dec 2024 20:10:57 -0800 Message-ID: <20241220041104.53105-46-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220041104.53105-1-richard.henderson@linaro.org> References: <20241220041104.53105-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- tcg/optimize.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index 56bf3c1aaa..0a84959f4c 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -2713,7 +2713,7 @@ static bool fold_tcg_ld_memcopy(OptContext *ctx, TCGOp *op) TCGType type; if (op->args[1] != tcgv_ptr_arg(tcg_env)) { - return false; + return finish_folding(ctx, op); } type = ctx->type; From patchwork Fri Dec 20 04:10:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13916181 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 256B7E77188 for ; Fri, 20 Dec 2024 04:18:50 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOUQv-0003aZ-UP; Thu, 19 Dec 2024 23:16:14 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOUPT-0001Ln-UA for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:14:49 -0500 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOUPR-0006qn-Qb for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:14:43 -0500 Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-7292a83264eso1345755b3a.0 for ; Thu, 19 Dec 2024 20:14:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734668080; x=1735272880; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JRQkBQzTRu7scLpRrqJFno9GLIyKwfRFAwGQsXfZPj8=; b=zwx2Nj1JD6vqgeeZ/xhwzu2iSPPUk0FAJqcl46ISHfcFZuv/K/4FG5dMkKm0BkZoS7 eWz4Z5uqUamRleRduBx84+8/Iz303qmLB0jZTojlRwQ44Beg4enXP37XZJNWMAINmJlP f05U2ewSBsymEKCPfEyztT30kZw3otXx02KUG4nG+UsV+eD1SaSp78173ALAQdQ5NGpU 76BW0qW5/a/gtZlofk0QSRyS2cRMcUoYEppJLTh/NbhzPMz2dfQwXkkvQhtL6EbI2FEy NNQZQtTPyQbp4/+l/YfDd45zE98NAVOEkkeRtvsUEHcDxyLwmmJk879E1J9LCjFYnb2M yrbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734668080; x=1735272880; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JRQkBQzTRu7scLpRrqJFno9GLIyKwfRFAwGQsXfZPj8=; b=qn++3VmWYNJnqslpelQZexkPlEBj7yNBhY5zlXW1tSPsXDFa/WGj5xcx5+4+8QSWnN IY0/3nQGijuQdEQWSEYZXd0M7pkrZ8bmVhGINJNrkDUkxtmoO/5ch+xYUHqCkd+lZP9q MH2fMz+JvluLINjubymVthPwepely1OjZqcDe1SxjCu7sf7DcoGOP5Lcst99UeklQFIH F20yaV+/G3GOvJoXJMsNU58d53yXNIQJeSklWcA3OXe1afrUeYImhzYTzd9M8mpMvdBb OD78VxtNd3DdmtSwwxX5Cn3V4txaYzAPScgF5Lz13t1yss4/j+mKkm+l+CHJhg0LV7v5 zEqQ== X-Gm-Message-State: AOJu0YzzhTJIk8PD7BRb125xyrckUK16l+gr2qpMC9ZKDYsKz/h9KjwW nf/4KrnDLhaN4xFMFZOIscLSIq/z5fsb29gdVdg1a5v5PnPjNtP2HybSC8pLH0NWziMotk2/Stt s X-Gm-Gg: ASbGncsQhRmrNyYFq3jyWHYvVbyWR3ciiw+mr8MFst2c/hLZWgQxTTPf4FUg3Id5eyn nWdFJFhssD3axGrnxkRx6PgkAq4eLshwBy64igKhAgoOiIRvwMO/HKa7Imy2ajyNUvqwfj5Lh33 /jVLgsze2HoWh7UXl7vUlft7q1lwPR6uqQ3gnpatYyEI6ksHSdgeRwVQzfoxq7wuPGoebW4Qhcf pQTPNTsdIKaufgzCsHdRgirvvqG6Jjfi6fGPBOsnZVQUWP1qyOjZWNQbMlI5p4= X-Google-Smtp-Source: AGHT+IEnGTU2K0VvmCJC9q8FhopKdmQClxxfXc3e7Uj6JFrB1EuLsitemCd+Zmj1S5ruSVokAnZ9hg== X-Received: by 2002:a05:6a00:3286:b0:725:b201:2353 with SMTP id d2e1a72fcca58-72abdec8856mr1967427b3a.13.1734668080241; Thu, 19 Dec 2024 20:14:40 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-8529e78a55dsm506952a12.80.2024.12.19.20.14.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 20:14:39 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PATCH v2 46/51] tcg/optimize: Use fold_masks_zs in fold_xor Date: Thu, 19 Dec 2024 20:10:58 -0800 Message-ID: <20241220041104.53105-47-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220041104.53105-1-richard.henderson@linaro.org> References: <20241220041104.53105-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Avoid the use of the OptContext slots. Find TempOptInfo once. Remove fold_masks as the function becomes unused. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- tcg/optimize.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index 0a84959f4c..6f81d2e831 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -1096,11 +1096,6 @@ static bool fold_masks_s(OptContext *ctx, TCGOp *op, uint64_t s_mask) return fold_masks_zs(ctx, op, -1, s_mask); } -static bool fold_masks(OptContext *ctx, TCGOp *op) -{ - return fold_masks_zs(ctx, op, ctx->z_mask, ctx->s_mask); -} - /* * An "affected" mask bit is 0 if and only if the result is identical * to the first input. Thus if the entire mask is 0, the operation @@ -2797,6 +2792,9 @@ static bool fold_tcg_st_memcopy(OptContext *ctx, TCGOp *op) static bool fold_xor(OptContext *ctx, TCGOp *op) { + uint64_t z_mask, s_mask; + TempOptInfo *t1, *t2; + if (fold_const2_commutative(ctx, op) || fold_xx_to_i(ctx, op, 0) || fold_xi_to_x(ctx, op, 0) || @@ -2804,11 +2802,11 @@ static bool fold_xor(OptContext *ctx, TCGOp *op) return true; } - ctx->z_mask = arg_info(op->args[1])->z_mask - | arg_info(op->args[2])->z_mask; - ctx->s_mask = arg_info(op->args[1])->s_mask - & arg_info(op->args[2])->s_mask; - return fold_masks(ctx, op); + t1 = arg_info(op->args[1]); + t2 = arg_info(op->args[2]); + z_mask = t1->z_mask | t2->z_mask; + s_mask = t1->s_mask & t2->s_mask; + return fold_masks_zs(ctx, op, z_mask, s_mask); } static bool fold_bitsel_vec(OptContext *ctx, TCGOp *op) From patchwork Fri Dec 20 04:10:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13916167 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 720B4E77188 for ; Fri, 20 Dec 2024 04:16:32 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOUQk-0002se-Su; Thu, 19 Dec 2024 23:16:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOUPU-0001MR-1u for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:14:49 -0500 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOUPS-0006qu-GJ for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:14:43 -0500 Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-7265c18d79bso1737340b3a.3 for ; Thu, 19 Dec 2024 20:14:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734668081; x=1735272881; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WnCYLrjrRoWxGmpvDns+P9bIwvUmd238WAtJ1MV9Lf8=; b=GSXSwG1kFf+QKhVfktH4p4zdveNpLpWr/st2HLqwDPntXQFMJCW+DSyvQT2ZfUE5zL SISVf/DRWLecmGYq5HfyFqIc6I/tDS/Z9Nhhv/s7ESR9+rINkGS3s5WrO1QuIqKupYtt sS2bXbDRSltjNsMLb+EKYyZan7T3e+pB9Yx3po+npRM6VcidWcfgVwaW03yzaxKfTKz1 T9jolCc09msIRe4IkHQXnqrUgRlz0akczbZHrFWGyNEa4a4lyFYQYB6lq52QWkmyMxGO j42+KvIUT4VK1W1biB22l1oNB/9SKPZMCpWPyu0I1jZia720SCPZ559OL3K20p+rPTxI RSsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734668081; x=1735272881; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WnCYLrjrRoWxGmpvDns+P9bIwvUmd238WAtJ1MV9Lf8=; b=r7WCoSaaFbn7npljyhrhtXVe5xDX5ubsuSDnbV4S8YU+iZrpKrQwueR1ZsTyKtO10C +e16hgHLfIyRE76ngg8nHwepRi3WyBMfEJ7goM8hnzTyAtX9W0iIQC27ryGU92KTV9DV 7zwBc7wSeXAR2OQ3wk9WgzaLiswAWDGBDLGVwssgUQGJfE1kEAhfDUq+7h2dSEnzxQIT mhXEF8jfzdJCJtAeMomtRduQoKcg9zfKD9CcsV3NgbIxW19xVgPECMIkhEQOgY5a0iC8 ts/zQA4iLL8xADgGq47Mh7a4Xns85UqrckFYsmpKmuN0Lh43N2W49eaaPo0RRNskaKPz Kp1A== X-Gm-Message-State: AOJu0YyflNO2t1pFbVttZg6q52LGkLWK7r7SzC9kv+PXj0bmq0b6hGzT LwLL7A+9FCX2l6FAnPJJhxbFnQiNYHVGic2mePiTf/QGqDrnOFPDWwv57j2Fvva7wiZjNEsvLoI p X-Gm-Gg: ASbGncuILpA9EyNRzGWBD+lUKhfaD3uAsNk9c2hbxi/K8Gs+DY/D5LzspqpGZX3eKsT K5J1XwEgFtPut01/LL59dqu6z92VnTeoNCX2mO+B5XYoQ133ZMx3Bahkj4pN2+prgOOaRd1zL4S bT5Hd/w/m/PVD6cxnQfu42Hc0Gpot2Xf0bO8NlyUuypg86i1hUsBG/mFcSgw4siCQ/IEqopzpXv /nZtEF7LLYv0UgVVuci6kB2kNRDQhFaQWEqDe3/qVhTeC0SugXGodbf/Q12Smo= X-Google-Smtp-Source: AGHT+IGrMXwEgCnARyAnl0cZWJ0hZeGFUwfiQz3HAh8YyT1sF9v8axh2Og6DzJVuehfEG4fG1TJw8A== X-Received: by 2002:a05:6a20:7343:b0:1e1:90bd:21a0 with SMTP id adf61e73a8af0-1e5e081f33cmr2734296637.42.1734668081042; Thu, 19 Dec 2024 20:14:41 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-8529e78a55dsm506952a12.80.2024.12.19.20.14.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 20:14:40 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PATCH v2 47/51] tcg/optimize: Use finish_folding in fold_bitsel_vec Date: Thu, 19 Dec 2024 20:10:59 -0800 Message-ID: <20241220041104.53105-48-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220041104.53105-1-richard.henderson@linaro.org> References: <20241220041104.53105-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42a; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42a.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- tcg/optimize.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index 6f81d2e831..74d1ca7484 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -2861,7 +2861,7 @@ static bool fold_bitsel_vec(OptContext *ctx, TCGOp *op) return fold_orc(ctx, op); } } - return false; + return finish_folding(ctx, op); } /* Propagate constants and copies, fold constant expressions. */ From patchwork Fri Dec 20 04:11:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13916177 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 56D64E7718A for ; Fri, 20 Dec 2024 04:18:30 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOUQu-0003Ng-Ok; Thu, 19 Dec 2024 23:16:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOUPV-0001W0-9P for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:14:49 -0500 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOUPT-0006rD-MG for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:14:44 -0500 Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-7242f559a9fso1866827b3a.1 for ; Thu, 19 Dec 2024 20:14:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734668082; x=1735272882; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=r7L4FLUiYXqQ6+VueavIkRjEije4QoOvDQPVTQQ73H4=; b=d82HzSP6W+NgQxSV4RRhb9yniV9Z+9QpdBCqSshC/ZcenkGZCCiJGSfkzcS/XFdYuF p2jXgelnTrAYt5KXBgCMRwtfZfKJ6RHMnMrZ8FoXAQEXXSlBPpVebArDPHBAIPkWGPkM mmI7sfWHfX1pzaIMf64PPRRB9G7y91oj2z62TJvMpP9oMVcRvCsP69QQki5U0TxutnHl HNnAjVL9pTP+lmX2uE5V5vXO4W8dXxeOuOBne/vwnnwwKJedetw2/Yp5ym3pqP7xcBN6 bv/uXk2kONlC/q8IdLTnQNJ2VHHc6Zv71mmHIuVsIPYjcvemGIFd0VV6ile6gnH+l1Qm 1kXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734668082; x=1735272882; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=r7L4FLUiYXqQ6+VueavIkRjEije4QoOvDQPVTQQ73H4=; b=Hzi/6OjDl0AqcgdzHyuKGdLrzusYec5+FYvCPQxWS4LBPjB4T8lyGLBtDIog+WmBHX i3Zxr35hu+H2lCPLSr2jIhbRr+t2mFlC6VICgOlvHfFaGjvETpPrKO0+2MdMU9+/TQSV RMdvE9UKijBSUJLKcDj5cH+iJOmHAUV6FOeHxmqXiCkEhaak78btFbF+A6/+OE1Ij4b0 kEteEybG8PNbJBh+pyr0so+bqkabIFk5JphvcT5AYYqJJtw4AGxTibKAPO+4HpTIoRUo oyvEKJBoM5YPkUVDIW88R/ze72Fd2+GhYNWusK0qjTGoQE5IZr4VTROPtkmLC3ABOsmr PPhA== X-Gm-Message-State: AOJu0YxwghNKNeNvg19bSae3I+amFyvyATCPdEmANVOFhIXHk2eQcW7m qhuBrxru1PozDAtKi79gnITiPRxlWIgZijXMW5jCcqEjVk7jFBcSJSK/6q0Xg5i4kOFZchauvbt B X-Gm-Gg: ASbGncvEsUaV2Cp7AC+CTB8StsmxyB9zLrTPRTiLVBrhCaGvJZhnVXPwYj1pzLHh5pH lU9hy6SuY6nsPf08H5VBHpF/HxI+7yjleM2YLNMh6W8GAyezys6t7rPgghUilFLfJwAJXflDRZE c6BlNK62EV6ew24faDUdcBq36C/mFHdbvHkzBr07cSMJPhxcZAukLL9CHVa9zTWpifmDtx2o+Zo uygVcQSMIQLaQtkjQtJJ6or5S0HaPNReuZR4eSvnTa+qLQfrjG/QHsmx1nqvUw= X-Google-Smtp-Source: AGHT+IHhJtZ+WK0dSI7JdxWUDjlx/vDNxyrivZzm5MDS0CGNZOS5tknHLcC2A4bvx6qxK5sqom3+4A== X-Received: by 2002:a05:6a21:339e:b0:1e1:aba4:209c with SMTP id adf61e73a8af0-1e5e07ffc0amr2924286637.29.1734668081957; Thu, 19 Dec 2024 20:14:41 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-8529e78a55dsm506952a12.80.2024.12.19.20.14.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 20:14:41 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PATCH v2 48/51] tcg/optimize: Use finish_folding as default in tcg_optimize Date: Thu, 19 Dec 2024 20:11:00 -0800 Message-ID: <20241220041104.53105-49-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220041104.53105-1-richard.henderson@linaro.org> References: <20241220041104.53105-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::435; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x435.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org All non-default cases now finish folding within each function. Do the same with the default case and assert it is done after. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- tcg/optimize.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index 74d1ca7484..94be844ee5 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -3124,11 +3124,9 @@ void tcg_optimize(TCGContext *s) done = true; break; default: + done = finish_folding(&ctx, op); break; } - - if (!done) { - finish_folding(&ctx, op); - } + tcg_debug_assert(done); } } From patchwork Fri Dec 20 04:11:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13916170 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2BEBCE7718B for ; Fri, 20 Dec 2024 04:16:44 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOUQj-0002p1-E1; Thu, 19 Dec 2024 23:16:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOUPV-0001YR-Mv for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:14:49 -0500 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOUPU-0006rL-2B for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:14:45 -0500 Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-728e81257bfso1357597b3a.2 for ; Thu, 19 Dec 2024 20:14:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734668083; x=1735272883; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jULyl7u+QKbWOLYYhEW/2BBIfmsvWodRkVtxb7KDSes=; b=fOsnTLm1bzJd2IkkKD16lFemy5eFKLUxEeAu9PQaNRxDvgTa3AKw8Pl+x6uhvm8rOy 9lX0t9VQnLIH5leMRfd36vmZTF6J7QBZngAR1/KcaGnrPAahoD/yheVww3AktuDd9uDD XD/frzc69MN1CwFJBMUuCB43raUMIXeRAUvojLymCKeIfRoTogvlfmN1Vr5ytQmansgc D09C7fKzK+eh50QamszsZH+jJAW+JXyjsszzbEJgTm7rov8SEnvFOnOrDvX9UriUG942 U/geqU2EWz0/Ye8kG0sPZj/hkqMVDL5+xFQrE++eiMYkkCGkq3rpg+pFDvSWpp/pAUCC pDZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734668083; x=1735272883; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jULyl7u+QKbWOLYYhEW/2BBIfmsvWodRkVtxb7KDSes=; b=WyWrsaGun6PERWHuAIDSEm+12XJMhbA4bMD1eyJCKstuJTU7UXEY+30G76Vmgil9IZ LqjsXbXWxVVSZQxappxBh5JT3PdfzxiPaxDRq0REXQP/hzY66Qx9IPqLLoB0NDdtXXJc +2QLV5BsQvryszIf9vgH3v3SajfHvAVKauj85G2Q6ld3/7YbT3C3EDUTwNleeIN/MBWL epSZ2PaeP84jQ4SCOKVug2NYy1lodihr+Qqkv6+ywrUqVNOmtYpM3WnvY035Rk/Na+cl RLYnJaKxfKJ4L8r39mSyTPFl6lq6mwKJUcf4QSMQylAek4JxPidYHp+gsWKwLLin7Lys hjBw== X-Gm-Message-State: AOJu0YwlPEJMTBDi0OKuUmX4wifAUHHLkduTBYbfcyT8NrIturHpYkTn MwpJ2/xMTSX/LAzpjyy3yosHMNlJIv27jKtjpf67FawSmXK1mDueWQ7FUhRsnZ2ivbBeJlX5zFw S X-Gm-Gg: ASbGncsS2m2En9X0Fj6Ir6LsU/JegNM+YIRgzRBbt8YCpRu2EO6uPAaLlxSMATPgjPS WLEBwfe5et8bVhfQOHAiHFOGppQIxnGV0ckNu5O7FV+FfVlxrcQNziDbbGbxHppN5atMMhDiGpG qFs/RMnIB9ROwjaSx1LpXcLkN24tmwQN9tOov/cY1i6GI2A2DAFJFWnqINZL3LLw6zr4d/d6GnD lQVQZ4YzCtN8IJqErEEcq7EzlVMnXH/PX7JxLzqHrDcsI08qqfWkNERA2k0a+E= X-Google-Smtp-Source: AGHT+IGYrckfjn7ZpNDZAugLzW9SEcHUs83GB6NRWUjIFBHlzotmIBK/goG3sq0MSweBuG+j4//f0Q== X-Received: by 2002:a05:6a00:44ce:b0:725:ea30:ab15 with SMTP id d2e1a72fcca58-72abdd5efb5mr1743062b3a.1.1734668082624; Thu, 19 Dec 2024 20:14:42 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-8529e78a55dsm506952a12.80.2024.12.19.20.14.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 20:14:42 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PATCH v2 49/51] tcg/optimize: Remove z_mask, s_mask from OptContext Date: Thu, 19 Dec 2024 20:11:01 -0800 Message-ID: <20241220041104.53105-50-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220041104.53105-1-richard.henderson@linaro.org> References: <20241220041104.53105-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org All mask setting is now done with parameters via fold_masks_*. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- tcg/optimize.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index 94be844ee5..2b64b8a0ec 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -64,8 +64,6 @@ typedef struct OptContext { QSIMPLEQ_HEAD(, MemCopyInfo) mem_free; /* In flight values from optimization. */ - uint64_t z_mask; /* mask bit is 0 iff value bit is 0 */ - uint64_t s_mask; /* mask of clrsb(value) bits */ TCGType type; } OptContext; @@ -986,14 +984,6 @@ static bool finish_folding(OptContext *ctx, TCGOp *op) for (i = 0; i < nb_oargs; i++) { TCGTemp *ts = arg_temp(op->args[i]); reset_ts(ctx, ts); - /* - * Save the corresponding known-zero/sign bits mask for the - * first output argument (only one supported so far). - */ - if (i == 0) { - ts_info(ts)->z_mask = ctx->z_mask; - ts_info(ts)->s_mask = ctx->s_mask; - } } return true; } @@ -2907,10 +2897,6 @@ void tcg_optimize(TCGContext *s) ctx.type = TCG_TYPE_I32; } - /* Assume all bits affected, no bits known zero, no sign reps. */ - ctx.z_mask = -1; - ctx.s_mask = 0; - /* * Process each opcode. * Sorted alphabetically by opcode as much as possible. From patchwork Fri Dec 20 04:11:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13916174 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 78360E77188 for ; Fri, 20 Dec 2024 04:17:27 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOUQv-0003TD-BI; Thu, 19 Dec 2024 23:16:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOUPW-0001YW-Pj for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:14:50 -0500 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOUPU-0006rQ-Vi for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:14:46 -0500 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-725abf74334so1298126b3a.3 for ; Thu, 19 Dec 2024 20:14:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734668083; x=1735272883; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=KAulOf64Aq+MQyz7Gm3afpYDj7PG4HhSWEO5QGhMKrY=; b=Gl2dV9IP0oXdOC0s8bsj0MfbbJbthae2MNj2nYhJXXnKFQsTi5WaajgQsmdlXZc/is gilPTa5oIUItv5AXMe9JoykD9e2i8PZNpc7HIuFswCmTXtlHs6wvd12Tb9iwN/m9bCpJ iNE0RJVYkDJJBAsBKSSyyGD8sTeVSYf9+yAtAcycXxZQhAWfxLlKi7B7y66e85XVUs4N o4X6Sd6SLeggzy32IOGAPUcLq1vMv+PLESgW4GzjcWaPoR+b3WZRKW01d12iWrNTflTJ DiPyIXxlqju8PhTIRY4Zr12zJLMzUCXeSwTEoU/9DfLNlBj6ndu321s23NV4JT3Jn3np Hf9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734668083; x=1735272883; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KAulOf64Aq+MQyz7Gm3afpYDj7PG4HhSWEO5QGhMKrY=; b=QuG8dzmAKn+TekqY5eB0DuCYr5dYNeblFHp/YsZWO7xi2BBNjiUOAJqfu73znhXuMX 3zXmwhfRHP/qpif8eIJzP0StG50YK2a2Hr3R17FajYogOwwd+Wl2vCCaQAAfqSDOaGFK qH/s1/7RgSZkHIY2J0IVolCZyNh1iqfpe65c8v7jSCD7DVwcSrJuWKeLyORXgCHrjymu ESrl4dmrnNp57iNeRKev8C6vopf8M+NVDTMXgkQSO6zQ8eKMBz8eB171bBj9QY1Md0bS MJ86KbrXOoocKvwH5C6RHbcZj0hYepienURpl7rrwc+KPEfT24tNObwMu1GeVX/nDp+X l5vg== X-Gm-Message-State: AOJu0YwVyjnatjpNNVvTyulhmjleCYKpio3oD6PWuKsT5kDEydGUk19R Z2kQUgyGPJWf1uyZiBlUq8paCksCbTtOzJLOwp2OJappo4uG41jtyW25NdN/EENIEAkR8L2YK+E G X-Gm-Gg: ASbGnculgmr35MLufq32TAS/VpATL/Y+jZrIPmZSTwWkXGD/ACJ2F1pvBJTi+I7yxfR 7FPWAsdlCj882m/Cbtc4nuyV2B4lY+tqqjV5KlZHihDsw/EZn6KPyttZuYH/0feb9Ck/tWxTC6P 8KWDznsqaoe8ZO9PmgkezAvO/6QR74GFh3rx2MgbyVMq3luGZl1dTZPpkAuaNXUN8/zdnU3B1H1 cMuas97NeZuDDlCIWnFkGR6wpBt50To7p+Ke8c/K/eMYZkUWoSmwwkYlmTt5rA= X-Google-Smtp-Source: AGHT+IGQaSJ7E4TnSwOgdRbci61uPvpkftB5qjHIPmw976SITYpdEhd4wHHKJUU9T77b4pLBbO7aXw== X-Received: by 2002:a05:6a20:158c:b0:1e1:afd3:bbfc with SMTP id adf61e73a8af0-1e5e0446374mr2820327637.3.1734668083253; Thu, 19 Dec 2024 20:14:43 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-8529e78a55dsm506952a12.80.2024.12.19.20.14.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 20:14:42 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PATCH v2 50/51] tcg/optimize: Move fold_bitsel_vec into alphabetic sort Date: Thu, 19 Dec 2024 20:11:02 -0800 Message-ID: <20241220041104.53105-51-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220041104.53105-1-richard.henderson@linaro.org> References: <20241220041104.53105-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::429; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x429.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org The big comment just above says functions should be sorted. Add forward declarations as needed. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- tcg/optimize.c | 114 +++++++++++++++++++++++++------------------------ 1 file changed, 59 insertions(+), 55 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index 2b64b8a0ec..4ec70130a9 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -1211,6 +1211,10 @@ static bool fold_xx_to_x(OptContext *ctx, TCGOp *op) * 3) those that produce information about the result value. */ +static bool fold_or(OptContext *ctx, TCGOp *op); +static bool fold_orc(OptContext *ctx, TCGOp *op); +static bool fold_xor(OptContext *ctx, TCGOp *op); + static bool fold_add(OptContext *ctx, TCGOp *op) { if (fold_const2_commutative(ctx, op) || @@ -1373,6 +1377,61 @@ static bool fold_andc(OptContext *ctx, TCGOp *op) return fold_masks_zs(ctx, op, z_mask, s_mask); } +static bool fold_bitsel_vec(OptContext *ctx, TCGOp *op) +{ + /* If true and false values are the same, eliminate the cmp. */ + if (args_are_copies(op->args[2], op->args[3])) { + return tcg_opt_gen_mov(ctx, op, op->args[0], op->args[2]); + } + + if (arg_is_const(op->args[2]) && arg_is_const(op->args[3])) { + uint64_t tv = arg_info(op->args[2])->val; + uint64_t fv = arg_info(op->args[3])->val; + + if (tv == -1 && fv == 0) { + return tcg_opt_gen_mov(ctx, op, op->args[0], op->args[1]); + } + if (tv == 0 && fv == -1) { + if (TCG_TARGET_HAS_not_vec) { + op->opc = INDEX_op_not_vec; + return fold_not(ctx, op); + } else { + op->opc = INDEX_op_xor_vec; + op->args[2] = arg_new_constant(ctx, -1); + return fold_xor(ctx, op); + } + } + } + if (arg_is_const(op->args[2])) { + uint64_t tv = arg_info(op->args[2])->val; + if (tv == -1) { + op->opc = INDEX_op_or_vec; + op->args[2] = op->args[3]; + return fold_or(ctx, op); + } + if (tv == 0 && TCG_TARGET_HAS_andc_vec) { + op->opc = INDEX_op_andc_vec; + op->args[2] = op->args[1]; + op->args[1] = op->args[3]; + return fold_andc(ctx, op); + } + } + if (arg_is_const(op->args[3])) { + uint64_t fv = arg_info(op->args[3])->val; + if (fv == 0) { + op->opc = INDEX_op_and_vec; + return fold_and(ctx, op); + } + if (fv == -1 && TCG_TARGET_HAS_orc_vec) { + op->opc = INDEX_op_orc_vec; + op->args[2] = op->args[1]; + op->args[1] = op->args[3]; + return fold_orc(ctx, op); + } + } + return finish_folding(ctx, op); +} + static bool fold_brcond(OptContext *ctx, TCGOp *op) { int i = do_constant_folding_cond1(ctx, op, NO_DEST, &op->args[0], @@ -2799,61 +2858,6 @@ static bool fold_xor(OptContext *ctx, TCGOp *op) return fold_masks_zs(ctx, op, z_mask, s_mask); } -static bool fold_bitsel_vec(OptContext *ctx, TCGOp *op) -{ - /* If true and false values are the same, eliminate the cmp. */ - if (args_are_copies(op->args[2], op->args[3])) { - return tcg_opt_gen_mov(ctx, op, op->args[0], op->args[2]); - } - - if (arg_is_const(op->args[2]) && arg_is_const(op->args[3])) { - uint64_t tv = arg_info(op->args[2])->val; - uint64_t fv = arg_info(op->args[3])->val; - - if (tv == -1 && fv == 0) { - return tcg_opt_gen_mov(ctx, op, op->args[0], op->args[1]); - } - if (tv == 0 && fv == -1) { - if (TCG_TARGET_HAS_not_vec) { - op->opc = INDEX_op_not_vec; - return fold_not(ctx, op); - } else { - op->opc = INDEX_op_xor_vec; - op->args[2] = arg_new_constant(ctx, -1); - return fold_xor(ctx, op); - } - } - } - if (arg_is_const(op->args[2])) { - uint64_t tv = arg_info(op->args[2])->val; - if (tv == -1) { - op->opc = INDEX_op_or_vec; - op->args[2] = op->args[3]; - return fold_or(ctx, op); - } - if (tv == 0 && TCG_TARGET_HAS_andc_vec) { - op->opc = INDEX_op_andc_vec; - op->args[2] = op->args[1]; - op->args[1] = op->args[3]; - return fold_andc(ctx, op); - } - } - if (arg_is_const(op->args[3])) { - uint64_t fv = arg_info(op->args[3])->val; - if (fv == 0) { - op->opc = INDEX_op_and_vec; - return fold_and(ctx, op); - } - if (fv == -1 && TCG_TARGET_HAS_orc_vec) { - op->opc = INDEX_op_orc_vec; - op->args[2] = op->args[1]; - op->args[1] = op->args[3]; - return fold_orc(ctx, op); - } - } - return finish_folding(ctx, op); -} - /* Propagate constants and copies, fold constant expressions. */ void tcg_optimize(TCGContext *s) { From patchwork Fri Dec 20 04:11:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13916164 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6D431E77188 for ; Fri, 20 Dec 2024 04:16:15 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOUQ9-00022y-7r; Thu, 19 Dec 2024 23:15:27 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOUPX-0001Yf-Ku for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:14:50 -0500 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOUPV-0006rk-Lx for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:14:46 -0500 Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-72764c995e5so916821b3a.2 for ; Thu, 19 Dec 2024 20:14:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734668084; x=1735272884; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jeaDhdgh49HwDL7JKkbuMtxfcE1xBL3FzDC+L5uqhuU=; b=az/e7WiTyBU6GWbHaOWKF+fW0NAOE7ipcGRvHTVnEBOgqw1evvgETq/qCpMPD+Hp/U nq1uqk6uvQEnqz6HPrGrewpckEPS4wnFz+0Ca1G71q7XyjdmiIadziBo7Q9v9Lg4+hGi 6WPcmQ3Gh22eNSQXCwO7LDR088ElAK5pfRPED5FJbz2DiJCxOhbTNrchmZJNq4lnr7B/ s+UEH0Ct9WvFSKCg449rfLfjunMWCaI5NGKMkUzHERiRBnE1LJ7ynZ5bhwlSNazeKX+y xg2bd+RSf8rbJTfhv8Tc88tq3zh4pEojnSVTK04FBD6VOntLDNxYH1F0AebrR4xCLb5Y lREQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734668084; x=1735272884; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jeaDhdgh49HwDL7JKkbuMtxfcE1xBL3FzDC+L5uqhuU=; b=pbX5tQhRZB4UwuEZn05CPGnrR757+Je7ewhP2GZTKYKffJYVHQU25vsV7tNOgYv11s EkrZyE6a3bauAMIUooEFcfkUctXV8yexrmNfGbo6+GAsog1f/U7nKDNCLIFuhbIieNYF OsxEK5WndZi+3dTvuzZCFyU1abvR9VR8/YIxVQchw42p6sjT9niK2BK24obpE6bbCUGV whyXoD17KYfqm1zrnqy17u1jNyTVX6wK0pUVGbMuVW1yazc1YtXOns9gPeMtkJvPMY2h jexba8liWAXlZRqj+sJSnDXsz8kYz6XjXzmRBdvxBdWVclNuvh6ZNcSo9SIULX6z9YVo X52A== X-Gm-Message-State: AOJu0YzrOdZsu/q0x/omLze9ImKKWMRhQN5U2h98y3FePaREykc+brk0 fmbYH9yE4RUoGuxMX1fgz2tQMf+3iVHNytFYpA8Ju9qq0PK9PVtYflS0Wrg1ZqNwYnGqyNp1SsZ 4 X-Gm-Gg: ASbGncuslQ9sz3OpT2u1+C/KRF4AQPscypUMnXo7OAlXwK0kH60l18p9zt3P4gHJrBa LQqHOr29h4TOTMTLXxiBKbXLlKjHzy53j78x7rg1cw14tyrDJWuYCIZmdJ9IuV8T/QSniIQE5pA mbEubLZgEszs9YLEl7lMklC9Y7bnLFFUy2sjCko7FvGkLruHT68eWOQ3vVEYHLZKkgkiuVMeqe0 ujXvXEqiHYOvOuZZtMjHXVdpJ51PMZEin0bgCdGLUvFZL9oKd7Man+SuiE3Qyw= X-Google-Smtp-Source: AGHT+IHT3J90bjDvyZLE3DHgD6hE3bP85A5oxadrtb2zqTh0ZmjRQVbisOPyivxLSRvP6yP11weC8Q== X-Received: by 2002:a05:6a00:240f:b0:728:e40d:c5fc with SMTP id d2e1a72fcca58-72abdeb6267mr1442069b3a.22.1734668084085; Thu, 19 Dec 2024 20:14:44 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-8529e78a55dsm506952a12.80.2024.12.19.20.14.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 20:14:43 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PATCH v2 51/51] tcg/optimize: Move fold_cmp_vec, fold_cmpsel_vec into alphabetic sort Date: Thu, 19 Dec 2024 20:11:03 -0800 Message-ID: <20241220041104.53105-52-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220041104.53105-1-richard.henderson@linaro.org> References: <20241220041104.53105-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org The big comment just above says functions should be sorted. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- tcg/optimize.c | 60 +++++++++++++++++++++++++------------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index 4ec70130a9..c708e50bc2 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -1635,6 +1635,36 @@ static bool fold_call(OptContext *ctx, TCGOp *op) return true; } +static bool fold_cmp_vec(OptContext *ctx, TCGOp *op) +{ + /* Canonicalize the comparison to put immediate second. */ + if (swap_commutative(NO_DEST, &op->args[1], &op->args[2])) { + op->args[3] = tcg_swap_cond(op->args[3]); + } + return finish_folding(ctx, op); +} + +static bool fold_cmpsel_vec(OptContext *ctx, TCGOp *op) +{ + /* If true and false values are the same, eliminate the cmp. */ + if (args_are_copies(op->args[3], op->args[4])) { + return tcg_opt_gen_mov(ctx, op, op->args[0], op->args[3]); + } + + /* Canonicalize the comparison to put immediate second. */ + if (swap_commutative(NO_DEST, &op->args[1], &op->args[2])) { + op->args[5] = tcg_swap_cond(op->args[5]); + } + /* + * Canonicalize the "false" input reg to match the destination, + * so that the tcg backend can implement "move if true". + */ + if (swap_commutative(op->args[0], &op->args[4], &op->args[3])) { + op->args[5] = tcg_invert_cond(op->args[5]); + } + return finish_folding(ctx, op); +} + static bool fold_count_zeros(OptContext *ctx, TCGOp *op) { uint64_t z_mask, s_mask; @@ -2536,36 +2566,6 @@ static bool fold_setcond2(OptContext *ctx, TCGOp *op) return tcg_opt_gen_movi(ctx, op, op->args[0], i); } -static bool fold_cmp_vec(OptContext *ctx, TCGOp *op) -{ - /* Canonicalize the comparison to put immediate second. */ - if (swap_commutative(NO_DEST, &op->args[1], &op->args[2])) { - op->args[3] = tcg_swap_cond(op->args[3]); - } - return finish_folding(ctx, op); -} - -static bool fold_cmpsel_vec(OptContext *ctx, TCGOp *op) -{ - /* If true and false values are the same, eliminate the cmp. */ - if (args_are_copies(op->args[3], op->args[4])) { - return tcg_opt_gen_mov(ctx, op, op->args[0], op->args[3]); - } - - /* Canonicalize the comparison to put immediate second. */ - if (swap_commutative(NO_DEST, &op->args[1], &op->args[2])) { - op->args[5] = tcg_swap_cond(op->args[5]); - } - /* - * Canonicalize the "false" input reg to match the destination, - * so that the tcg backend can implement "move if true". - */ - if (swap_commutative(op->args[0], &op->args[4], &op->args[3])) { - op->args[5] = tcg_invert_cond(op->args[5]); - } - return finish_folding(ctx, op); -} - static bool fold_sextract(OptContext *ctx, TCGOp *op) { uint64_t z_mask, s_mask, s_mask_old;