From patchwork Thu Mar 9 20:05:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 661123 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp502939wrb; Thu, 9 Mar 2023 12:22:47 -0800 (PST) X-Google-Smtp-Source: AK7set/QVPQRUhLHG4NE+3GOneMmOK4p6fRj8nHZxF83em/lPnnnirsFnaZhafL8obK7DRDerCX3 X-Received: by 2002:adf:e908:0:b0:2c3:e0a0:93f with SMTP id f8-20020adfe908000000b002c3e0a0093fmr14847468wrm.8.1678393367411; Thu, 09 Mar 2023 12:22:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678393367; cv=none; d=google.com; s=arc-20160816; b=xtOHWk8Z2U3pLk3oWDDmXA3VE/Nbrr1BmPzWuz043Bs3FNewuXseJ2X82g77UQl7py lUcMwRyE46nY1fKw3jXd/MmpL9mVPRJO/R9gDWZX7mK8bkOUBAxKxURA2JQXKgs1J2Tv 7yYXQcEPMQP1wsRVU7i7XrMyJTwiLQl7XggkIVrn/usUsM9I3s13EHw1MoGQHStHnDFq nR+bevIdzlhnXfRDAsvSDDLTKHcujIkVSCQgCNNWE25AFKGyEnalkMNj3KBvb34RZgfG 7E2ZaQDgGiFRJ7X/i7ahOihnCy+0IWchN/mQGANiXTtKq8ZA7dLS64dDaU1qED2dRpss bK+A== 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=1KeE8/x+gbRZ4wtBXKBEex8o90m+5WViCdselB5pOEg=; b=JaXrC4ppcqPRLR05f22OCaEq/NzemrCclV56M4UqB9KfRpqwJ7uiEy336Qfl5F5Eje 9qE+fZ51/4Eu51e6DeYx9fLUj+5CODoTNsqBEqw2eJLbq2ntju7kWoB4FsI5xaZkm2qk QqBDKFSpQrLEX/VrBuk/AL0H3n78Q+uwVYPLXyZxWEuzj4xk6vkNMcITDU7H/9+oJ6ae QXOfJnOfYVlxHBZUqZqovAS+a300cRsB0WFpkiwATDj5pHRMitIe0m5d+ISnb48kltFm HxNUpKngGkCLvOUOGJFPDhcDCyIMs+sA5a2jc/nhJP7YG0Wi0GwCfYBeK4rZ1AlVBArU nhQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xWMpGfPu; 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 j13-20020a056000124d00b002c57488b866si323425wrx.145.2023.03.09.12.22.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 Mar 2023 12:22:47 -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=xWMpGfPu; 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 1paMau-0006fs-A0; Thu, 09 Mar 2023 15:10:34 -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 1paMaP-0005YH-GH for qemu-devel@nongnu.org; Thu, 09 Mar 2023 15:10:05 -0500 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1paMaN-0001dC-Le for qemu-devel@nongnu.org; Thu, 09 Mar 2023 15:10:01 -0500 Received: by mail-pl1-x62b.google.com with SMTP id y11so3242112plg.1 for ; Thu, 09 Mar 2023 12:09:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678392599; 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=1KeE8/x+gbRZ4wtBXKBEex8o90m+5WViCdselB5pOEg=; b=xWMpGfPupYXG5KzoIlS64FN/FKiuBRC67q64as2BQAyXfjAUYhx1j5F7Hnxfv+UeNr Mb0gWNBeNBXxjkKiWXgTMbNuXgwD7zERaOv5DVO06bt9stJ9suNt+0H7IIyH5n2ZMWPm i4NxYiKZ4742WlZj0WD412zHRmgxHpc44esCnvMJbRofGT3/h7Ao8d6J7nZdq9D2M9Ug 7JAq/78XG46N0fHRxExfo6X/ScHFybq7coLx5I1NWpTwyKdbAl3l+RSMQ2mnYABWu9KX RA16rgXJvLgKfMnLNhk6CjTusZy7BDbzSrtRU3SQ/MPDhhcG9qpIOII215E8AHkJpoSw ElcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678392599; 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=1KeE8/x+gbRZ4wtBXKBEex8o90m+5WViCdselB5pOEg=; b=Ygjl+4u2oT4ctfaYTZzrCxcDjJmLXELKvxF2i3vmWS5RDBPadnND3jzS4CxoyDMdS4 w4FQqynI/SjjinOrdG8ipEMvND45W2IRjXzM3gVVuEd7cmKFkI3881sc9RyA+yi9MYw+ 1hfUiIdFOGC+hAY8OyCa9vu1n5ECV9FA9rGn9tO/iRE3waI4wkUSoC2JB5RTR/kFkFxA +KYL1/zfluA4YkCYbLDOcySkrLwAETQ4tEXfqcNHWvM7+5fpghnmvpHkhqf7dPEJFDcM km9yNYsLowj9aFClM5wd7njRHhRcsTRh8tn3ODtPO6pk8kYGjrin0NAMziY+Nl95Cv6m Nb9A== X-Gm-Message-State: AO0yUKUSy+y9x9fdiF3DJMEtbEi1zKjkVmh73VyH9/LhLuL4Vtzd+pMX CbA9iPbAiYDqJ6YlphxLcZpI88Xe69kTwSPhPtc= X-Received: by 2002:a17:902:ea03:b0:19e:2869:7793 with SMTP id s3-20020a170902ea0300b0019e28697793mr25795286plg.16.1678392598833; Thu, 09 Mar 2023 12:09:58 -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.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Mar 2023 12:09:58 -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 76/91] target/arm: Avoid tcg_const_ptr in disas_simd_zip_trn Date: Thu, 9 Mar 2023 12:05:35 -0800 Message-Id: <20230309200550.3878088-77-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::62b; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62b.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 It is easy enough to use mov instead of or-with-zero and relying on the optimizer to fold away the or. Use an array for the output, rather than separate tcg_res{l,h} variables. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 41 +++++++++++++++++----------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 989c958de6..2ad7c48901 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -7442,10 +7442,10 @@ static void disas_simd_zip_trn(DisasContext *s, uint32_t insn) bool part = extract32(insn, 14, 1); bool is_q = extract32(insn, 30, 1); int esize = 8 << size; - int i, ofs; + int i; int datasize = is_q ? 128 : 64; int elements = datasize / esize; - TCGv_i64 tcg_res, tcg_resl, tcg_resh; + TCGv_i64 tcg_res[2], tcg_ele; if (opcode == 0 || (size == 3 && !is_q)) { unallocated_encoding(s); @@ -7456,37 +7456,39 @@ static void disas_simd_zip_trn(DisasContext *s, uint32_t insn) return; } - tcg_resl = tcg_const_i64(0); - tcg_resh = is_q ? tcg_const_i64(0) : NULL; - tcg_res = tcg_temp_new_i64(); + tcg_res[0] = tcg_temp_new_i64(); + tcg_res[1] = is_q ? tcg_temp_new_i64() : NULL; + tcg_ele = tcg_temp_new_i64(); for (i = 0; i < elements; i++) { + int o, w; + switch (opcode) { case 1: /* UZP1/2 */ { int midpoint = elements / 2; if (i < midpoint) { - read_vec_element(s, tcg_res, rn, 2 * i + part, size); + read_vec_element(s, tcg_ele, rn, 2 * i + part, size); } else { - read_vec_element(s, tcg_res, rm, + read_vec_element(s, tcg_ele, rm, 2 * (i - midpoint) + part, size); } break; } case 2: /* TRN1/2 */ if (i & 1) { - read_vec_element(s, tcg_res, rm, (i & ~1) + part, size); + read_vec_element(s, tcg_ele, rm, (i & ~1) + part, size); } else { - read_vec_element(s, tcg_res, rn, (i & ~1) + part, size); + read_vec_element(s, tcg_ele, rn, (i & ~1) + part, size); } break; case 3: /* ZIP1/2 */ { int base = part * elements / 2; if (i & 1) { - read_vec_element(s, tcg_res, rm, base + (i >> 1), size); + read_vec_element(s, tcg_ele, rm, base + (i >> 1), size); } else { - read_vec_element(s, tcg_res, rn, base + (i >> 1), size); + read_vec_element(s, tcg_ele, rn, base + (i >> 1), size); } break; } @@ -7494,19 +7496,18 @@ static void disas_simd_zip_trn(DisasContext *s, uint32_t insn) g_assert_not_reached(); } - ofs = i * esize; - if (ofs < 64) { - tcg_gen_shli_i64(tcg_res, tcg_res, ofs); - tcg_gen_or_i64(tcg_resl, tcg_resl, tcg_res); + w = (i * esize) / 64; + o = (i * esize) % 64; + if (o == 0) { + tcg_gen_mov_i64(tcg_res[w], tcg_ele); } else { - tcg_gen_shli_i64(tcg_res, tcg_res, ofs - 64); - tcg_gen_or_i64(tcg_resh, tcg_resh, tcg_res); + tcg_gen_shli_i64(tcg_ele, tcg_ele, o); + tcg_gen_or_i64(tcg_res[w], tcg_res[w], tcg_ele); } } - write_vec_element(s, tcg_resl, rd, 0, MO_64); - if (is_q) { - write_vec_element(s, tcg_resh, rd, 1, MO_64); + for (i = 0; i <= is_q; ++i) { + write_vec_element(s, tcg_res[i], rd, i, MO_64); } clear_vec_high(s, is_q, rd); }