From patchwork Sun Apr 17 17:43:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562825 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1856569map; Sun, 17 Apr 2022 10:57:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9zl6h2htf8c1ln/TILlT13SD+7WQCCDZ/X/JLRXueGtdmCprzfSNZLhT+yugLc43EL/+s X-Received: by 2002:a05:622a:1443:b0:2eb:b4b7:c3b with SMTP id v3-20020a05622a144300b002ebb4b70c3bmr4960156qtx.574.1650218235432; Sun, 17 Apr 2022 10:57:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650218235; cv=none; d=google.com; s=arc-20160816; b=IeMMxn6QQbGRJ5K81izgqTG90nBWTmY5/2YbPDJPCbdWOaybq/EuHqLRhvisCmyqP2 reKInHMnY2v9rxJ3XQZ0iwh5yMgv1v/VJjMDZrJdXnfvs3GUCcyH9aQNhChtsBdRbmCm acfCTQVkBQtN177n6Q8puWcDdIo1uxet6KIJIcBQ3NsWKg/MZRBVGozRTv41ahgzgOEl QlD9tCRJtYu9+vVMfIJ8fR3Pn4Ee4CCOs4NHlElbVzGqLL3cYAHpQgnIOc6IETMAi0aT Wx5YSboe8HCkqrf0pQM+5TLV/Wq4t9B+Nyhe204Y5+ck07QQgsuFWgo8z1wf6YB1aoex 4lFg== 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=cn62Jvoq3Pb11WwsFWhBF5m4nITQmzUChokYzJD1Jq4=; b=VJzHB5J3qIsWW4yIJzeGcZuL4K21cyP59vqiuEXanMUfT0pI6wJPNNmitXuqmNIESx dy467H7aVcVXO/ZaIYFxc/QSSUPZzkS1IBcsWvx9jQlG9uApypZ9zW3zEXBUE8uhmpq2 ta3RAYGK6tb87t49Q0haHu5ZjVzLOVUy3O2ZMwECVO0SnXOoOEsZKqKz/1QQy1G3irG5 UJN0MWTPWLZu0ZVQMEBhSPcilFEtAU8yMgHjJ9bTpjbRf5XSHvL3z2FL4EPSxJD0pyiU A/jdOhMDEvNTJX3XtTPc7zaHzRmTX6Exf7O4FjeLBhIJjXZ222JK+JJArKt7u+DyUal/ wgRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eReMNywe; 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 m19-20020a05620a291300b0067ecf414f7asi2469152qkp.156.2022.04.17.10.57.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 10:57:15 -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=eReMNywe; 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]:48556 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng999-0007B2-2A for patch@linaro.org; Sun, 17 Apr 2022 13:57:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48040) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng8x3-0000hB-DG for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:45 -0400 Received: from mail-pg1-x533.google.com ([2607:f8b0:4864:20::533]:38895) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng8x1-0003J3-2W for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:44 -0400 Received: by mail-pg1-x533.google.com with SMTP id s137so14959686pgs.5 for ; Sun, 17 Apr 2022 10:44:42 -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=cn62Jvoq3Pb11WwsFWhBF5m4nITQmzUChokYzJD1Jq4=; b=eReMNyweJi6MfDh6wje3xHRDFoafz6DelGZ7BTElJiwX1MEN+afQ6vd1k0/ygxxcmH I1s06huv/JT0z+TtstYbh0GX1xX8NPOxDh5Eo6hE1u8oIp5wefixtEH0K1VGpVHQEsjD 2U0LBaFsy9Ud6KIkhsuvStq1om78hlq/HGk8RQQ93GluZ4JlzUTOvB01T0SVuia7mzZV wMT7SaAaww5UE8V4FW0kLJU0Vga4gDiSxo2+8uACq5je6JTPsRCTAOSzT/BCabSDdD9g zIL+et9OUkR26jvckhb1UsV1Mg6qhfTJJs5fg4Llk3HUWHiNz38TDvOMw08lxbo2r+d5 yXSQ== 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=cn62Jvoq3Pb11WwsFWhBF5m4nITQmzUChokYzJD1Jq4=; b=a4lZ76YK4CkbMMehU7wgK+i1IgNtmfwgA72R86nvWzlaykSW8rPeXX5FW0U2W5Kxtw dWkGtzfm46WbC4qFWSCj6AO7AebFktTK1VultlDdhgN4MVsnbeKRWpD4UHeVetd1xgI9 GAVGItKjtOZzRWVqZsET36YWtoQM0r/Y87g+gLN+liqWYxA0sIMam7wCRWqhpXRyMjcu NyBVo3moGj13fxHd0pLtidBV6iG4DG8F0LV4g1JO8aRjcEODxKCTxSrM1E1ZCbo6OFof iR3mtliPRwoaxR5z9rbNYAEA3Nwwrs61Mh1v9Yg+zjGyquQktN3Hfok+4ZluND3lX/Is iXfQ== X-Gm-Message-State: AOAM531caEK2tKWtNkPAzuJb+RZCMKdVbca3MiD7yL9QX2aYfoo/iD9V yCAC+ARVLnnrFs9gHCLV1KaWudPcIBXlyA== X-Received: by 2002:a05:6a00:b94:b0:50a:5ff2:bb2a with SMTP id g20-20020a056a000b9400b0050a5ff2bb2amr5172146pfj.56.1650217481745; Sun, 17 Apr 2022 10:44:41 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id i2-20020a17090a138200b001cb6512b579sm10372119pja.44.2022.04.17.10.44.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:44:41 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 14/60] target/arm: Simplify GEN_SHIFT in translate.c Date: Sun, 17 Apr 2022 10:43:40 -0700 Message-Id: <20220417174426.711829-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::533; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x533.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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: , Cc: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Instead of computing tmp1 = shift & 0xff; dest = (tmp1 > 0x1f ? 0 : value) << (tmp1 & 0x1f) use tmpd = value << (shift & 0x1f); dest = shift & 0xe ? 0 : tmpd; which has a flatter dependency tree. Use tcg_constant_i32 while we're at it. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/translate.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/target/arm/translate.c b/target/arm/translate.c index 6b293f8279..57631c9fa1 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -552,16 +552,14 @@ static void gen_sbc_CC(TCGv_i32 dest, TCGv_i32 t0, TCGv_i32 t1) #define GEN_SHIFT(name) \ static void gen_##name(TCGv_i32 dest, TCGv_i32 t0, TCGv_i32 t1) \ { \ - TCGv_i32 tmp1, tmp2, tmp3; \ - tmp1 = tcg_temp_new_i32(); \ - tcg_gen_andi_i32(tmp1, t1, 0xff); \ - tmp2 = tcg_const_i32(0); \ - tmp3 = tcg_const_i32(0x1f); \ - tcg_gen_movcond_i32(TCG_COND_GTU, tmp2, tmp1, tmp3, tmp2, t0); \ - tcg_temp_free_i32(tmp3); \ - tcg_gen_andi_i32(tmp1, tmp1, 0x1f); \ - tcg_gen_##name##_i32(dest, tmp2, tmp1); \ - tcg_temp_free_i32(tmp2); \ + TCGv_i32 tmpd = tcg_temp_new_i32(); \ + TCGv_i32 tmp1 = tcg_temp_new_i32(); \ + TCGv_i32 zero = tcg_constant_i32(0); \ + tcg_gen_andi_i32(tmp1, t1, 0x1f); \ + tcg_gen_##name##_i32(tmpd, t0, tmp1); \ + tcg_gen_andi_i32(tmp1, t1, 0xe0); \ + tcg_gen_movcond_i32(TCG_COND_NE, dest, tmp1, zero, zero, tmpd); \ + tcg_temp_free_i32(tmpd); \ tcg_temp_free_i32(tmp1); \ } GEN_SHIFT(shl)