From patchwork Fri Dec 30 00:01:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 637815 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp3177661pvb; Thu, 29 Dec 2022 16:04:09 -0800 (PST) X-Google-Smtp-Source: AMrXdXvmzBT7OshyigAORJma+A366A63oAbw7ytO/9WYj/mPnUV1OrLtxxafFepZTzNp+7S7eYNz X-Received: by 2002:a05:622a:4116:b0:3a8:1ba:b8ab with SMTP id cc22-20020a05622a411600b003a801bab8abmr45981377qtb.6.1672358649647; Thu, 29 Dec 2022 16:04:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672358649; cv=none; d=google.com; s=arc-20160816; b=z4IUoxqK2nC31mUbIywZ8P2iw2uJxCbS3uzeLn2DPBsgoeeiDsTkEDh6ZYKwmVgJWs rZBAyK3qQ+5Q38lOzi9mpLykKP2xKUxfYloF7EoXcFTR8Jq+66SLC6SEuBYBUg3vn9fM iO4s4gBXuPWvBNOhilp3QMB1gZsXgz7aIxh8YRqiDlJ259JpUFiZG1T+0YWbRzUSw8m6 mKlB2VOmY/7P0A8/utqduCVlgyqE40ge/ETBj3c7WMhjP2MZIqSfA9U/8zCMnCW+0H5Y iu8MR4S4eUY0Fp4ZyQEZVRZPiYciVK2v8gETJ3L1c0/zxX9ugU47BD9buJHIlE69aZzl 9nig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vtHTxOsR6ht0+9SPiWHuqeFVG+XUj4+DdhfsvFYW/Qc=; b=FI3oG2NFCpfEXf+at1uAtNa+MS2zfNr5APd5p4K4b5VtF8z6yMaLAMm/BncnxAza8V 9WtiAz7kBMN0oh+U79UlPqV07xLra34cx07LWOXfapavKLgU8kjfEYUOiPdbPLLZU0mX vreR0rWtdRT39OQBrXhf6V4uYOL6UfirPExGQi24kzUQbWs4JVIWqPz+UoOt8IWE4UKE XmV3nyHHYhyJxmnQ98lQwueUxJ/ib5OQClHVFXT/HYD5V+JuScNBeUFIhgPQZRWdDzGr /nzdHafNdN89mcGdgCs9/hJBdF6e4QZhl6/1g7q/WiBq56naUZo6thah11c1NohPKjjG /cdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CuhoUqCN; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id i3-20020a05622a08c300b003a81315771dsi9289968qte.211.2022.12.29.16.04.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 29 Dec 2022 16:04:09 -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=CuhoUqCN; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pB2r9-00031g-8L; Thu, 29 Dec 2022 19:02: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 1pB2r7-00030h-L8 for qemu-devel@nongnu.org; Thu, 29 Dec 2022 19:02:37 -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 1pB2r5-0002gz-Qg for qemu-devel@nongnu.org; Thu, 29 Dec 2022 19:02:37 -0500 Received: by mail-pj1-x102d.google.com with SMTP id fy4so20830718pjb.0 for ; Thu, 29 Dec 2022 16:02:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=vtHTxOsR6ht0+9SPiWHuqeFVG+XUj4+DdhfsvFYW/Qc=; b=CuhoUqCNKff5g05AesnvhmC82N0vQzpitb3pRHJSXSO3hBBXvOP0eYYGv+HgpNfeCo xJ1lFKkSbb9ow8bmoV68dQ5UHXuKMxsBn0ZJTwwc2ZONESqIbfFxZmctSe8MvxYYb9x9 waODVHF7gY/1PlcXEhY89PFnxMxHLgsvJUPh2QK1GbwQhtmPFdDfURfV3lAClK7tSOU8 vthdwe54NsFGEyGFbpRryFMp5Wrk0JmnXKQ7EGtj0Y905AprkiMhR0WwlXhHw0Vs7r25 qAvmyivXeAgvE/u7rAuHW7ZBaRxNuLlCI+WEPliiyCzFvIEB/pAN/oKBIsORsXGJ9um8 Za/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=vtHTxOsR6ht0+9SPiWHuqeFVG+XUj4+DdhfsvFYW/Qc=; b=vnzp33ofXBQ+IWxMk+5KZhGt6ghQ4kFCbtpvBh1q0PTuSVCIJjd0Ri952YCu+RMLVm F+Bti8mnhNAF6fWGoE3KjbeUyJbEJJwC4AOT3U3ELH5yOvm4cUh3QmYiny0sGnw7CsDT S+Qa9ssQtt3v+VaDcyNFT9J9kQzEtUB4Z8Pi2XHnRt3irvUuMJftWFO3yCabo3MKcV6X YzZLXvzDyUsfyIPqLlAsziebW3+EIK7rhV2xRoQDQHWtv4IjbGehA7p7x415LR/j3nKc a10AbVbTUVGejA3h34EjoJltxUcC1Qx4g6mKAYgkgbWsUUC2m2SWUDcfXfFqJItPAZI7 CY3Q== X-Gm-Message-State: AFqh2krZ8jslEGrsCeRq2/4dV/jxk/Ln8R/qzdSjmjvbD2ebVDawhWCd SbRaWh/q65Sn4aPjSPo2bQXJZzRJRw9Z7PZP X-Received: by 2002:a17:903:443:b0:189:c7e3:275f with SMTP id iw3-20020a170903044300b00189c7e3275fmr31281668plb.38.1672358554257; Thu, 29 Dec 2022 16:02:34 -0800 (PST) Received: from stoup.. (76-14-210-194.or.wavecable.com. [76.14.210.194]) by smtp.gmail.com with ESMTPSA id j14-20020a170903028e00b00192849e1d0asm7343953plr.116.2022.12.29.16.02.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Dec 2022 16:02:33 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 12/47] tcg: Tidy tcg_reg_alloc_op Date: Thu, 29 Dec 2022 16:01:46 -0800 Message-Id: <20221230000221.2764875-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221230000221.2764875-1-richard.henderson@linaro.org> References: <20221230000221.2764875-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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Replace goto allocate_in_reg with a boolean. Remove o_preferred_regs which isn't used, except to copy. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- tcg/tcg.c | 45 +++++++++++++++++++++------------------------ 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/tcg/tcg.c b/tcg/tcg.c index db64799e03..215ddf2db5 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -3607,7 +3607,8 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op) /* satisfy input constraints */ for (k = 0; k < nb_iargs; k++) { - TCGRegSet i_preferred_regs, o_preferred_regs; + TCGRegSet i_preferred_regs; + bool allocate_new_reg; i = def->args_ct[nb_oargs + k].sort_index; arg = op->args[i]; @@ -3622,9 +3623,12 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op) continue; } - i_preferred_regs = o_preferred_regs = 0; + reg = ts->reg; + i_preferred_regs = 0; + allocate_new_reg = false; + if (arg_ct->ialias) { - o_preferred_regs = op->output_pref[arg_ct->alias_index]; + i_preferred_regs = op->output_pref[arg_ct->alias_index]; /* * If the input is readonly, then it cannot also be an @@ -3633,30 +3637,23 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op) * register and move it. */ if (temp_readonly(ts) || !IS_DEAD_ARG(i)) { - goto allocate_in_reg; + allocate_new_reg = true; + } else if (ts->val_type == TEMP_VAL_REG) { + /* + * Check if the current register has already been + * allocated for another input. + */ + allocate_new_reg = tcg_regset_test_reg(i_allocated_regs, reg); } - - /* - * Check if the current register has already been allocated - * for another input aliased to an output. - */ - if (ts->val_type == TEMP_VAL_REG) { - reg = ts->reg; - for (int k2 = 0; k2 < k; k2++) { - int i2 = def->args_ct[nb_oargs + k2].sort_index; - if (def->args_ct[i2].ialias && reg == new_args[i2]) { - goto allocate_in_reg; - } - } - } - i_preferred_regs = o_preferred_regs; } - temp_load(s, ts, arg_ct->regs, i_allocated_regs, i_preferred_regs); - reg = ts->reg; + if (!allocate_new_reg) { + temp_load(s, ts, arg_ct->regs, i_allocated_regs, i_preferred_regs); + reg = ts->reg; + allocate_new_reg = !tcg_regset_test_reg(arg_ct->regs, reg); + } - if (!tcg_regset_test_reg(arg_ct->regs, reg)) { - allocate_in_reg: + if (allocate_new_reg) { /* * Allocate a new register matching the constraint * and move the temporary register into it. @@ -3664,7 +3661,7 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op) temp_load(s, ts, tcg_target_available_regs[ts->type], i_allocated_regs, 0); reg = tcg_reg_alloc(s, arg_ct->regs, i_allocated_regs, - o_preferred_regs, ts->indirect_base); + i_preferred_regs, ts->indirect_base); if (!tcg_out_mov(s, ts->type, reg, ts->reg)) { /* * Cross register class move not supported. Sync the