From patchwork Thu Oct 21 21:05:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 516100 Delivered-To: patch@linaro.org Received: by 2002:ac0:bf50:0:0:0:0:0 with SMTP id o16csp346897imj; Thu, 21 Oct 2021 14:33:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxpS3ZI7cAUOBDuwNyJj81+6rH2AbObyPTAvp1C9kxQFrds5GBfflbyT2/jbNXR4LB9sA24 X-Received: by 2002:a05:6808:1513:: with SMTP id u19mr6210545oiw.27.1634852034337; Thu, 21 Oct 2021 14:33:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634852034; cv=none; d=google.com; s=arc-20160816; b=wYn7UUxOI4DvYM764bnyVKFzFvkdDTh4oMDJBlF9X0uGQ4QgIvQZfbVzbCfqSZL+4G xTdfq764yzN46nIfDaXGiiuzhdkgDIt5wU9BtekHSzN0CgtIphfOkAzsAYNIChjMMr6c /l0TtDCBXstyfNky+CnBaYRCD2EYcW/pydXNrTaZGfAOwPa7qHWb4eTEFHCArzpMiyv6 TQjyefsXyrayjyaadoayVCs/D+1MtFP1aR0fWVo6iIfDavupCU4WVNjD38YmDe+C+GFZ 3co3zuO6iIkEPJtDMokmgjB2t31bpHUtAyWR8F3YX1mainpONpTk/OQvwvCykxZ/BzEn UT9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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=n8kgEhZ3moEwjJA/HJM3esOP+NIO+uYyJDqs9fWnnDo=; b=QM8ggqiMq/RTxGFPc3W1JMrbKQBYITmo7oVXie+653OI2ifcmQaCP7kShHnPk9gauW SvCoaaiXHjC7cE2onowGdUpReoIqcKOnAgL7G7jwe+LNs74cCBY2LZffP9j1SzMg6C3e 6gqAcTjkssLu2gsy6hHvb7T+2w2YhD+G32rHIWqo7cwC22BnM5QBBE01cWt/Bqam/E22 jQcLlpM+DGMkNrIhUJIjQ0I20gzRme3f2tEKJk5rL/uGKfcYgutGe9PD2jlUz0fDkbtL dnacCYogdXyJuwC/XMMmiPCVtOQdypl5TNzgECh4iH6sUQPgZvgPLagnxy/E6ffCayW8 v6hQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=deDI8NBW; 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=fail (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 bf32si9976780oib.237.2021.10.21.14.33.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Oct 2021 14:33:54 -0700 (PDT) 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=fail header.i=@linaro.org header.s=google header.b=deDI8NBW; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:57390 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mdfhB-00044u-LJ for patch@linaro.org; Thu, 21 Oct 2021 17:33:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48568) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mdfGI-0007eE-Ky for qemu-devel@nongnu.org; Thu, 21 Oct 2021 17:06:08 -0400 Received: from mail-pg1-x52f.google.com ([2607:f8b0:4864:20::52f]:43573) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mdfGE-0004Pg-Lg for qemu-devel@nongnu.org; Thu, 21 Oct 2021 17:06:06 -0400 Received: by mail-pg1-x52f.google.com with SMTP id r2so1386738pgl.10 for ; Thu, 21 Oct 2021 14:06:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=n8kgEhZ3moEwjJA/HJM3esOP+NIO+uYyJDqs9fWnnDo=; b=deDI8NBWnWSwlj1m+kxACbuqXGK2FEG+NfL6Ze2mZtMh3QtCls27Aoa+IUcqhb6LL/ raHSxMdrWQP1HrfCKSU3xWJimDc0xu5dldpO0aS0ANQ06DFIVQ5QXLIRLzcZXIRxpN3l GunnDfOa4KLq4GOGoBtuBZVTeTsxTNAdzzFzgPYqxMGcdg1D7wBaJT6nwf5SZAQMATYH 41QwggFF+BfrY+Oh73btpt06ga6OuDp3zxnjKMOiJ0uc62Yr0EA8ZIEIyrCcLxPCGXRB bfVFtasMTIPECNEQ7JXyOkY0aGGz4Yai9kwPusqk3P/scsh7qEPR0fjXS3XrbIi8AKYU kMLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=n8kgEhZ3moEwjJA/HJM3esOP+NIO+uYyJDqs9fWnnDo=; b=Oi+pEZX8AR4tBhfSVgvc/HXTtf4rO/mi4u6LsPJAYRpOJLJmrVvaOuMN9GzKe7j7ld E8WiiayiiwwmFDiRKqTUMDLV7ywY8oMslaMIVNSZx4Pc3wPzBMGn8qmicoiJp7VrL4nk HiWBpaOHiEIB7ZHh1ul9Q1bAiDQvdIvnvjbyMfDg54HqMd1yZ1x2dNxxIB6LwIFn1BHw OxPEKVZFDFHL9KvUBvtfmvQEo4FPUVkiXhPLlAEKB7/8i3yBPcW1B4AtmiSRccVa9oWV jDbMogLvQst3ExDTXiw57Xjm+TlsEHL9SAoeYKoFhGViLOM6oA2eR8H0xNE+XFRsLg8S F61w== X-Gm-Message-State: AOAM533BbIeOWS9GzRIzZQbtXT+pQyIiwM8qRF1MEYQeDFrcXZLw4boN CrK/EkoBpvvdg6iaTd+U3axjSMmMk6DsXA== X-Received: by 2002:a05:6a00:181d:b0:44d:8425:fbe3 with SMTP id y29-20020a056a00181d00b0044d8425fbe3mr8459157pfa.6.1634850361141; Thu, 21 Oct 2021 14:06:01 -0700 (PDT) Received: from localhost.localdomain ([71.212.134.125]) by smtp.gmail.com with ESMTPSA id g7sm5981670pgp.17.2021.10.21.14.06.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Oct 2021 14:06:00 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 28/48] tcg/optimize: Split out fold_dup, fold_dup2 Date: Thu, 21 Oct 2021 14:05:19 -0700 Message-Id: <20211021210539.825582-29-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211021210539.825582-1-richard.henderson@linaro.org> References: <20211021210539.825582-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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: luis.pires@eldorado.org.br, alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- tcg/optimize.c | 53 +++++++++++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 22 deletions(-) -- 2.25.1 Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Luis Pires diff --git a/tcg/optimize.c b/tcg/optimize.c index 77b31680f1..2d626c604a 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -915,6 +915,31 @@ static bool fold_deposit(OptContext *ctx, TCGOp *op) return false; } +static bool fold_dup(OptContext *ctx, TCGOp *op) +{ + if (arg_is_const(op->args[1])) { + uint64_t t = arg_info(op->args[1])->val; + t = dup_const(TCGOP_VECE(op), t); + return tcg_opt_gen_movi(ctx, op, op->args[0], t); + } + return false; +} + +static bool fold_dup2(OptContext *ctx, TCGOp *op) +{ + if (arg_is_const(op->args[1]) && arg_is_const(op->args[2])) { + uint64_t t = deposit64(arg_info(op->args[1])->val, 32, 32, + arg_info(op->args[2])->val); + return tcg_opt_gen_movi(ctx, op, op->args[0], t); + } + + if (args_are_copies(op->args[1], op->args[2])) { + op->opc = INDEX_op_dup_vec; + TCGOP_VECE(op) = MO_32; + } + return false; +} + static bool fold_eqv(OptContext *ctx, TCGOp *op) { return fold_const2(ctx, op); @@ -1716,28 +1741,6 @@ void tcg_optimize(TCGContext *s) done = tcg_opt_gen_mov(&ctx, op, op->args[0], op->args[1]); break; - case INDEX_op_dup_vec: - if (arg_is_const(op->args[1])) { - tmp = arg_info(op->args[1])->val; - tmp = dup_const(TCGOP_VECE(op), tmp); - tcg_opt_gen_movi(&ctx, op, op->args[0], tmp); - continue; - } - break; - - case INDEX_op_dup2_vec: - assert(TCG_TARGET_REG_BITS == 32); - if (arg_is_const(op->args[1]) && arg_is_const(op->args[2])) { - tcg_opt_gen_movi(&ctx, op, op->args[0], - deposit64(arg_info(op->args[1])->val, 32, 32, - arg_info(op->args[2])->val)); - continue; - } else if (args_are_copies(op->args[1], op->args[2])) { - op->opc = INDEX_op_dup_vec; - TCGOP_VECE(op) = MO_32; - } - break; - default: break; @@ -1781,6 +1784,12 @@ void tcg_optimize(TCGContext *s) CASE_OP_32_64(divu): done = fold_const2(&ctx, op); break; + case INDEX_op_dup_vec: + done = fold_dup(&ctx, op); + break; + case INDEX_op_dup2_vec: + done = fold_dup2(&ctx, op); + break; CASE_OP_32_64(eqv): done = fold_eqv(&ctx, op); break;