From patchwork Thu Mar 9 20:05:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 661081 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp499203wrb; Thu, 9 Mar 2023 12:14:03 -0800 (PST) X-Google-Smtp-Source: AK7set9I29qggRPTNitPdJGcC9u3v8hjSH1y46Vvgi/HzYNu5flT1av4aeZKPzvysw03NLIASpai X-Received: by 2002:a05:600c:34d5:b0:3ea:f882:bb3d with SMTP id d21-20020a05600c34d500b003eaf882bb3dmr515443wmq.4.1678392843737; Thu, 09 Mar 2023 12:14:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678392843; cv=none; d=google.com; s=arc-20160816; b=cw0W1LYB20SjyN2ErDpMwb73ox4Ef2gyadsT8JAo/l1qYrDSilEdmp8D7lS/gaIXHA llQ8PC9CxzvUNz4q5Tzdx0jdJd1GN6rCGa8oRZQW2mQE6ARbx3z+rMKd44tJTzoHmvDh UaMMhfcNGY5hG9fgMQmxOSXabDvOTWONiCXLEUzljE+/y03NcgtWArcXb7dyk21gxh30 TPSo12oNrxOFxRiv54lP3yb8OrqqtAI+YQ9C7q2XHysYSHuWy/IxKHMdtECEvJ/dAP4q 4QX4MBlB/0fRVwnvFqlSH2M/tY4Hd/1f+P/nT6TOGyWQmbrZMozTFyFf6J5SdBecu1EA NZCw== 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=ldBuLbcQb0n6Aye54OPPs45YCet33rD06BKJ9Zw2Tyk=; b=vvz6DDpO4fPYGvs2urpvlqyrBdP1jqgcQoGNH0fyHDSQJrf62uyx7iptcl7V2oDYN2 hYxnBbobwU15YLfbU8NuchIGrzrpTgpBcGK2JYBBlW5zjKZ4+kcyc0B1t9QLDUV+4L0b iV+eJAtda3UA7/0y4DFjBxMGl8m2pzHg5r/Rd72oRN6ugTX3WvRGsHsVZ/Mm0GT4GXvr JPM/hyk+lZ0G2n3AfvfLMkNMK5iewqIuAGjyfAEHY5323j1voTnj0PzCQU8pHkyX2IP+ UhJt+Z3vvBRtpKZjT/ruUULc9DgkiQv5MgRX9Bg6ZxZiu/fzdvHxwntVZI8mW0hylVKf 1ECQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Dvktk8Cz; 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 d12-20020a5d6dcc000000b002c54737cc7dsi320081wrz.52.2023.03.09.12.14.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 Mar 2023 12:14:03 -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=Dvktk8Cz; 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 1paMab-0005gZ-MM; Thu, 09 Mar 2023 15:10:13 -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 1paMaR-0005ab-57 for qemu-devel@nongnu.org; Thu, 09 Mar 2023 15:10:07 -0500 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1paMaP-0001XT-Gi for qemu-devel@nongnu.org; Thu, 09 Mar 2023 15:10:02 -0500 Received: by mail-pj1-x1034.google.com with SMTP id fr5-20020a17090ae2c500b0023af8a036d2so6592880pjb.5 for ; Thu, 09 Mar 2023 12:10:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678392600; 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=ldBuLbcQb0n6Aye54OPPs45YCet33rD06BKJ9Zw2Tyk=; b=Dvktk8Cz2fjv8jpYW2ezbRYJNy5xh7WWLbYYeB7bB1moAiJAVUNgE0uJ6KT3H7+lQZ cLCDOyTBo61v9Ym7LGr2Mo83GvY16g/KiMPw6udx3U7OcYuiA9YXuCOZ8deqTNlUdpRr bhe3b08u4CeAO2gMF+KXTKzK63lt67dbNcqGaG6AFiDjV6mOYzjdmxV6n7ywhktHgsUN bLlZEhPB1Pxhwf5ft4mU/DdKFSoMYzEgROO6tkK4QIOB08lEGE3VQO/q/tZGth0a9q+z ugUbB3v6Yio586WJJ1WB8TgSle9846v9reV1aMsDzJkdQDwGnBdVUn6myUYZTIawOsj8 wbug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678392600; 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=ldBuLbcQb0n6Aye54OPPs45YCet33rD06BKJ9Zw2Tyk=; b=VoajzN5yUywtHh7Qv4jdCeXC8+rD9FHp+fy11+u12TlxvnXtji+fHfYQQ0eBEi0wOg o8d3x5foTXTIA3vof3AySPWpPjzygOdPj9IbePtoWVAOO0Awhe5j1/I6wftPC+Q0NWwH 7CKdYfI68uZsmP6g+4ljf1zrHr+Q9h3HafTgALwPLP/3e6/pkYLcxyWVGNlgQmMqSNzs bGoRBeTdkm3Er9/F4lsVjJTbtuDezNEWSTwZvFeeNvpuU2x85ID0exuCkLkPpQ+NMu48 Jp7ac6f0S+SuIaxffrF4UHduUwUB3v2h714zMyReGe3uJwvyq0fLSu4j5aJ+4a7h07ou xmpw== X-Gm-Message-State: AO0yUKXurNBm5Wgiq4gP19IutURm9Lt9PxVamX+3JtF+igYPgIOH75C0 07wMTxW/9XZjE9srvfi60QanT2jNZf9eSvL9CnI= X-Received: by 2002:a17:902:d4c5:b0:19c:d4c0:ce78 with SMTP id o5-20020a170902d4c500b0019cd4c0ce78mr27505888plg.29.1678392600538; Thu, 09 Mar 2023 12:10:00 -0800 (PST) Received: from stoup.. ([2602:ae:154a:9f01:bf7f:79a0:a976:bdaf]) by smtp.gmail.com with ESMTPSA id c2-20020a170902aa4200b001991e4e0bdcsm43797plr.233.2023.03.09.12.09.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Mar 2023 12:10:00 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL v2 78/91] target/arm: Avoid tcg_const_ptr in handle_rev Date: Thu, 9 Mar 2023 12:05:37 -0800 Message-Id: <20230309200550.3878088-79-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230309200550.3878088-1-richard.henderson@linaro.org> References: <20230309200550.3878088-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1034; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1034.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 Here it is not trivial to notice first initialization, so explicitly zero the temps. Use an array for the output, rather than separate tcg_rd/tcg_rd_hi variables. Fixes a bug by adding a missing clear_vec_high. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 082a8b82dd..dff391bfe2 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -12003,22 +12003,26 @@ static void handle_rev(DisasContext *s, int opcode, bool u, int esize = 8 << size; int elements = dsize / esize; TCGv_i64 tcg_rn = tcg_temp_new_i64(); - TCGv_i64 tcg_rd = tcg_const_i64(0); - TCGv_i64 tcg_rd_hi = tcg_const_i64(0); + TCGv_i64 tcg_rd[2]; + + for (i = 0; i < 2; i++) { + tcg_rd[i] = tcg_temp_new_i64(); + tcg_gen_movi_i64(tcg_rd[i], 0); + } for (i = 0; i < elements; i++) { int e_rev = (i & 0xf) ^ revmask; - int off = e_rev * esize; + int w = (e_rev * esize) / 64; + int o = (e_rev * esize) % 64; + read_vec_element(s, tcg_rn, rn, i, size); - if (off >= 64) { - tcg_gen_deposit_i64(tcg_rd_hi, tcg_rd_hi, - tcg_rn, off - 64, esize); - } else { - tcg_gen_deposit_i64(tcg_rd, tcg_rd, tcg_rn, off, esize); - } + tcg_gen_deposit_i64(tcg_rd[w], tcg_rd[w], tcg_rn, o, esize); } - write_vec_element(s, tcg_rd, rd, 0, MO_64); - write_vec_element(s, tcg_rd_hi, rd, 1, MO_64); + + for (i = 0; i < 2; i++) { + write_vec_element(s, tcg_rd[i], rd, i, MO_64); + } + clear_vec_high(s, true, rd); } }