From patchwork Mon Mar 6 00:39:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 659206 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp1575538wrb; Sun, 5 Mar 2023 16:53:15 -0800 (PST) X-Google-Smtp-Source: AK7set/BJDuGy6KovoznfI2t7SedYKEsdgMbETrR2hHZ/hnxy4W5WkWju/O1fCX0i72zhuAPKx6Y X-Received: by 2002:a05:6214:509e:b0:56e:a5ea:1450 with SMTP id kk30-20020a056214509e00b0056ea5ea1450mr11156902qvb.6.1678063994984; Sun, 05 Mar 2023 16:53:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678063994; cv=none; d=google.com; s=arc-20160816; b=WJqWOaDsxldn66xhheILTpCpEf8hLxT9szfyGY7sT/bS5UkGPdZaMlmBRiZKhpTOTB 147DesesvLvLGSD7P/PIQZVrmnyKdvKBOwfjrl1btZsBce72c9/uUouIceMW9PKL+r1A Rw+8D1x8i/UOLMfKsZdCP1U6ZgJQJMDWQvtiX65p1gNLPL/YvQ01wlPeJgUq2KI9a+4D jZzzgRfWBZcJSvPUbTV9NRxfVgNQLizm01W7gzbjvFuYW7IL0IjCKbzftfJSShDGkwRP LWX+DJyECGltj3b1NoLRnoI9coQt/dyNEWsGpeowvRKYSHQH5suC1IOduzbjVBj2aS5V Z29w== 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=kqQ2BcCZ3kgjD9PONBkMQdY9pGsYGr5TJkgoV7UntP0=; b=0WEkfxPSz5N5jEOAhfof24Y1hrYkl3C8CFqkEN2Rg35G0zwe9J3TAaHU836KyU5j3B 7FrmLruHxCvMRkrIP/6B7AB/4Bf8zmpIjhnlrhOVhabSkoZc+7Jgj29NwW3GZXUBSqYk rzGbhqRrHOdADYYupo7CVueaOM6F9ue8yGf/jOr8vBHybHB/VVBWd5x7tGMOAbDmFxGG XlBXkA7mf1K7lPxYXDyfhzuafSvZAN41GvF6aMIQbmPAHx4m2akazoLk7+nMcgR3MF8t Ks0epaZedVRPvLdDjPkQL4WJ/1MfNAzDl1oehVSzjON0P80QWFjmhW/izomXGaWU5w4z EDTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sPN9nQ5S; 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 q30-20020a37f71e000000b006fc29969febsi6142622qkj.145.2023.03.05.16.53.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 05 Mar 2023 16:53:14 -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=sPN9nQ5S; 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 1pYyyQ-0004Up-JA; Sun, 05 Mar 2023 19:45:06 -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 1pYyxk-0002u3-KB for qemu-devel@nongnu.org; Sun, 05 Mar 2023 19:44:25 -0500 Received: from mail-pj1-x1041.google.com ([2607:f8b0:4864:20::1041]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pYyxi-0007MT-Lj for qemu-devel@nongnu.org; Sun, 05 Mar 2023 19:44:24 -0500 Received: by mail-pj1-x1041.google.com with SMTP id 6-20020a17090a190600b00237c5b6ecd7so11551820pjg.4 for ; Sun, 05 Mar 2023 16:44:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678063461; 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=kqQ2BcCZ3kgjD9PONBkMQdY9pGsYGr5TJkgoV7UntP0=; b=sPN9nQ5Sai2vaqQwjhtnSG6ufChMul8iUK0oGdSRGHWE8VFklbnprHGIZ4lqgthRka plodMGK23XlizFMsWrjPf62WUq73tzIn4boaJqcR/su6pwkrqO+J5Hl2Uk4pj+fS0hIB 6x0AJbBHXOD/3DGI2iFCYBsh3iEauLTK0s7vhTGwky/JJprmhBJZ8uBP7CKG9dSPClwv WKyZdSW9vbZljlcBknMZR9AQ+ahleURY2uQ5cKVy4PJyGoFhvwKs35vviTVDQKwhBBqV Ma2bLwZi/VDTCvOK6fkFUS+ERnMrWyaHLGyoSXRlj+H4mxfrIguZUiTIZ2Ng+VXfwkeI UqzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678063461; 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=kqQ2BcCZ3kgjD9PONBkMQdY9pGsYGr5TJkgoV7UntP0=; b=Mcv1A0TUy/2hNPXP1/FKQEiZFjcypRQDWUvh7O04Q8NICUdQvgw+MfBDbe57SBiwTo UaSdKKemX11cv4AxhKELOScNOCY9LAdYY3FfLKoGa3wTWFiHQFYaUlm+hnCniRmku0mC 2izZAc90NtxBs+Jk+PZK1tVf2g3ujouQl9eyRIY70AN7Xyh7us8siqk3VbxZA6SkL7WU bnoMAiDMQWd0lsRAkYpQM6g0N8H2F3Xpc9oNExk4bjUZM1QS5k0oeLVYJVwjztnDktQb BFl5ernewvyT4VraOCQNuelbodDHRj2QpQjcPknids1EdxR9I0F4KiYNlv6S7WU6LpMW ye/w== X-Gm-Message-State: AO0yUKXWHg1rjapyixPQcJuUB9BiGGAS6Nz8K8PXrkgh7qu1s+fssPdL QWtcS2fVGsc1rtwOR1IGWQSTLGEUZqMZepi5MrjCJk/G X-Received: by 2002:a05:6a20:b061:b0:c7:320a:60b6 with SMTP id dx33-20020a056a20b06100b000c7320a60b6mr7433981pzb.26.1678063461119; Sun, 05 Mar 2023 16:44:21 -0800 (PST) Received: from stoup.. ([2602:ae:154a:9f01:87cc:49bb:2900:c08b]) by smtp.gmail.com with ESMTPSA id x52-20020a056a000bf400b005895f9657ebsm5045726pfu.70.2023.03.05.16.44.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Mar 2023 16:44:20 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, Taylor Simpson Subject: [PULL 73/84] target/hexagon/idef-parser: Use gen_constant for gen_extend_tcg_width_op Date: Sun, 5 Mar 2023 16:39:43 -0800 Message-Id: <20230306003954.1866998-74-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230306003954.1866998-1-richard.henderson@linaro.org> References: <20230306003954.1866998-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1041; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1041.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 We already have a temporary, res, which we can use for the intermediate shift result. Simplify the constant to -1 instead of 0xf*f. This was the last use of gen_tmp_value, so remove it. Reviewed-by: Taylor Simpson Signed-off-by: Richard Henderson --- target/hexagon/idef-parser/parser-helpers.c | 30 +++------------------ 1 file changed, 3 insertions(+), 27 deletions(-) diff --git a/target/hexagon/idef-parser/parser-helpers.c b/target/hexagon/idef-parser/parser-helpers.c index c0e6f2190c..e1a55412c8 100644 --- a/target/hexagon/idef-parser/parser-helpers.c +++ b/target/hexagon/idef-parser/parser-helpers.c @@ -305,26 +305,6 @@ HexValue gen_tmp(Context *c, return rvalue; } -static HexValue gen_tmp_value(Context *c, - YYLTYPE *locp, - const char *value, - unsigned bit_width, - HexSignedness signedness) -{ - HexValue rvalue; - assert(bit_width == 32 || bit_width == 64); - memset(&rvalue, 0, sizeof(HexValue)); - rvalue.type = TEMP; - rvalue.bit_width = bit_width; - rvalue.signedness = signedness; - rvalue.is_dotnew = false; - rvalue.tmp.index = c->inst.tmp_count; - OUT(c, locp, "TCGv_i", &bit_width, " tmp_", &c->inst.tmp_count, - " = tcg_const_i", &bit_width, "(", value, ");\n"); - c->inst.tmp_count++; - return rvalue; -} - static HexValue gen_constant_from_imm(Context *c, YYLTYPE *locp, HexValue *value) @@ -1120,15 +1100,11 @@ static HexValue gen_extend_tcg_width_op(Context *c, OUT(c, locp, "tcg_gen_subfi_i", &dst_width); OUT(c, locp, "(", &shift, ", ", &dst_width, ", ", &src_width_m, ");\n"); if (signedness == UNSIGNED) { - const char *mask_str = (dst_width == 32) - ? "0xffffffff" - : "0xffffffffffffffff"; - HexValue mask = gen_tmp_value(c, locp, mask_str, - dst_width, UNSIGNED); + HexValue mask = gen_constant(c, locp, "-1", dst_width, UNSIGNED); OUT(c, locp, "tcg_gen_shr_i", &dst_width, "(", - &mask, ", ", &mask, ", ", &shift, ");\n"); + &res, ", ", &mask, ", ", &shift, ");\n"); OUT(c, locp, "tcg_gen_and_i", &dst_width, "(", - &res, ", ", value, ", ", &mask, ");\n"); + &res, ", ", &res, ", ", value, ");\n"); } else { OUT(c, locp, "tcg_gen_shl_i", &dst_width, "(", &res, ", ", value, ", ", &shift, ");\n");