From patchwork Thu Oct 21 21:05:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 516087 Delivered-To: patch@linaro.org Received: by 2002:ac0:bf50:0:0:0:0:0 with SMTP id o16csp339880imj; Thu, 21 Oct 2021 14:24:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxqde0ebe3qpwGOPfWQimU5tvxvcwy5GDFot7s8dnVqce8TlFMzoeqY0qos/h6w1etsPbHS X-Received: by 2002:a9d:63ca:: with SMTP id e10mr6830809otl.175.1634851476226; Thu, 21 Oct 2021 14:24:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634851476; cv=none; d=google.com; s=arc-20160816; b=0GiwTHJ72Y2kT5udhyiM6LumpLdBRVfrKynT5z6fZ3T7NoxBZu0N8up4EaoRrPL1MW zD5xDhJdhmuqMzC3M7YRKrtXvHn8+3RG+RKcQUeilzKV5e5JXea/HdF8skRcP9FkPSWl 0P5d/UtfEL7nmAcOE1+KFCHlJ7dytRTt9dnNo7LLTUThYJ5vScrs5/tLy8bEEfRgCBwV O7jswmqy+AZAg7Xmm23WTyu9pGobW58fqVgBV6PQ/Skwuh6vKFlvqUBWDSpT/uMBh56Y kzATL/eYWglSUSqDJCxFlleFeECYe6RclaBEeafwygmk61ClV2DCXT8GTkZPDJfbWeVR o59w== 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=mlDz5NV39+/BiKwi9g2AHEtuJhk+VWM4jALC7rsCK2M=; b=m2bjgqGICQX5xUZxhCbD5/HOKu/1DniasMoiJ9u+bm+DtX1q2XaeXySaZQyAa8DZNX CqmryrjLZy+yxA+gSDIZ1vT0xOD74B4NM8tmntK2yJONd7wRkvMMnQ8vNyUNr8EbYG2P 9uTGlUbKJy9WwXpHwSJXaiE9w8CT1C4JM4lG2SB+oJxImXHHfl62j16b23iEeqK8zUYS PtXqKoILMgJkTTUvVDOZ5EKfRmDJTtxXBfHWMW9fzhtuxtsvnSgO4+JYGZ5MQ4rUQzNB RW2YlyWtxnghU5HLhk2l9BmJD0WdDNNS3/QrWGza5SqfLh5kiiuI3pz6XNzXm5ZsIZXW N8nA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=jaoWJJUq; 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 c4si7457623ooi.66.2021.10.21.14.24.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Oct 2021 14:24:36 -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=jaoWJJUq; 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]:59908 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mdfYB-0003LW-I4 for patch@linaro.org; Thu, 21 Oct 2021 17:24:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48468) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mdfGE-0007ZY-RW for qemu-devel@nongnu.org; Thu, 21 Oct 2021 17:06:02 -0400 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]:40601) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mdfGA-0004Jo-4b for qemu-devel@nongnu.org; Thu, 21 Oct 2021 17:06:02 -0400 Received: by mail-pl1-x62c.google.com with SMTP id v20so1280219plo.7 for ; Thu, 21 Oct 2021 14:05:56 -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=mlDz5NV39+/BiKwi9g2AHEtuJhk+VWM4jALC7rsCK2M=; b=jaoWJJUqBVnq1m3NhVt3sr8z1jDfglUP/xEYIL7Pf3tisX2lemHEJGcO6dx++RTMiH 8ce47Z/i8IEH+AaIQjfrMs9M/nhw9wrI+X+OAlsunWbVgJ6BfnSInF/nhxkx1iehjXZF AA9EQBbGcqoZynuuNSX3mhIYeRy2/qhGZXY0rHszsfdG7bjfJzQfbBX2nvTucDkfZoUp EauqCpRLGCSpjFSmINIgk9e16TTOnYadv13kj3ddK16q7BPjplUk7dk/JKHHB4hoE7RA Qbe7SrLZDyFa0MfKFqJVTsSzGJIeInMO+DXveeJe77LF4IQTpnGWjlSCJS5sjXuJm3vR ZZww== 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=mlDz5NV39+/BiKwi9g2AHEtuJhk+VWM4jALC7rsCK2M=; b=tO+HNubBdXrAPttx8Lj4qg/XqF0Dq7r9aVImv4r2+e4bHMGR/blZQf3BzBKl7rby70 1lS2ntOmX5dCgm7YNEmmurCS0mieiwwaWprrVcWydqLkL4XGTn028KXJHtvzFhaBcDIf EuZPkOEDeoHBz9/Fo2bbi3JWq8GTK+GUASjEVHF/OSMv2rBE0PmtYVUZtFAK6d223gJs TkmHzgQ9fswdBHjK4EqDbEHn6tXwoysDM9lJqsG4g1o+HeZY+/sVwSL0FbtnoH042mPJ Ne5meQ6X8qPNt7Jr1ur9t+MSDOzcDetAvOfvhYURA8OlgtfrIiLFQaDeC4NHoHxBIXdD wPPw== X-Gm-Message-State: AOAM530RzH47sh6KVZm0e5+vmMtvZZ/d2Uwhz0/Io5WtfeldteojCAwj SE0Ts8wAKbztXvQmrdcsfNTSq5fuUaOEow== X-Received: by 2002:a17:903:2341:b0:13e:ae30:412 with SMTP id c1-20020a170903234100b0013eae300412mr7387578plh.15.1634850355273; Thu, 21 Oct 2021 14:05:55 -0700 (PDT) Received: from localhost.localdomain ([71.212.134.125]) by smtp.gmail.com with ESMTPSA id g7sm5981670pgp.17.2021.10.21.14.05.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Oct 2021 14:05:54 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 20/48] tcg/optimize: Split out fold_mulu2_i32 Date: Thu, 21 Oct 2021 14:05:11 -0700 Message-Id: <20211021210539.825582-21-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::62c; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62c.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 | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) -- 2.25.1 Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Luis Pires diff --git a/tcg/optimize.c b/tcg/optimize.c index 2086e894c6..142f445cb1 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -889,6 +889,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); @@ -1695,22 +1713,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; @@ -1764,6 +1766,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;