From patchwork Mon Aug 30 06:24:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 504312 Delivered-To: patch@linaro.org Received: by 2002:a02:8629:0:0:0:0:0 with SMTP id e38csp1520767jai; Sun, 29 Aug 2021 23:47:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzSO6F0Vv0lfLDQTWwmcd0Lak4BRNv81G9HW+m/d2cdKAUEalXcibJEGpm8pKRZt5lMhZkp X-Received: by 2002:a6b:fc17:: with SMTP id r23mr17271720ioh.89.1630306027663; Sun, 29 Aug 2021 23:47:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630306027; cv=none; d=google.com; s=arc-20160816; b=rEitY8IA3nd5Fjzs9tVymUp1+q/m5kJsveo0PuXMgfH03RkQuvcvudy0OpK556ow1T OEHR+EhTjayafFnvvluUrGins8DLqWUAv+EkH8517+16IbmbGqz6S6JfGtiAToMtOvYY EFLS7JDHWo+PnCQI7UzOJ43Ge8uyia7BZF9bGj/QycZDcIr1c9D1+OdE9QlOVGcKJUZO 2DlGXVS/nlGMKW9nSp1ITu7beYyOvLwfl+7wwiiwb5IYsUQV7aAcdzZ74mdrNUsNw70p 0Ef4EZnE4wcpThU4k1jKKyRmtSlaztISFTVx3FDR9Dg0JeUxNqDdyAJ6PBLmCZMrdjMT A65w== 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:to:from :dkim-signature; bh=fSv6smAwvoecU3iByhei9EwDSG45D2jhxFvytV+nznA=; b=yJSyonnHJbMs2Tuc0DvzDT/hwNiio9UvTz22JFBi86EKX9na0scvTh0mlQfPv8oVcX H3q3DwoMfhxgvT+O3NR5ZxnC11BkgW6p5ApWGxhsYjYSc4J+LdHzoEYnuR+ShQH3rO/G nLbSdHLyiV2IgKsBHvOvCNZbYCv0L1hBoawusHC6wB2pRDGjoZS4Ph9jB7wtXneqUNck GFltomzfDi51ybtUKzWa2EEZV0wy/iaRvNd1qMZUzDFVvNuRy6sbko/jnmJ8OPZVxWkd 424ODn4ccuZYYQMDN1VPO/BLFLjkDCKj7OjT8ZXhq5sfv4sJW08Liv3Yh1M24NCzUC/F WvrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WSoh7df0; 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 y15si13496567ioa.67.2021.08.29.23.47.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 29 Aug 2021 23:47:07 -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=pass header.i=@linaro.org header.s=google header.b=WSoh7df0; 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]:56566 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mKb4U-0007SQ-Va for patch@linaro.org; Mon, 30 Aug 2021 02:47:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46378) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mKajE-00042A-UU for qemu-devel@nongnu.org; Mon, 30 Aug 2021 02:25:08 -0400 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]:39639) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mKajD-0007Y1-AY for qemu-devel@nongnu.org; Mon, 30 Aug 2021 02:25:08 -0400 Received: by mail-pj1-x1031.google.com with SMTP id mj9-20020a17090b368900b001965618d019so2981372pjb.4 for ; Sun, 29 Aug 2021 23:25:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=fSv6smAwvoecU3iByhei9EwDSG45D2jhxFvytV+nznA=; b=WSoh7df00dpEjHjVFrDgLvZeE3qIKeupl+0CAUEjvU6Oo8xqy6JBxZUT5mPEd9VR4y H5wLZHqOM6O1mmIR6bNMbWzPVRcoVs9cnYrklGEB2vfZX8MmNmEh7bQ0z48hnEMuUzXX GC0j9ev2wkSStmnQm6avTlfD9wK/h2TiOPEawXkFtxsFCvSRHfZtX5EY2lR71zQCPScR wkIegDvBQ9Vv6SkhxLdju4QfQ1stDyV5F8ZVVwfMwxdc0hXp7dwM8N6HVf0kgUxD4w7i A/3LeipdW6/FtuOPhIfyQsMVM05pxIYkFLfxfXu7lmI/Y8DEnT1TVfSqIx4SmdRJ5AH7 u6IQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fSv6smAwvoecU3iByhei9EwDSG45D2jhxFvytV+nznA=; b=Z6PMzrRE5H2U7LD4aH5tKNVbrMxnEwHU9+T6QtMynGyfoSgMvV2LfndutWTOEVwa9S 5Y92qzbN0elJFwCq4TwZZzjzg6y8u/PuyYb3Q6EgUIhv8ha1A5OvA5fRKbNlW5eeRnbt 4MTIpbGzsB4ozKEuU3zSBXxHj7uptNRqEFxxl4hfKyaQ9XEYnRRKUxBXlYtpcB39BXEx UQIZlGsaFaYsbBfBlKb0Xsr9OeSo1gm4eRvG2y8l87QXtDJWZoUPigpMnJEhUIAgfJX5 UZDLYzJ2+ncpw9f9G3HuDNczSFMesWjD/SAuaLMSprsSG7/xe3V8q3yhTqBk1rGIfCvi mWOg== X-Gm-Message-State: AOAM531DR+MQ2uo1pEzwusQ7OaMf0ShJKifUtp7jDVL3OkXV2eJh88dt 7SYgjksYedljUZrDUKCRv8VNbEnB/hFQcQ== X-Received: by 2002:a17:90a:4093:: with SMTP id l19mr25127419pjg.118.1630304706078; Sun, 29 Aug 2021 23:25:06 -0700 (PDT) Received: from localhost.localdomain (174-21-72-39.tukw.qwest.net. [174.21.72.39]) by smtp.gmail.com with ESMTPSA id b12sm13942084pff.63.2021.08.29.23.25.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Aug 2021 23:25:05 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 20/48] tcg/optimize: Split out fold_mulu2_i32 Date: Sun, 29 Aug 2021 23:24:23 -0700 Message-Id: <20210830062451.639572-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210830062451.639572-1-richard.henderson@linaro.org> References: <20210830062451.639572-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1031; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1031.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- tcg/optimize.c | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) -- 2.25.1 diff --git a/tcg/optimize.c b/tcg/optimize.c index 58f03737d2..dbe283cedb 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -891,6 +891,24 @@ static bool fold_multiply(OptContext *ctx, TCGOp *op) return fold_const2(ctx, op); } +static bool fold_mulu2_i32(OptContext *ctx, TCGOp *op) +{ + if (arg_is_const(op->args[2]) && arg_is_const(op->args[3])) { + uint32_t a = arg_info(op->args[2])->val; + uint32_t b = arg_info(op->args[3])->val; + uint64_t r = (uint64_t)a * b; + TCGArg rl, rh; + TCGOp *op2 = tcg_op_insert_before(ctx->tcg, op, INDEX_op_mov_i32); + + rl = op->args[0]; + rh = op->args[1]; + tcg_opt_gen_movi(ctx, op, rl, (int32_t)r); + tcg_opt_gen_movi(ctx, op2, rh, (int32_t)(r >> 32)); + return true; + } + return false; +} + static bool fold_nand(OptContext *ctx, TCGOp *op) { return fold_const2(ctx, op); @@ -1697,22 +1715,6 @@ void tcg_optimize(TCGContext *s) } break; - case INDEX_op_mulu2_i32: - if (arg_is_const(op->args[2]) && arg_is_const(op->args[3])) { - uint32_t a = arg_info(op->args[2])->val; - uint32_t b = arg_info(op->args[3])->val; - uint64_t r = (uint64_t)a * b; - TCGArg rl, rh; - TCGOp *op2 = tcg_op_insert_before(s, op, INDEX_op_mov_i32); - - rl = op->args[0]; - rh = op->args[1]; - tcg_opt_gen_movi(&ctx, op, rl, (int32_t)r); - tcg_opt_gen_movi(&ctx, op2, rh, (int32_t)(r >> 32)); - continue; - } - break; - default: break; @@ -1766,6 +1768,9 @@ void tcg_optimize(TCGContext *s) CASE_OP_32_64(muluh): done = fold_multiply(&ctx, op); break; + case INDEX_op_mulu2_i32: + done = fold_mulu2_i32(&ctx, op); + break; CASE_OP_32_64(nand): done = fold_nand(&ctx, op); break;