From patchwork Sun Dec 22 16:24: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: 852945 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp3036893wrq; Sun, 22 Dec 2024 08:33:26 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWZ029PF8MOg8J9KquvnRyDDOkOYjc9BABHxDwz82vBT8PdhbLRhaU5WYRP63YmXGtMrxI0wA==@linaro.org X-Google-Smtp-Source: AGHT+IGAl1YGYhT9l50u/jqzQvFZw6rCJqSky1p+rSmYFVsn5TdJeDmtW+vjqWGitb3AWJWEkr6e X-Received: by 2002:a05:622a:1994:b0:467:5d0b:c750 with SMTP id d75a77b69052e-46a4a8dcbdbmr168716721cf.22.1734885206126; Sun, 22 Dec 2024 08:33:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1734885206; cv=none; d=google.com; s=arc-20240605; b=fH2nqq/diUwKpmdVGXz03Pp8TDZaytXRPmiV9LnglkPmDmrPQeDqUKd2ZU4rvDca6W xnqkJvqI6AuK//UO99OVTh6c5Y/HUDZyekHjPcMePge7efWy+ScaDGJ0FhTtk5Tb0ieC GxM8s2dw9LmyrgWUt0vdwGUK6tEUj7tx3kjNPtz0gWEZ1lv5X8gIxnH7p2nQfTFpuBSp l32sy7G8MwMVutcA0YiMQc2cP1a3NYBbGYKxy7HvQd+CCnU42/IcEPRZoNrgV8Mp1t/q m+sY5AhYReFl1jQ4CmKkm0J/i7k0Jk1uzlJqK7fu0s5YOQtsX1iyu0fKx6vd3n7I9gdF QSHg== 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=qQH+PLeOfmKV/hMlw3a5mreXmP+mpfARLWnXc9y+J+4=; fh=vm85eyWrvOAHduw3sqEA+cYBqvHB7M0MHFcRJg7VWOo=; b=CPbojLUvoxEo01eZCmgbBwvCFTV3x/v+OpHh9GFQjbkOk4Tk1XYEzbrUwH+38MTgZG 3uuNvSpVdnh0D5QNSTAf9NrHGKU9914JwKTlTHh2UyHZ+z9b7oAKpUr8lrHuPFaRkr7+ eKr9cl8BjCbkTOixpK/ODMMtzk5jOkqvH7plBHn5Zeh54Ab6lPWMsMTu+0A9P6PHxbG/ e7I6uqbKKXMps6FlAtj69d9if7KBQrzJwHinv6migssduIBke+FWLcFJlgncF6/+puOo S77BRWIdI/sICSatC4WJKBnnvQRKRc0Gc8oJ0RllN6tiqZuD/rnMoOEVYJqTHj7C/e+/ C9/g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eUvpJs0L; 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-46a3eb99b8bsi86993191cf.334.2024.12.22.08.33.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 22 Dec 2024 08:33:26 -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=eUvpJs0L; 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 1tPOpc-0005Rc-6w; Sun, 22 Dec 2024 11:29: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 1tPOod-00051p-0l for qemu-devel@nongnu.org; Sun, 22 Dec 2024 11:28:29 -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 1tPOoa-0003kO-O4 for qemu-devel@nongnu.org; Sun, 22 Dec 2024 11:28:26 -0500 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-728ea1e0bdbso3145058b3a.0 for ; Sun, 22 Dec 2024 08:28:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734884903; x=1735489703; 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=qQH+PLeOfmKV/hMlw3a5mreXmP+mpfARLWnXc9y+J+4=; b=eUvpJs0LE63PL7s3ZJnmUQTBU3wmhe5a5hj7+6oEhpQOvJnRaDW4ov9PEg2ilzvd9Z P2ITmp6+KMEU/80ras5zdSDBCWcO7EHoW5HmxyS5xabCRgNcQxKjemFzQTelzrSYPmxj TEphB5GgGNWpxH0tcW6tJlawD/f2Mv7Mc1WfS9UDS8JoYtahyGAf6yFTxLwj+fZFTv9s 4RbJx5WUqC/LPVwmPsKpSzp3OgL6x6//IyW07xPMBBC8LzYY4kzmLI+Mlhv63QCebUgj CAEOnCJUYYsjMMdUni5C4RNDnOZewpt2j/PFRMBw+mAy0e4q9dN6VXHaSIOzjaXnyB5l k0EA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734884903; x=1735489703; 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=qQH+PLeOfmKV/hMlw3a5mreXmP+mpfARLWnXc9y+J+4=; b=Y8WHzC8CwHl7fT9jFS8LVUIzXYYbEmawuWOCE75n5pDI2/SyLJYy5x2Z79DB7mvx5f ZYo0sFej7YvdnzfEjHs51+Wfm3h/ARWJFEo2xJddxX6jj8MmfMMpXMd1TxyqcK0BkRYZ lHtyKtG+iXNZs6aNWY0YI5B4wx6ScmAaVTbqeK9jCrJHclPT+eFdm5/23oUrHz/6LCtN jmqC78zsdCaz/gqslBfjIX+2uUPPWU/ojEwpdli8msIEjg/B94267csJuM25Pl+q+sWN l9HZZeQz1bqu16XioDGVnUS/tuAMLonz70vNFdeYt2PGU9AW9mkwCusdRtQx22NGmtGh Fdfw== X-Gm-Message-State: AOJu0YwW/7tgcGfX6Uju+63+o6iVKG5OePoSpULPHluBKNQnVNO1csor /61UnfMLXRMOjmoDWOhwSVEiCCj44LcaiBemcG6Zw4AD+qLqXpEKKAG6abZCUyHicP42qGtxq4v bAvI= X-Gm-Gg: ASbGnctoyuPB+BRz95fczdJCf9mQF/dR5GEF+IWcPX2tJL38w7ruHulxnMBDUEP9ko/ e49ZkDUs2Ne8D0/SZaSM4qgtm7mOoBONkcQey3p3iyd1CvlFALU8td1hO8cGpAu2JjZyIzXg2zc ZijQiC35qpFW99eZb1d+3F+NBl/hhbJHvywsczZFybHWutLxGUnmgnT2qrxd6TarAR7czFiLgGi Fe6u3XBb2WSmMxvp/U0huoEHhyhGkqlBxqVp/J5NCztxPaAcc5Wtv1JRTbS/xc= X-Received: by 2002:a05:6a20:e68e:b0:1e1:becc:1c81 with SMTP id adf61e73a8af0-1e5e0801191mr18594050637.32.1734884903544; Sun, 22 Dec 2024 08:28:23 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-842dcaca43bsm5848808a12.66.2024.12.22.08.28.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Dec 2024 08:28:23 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PATCH v3 51/51] tcg/optimize: Move fold_cmp_vec, fold_cmpsel_vec into alphabetic sort Date: Sun, 22 Dec 2024 08:24:46 -0800 Message-ID: <20241222162446.2415717-52-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241222162446.2415717-1-richard.henderson@linaro.org> References: <20241222162446.2415717-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+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 312cbac690..2a9c87eb07 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -1603,6 +1603,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; @@ -2502,36 +2532,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;