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: 852369 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp1852789wrq; Thu, 19 Dec 2024 20:16:15 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVdd84LUWg6uJ4ycXX1bK8XHAQL7m+k0F3/kRGuXUZsmpdMZNKByplU6y4fNUauanoNjnxf9Q==@linaro.org X-Google-Smtp-Source: AGHT+IFFcLuE0Bo9bm4O/Bnx0szNCvQwqWKctSWBbZgbzBbuzWnwCS0yRk+qEibFZjQsezI7NsIX X-Received: by 2002:a05:620a:31a8:b0:7b8:70b2:5093 with SMTP id af79cd13be357-7b9ba7f6879mr223686185a.42.1734668175138; Thu, 19 Dec 2024 20:16:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1734668175; cv=none; d=google.com; s=arc-20240605; b=GY34nS6NYJVqOntjQxi9sVv1blAuVpnLhNyIO1jGTVt/m2ISvXmxB8gUrlBqJDHkBl 1j+45hd+7APDbjAANmPJubtRJgDd10+Q9jG5NK3Dxt55F1ed3mQeHPB9HooHLsCeNkiC Ar9LGk4lfF1gqa59aof8olIpuFCKkpzhBHBWTfxTMniwQeiaUnPfDcpYm4q5waLmU9LD E0h3Col4bdX6Uf1182Y+mcKoPxO7YgGJ6khZ6LyV3UdTmFjINUCe0IhROzYi5397BCcg bvKtihV+IwpTUTN0adsHWSBerNLv2qUGczT6YIiUBBmDaFBayImjqa4vWMq9GHmypgEH bQkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jeaDhdgh49HwDL7JKkbuMtxfcE1xBL3FzDC+L5uqhuU=; fh=vm85eyWrvOAHduw3sqEA+cYBqvHB7M0MHFcRJg7VWOo=; b=LelzDBLocL4ELacscoeedPqI+MIPo5DdZ3jInU8riUXDCvYH+wdI6juAOSISJrU2iB SNZ0rcIG/YBq64Dg22MEwoUqUGlSW3VofZrbq+XFTHVt3W8pW/tGj+TtHSDB+Fmdmefx fHPER1x8BRp2KBtC3zLlKoIdwNZ7IvSNR2wNMPvqEf3GrC1gYGntE8ZSlRd+AAtCG8TT pFHRDopUzLQ5Uw9InfqqQG+a2fuG0FhL10JT03JCw3+VbG690bTzc0wdtcOUwAORlII7 fyYludHzHcjvgA8LQJ07hkoMnimfvcyqefPgplys7Jog4fCVAJKw5TaNFDmKCLwOSI8n wncw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="az/e7WiT"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b9ac47a528si341284885a.278.2024.12.19.20.16.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Dec 2024 20:16:15 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="az/e7WiT"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org 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-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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.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;