From patchwork Fri Jan 19 04:54:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 125076 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp131153ljf; Thu, 18 Jan 2018 20:59:48 -0800 (PST) X-Google-Smtp-Source: ACJfBou/mzUCxwpUiwIg8CnF1JGsm2saD0PDeWqTP+7SH2jOi1iWAQWywAYy+Z8PCEk4a+C48Pz4 X-Received: by 10.129.109.133 with SMTP id i127mr8006569ywc.444.1516337988718; Thu, 18 Jan 2018 20:59:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516337988; cv=none; d=google.com; s=arc-20160816; b=C+ILcgmTInA3RkTwowVTLBojtnc7K1mFem5mDWYryE43v1FrDkQM1wzxE1/MxX4b4D WFe3Zaf2uB0fqZpV5XFM/kbPg1tNnCoxYz+KZNMHfomyhh1mQSlDms1MFEOwpiH9nTHn gcegkMUbFxc+A8Z9Yo6UqyhOVIqHbVn+BLiPN9ycw3Y4Iuha7dnCOE8primyuphj8ytj nbu2l9uPWmMpMBdnTxiGutDFaEN7uyGo8WwmVyjNS2+6N2e0K+rGiYENwkEh+IKbxUkf sgdSonSIGdPKYnodDNQe7pEr6JBfp4QFUzE624z2PIPXiknRzHJrYXeFB7XMC3iw9tzs 4gPw== 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:subject:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=ic8DS/8F1ksiM2fAC/o/diUdxahtrTm3gKg3dhh/7c4=; b=l4EBha+NRDig1XKyMyjIn/Tuqq61jnymXP7kjUhKIREVlAMN7O61TBTTNsI7AXh4Du IlB7SCGfDD3TwwVsulnO5K8mdjGsDZedJsgl5xGO6je95mQ10v6Zh6l6qvTqrjbArURx TSh4vk09aCkrvDZMplBlKrpjnB0aezxHfI0/+yfURJdz7EJX/EpS30WLtS9qrPKDJztS L39Hz5060OnKnmt37vUID5x8bNqrCWcw8vlX8s/cPou3ce0IW6SBCRPA8oICS+tCWYYK IrZEgFdLJhO+74uMYv/9ZuCRUDe0V3GlDBff7PqPlo3XXSGBzwFz8YXXsOqTcRvgIjWu RoRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=LRkTO6og; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id r15si453350ybg.163.2018.01.18.20.59.48 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 18 Jan 2018 20:59:48 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=LRkTO6og; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:52334 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecOmK-0005ld-5e for patch@linaro.org; Thu, 18 Jan 2018 23:59:48 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58617) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecOhY-00028r-Ez for qemu-devel@nongnu.org; Thu, 18 Jan 2018 23:54:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ecOhX-0008WH-HT for qemu-devel@nongnu.org; Thu, 18 Jan 2018 23:54:52 -0500 Received: from mail-pf0-x243.google.com ([2607:f8b0:400e:c00::243]:45122) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ecOhX-0008Ul-Cd for qemu-devel@nongnu.org; Thu, 18 Jan 2018 23:54:51 -0500 Received: by mail-pf0-x243.google.com with SMTP id a88so515531pfe.12 for ; Thu, 18 Jan 2018 20:54:51 -0800 (PST) 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; bh=ic8DS/8F1ksiM2fAC/o/diUdxahtrTm3gKg3dhh/7c4=; b=LRkTO6ogihmxW6L1FcaZnp/Lkw1eaBgrH1/FU5oDZCAJZFfRyIHIxnOqv5lpTESPyr F0vQpWE8LbVAwgJWGAbwZrdWPEqUOl3i41RaFKa4UhZ1I9JN/lbFSB1KAHKhRQUa+8e4 ESHfH/cHeS3QYVPXnQM4VGD24lmVMZi0ikml0= 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; bh=ic8DS/8F1ksiM2fAC/o/diUdxahtrTm3gKg3dhh/7c4=; b=URDbfIWxQcKUP145xVz9jX5i2ohmw+6RsZS99MBP/6ADU1Pgyt9HtxfBbpGQ2lGbx6 /iSXUlQJs0w8CROS0Z7HCm8eLTz+k0cW93BZoSDkRQKWJiJhMmby9C5+5HaNrwEJKpzg 40tqMw/XdGwhNdC176ZAcOV05/QizJwO8w1Dgf82ddv1mUeW2Uh8rbZ1/H0nZT4Ngh7u Z9zJ+VDey0ukxoZDqmZSCqqpq6YqwP5IumPn8yw5jsg8ZrcxacVBMSQYy1E5tTFFZ/Jj nPsPNlxUP5G69JI0eQIoZ1NPGmDaWLSsHULQ786dL9LOJXOoFyhlrrAM9fy8BL7endJx ERwg== X-Gm-Message-State: AKwxyteSFA4CbIt43q+4MMl22ADCCdzdWmjTFscSHAfg22wFlJzQ/XfC fz4aPihfcblRcrCqXClaFq1V/5row6w= X-Received: by 10.101.90.202 with SMTP id d10mr16805769pgt.366.1516337690107; Thu, 18 Jan 2018 20:54:50 -0800 (PST) Received: from cloudburst.twiddle.net (97-113-183-164.tukw.qwest.net. [97.113.183.164]) by smtp.gmail.com with ESMTPSA id m12sm13690022pga.68.2018.01.18.20.54.48 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Jan 2018 20:54:49 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 18 Jan 2018 20:54:26 -0800 Message-Id: <20180119045438.28582-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180119045438.28582-1-richard.henderson@linaro.org> References: <20180119045438.28582-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::243 Subject: [Qemu-devel] [PATCH v2 04/16] target/arm: Use pointers in neon tbl helper X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 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" Rather than passing a regno to the helper, pass pointers to the vector register directly. This eliminates the need to pass in the environment pointer and reduces the number of places that directly access env->vfp.regs[]. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/helper.h | 2 +- target/arm/op_helper.c | 17 +++++++---------- target/arm/translate.c | 8 ++++---- 3 files changed, 12 insertions(+), 15 deletions(-) -- 2.14.3 Reviewed-by: Alex Bennée diff --git a/target/arm/helper.h b/target/arm/helper.h index dbdc38fcb7..5dec2e6262 100644 --- a/target/arm/helper.h +++ b/target/arm/helper.h @@ -188,7 +188,7 @@ DEF_HELPER_FLAGS_2(rsqrte_f32, TCG_CALL_NO_RWG, f32, f32, ptr) DEF_HELPER_FLAGS_2(rsqrte_f64, TCG_CALL_NO_RWG, f64, f64, ptr) DEF_HELPER_2(recpe_u32, i32, i32, ptr) DEF_HELPER_FLAGS_2(rsqrte_u32, TCG_CALL_NO_RWG, i32, i32, ptr) -DEF_HELPER_5(neon_tbl, i32, env, i32, i32, i32, i32) +DEF_HELPER_FLAGS_4(neon_tbl, TCG_CALL_NO_RWG, i32, i32, i32, ptr, i32) DEF_HELPER_3(shl_cc, i32, env, i32, i32) DEF_HELPER_3(shr_cc, i32, env, i32, i32) diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c index 712c5c55b6..a937e76710 100644 --- a/target/arm/op_helper.c +++ b/target/arm/op_helper.c @@ -54,20 +54,17 @@ static int exception_target_el(CPUARMState *env) return target_el; } -uint32_t HELPER(neon_tbl)(CPUARMState *env, uint32_t ireg, uint32_t def, - uint32_t rn, uint32_t maxindex) +uint32_t HELPER(neon_tbl)(uint32_t ireg, uint32_t def, void *vn, + uint32_t maxindex) { - uint32_t val; - uint32_t tmp; - int index; - int shift; - uint64_t *table; - table = (uint64_t *)&env->vfp.regs[rn]; + uint32_t val, shift; + uint64_t *table = vn; + val = 0; for (shift = 0; shift < 32; shift += 8) { - index = (ireg >> shift) & 0xff; + uint32_t index = (ireg >> shift) & 0xff; if (index < maxindex) { - tmp = (table[index >> 3] >> ((index & 7) << 3)) & 0xff; + uint32_t tmp = (table[index >> 3] >> ((index & 7) << 3)) & 0xff; val |= tmp << shift; } else { val |= def & (0xff << shift); diff --git a/target/arm/translate.c b/target/arm/translate.c index 6f02c56abb..852d2a75b1 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -7544,9 +7544,9 @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) tcg_gen_movi_i32(tmp, 0); } tmp2 = neon_load_reg(rm, 0); - tmp4 = tcg_const_i32(rn); + ptr1 = vfp_reg_ptr(true, rn); tmp5 = tcg_const_i32(n); - gen_helper_neon_tbl(tmp2, cpu_env, tmp2, tmp, tmp4, tmp5); + gen_helper_neon_tbl(tmp2, tmp2, tmp, ptr1, tmp5); tcg_temp_free_i32(tmp); if (insn & (1 << 6)) { tmp = neon_load_reg(rd, 1); @@ -7555,9 +7555,9 @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) tcg_gen_movi_i32(tmp, 0); } tmp3 = neon_load_reg(rm, 1); - gen_helper_neon_tbl(tmp3, cpu_env, tmp3, tmp, tmp4, tmp5); + gen_helper_neon_tbl(tmp3, tmp3, tmp, ptr1, tmp5); tcg_temp_free_i32(tmp5); - tcg_temp_free_i32(tmp4); + tcg_temp_free_ptr(ptr1); neon_store_reg(rd, 0, tmp2); neon_store_reg(rd, 1, tmp3); tcg_temp_free_i32(tmp);