From patchwork Mon Feb 27 05:41:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 656901 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp2228157wrb; Mon, 27 Feb 2023 00:13:05 -0800 (PST) X-Google-Smtp-Source: AK7set/WEx466PvZuOloyKsZ5iSoN2ykzk2BXNnh7lVLy+3ik3WjuoRN2JlZCWDVLO2XXlD6b4dS X-Received: by 2002:ac8:58c3:0:b0:3bf:d1ba:daec with SMTP id u3-20020ac858c3000000b003bfd1badaecmr7667350qta.16.1677485585730; Mon, 27 Feb 2023 00:13:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677485585; cv=none; d=google.com; s=arc-20160816; b=Px+5ziLWrSCfWCWHRI2Ee+tUS7poUoOSKMgOMJBxWqaWryAMmCCiOLIUb4x8S86zqt R3dlHYUxtCZDH24pIsz2owIGz2VCllQByF0g5Ei3wjvGe3rWKTs/r3x+3DHApE4WkxRP TIbSvlcbhzTyr1ceW+8ptr62vVAiYgO143hrre1VhACw0biMi2py4uymMI1RSWr8/sjN Janig4gghB5y6RVnUoeFPs/lRiJuNYQEr2XZTP4gr2TA8OHrINWE6N6jFPiRyb5/GWCY 2iWTxSg57QH09grFsMQFbgPot8VdE0INkw+Z4yoHjqSMqe4a30O17X9BKtCIZXrcTXVD TVxA== 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=Ko5d2/IanWd/pjymt4+iUKkd751sWBMgapBL5xX0YbQ=; b=wPJ6xVj/7SjJ1V7S71VdBDtXsiM46/Q2x2Yj/7gAZZ8MytzHYBj+6lhNpVna4SckrQ yjLkxHAzRxE6JIU6Rn/Df37EcCggRIYn73A+4CNMSJRnNMGNjeNWZQjScNbo9O3mgZ6l troA4Z1KdF4Vkhmy6BvOkG7mXFvkSyFiGUKI30aj4N5d14NxTPwCGBPz6rYFD0wZATDJ KBr7LqzXdtDnzaeDC2o00pgYUG86lJx/VcxiELaiXDSM5OdS2+bnLy/3AnMQ2q7UH0dH 9sRi9q9KjxKkk2nlTT70Ijbv4GwBFrIgiBDDxq/eUqha8aGYxvOj6K9WrfSYrXWSSRox z8XQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Q1OkCNSX; 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 h9-20020a05620a400900b0070fe8de6d50si6481412qko.386.2023.02.27.00.13.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Feb 2023 00:13:05 -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=Q1OkCNSX; 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 1pWWIF-0003eF-W7; Mon, 27 Feb 2023 00:43:24 -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 1pWWIC-0003Jo-Ez for qemu-devel@nongnu.org; Mon, 27 Feb 2023 00:43:20 -0500 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pWWI6-0004yk-Ib for qemu-devel@nongnu.org; Mon, 27 Feb 2023 00:43:16 -0500 Received: by mail-pl1-x633.google.com with SMTP id ky4so5580795plb.3 for ; Sun, 26 Feb 2023 21:43:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=Ko5d2/IanWd/pjymt4+iUKkd751sWBMgapBL5xX0YbQ=; b=Q1OkCNSXNxA92Cxl2bJxiDCZpgHHttWBi2+te6jFAEBClAAXaIfO53F5DQdCzk05VG LVycgjrjLleVGptjoHlY5gyYSYeW3byqnv46H+2cy4SRF0NU+16utvs85JjEPcXiOeXt KTH/gTtF1piO7PT8DfMO0Lf92o9i5a3hbsSBo46YKhqHg7joqvVgQip7vA4NSkvJbix9 OFP0RX7UOt/yY011YJvvCVpStPJCn68vgK8GxXLGrC7xX2Ts+BYdB7RwCTjLae5Bw/Cw DfmXiKNljpnJ9TNaGgDCqiK9EBYxt0ZGIdZdMwnUtu4QGARhDWm5LZmtxStjcf0ocjqg HdlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=Ko5d2/IanWd/pjymt4+iUKkd751sWBMgapBL5xX0YbQ=; b=seGibdmAZAP1EM6Xc7eaLTUZXmiHub6cPwsycgBY20k7/VbVzQAqBz961J+4Lus1l1 HnVaSgnDJGg8sog/BTV9Au5RaY3e2eR+GIS1a6vzpi1+d7baJN7rWrR3u6OlEm4Fx3V4 HMK7hCCKqrdKH3uuhreNohyp3iYK04uTIOjZyuCCskAZlOYub3yd4Uy6RIH05ynW13Tr ilNe2OTqnwMTqSEUNirVnove7yhkAMkBfoslvPBHKw8QLbMScKdL9eEM6o8nmIidiyaw 75XeSta67Q9tazoR5dhZoXflRPxOv19R/nkgSDZ3z5mEpo05n6J39p2rPQ4ri6cLMw8t y+Iw== X-Gm-Message-State: AO0yUKX8EjtN/wEz750/UIHAABMpLIBCnuTmKiR4EJVEbkkx9aSDwach gfEu6a0JaKXPEab2Grd9bbBnjpUxgNudevrhiIs= X-Received: by 2002:a05:6a20:548e:b0:bc:a257:5b2a with SMTP id i14-20020a056a20548e00b000bca2575b2amr27799341pzk.31.1677476593203; Sun, 26 Feb 2023 21:43:13 -0800 (PST) Received: from stoup.. (rrcs-173-198-77-218.west.biz.rr.com. [173.198.77.218]) by smtp.gmail.com with ESMTPSA id d10-20020aa7868a000000b005cdc64a287dsm3317137pfo.115.2023.02.26.21.43.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Feb 2023 21:43:12 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, jcmvbkbc@gmail.com, kbastian@mail.uni-paderborn.de, ysato@users.sourceforge.jp, gaosong@loongson.cn, jiaxun.yang@flygoat.com, tsimpson@quicinc.com, ale@rev.ng, mrolnik@gmail.com, edgar.iglesias@gmail.com Subject: [PATCH 11/70] target/arm: Avoid tcg_const_ptr in handle_rev Date: Sun, 26 Feb 2023 19:41:34 -1000 Message-Id: <20230227054233.390271-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230227054233.390271-1-richard.henderson@linaro.org> References: <20230227054233.390271-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::633; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x633.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=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: , 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. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- target/arm/translate-a64.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 16aa71451c..02a61aa8b7 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/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); } }