From patchwork Fri May 8 15:21:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 186388 Delivered-To: patch@linaro.org Received: by 2002:a92:8d81:0:0:0:0:0 with SMTP id w1csp98349ill; Fri, 8 May 2020 08:42:24 -0700 (PDT) X-Google-Smtp-Source: APiQypILYdQ4Q+GuzOaZ9YYjBBKiN2vktb7xGvqDr/ti4dIhbskh9d1rujw4v2kjGnfm1hbtn0D4 X-Received: by 2002:ad4:4744:: with SMTP id c4mr3437409qvx.203.1588952544241; Fri, 08 May 2020 08:42:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588952544; cv=none; d=google.com; s=arc-20160816; b=k5HljC5owozbYuS4Li2ErdpULUPkhALwoI+DJPG1cKhP2F/nHOFYGF9HXp+ds+SpxD 9zB0KQFLnXOOJt/4MouK8V9ZU1JZEfgx2anxhS9BYjgSYleFPXryQ6wg8Z4tXDTLoDpE TROhv3nmvCFLh0XWEcWs0SB/z/e2oazs+FwP9SE0h3P7tycKV0QP6j9+zfL+7fhHu/7U psmkW5sRkBpTitB2Pc7A1gv3aGJTeMb7jwY/1ETLOcc7jsJnJBqvKDecvdeBYRqSsuom ZIXUAi7u2YJ6woJPwQwM/N8ACsOxl4iggK62GES245LVkY4ygLu0l1VXDrdHHV7zaDyq Qxxg== 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=ggARKVO3fE1KslGSPmXFgU6A6xt9PP9kAyW6YMyEtPE=; b=DIikxHvki50wWByYCf8/GwO00MetMdwfkr1yE3hcvfLL5w5eEp0+Cpd1EDpEvq039g kQeGLrD7N9N5Ai3Cx7FXjtfOaBOl6hwP5KCRJtX5wL+efgfqUteiIvKNuwwAu+8oe8Dz oUvpBph3IvVT0bt0IB/idMzjCsTLRfLj/Y3gbM9qERXdYgp7HUiVPN1fSUunJHoWYUBh EJGNl+rKbAEZ6iCqExjk3klzRWdUoLhXG/+b07T+ofbO/ywKMWT6svjL3/i26A/rcGvv C16IynrKck/QeT+sYdBCouCbb6ksTZUsCwMFnlajhOcSx6cSHf7/E+eJM6UTghRqd6Iq kbxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FF7s2NHr; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:470:142::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. [2001:470:142::17]) by mx.google.com with ESMTPS id q11si1155980qtk.235.2020.05.08.08.42.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 May 2020 08:42:24 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:470:142::17 as permitted sender) client-ip=2001:470:142::17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FF7s2NHr; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:470:142::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]:33506 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jX58p-00032g-Ov for patch@linaro.org; Fri, 08 May 2020 11:42:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34938) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jX4pH-0004Vv-LZ for qemu-devel@nongnu.org; Fri, 08 May 2020 11:22:11 -0400 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]:35698) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jX4pG-00075C-KN for qemu-devel@nongnu.org; Fri, 08 May 2020 11:22:11 -0400 Received: by mail-pf1-x442.google.com with SMTP id r14so1098490pfg.2 for ; Fri, 08 May 2020 08:22:10 -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=ggARKVO3fE1KslGSPmXFgU6A6xt9PP9kAyW6YMyEtPE=; b=FF7s2NHrtpYP6Staa8rGRTTe+4iyT4m59qcA6WFiR6CFqOvr0kuSRvoA2e3KFhHpU2 cPoN/0yO7+nZGpXWScwUer2FdoPmTXGMaaaoHIL7ebuqcRhYNsKLK1EnDlMoBk390bsI t849JZ0A4qJGLC2jQ30RToCf8Y3jlGUHry6yHQB4ZiSBdYgiYte6sjUaO5sK79JFeLAa ufsgtjtrBxbk+QSue0TQmiYD/oRxUjwauCurMmPCDgahnOHvgvFAg+hrGzlwA/fPxOGZ sHYxytZhoJFkMLqUHutD6uiHgCtfDhQp0Gn0pko+Hb0yybM8x1XyhsH+qPK/nvzSYbdb uIkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ggARKVO3fE1KslGSPmXFgU6A6xt9PP9kAyW6YMyEtPE=; b=pEfHnsHuWyOspT2Kh0d3j10hQekQlyBfa9UXeya5PxRrDk0/e99yVVB8V5Ffz0W623 DQi3ezccVWzERtWqzzuXzaUMuY064QynplGlKnczOX4MFCUCalWkO7uOmIRHbblRBDuc /hQ508ga6u8+Q+7GO8aHs5S0a7Mr5o3ROQ14LKC8sLYVang/pqyKzEjeTuIv7vhjPaV/ Qj6d4bxMhPgKyxnyPYbZHNpOjyCSEDYSIUNhebPPts7WJ9gqEa8pl5bXTQ4ha4H4cCB+ VagowY3h9zf5VG5MJVsUc9qkrGiZ4bnpi/Bk6tJOlONYSh9FQM/dyo0bWV8f8WO08Sb+ cfdg== X-Gm-Message-State: AGi0Pub8JvJyM8Dcee55hESVeRwV3bN0Keb+pZCDrbbKahYmPB/F90Wm u+7xINEugflca1Xaw4ndtOXzJqUNdIg= X-Received: by 2002:a62:5487:: with SMTP id i129mr3222318pfb.77.1588951328913; Fri, 08 May 2020 08:22:08 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id n16sm2104575pfq.61.2020.05.08.08.22.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2020 08:22:08 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 05/16] target/arm: Tidy handle_vec_simd_shri Date: Fri, 8 May 2020 08:21:49 -0700 Message-Id: <20200508152200.6547-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200508152200.6547-1-richard.henderson@linaro.org> References: <20200508152200.6547-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::442; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x442.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Now that we've converted all cases to gvec, there is quite a bit of dead code at the end of the function. Remove it. Sink the call to gen_gvec_fn2i to the end, loading a function pointer within the switch statement. Signed-off-by: Richard Henderson --- target/arm/translate-a64.c | 56 ++++++++++---------------------------- 1 file changed, 14 insertions(+), 42 deletions(-) -- 2.20.1 Reviewed-by: Peter Maydell diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 2d7dad6c3f..d5e77f34a7 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -10155,16 +10155,7 @@ static void handle_vec_simd_shri(DisasContext *s, bool is_q, bool is_u, int size = 32 - clz32(immh) - 1; int immhb = immh << 3 | immb; int shift = 2 * (8 << size) - immhb; - bool accumulate = false; - int dsize = is_q ? 128 : 64; - int esize = 8 << size; - int elements = dsize/esize; - MemOp memop = size | (is_u ? 0 : MO_SIGN); - TCGv_i64 tcg_rn = new_tmp_a64(s); - TCGv_i64 tcg_rd = new_tmp_a64(s); - TCGv_i64 tcg_round; - uint64_t round_const; - int i; + GVecGen2iFn *gvec_fn; if (extract32(immh, 3, 1) && !is_q) { unallocated_encoding(s); @@ -10178,13 +10169,12 @@ static void handle_vec_simd_shri(DisasContext *s, bool is_q, bool is_u, switch (opcode) { case 0x02: /* SSRA / USRA (accumulate) */ - gen_gvec_fn2i(s, is_q, rd, rn, shift, - is_u ? gen_gvec_usra : gen_gvec_ssra, size); - return; + gvec_fn = is_u ? gen_gvec_usra : gen_gvec_ssra; + break; case 0x08: /* SRI */ - gen_gvec_fn2i(s, is_q, rd, rn, shift, gen_gvec_sri, size); - return; + gvec_fn = gen_gvec_sri; + break; case 0x00: /* SSHR / USHR */ if (is_u) { @@ -10192,49 +10182,31 @@ static void handle_vec_simd_shri(DisasContext *s, bool is_q, bool is_u, /* Shift count the same size as element size produces zero. */ tcg_gen_gvec_dup_imm(size, vec_full_reg_offset(s, rd), is_q ? 16 : 8, vec_full_reg_size(s), 0); - } else { - gen_gvec_fn2i(s, is_q, rd, rn, shift, tcg_gen_gvec_shri, size); + return; } + gvec_fn = tcg_gen_gvec_shri; } else { /* Shift count the same size as element size produces all sign. */ if (shift == 8 << size) { shift -= 1; } - gen_gvec_fn2i(s, is_q, rd, rn, shift, tcg_gen_gvec_sari, size); + gvec_fn = tcg_gen_gvec_sari; } - return; + break; case 0x04: /* SRSHR / URSHR (rounding) */ - gen_gvec_fn2i(s, is_q, rd, rn, shift, - is_u ? gen_gvec_urshr : gen_gvec_srshr, size); - return; + gvec_fn = is_u ? gen_gvec_urshr : gen_gvec_srshr; + break; case 0x06: /* SRSRA / URSRA (accum + rounding) */ - gen_gvec_fn2i(s, is_q, rd, rn, shift, - is_u ? gen_gvec_ursra : gen_gvec_srsra, size); - return; + gvec_fn = is_u ? gen_gvec_ursra : gen_gvec_srsra; + break; default: g_assert_not_reached(); } - round_const = 1ULL << (shift - 1); - tcg_round = tcg_const_i64(round_const); - - for (i = 0; i < elements; i++) { - read_vec_element(s, tcg_rn, rn, i, memop); - if (accumulate) { - read_vec_element(s, tcg_rd, rd, i, memop); - } - - handle_shri_with_rndacc(tcg_rd, tcg_rn, tcg_round, - accumulate, is_u, size, shift); - - write_vec_element(s, tcg_rd, rd, i, size); - } - tcg_temp_free_i64(tcg_round); - - clear_vec_high(s, is_q, rd); + gen_gvec_fn2i(s, is_q, rd, rn, shift, gvec_fn, size); } /* SHL/SLI - Vector shift left */