From patchwork Tue Dec 10 15:24: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: 848788 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp388597wrn; Tue, 10 Dec 2024 07:33:36 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCW5/9qFuBWlQ6d51WL5zFDTrP44+qctS6d1pmDcPceKekU2vfYFHV+BTSpL7kHxqeZNu6bhQg==@linaro.org X-Google-Smtp-Source: AGHT+IFISV2WkKbR/utCHiQyUFWdVtIpgJoIL/hggwSycTr4wOw4sfGkEO8fIzGWiMgyEpOm3UFR X-Received: by 2002:a05:622a:4d07:b0:467:8217:aae3 with SMTP id d75a77b69052e-4678217ab77mr25730071cf.47.1733844816602; Tue, 10 Dec 2024 07:33:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733844816; cv=none; d=google.com; s=arc-20240605; b=SRFV8w64n3OGONR/lWRw0ckn52Iz+ayk/otH8fA8v7hfrJ8PrOm+eMtZiAXos9F5uz nGxzns6Oa+Wiz2bNb4TLt7Enltqw3ZC8NNoXuohXuUPcj3z9sYpUR30yGBP5GxqH+TkU YgWOzZDckdbKJ7pmE6Wp5opxceXIZ9Xwr7Y2CvcaYRBnBA47+IXsbxZL7lESf9QcCh3e 1qzOfa/vBfV6VNORoVFfJ7tw0UXQwLHD1MxJw03sfHkJKxbX4ghH4kch9ap9uFEKeCnH 6Y9uWKdR75bmx5NbLfKE+iYFqmm81WUpzU+2xtu7DudlivznR1GcR51AQQ66AksQACdi 4RfQ== 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:to:from :dkim-signature; bh=lMlOWnE/8rGwDe2I7u+91BhniWC68DXpBuoq//8jnkI=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=DZhdKilwxG5J2I4J5ORF82QD5y0en3gie9LQhGR84lDLay51HQuPBrFla/K5s3Vf+L i78ZEWgRvNk8jdWm+/ev7jq/tnaZ99oRb2X0YilaVk5bfMUF92s4lWYTrjLxyyTVULgx TMTPAcHF/IFQIvo3dFB/L3FjpziGF1IBrB1ge+NAZerx607/LRwtFOB3cYWKlI2eDyCN TF2byM4GEptYfSOds0xSEz8ue+Lgk9Uzh6O5AIV/v7JC7N+pL4B16ygneNrnU9c8nYFh XOqOoA4VMocBPsdDYOS9k7b6Tte81/P7D23qFgU+XxtSVgSN9QMTpiRnHso4SZviWsoO 8HwQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=s4bGPw8C; 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 d75a77b69052e-46749026737si90927261cf.55.2024.12.10.07.33.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 07:33:36 -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=s4bGPw8C; 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 1tL29m-0007YO-Hu; Tue, 10 Dec 2024 10:28: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 1tL29g-0006f0-7F for qemu-devel@nongnu.org; Tue, 10 Dec 2024 10:28:08 -0500 Received: from mail-ot1-x32b.google.com ([2607:f8b0:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL29e-0000KI-23 for qemu-devel@nongnu.org; Tue, 10 Dec 2024 10:28:07 -0500 Received: by mail-ot1-x32b.google.com with SMTP id 46e09a7af769-71e019b00e8so694329a34.1 for ; Tue, 10 Dec 2024 07:28:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733844484; x=1734449284; 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=lMlOWnE/8rGwDe2I7u+91BhniWC68DXpBuoq//8jnkI=; b=s4bGPw8CiGK0VxXfIr+Im4uA4oek9U9gUdqclIbDmrW4Pqpy478fSu51jdIMoCVoXg 6mYD7y+KTTqye9RyJOr7XYM1ZlBUIRcQI25XwNeREg1KrcFjDbRDGbKHQPi/uywMuamy DvrfeQ9C6FxVvK8yOnydqcbtJ+OuuXyrIA+qzllR50AI7PV4Yd2mNAn/fi+cJGbLbwfD 00jBA/Xi0bmEu/adoTOLH4yhV0qN7oXe/KlRPyycWgxLQPvbWaO57Be+o0rsFL1D030V upijd2KvYTSRTg/uoSF2jdWDX7lACV9iBow49BUULQ3QmbfKWtFpJ22B8nqC1Q562+3R W48A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733844484; x=1734449284; 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=lMlOWnE/8rGwDe2I7u+91BhniWC68DXpBuoq//8jnkI=; b=RneyxFWLcTOgbfkhs5xRfbm1PMffuv0tRs5j/T1jCdHFvQHY5b4VKfV7rHp36JAZG+ PLxoH/+/HXSPgWFaY5lvXOuzfdHc2TV28KbUU3641pXeN10BAgg9MHQMFZmh1IySLQ3W AiqtRZF7tsG8p2ilGMxgPZ+JE/6F4s5GMrFQtBSsHfUzuZB3DXgfZ2Vhp5XmousE3Fqj /M4gLUmxfRQJ3JXvCiSnrxmbiZvRmYV7BtH27dSWx0kbCZuz4wZI1icXYnlTydQXxxR4 GBGoZ6/LoWwFC0ITAZplDaeGs52bFYUaO22QuSGoYL/xXUFxjz2jr/hPZ3XLTcRA5Ees AYug== X-Gm-Message-State: AOJu0Yy5T4ZtpftexmVSc9c5sZKC2I9jE0BVBHQF3XZm6fOoDrSiNMmv Oh25+eUfB1J6l5LrC5WZPtdUCgEMzP030XEhurUD1lUV4e6NQorC4LHqmsl8IXHL4Rmuu9CcaU2 IR1S1rZTD X-Gm-Gg: ASbGncsxH1YmIf2dWbU9blKpbjgmH6ndOhP6JHSK/RylbNfE98MoEhxqhZoB3dc15gL qclX7HnssA2xEXdc5UzUEmka9J41mpwD0NFMRQoOYVgusUfrxoCPzyWIx/MGmEP3xzcoN3jtDc3 mog1IC6XpyloeBYNQma13Jcd+8+aC8ObsIJQ5FHSjDO3lblFQ8Kdk3EaUhJpJIqMY7TH/JJ2w+E fNesrMmib9HW4s1kWX9s/DXMCH5T8lB3n6s2abC2yWSco54OeZeTvSM328TLA== X-Received: by 2002:a05:6830:6112:b0:718:167f:7f1c with SMTP id 46e09a7af769-71dcf4e7ae5mr11509551a34.13.1733844483928; Tue, 10 Dec 2024 07:28:03 -0800 (PST) Received: from stoup.. ([187.217.227.247]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-71dc4a0267esm2785955a34.52.2024.12.10.07.28.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 07:28:03 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 46/46] tcg/optimize: Move fold_cmp_vec, fold_cmpsel_vec into alphabetic sort Date: Tue, 10 Dec 2024 09:24:01 -0600 Message-ID: <20241210152401.1823648-47-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210152401.1823648-1-richard.henderson@linaro.org> References: <20241210152401.1823648-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::32b; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32b.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. 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 54082042aa..2c5691e3c9 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -1610,6 +1610,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; @@ -2499,36 +2529,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, a_mask = -1;