From patchwork Fri Jan 19 04:54:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 125072 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp129757ljf; Thu, 18 Jan 2018 20:55:08 -0800 (PST) X-Google-Smtp-Source: ACJfBosrw2/NdtbWSLebPmkLUI+3ApBMWOD6hrqVaNMaOeP6KILFxglFvRW0JbRpMKQSte7Etq/m X-Received: by 10.129.181.71 with SMTP id c7mr8498114ywk.447.1516337708801; Thu, 18 Jan 2018 20:55:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516337708; cv=none; d=google.com; s=arc-20160816; b=HQIpIMFhquvEi6X6u/Q2PXRL+qwSrRZ16HFPUgKNJUVVZdBrDDC6FWvbSe3NnxuVlR 7CnH3ZXTJ7wFxDPmTGnCUwGF0+YYq+4kp+GHtIyFPrCxXVwWEL/EJMmxhNg2I3RRlhih 8oMJCz9SZ+osXwb0ljWADgwEMZjnprKDPy8q6/M+9ZemxUZz1k5FmmebBBkQeUKQJOFL HtVHI3cVl0vCrS4rf+r6Q3SL8g0lkXsIcdqvuT6eb69p9cC9d2bQaGSa88IsyZCpbiaf Yiy0dHPBOZeRjFdlZidYJCyHonXgKqaygMrvECgRfuLvpL+XHoOT/+lK8IMRDI97dzxI OC9Q== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=5WNzWOnHIPiHy0Szq3f4k4lBfnWBOrorMzjkzO2oPgc=; b=cF8sQoZw3vvnqgYWs56iqFDrkUX0O2cU2BGX63xgSKMiX+8inG8Glvx+v9bBQWS4rC Nmph17MO9LI/ts2mfh481waAaF7opF8tezoYu/9jEgCrqrqkIj2u7qNHRzGqpNy/BShz br8wleUxw+DcK0d+fowb0OLV2Ku6XqbmpjJhBl8czrLgODoJXGK4hW27he5XW3aoCmU3 EMlbj6oJzmgdQlWwkuRX794ICqzzzFzWBRR2WItH1pRWuTnxY9a2Jr016e+xf3fYizyU 7/L+j5xU6a98tlAXGRhTHIw4XHeBrlwgy4xvVdgVgGuAxq3fNoTDDuggAYi0ydk9KKuu I89g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=iNYCzjSg; 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 x193si2124642ywx.373.2018.01.18.20.55.08 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 18 Jan 2018 20:55:08 -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=iNYCzjSg; 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]:52251 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecOho-000242-5w for patch@linaro.org; Thu, 18 Jan 2018 23:55:08 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58559) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecOhT-00023X-IG for qemu-devel@nongnu.org; Thu, 18 Jan 2018 23:54:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ecOhP-0008QX-U5 for qemu-devel@nongnu.org; Thu, 18 Jan 2018 23:54:47 -0500 Received: from mail-pg0-x242.google.com ([2607:f8b0:400e:c05::242]:46595) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ecOhP-0008Pn-ON for qemu-devel@nongnu.org; Thu, 18 Jan 2018 23:54:43 -0500 Received: by mail-pg0-x242.google.com with SMTP id s9so538367pgq.13 for ; Thu, 18 Jan 2018 20:54:43 -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 :mime-version:content-transfer-encoding; bh=5WNzWOnHIPiHy0Szq3f4k4lBfnWBOrorMzjkzO2oPgc=; b=iNYCzjSgBnHehBFmyEw16BjWWjHVkp/ph+wiPXGSLKIpnTG07uh9tArpMPVuzV2mQc a8Qnf8EQWS8DmmIsbuEV8AqCCsChx5sxQW49dgna0r5zv4EPauudIkG+1+69/ENBgJoI Zyp2GX8V7lqvS/be3aVBTpA1MiAw9QUWMY2WQ= 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=5WNzWOnHIPiHy0Szq3f4k4lBfnWBOrorMzjkzO2oPgc=; b=NrJ/e1bu64++5AgkAcNJQIv/rZu7GyQEQoUv5BxSdazMY7/x06ErNk7cbeAL+2nePR IAhNO5K34ZlvEFz1gCpxonN0+JZiWpIw8F2MNwxHlLf2ECKyyslEawq0TzV5jrL9NpKS UO6aWxQmMpp4OQ4cRwbCHz3YltMLav3sA1Iga0AgmQrwija5tp/osxiyUUQOdIqqpHkX cKsK0pO34l8oQZa1bMINWfZK+skPgkOUGT22enFtm3DVh113H84qmEOfMDy0b1xORvRT yH4LKY2IfeUbNTxMgk6b9DfLzGttfrtzIwdozIjB5LKbkoLKbUOWhvNeGE2hNwsyb0g2 wV0A== X-Gm-Message-State: AKwxytfGzEfAk9aLvM7mR8ZM6cy//TGxwZoWC0bWEiN7TE+k/fcCsule SCxgZ5TgSxkkdXhn2WyMnXyd4CITOtY= X-Received: by 2002:a17:902:658f:: with SMTP id c15-v6mr946368plk.412.1516337682375; Thu, 18 Jan 2018 20:54:42 -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.41 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Jan 2018 20:54:41 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 18 Jan 2018 20:54:23 -0800 Message-Id: <20180119045438.28582-2-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> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c05::242 Subject: [Qemu-devel] [PATCH v2 01/16] target/arm: Mark disas_set_insn_syndrome inline 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" If it isn't used when translate.h is included, we'll get a compiler Werror. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/translate.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.14.3 Reviewed-by: Alex Bennée diff --git a/target/arm/translate.h b/target/arm/translate.h index cd7313ace7..3f4df91e5e 100644 --- a/target/arm/translate.h +++ b/target/arm/translate.h @@ -108,7 +108,7 @@ static inline int default_exception_el(DisasContext *s) ? 3 : MAX(1, s->current_el); } -static void disas_set_insn_syndrome(DisasContext *s, uint32_t syn) +static inline void disas_set_insn_syndrome(DisasContext *s, uint32_t syn) { /* We don't need to save all of the syndrome so we mask and shift * out unneeded bits to help the sleb128 encoder do a better job. From patchwork Fri Jan 19 04:54:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 125079 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp131293ljf; Thu, 18 Jan 2018 21:00:12 -0800 (PST) X-Google-Smtp-Source: ACJfBosXbZyt2me+ai5tRoZthYM4l/nwEcXyE2Iqtbdnp8GjspteNQc6PSzrX8U8WaZLDheYxRjf X-Received: by 10.37.91.214 with SMTP id p205mr17992678ybb.386.1516338012797; Thu, 18 Jan 2018 21:00:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516338012; cv=none; d=google.com; s=arc-20160816; b=rDlBjLSU/7krUfrf9KSi/EjWRxfqxPKb7XxLsOP6dz4VHRtToV++fie3V3QDvd0sag d1Dg4s5A02Re5hMKsaqPDX0034RYGr68yIg3rxOKUqYmf9/eCyMV46Vs5EtO/NW/oJj9 OqfnNhhE/sFgQcw3ArNElc9bUjP4SUcidJeXSfovyV+fjivcI5Cesg8LXhtYN4zL13kN UMni78zZxtnlarv/zcoiiVOqD2ebY/Z7UUVAjynbOMC80dx2GGMHxoX9WevdJoiQr5Wz +i/Sw6/9oz+z9n3pCapQoRTwRgieV+qm90zKvEdA+2Cz2YXar+iMnQXJXyfvMs9Zrkyl WOeQ== 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=cJ/sG2+QHUNjdmxtOhiJiYCY3BWFF+bfGGP6NiPjTYc=; b=R5dCGEeV3e2339XQsM4mbzs4iH8YL5n2ZlgxZz6pB5MQ1Z4RXDVwsGGtdd84ItlXVT imYyOUR+XqJLYuagAA23BUd6mcs9YNmniSf63DCu1yjv9afK/njuClV6LMBOXQHqsfAN Mx7k1AtfqPSDTQM3K8yAmnKbUYzn1/Vl3PPRZokovl5kmXvr14tuKYnu7sHUlNpFuSOA N0n8K+Zyp3HNdSV6I4lAAEJJ2SLoROc+tM/TnIS2EFWrzTDLrXpHwuNl5kn8OHSa98lB 01HhYf1+e00FJZdvGJ8jCggL18UHJ5SjocqHPf6SlUTfZ+HudAOSec9ojAJE18TI/3Uj gBIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=FSaUilJ+; 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 5si451491ybt.158.2018.01.18.21.00.12 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 18 Jan 2018 21:00:12 -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=FSaUilJ+; 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]:52348 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecOmi-0006pP-3P for patch@linaro.org; Fri, 19 Jan 2018 00:00:12 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58602) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecOhX-00027D-L7 for qemu-devel@nongnu.org; Thu, 18 Jan 2018 23:54:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ecOhU-0008T5-Sz for qemu-devel@nongnu.org; Thu, 18 Jan 2018 23:54:51 -0500 Received: from mail-pg0-x241.google.com ([2607:f8b0:400e:c05::241]:34382) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ecOhU-0008ST-KM for qemu-devel@nongnu.org; Thu, 18 Jan 2018 23:54:48 -0500 Received: by mail-pg0-x241.google.com with SMTP id r19so561719pgn.1 for ; Thu, 18 Jan 2018 20:54:48 -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=cJ/sG2+QHUNjdmxtOhiJiYCY3BWFF+bfGGP6NiPjTYc=; b=FSaUilJ+9o8d7yw0PxI6gHwVAyZsfeHclfeQdX7KVy5bzmHwfiG8a8/i2OMRvnHf+6 myLPP3uEqOggUkVaDfXcQ4k+3SKtUVY4zEm1ykdMw046+Aofb8A9T227eaqz868zgQw1 7LYy1BLhZv62DyLgA/85ccjrMWuWr7f+7w+4Y= 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=cJ/sG2+QHUNjdmxtOhiJiYCY3BWFF+bfGGP6NiPjTYc=; b=HtWejaPfwsbf+RIj0nHf12q/tFSQgePYXu8N6/DEj+ytJTIcv2MZd+OKl24vegMEc4 MdXHaIwKA0pPj9wsVgLffgvVj3glDAQObtkbYLw0g7B+Sq7+ueAmvC1ggRE1G9OpcNx1 ourjMbrE+01i2JacKcJgPgigGQKYSBCXcLaCMzmrDpngETx8hdh7YFRKMGzOmRISmyHO IqKR4aOx/UDaGMSuIYuD8c/3QY2KKHRTrrdij35NkcbRrsxVdIyhTLeNY6W+s4+rwKT1 pF92NmnmPo1uW9HL0SAK7KRpzRm8n8+2Gqwpcll0QINwBIXattWUDO5oqyeyoGBag6Yr l9eg== X-Gm-Message-State: AKwxytd/752YGE6vXuTBdVhPYPs87XQ5fgI3TwzwlEmjhrZsErTtcXvb gIK9747Uzv+gJzEN6CUXAKLmbKWe41Y= X-Received: by 10.99.168.5 with SMTP id o5mr8849171pgf.27.1516337686872; Thu, 18 Jan 2018 20:54:46 -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.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Jan 2018 20:54:45 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 18 Jan 2018 20:54:24 -0800 Message-Id: <20180119045438.28582-3-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:c05::241 Subject: [Qemu-devel] [PATCH v2 02/16] target/arm: Use pointers in crypto helpers 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 regnos to the helpers, pass pointers to the vector registers 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 | 18 ++--- target/arm/crypto_helper.c | 184 +++++++++++++++++---------------------------- target/arm/translate-a64.c | 75 ++++++++++-------- target/arm/translate.c | 68 +++++++++-------- 4 files changed, 161 insertions(+), 184 deletions(-) -- 2.14.3 Reviewed-by: Alex Bennée diff --git a/target/arm/helper.h b/target/arm/helper.h index 066729e8ad..688380af6b 100644 --- a/target/arm/helper.h +++ b/target/arm/helper.h @@ -522,17 +522,17 @@ DEF_HELPER_3(neon_qzip8, void, env, i32, i32) DEF_HELPER_3(neon_qzip16, void, env, i32, i32) DEF_HELPER_3(neon_qzip32, void, env, i32, i32) -DEF_HELPER_4(crypto_aese, void, env, i32, i32, i32) -DEF_HELPER_4(crypto_aesmc, void, env, i32, i32, i32) +DEF_HELPER_FLAGS_3(crypto_aese, TCG_CALL_NO_RWG, void, ptr, ptr, i32) +DEF_HELPER_FLAGS_3(crypto_aesmc, TCG_CALL_NO_RWG, void, ptr, ptr, i32) -DEF_HELPER_5(crypto_sha1_3reg, void, env, i32, i32, i32, i32) -DEF_HELPER_3(crypto_sha1h, void, env, i32, i32) -DEF_HELPER_3(crypto_sha1su1, void, env, i32, i32) +DEF_HELPER_FLAGS_4(crypto_sha1_3reg, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_2(crypto_sha1h, TCG_CALL_NO_RWG, void, ptr, ptr) +DEF_HELPER_FLAGS_2(crypto_sha1su1, TCG_CALL_NO_RWG, void, ptr, ptr) -DEF_HELPER_4(crypto_sha256h, void, env, i32, i32, i32) -DEF_HELPER_4(crypto_sha256h2, void, env, i32, i32, i32) -DEF_HELPER_3(crypto_sha256su0, void, env, i32, i32) -DEF_HELPER_4(crypto_sha256su1, void, env, i32, i32, i32) +DEF_HELPER_FLAGS_3(crypto_sha256h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr) +DEF_HELPER_FLAGS_3(crypto_sha256h2, TCG_CALL_NO_RWG, void, ptr, ptr, ptr) +DEF_HELPER_FLAGS_2(crypto_sha256su0, TCG_CALL_NO_RWG, void, ptr, ptr) +DEF_HELPER_FLAGS_3(crypto_sha256su1, TCG_CALL_NO_RWG, void, ptr, ptr, ptr) DEF_HELPER_FLAGS_3(crc32, TCG_CALL_NO_RWG_SE, i32, i32, i32, i32) DEF_HELPER_FLAGS_3(crc32c, TCG_CALL_NO_RWG_SE, i32, i32, i32, i32) diff --git a/target/arm/crypto_helper.c b/target/arm/crypto_helper.c index 3b6df3f41a..9ca0bdead7 100644 --- a/target/arm/crypto_helper.c +++ b/target/arm/crypto_helper.c @@ -30,20 +30,14 @@ union CRYPTO_STATE { #define CR_ST_WORD(state, i) (state.words[i]) #endif -void HELPER(crypto_aese)(CPUARMState *env, uint32_t rd, uint32_t rm, - uint32_t decrypt) +void HELPER(crypto_aese)(void *vd, void *vm, uint32_t decrypt) { static uint8_t const * const sbox[2] = { AES_sbox, AES_isbox }; static uint8_t const * const shift[2] = { AES_shifts, AES_ishifts }; - - union CRYPTO_STATE rk = { .l = { - float64_val(env->vfp.regs[rm]), - float64_val(env->vfp.regs[rm + 1]) - } }; - union CRYPTO_STATE st = { .l = { - float64_val(env->vfp.regs[rd]), - float64_val(env->vfp.regs[rd + 1]) - } }; + uint64_t *rd = vd; + uint64_t *rm = vm; + union CRYPTO_STATE rk = { .l = { rm[0], rm[1] } }; + union CRYPTO_STATE st = { .l = { rd[0], rd[1] } }; int i; assert(decrypt < 2); @@ -57,12 +51,11 @@ void HELPER(crypto_aese)(CPUARMState *env, uint32_t rd, uint32_t rm, CR_ST_BYTE(st, i) = sbox[decrypt][CR_ST_BYTE(rk, shift[decrypt][i])]; } - env->vfp.regs[rd] = make_float64(st.l[0]); - env->vfp.regs[rd + 1] = make_float64(st.l[1]); + rd[0] = st.l[0]; + rd[1] = st.l[1]; } -void HELPER(crypto_aesmc)(CPUARMState *env, uint32_t rd, uint32_t rm, - uint32_t decrypt) +void HELPER(crypto_aesmc)(void *vd, void *vm, uint32_t decrypt) { static uint32_t const mc[][256] = { { /* MixColumns lookup table */ @@ -197,10 +190,10 @@ void HELPER(crypto_aesmc)(CPUARMState *env, uint32_t rd, uint32_t rm, 0x92b479a7, 0x99b970a9, 0x84ae6bbb, 0x8fa362b5, 0xbe805d9f, 0xb58d5491, 0xa89a4f83, 0xa397468d, } }; - union CRYPTO_STATE st = { .l = { - float64_val(env->vfp.regs[rm]), - float64_val(env->vfp.regs[rm + 1]) - } }; + + uint64_t *rd = vd; + uint64_t *rm = vm; + union CRYPTO_STATE st = { .l = { rm[0], rm[1] } }; int i; assert(decrypt < 2); @@ -213,8 +206,8 @@ void HELPER(crypto_aesmc)(CPUARMState *env, uint32_t rd, uint32_t rm, rol32(mc[decrypt][CR_ST_BYTE(st, i + 3)], 24); } - env->vfp.regs[rd] = make_float64(st.l[0]); - env->vfp.regs[rd + 1] = make_float64(st.l[1]); + rd[0] = st.l[0]; + rd[1] = st.l[1]; } /* @@ -236,21 +229,14 @@ static uint32_t maj(uint32_t x, uint32_t y, uint32_t z) return (x & y) | ((x | y) & z); } -void HELPER(crypto_sha1_3reg)(CPUARMState *env, uint32_t rd, uint32_t rn, - uint32_t rm, uint32_t op) +void HELPER(crypto_sha1_3reg)(void *vd, void *vn, void *vm, uint32_t op) { - union CRYPTO_STATE d = { .l = { - float64_val(env->vfp.regs[rd]), - float64_val(env->vfp.regs[rd + 1]) - } }; - union CRYPTO_STATE n = { .l = { - float64_val(env->vfp.regs[rn]), - float64_val(env->vfp.regs[rn + 1]) - } }; - union CRYPTO_STATE m = { .l = { - float64_val(env->vfp.regs[rm]), - float64_val(env->vfp.regs[rm + 1]) - } }; + uint64_t *rd = vd; + uint64_t *rn = vn; + uint64_t *rm = vm; + union CRYPTO_STATE d = { .l = { rd[0], rd[1] } }; + union CRYPTO_STATE n = { .l = { rn[0], rn[1] } }; + union CRYPTO_STATE m = { .l = { rm[0], rm[1] } }; if (op == 3) { /* sha1su0 */ d.l[0] ^= d.l[1] ^ m.l[0]; @@ -284,42 +270,37 @@ void HELPER(crypto_sha1_3reg)(CPUARMState *env, uint32_t rd, uint32_t rn, CR_ST_WORD(d, 0) = t; } } - env->vfp.regs[rd] = make_float64(d.l[0]); - env->vfp.regs[rd + 1] = make_float64(d.l[1]); + rd[0] = d.l[0]; + rd[1] = d.l[1]; } -void HELPER(crypto_sha1h)(CPUARMState *env, uint32_t rd, uint32_t rm) +void HELPER(crypto_sha1h)(void *vd, void *vm) { - union CRYPTO_STATE m = { .l = { - float64_val(env->vfp.regs[rm]), - float64_val(env->vfp.regs[rm + 1]) - } }; + uint64_t *rd = vd; + uint64_t *rm = vm; + union CRYPTO_STATE m = { .l = { rm[0], rm[1] } }; CR_ST_WORD(m, 0) = ror32(CR_ST_WORD(m, 0), 2); CR_ST_WORD(m, 1) = CR_ST_WORD(m, 2) = CR_ST_WORD(m, 3) = 0; - env->vfp.regs[rd] = make_float64(m.l[0]); - env->vfp.regs[rd + 1] = make_float64(m.l[1]); + rd[0] = m.l[0]; + rd[1] = m.l[1]; } -void HELPER(crypto_sha1su1)(CPUARMState *env, uint32_t rd, uint32_t rm) +void HELPER(crypto_sha1su1)(void *vd, void *vm) { - union CRYPTO_STATE d = { .l = { - float64_val(env->vfp.regs[rd]), - float64_val(env->vfp.regs[rd + 1]) - } }; - union CRYPTO_STATE m = { .l = { - float64_val(env->vfp.regs[rm]), - float64_val(env->vfp.regs[rm + 1]) - } }; + uint64_t *rd = vd; + uint64_t *rm = vm; + union CRYPTO_STATE d = { .l = { rd[0], rd[1] } }; + union CRYPTO_STATE m = { .l = { rm[0], rm[1] } }; CR_ST_WORD(d, 0) = rol32(CR_ST_WORD(d, 0) ^ CR_ST_WORD(m, 1), 1); CR_ST_WORD(d, 1) = rol32(CR_ST_WORD(d, 1) ^ CR_ST_WORD(m, 2), 1); CR_ST_WORD(d, 2) = rol32(CR_ST_WORD(d, 2) ^ CR_ST_WORD(m, 3), 1); CR_ST_WORD(d, 3) = rol32(CR_ST_WORD(d, 3) ^ CR_ST_WORD(d, 0), 1); - env->vfp.regs[rd] = make_float64(d.l[0]); - env->vfp.regs[rd + 1] = make_float64(d.l[1]); + rd[0] = d.l[0]; + rd[1] = d.l[1]; } /* @@ -347,21 +328,14 @@ static uint32_t s1(uint32_t x) return ror32(x, 17) ^ ror32(x, 19) ^ (x >> 10); } -void HELPER(crypto_sha256h)(CPUARMState *env, uint32_t rd, uint32_t rn, - uint32_t rm) +void HELPER(crypto_sha256h)(void *vd, void *vn, void *vm) { - union CRYPTO_STATE d = { .l = { - float64_val(env->vfp.regs[rd]), - float64_val(env->vfp.regs[rd + 1]) - } }; - union CRYPTO_STATE n = { .l = { - float64_val(env->vfp.regs[rn]), - float64_val(env->vfp.regs[rn + 1]) - } }; - union CRYPTO_STATE m = { .l = { - float64_val(env->vfp.regs[rm]), - float64_val(env->vfp.regs[rm + 1]) - } }; + uint64_t *rd = vd; + uint64_t *rn = vn; + uint64_t *rm = vm; + union CRYPTO_STATE d = { .l = { rd[0], rd[1] } }; + union CRYPTO_STATE n = { .l = { rn[0], rn[1] } }; + union CRYPTO_STATE m = { .l = { rm[0], rm[1] } }; int i; for (i = 0; i < 4; i++) { @@ -383,25 +357,18 @@ void HELPER(crypto_sha256h)(CPUARMState *env, uint32_t rd, uint32_t rn, CR_ST_WORD(d, 0) = t; } - env->vfp.regs[rd] = make_float64(d.l[0]); - env->vfp.regs[rd + 1] = make_float64(d.l[1]); + rd[0] = d.l[0]; + rd[1] = d.l[1]; } -void HELPER(crypto_sha256h2)(CPUARMState *env, uint32_t rd, uint32_t rn, - uint32_t rm) +void HELPER(crypto_sha256h2)(void *vd, void *vn, void *vm) { - union CRYPTO_STATE d = { .l = { - float64_val(env->vfp.regs[rd]), - float64_val(env->vfp.regs[rd + 1]) - } }; - union CRYPTO_STATE n = { .l = { - float64_val(env->vfp.regs[rn]), - float64_val(env->vfp.regs[rn + 1]) - } }; - union CRYPTO_STATE m = { .l = { - float64_val(env->vfp.regs[rm]), - float64_val(env->vfp.regs[rm + 1]) - } }; + uint64_t *rd = vd; + uint64_t *rn = vn; + uint64_t *rm = vm; + union CRYPTO_STATE d = { .l = { rd[0], rd[1] } }; + union CRYPTO_STATE n = { .l = { rn[0], rn[1] } }; + union CRYPTO_STATE m = { .l = { rm[0], rm[1] } }; int i; for (i = 0; i < 4; i++) { @@ -415,51 +382,40 @@ void HELPER(crypto_sha256h2)(CPUARMState *env, uint32_t rd, uint32_t rn, CR_ST_WORD(d, 0) = CR_ST_WORD(n, 3 - i) + t; } - env->vfp.regs[rd] = make_float64(d.l[0]); - env->vfp.regs[rd + 1] = make_float64(d.l[1]); + rd[0] = d.l[0]; + rd[1] = d.l[1]; } -void HELPER(crypto_sha256su0)(CPUARMState *env, uint32_t rd, uint32_t rm) +void HELPER(crypto_sha256su0)(void *vd, void *vm) { - union CRYPTO_STATE d = { .l = { - float64_val(env->vfp.regs[rd]), - float64_val(env->vfp.regs[rd + 1]) - } }; - union CRYPTO_STATE m = { .l = { - float64_val(env->vfp.regs[rm]), - float64_val(env->vfp.regs[rm + 1]) - } }; + uint64_t *rd = vd; + uint64_t *rm = vm; + union CRYPTO_STATE d = { .l = { rd[0], rd[1] } }; + union CRYPTO_STATE m = { .l = { rm[0], rm[1] } }; CR_ST_WORD(d, 0) += s0(CR_ST_WORD(d, 1)); CR_ST_WORD(d, 1) += s0(CR_ST_WORD(d, 2)); CR_ST_WORD(d, 2) += s0(CR_ST_WORD(d, 3)); CR_ST_WORD(d, 3) += s0(CR_ST_WORD(m, 0)); - env->vfp.regs[rd] = make_float64(d.l[0]); - env->vfp.regs[rd + 1] = make_float64(d.l[1]); + rd[0] = d.l[0]; + rd[1] = d.l[1]; } -void HELPER(crypto_sha256su1)(CPUARMState *env, uint32_t rd, uint32_t rn, - uint32_t rm) +void HELPER(crypto_sha256su1)(void *vd, void *vn, void *vm) { - union CRYPTO_STATE d = { .l = { - float64_val(env->vfp.regs[rd]), - float64_val(env->vfp.regs[rd + 1]) - } }; - union CRYPTO_STATE n = { .l = { - float64_val(env->vfp.regs[rn]), - float64_val(env->vfp.regs[rn + 1]) - } }; - union CRYPTO_STATE m = { .l = { - float64_val(env->vfp.regs[rm]), - float64_val(env->vfp.regs[rm + 1]) - } }; + uint64_t *rd = vd; + uint64_t *rn = vn; + uint64_t *rm = vm; + union CRYPTO_STATE d = { .l = { rd[0], rd[1] } }; + union CRYPTO_STATE n = { .l = { rn[0], rn[1] } }; + union CRYPTO_STATE m = { .l = { rm[0], rm[1] } }; CR_ST_WORD(d, 0) += s1(CR_ST_WORD(m, 2)) + CR_ST_WORD(n, 1); CR_ST_WORD(d, 1) += s1(CR_ST_WORD(m, 3)) + CR_ST_WORD(n, 2); CR_ST_WORD(d, 2) += s1(CR_ST_WORD(d, 0)) + CR_ST_WORD(n, 3); CR_ST_WORD(d, 3) += s1(CR_ST_WORD(d, 1)) + CR_ST_WORD(m, 0); - env->vfp.regs[rd] = make_float64(d.l[0]); - env->vfp.regs[rd + 1] = make_float64(d.l[1]); + rd[0] = d.l[0]; + rd[1] = d.l[1]; } diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 70c1e08a36..6d9b3af64c 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -80,8 +80,9 @@ typedef void NeonGenWidenFn(TCGv_i64, TCGv_i32); typedef void NeonGenTwoSingleOPFn(TCGv_i32, TCGv_i32, TCGv_i32, TCGv_ptr); typedef void NeonGenTwoDoubleOPFn(TCGv_i64, TCGv_i64, TCGv_i64, TCGv_ptr); typedef void NeonGenOneOpFn(TCGv_i64, TCGv_i64); -typedef void CryptoTwoOpEnvFn(TCGv_ptr, TCGv_i32, TCGv_i32); -typedef void CryptoThreeOpEnvFn(TCGv_ptr, TCGv_i32, TCGv_i32, TCGv_i32); +typedef void CryptoTwoOpFn(TCGv_ptr, TCGv_ptr); +typedef void CryptoThreeOpIntFn(TCGv_ptr, TCGv_ptr, TCGv_i32); +typedef void CryptoThreeOpFn(TCGv_ptr, TCGv_ptr, TCGv_ptr); /* initialize TCG globals. */ void a64_translate_init(void) @@ -535,6 +536,21 @@ static inline int vec_reg_offset(DisasContext *s, int regno, return offs; } +/* Return the offset info CPUARMState of the "whole" vector register Qn. */ +static inline int vec_full_reg_offset(DisasContext *s, int regno) +{ + assert_fp_access_checked(s); + return offsetof(CPUARMState, vfp.regs[regno * 2]); +} + +/* Return a newly allocated pointer to the vector register. */ +static TCGv_ptr vec_full_reg_ptr(DisasContext *s, int regno) +{ + TCGv_ptr ret = tcg_temp_new_ptr(); + tcg_gen_addi_ptr(ret, cpu_env, vec_full_reg_offset(s, regno)); + return ret; +} + /* Return the offset into CPUARMState of a slice (from * the least significant end) of FP register Qn (ie * Dn, Sn, Hn or Bn). @@ -10949,8 +10965,9 @@ static void disas_crypto_aes(DisasContext *s, uint32_t insn) int rn = extract32(insn, 5, 5); int rd = extract32(insn, 0, 5); int decrypt; - TCGv_i32 tcg_rd_regno, tcg_rn_regno, tcg_decrypt; - CryptoThreeOpEnvFn *genfn; + TCGv_ptr tcg_rd_ptr, tcg_rn_ptr; + TCGv_i32 tcg_decrypt; + CryptoThreeOpIntFn *genfn; if (!arm_dc_feature(s, ARM_FEATURE_V8_AES) || size != 0) { @@ -10984,18 +11001,14 @@ static void disas_crypto_aes(DisasContext *s, uint32_t insn) return; } - /* Note that we convert the Vx register indexes into the - * index within the vfp.regs[] array, so we can share the - * helper with the AArch32 instructions. - */ - tcg_rd_regno = tcg_const_i32(rd << 1); - tcg_rn_regno = tcg_const_i32(rn << 1); + tcg_rd_ptr = vec_full_reg_ptr(s, rd); + tcg_rn_ptr = vec_full_reg_ptr(s, rn); tcg_decrypt = tcg_const_i32(decrypt); - genfn(cpu_env, tcg_rd_regno, tcg_rn_regno, tcg_decrypt); + genfn(tcg_rd_ptr, tcg_rn_ptr, tcg_decrypt); - tcg_temp_free_i32(tcg_rd_regno); - tcg_temp_free_i32(tcg_rn_regno); + tcg_temp_free_ptr(tcg_rd_ptr); + tcg_temp_free_ptr(tcg_rn_ptr); tcg_temp_free_i32(tcg_decrypt); } @@ -11012,8 +11025,8 @@ static void disas_crypto_three_reg_sha(DisasContext *s, uint32_t insn) int rm = extract32(insn, 16, 5); int rn = extract32(insn, 5, 5); int rd = extract32(insn, 0, 5); - CryptoThreeOpEnvFn *genfn; - TCGv_i32 tcg_rd_regno, tcg_rn_regno, tcg_rm_regno; + CryptoThreeOpFn *genfn; + TCGv_ptr tcg_rd_ptr, tcg_rn_ptr, tcg_rm_ptr; int feature = ARM_FEATURE_V8_SHA256; if (size != 0) { @@ -11052,23 +11065,23 @@ static void disas_crypto_three_reg_sha(DisasContext *s, uint32_t insn) return; } - tcg_rd_regno = tcg_const_i32(rd << 1); - tcg_rn_regno = tcg_const_i32(rn << 1); - tcg_rm_regno = tcg_const_i32(rm << 1); + tcg_rd_ptr = vec_full_reg_ptr(s, rd); + tcg_rn_ptr = vec_full_reg_ptr(s, rn); + tcg_rm_ptr = vec_full_reg_ptr(s, rm); if (genfn) { - genfn(cpu_env, tcg_rd_regno, tcg_rn_regno, tcg_rm_regno); + genfn(tcg_rd_ptr, tcg_rn_ptr, tcg_rm_ptr); } else { TCGv_i32 tcg_opcode = tcg_const_i32(opcode); - gen_helper_crypto_sha1_3reg(cpu_env, tcg_rd_regno, - tcg_rn_regno, tcg_rm_regno, tcg_opcode); + gen_helper_crypto_sha1_3reg(tcg_rd_ptr, tcg_rn_ptr, + tcg_rm_ptr, tcg_opcode); tcg_temp_free_i32(tcg_opcode); } - tcg_temp_free_i32(tcg_rd_regno); - tcg_temp_free_i32(tcg_rn_regno); - tcg_temp_free_i32(tcg_rm_regno); + tcg_temp_free_ptr(tcg_rd_ptr); + tcg_temp_free_ptr(tcg_rn_ptr); + tcg_temp_free_ptr(tcg_rm_ptr); } /* Crypto two-reg SHA @@ -11083,9 +11096,9 @@ static void disas_crypto_two_reg_sha(DisasContext *s, uint32_t insn) int opcode = extract32(insn, 12, 5); int rn = extract32(insn, 5, 5); int rd = extract32(insn, 0, 5); - CryptoTwoOpEnvFn *genfn; + CryptoTwoOpFn *genfn; int feature; - TCGv_i32 tcg_rd_regno, tcg_rn_regno; + TCGv_ptr tcg_rd_ptr, tcg_rn_ptr; if (size != 0) { unallocated_encoding(s); @@ -11119,13 +11132,13 @@ static void disas_crypto_two_reg_sha(DisasContext *s, uint32_t insn) return; } - tcg_rd_regno = tcg_const_i32(rd << 1); - tcg_rn_regno = tcg_const_i32(rn << 1); + tcg_rd_ptr = vec_full_reg_ptr(s, rd); + tcg_rn_ptr = vec_full_reg_ptr(s, rn); - genfn(cpu_env, tcg_rd_regno, tcg_rn_regno); + genfn(tcg_rd_ptr, tcg_rn_ptr); - tcg_temp_free_i32(tcg_rd_regno); - tcg_temp_free_i32(tcg_rn_regno); + tcg_temp_free_ptr(tcg_rd_ptr); + tcg_temp_free_ptr(tcg_rn_ptr); } /* C3.6 Data processing - SIMD, inc Crypto diff --git a/target/arm/translate.c b/target/arm/translate.c index 781be1e219..7b5db15861 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -1559,6 +1559,13 @@ static inline void neon_store_reg64(TCGv_i64 var, int reg) tcg_gen_st_i64(var, cpu_env, vfp_reg_offset(1, reg)); } +static TCGv_ptr vfp_reg_ptr(bool dp, int reg) +{ + TCGv_ptr ret = tcg_temp_new_ptr(); + tcg_gen_addi_ptr(ret, cpu_env, vfp_reg_offset(dp, reg)); + return ret; +} + #define tcg_gen_ld_f32 tcg_gen_ld_i32 #define tcg_gen_ld_f64 tcg_gen_ld_i64 #define tcg_gen_st_f32 tcg_gen_st_i32 @@ -5597,6 +5604,7 @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) int u; uint32_t imm, mask; TCGv_i32 tmp, tmp2, tmp3, tmp4, tmp5; + TCGv_ptr ptr1, ptr2, ptr3; TCGv_i64 tmp64; /* FIXME: this access check should not take precedence over UNDEF @@ -5643,34 +5651,34 @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) if (!arm_dc_feature(s, ARM_FEATURE_V8_SHA1)) { return 1; } - tmp = tcg_const_i32(rd); - tmp2 = tcg_const_i32(rn); - tmp3 = tcg_const_i32(rm); + ptr1 = vfp_reg_ptr(true, rd); + ptr2 = vfp_reg_ptr(true, rn); + ptr3 = vfp_reg_ptr(true, rm); tmp4 = tcg_const_i32(size); - gen_helper_crypto_sha1_3reg(cpu_env, tmp, tmp2, tmp3, tmp4); + gen_helper_crypto_sha1_3reg(ptr1, ptr2, ptr3, tmp4); tcg_temp_free_i32(tmp4); } else { /* SHA-256 */ if (!arm_dc_feature(s, ARM_FEATURE_V8_SHA256) || size == 3) { return 1; } - tmp = tcg_const_i32(rd); - tmp2 = tcg_const_i32(rn); - tmp3 = tcg_const_i32(rm); + ptr1 = vfp_reg_ptr(true, rd); + ptr2 = vfp_reg_ptr(true, rn); + ptr3 = vfp_reg_ptr(true, rm); switch (size) { case 0: - gen_helper_crypto_sha256h(cpu_env, tmp, tmp2, tmp3); + gen_helper_crypto_sha256h(ptr1, ptr2, ptr3); break; case 1: - gen_helper_crypto_sha256h2(cpu_env, tmp, tmp2, tmp3); + gen_helper_crypto_sha256h2(ptr1, ptr2, ptr3); break; case 2: - gen_helper_crypto_sha256su1(cpu_env, tmp, tmp2, tmp3); + gen_helper_crypto_sha256su1(ptr1, ptr2, ptr3); break; } } - tcg_temp_free_i32(tmp); - tcg_temp_free_i32(tmp2); - tcg_temp_free_i32(tmp3); + tcg_temp_free_ptr(ptr1); + tcg_temp_free_ptr(ptr2); + tcg_temp_free_ptr(ptr3); return 0; } if (size == 3 && op != NEON_3R_LOGIC) { @@ -7159,8 +7167,8 @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) || ((rm | rd) & 1)) { return 1; } - tmp = tcg_const_i32(rd); - tmp2 = tcg_const_i32(rm); + ptr1 = vfp_reg_ptr(true, rd); + ptr2 = vfp_reg_ptr(true, rm); /* Bit 6 is the lowest opcode bit; it distinguishes between * encryption (AESE/AESMC) and decryption (AESD/AESIMC) @@ -7168,12 +7176,12 @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) tmp3 = tcg_const_i32(extract32(insn, 6, 1)); if (op == NEON_2RM_AESE) { - gen_helper_crypto_aese(cpu_env, tmp, tmp2, tmp3); + gen_helper_crypto_aese(ptr1, ptr2, tmp3); } else { - gen_helper_crypto_aesmc(cpu_env, tmp, tmp2, tmp3); + gen_helper_crypto_aesmc(ptr1, ptr2, tmp3); } - tcg_temp_free_i32(tmp); - tcg_temp_free_i32(tmp2); + tcg_temp_free_ptr(ptr1); + tcg_temp_free_ptr(ptr2); tcg_temp_free_i32(tmp3); break; case NEON_2RM_SHA1H: @@ -7181,13 +7189,13 @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) || ((rm | rd) & 1)) { return 1; } - tmp = tcg_const_i32(rd); - tmp2 = tcg_const_i32(rm); + ptr1 = vfp_reg_ptr(true, rd); + ptr2 = vfp_reg_ptr(true, rm); - gen_helper_crypto_sha1h(cpu_env, tmp, tmp2); + gen_helper_crypto_sha1h(ptr1, ptr2); - tcg_temp_free_i32(tmp); - tcg_temp_free_i32(tmp2); + tcg_temp_free_ptr(ptr1); + tcg_temp_free_ptr(ptr2); break; case NEON_2RM_SHA1SU1: if ((rm | rd) & 1) { @@ -7201,15 +7209,15 @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) } else if (!arm_dc_feature(s, ARM_FEATURE_V8_SHA1)) { return 1; } - tmp = tcg_const_i32(rd); - tmp2 = tcg_const_i32(rm); + ptr1 = vfp_reg_ptr(true, rd); + ptr2 = vfp_reg_ptr(true, rm); if (q) { - gen_helper_crypto_sha256su0(cpu_env, tmp, tmp2); + gen_helper_crypto_sha256su0(ptr1, ptr2); } else { - gen_helper_crypto_sha1su1(cpu_env, tmp, tmp2); + gen_helper_crypto_sha1su1(ptr1, ptr2); } - tcg_temp_free_i32(tmp); - tcg_temp_free_i32(tmp2); + tcg_temp_free_ptr(ptr1); + tcg_temp_free_ptr(ptr2); break; default: elementwise: From patchwork Fri Jan 19 04:54:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 125077 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp131166ljf; Thu, 18 Jan 2018 20:59:50 -0800 (PST) X-Google-Smtp-Source: ACJfBosaE4yfC2vpaEFcLUG06XB4s2HcwxoS3KoBpXzp8xoeK9ZSq6rZN7FC12qo+dwvfez3oYhC X-Received: by 10.129.172.19 with SMTP id k19mr8381453ywh.274.1516337990186; Thu, 18 Jan 2018 20:59:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516337990; cv=none; d=google.com; s=arc-20160816; b=Kg22xBy2eUhNEcTYb4d3AgcEkyqhg+tMWRi95ROXU2OxeCHLm2mgyLU9OolyoiBUuB 77mdsf7Z1VIwQDGsq0t8S9Bpwnwc2/C501ei3DKsYdtJ53nHi8XDCoRPNlxsMaBYH6bJ v5J2QjOCmhSqUi4dRmkTlaHDXr4JMp9yBt5pkEX1rxB8B6L3ZbF58rQIULQnqIAOPKwL La6EORmx6s5xD7OIr4n7nPHkNnptjT6FfCH0l06u4MrsIXto9midaY/z/3vA07WXd9+V km8BFLNARAIrLyEjjLENYblHLp2exXPMMTv38druAc9pOlIG6j3ISy4/e3jxF52Ck8z3 nSrA== 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=cqrA8CU4eKHFUueqSZ+9jYOSEtrX5Z7lO22SsZclNa8=; b=b7/Y40R6ToTW9NdKSo144todJyaaYvoaKeUmQBFZ/gPTHp3RKfaUw+gocVKumZM1lx WSUa98wc0Jc0LbOqcJLLMh4SdUu5ZT7/lNT9f4QLvVZMuqIeDNv8uidp9/YjpEpwdz1Z kAdRPiAv7EPSsM7Lhclq4IlIhuGaHUC6QZRawxIWZPPnHaS5taTaye0SjMf0hChAkk1a BvwRfn/kMZiyV2UGymlG5BV5pHCqb9ABPUJ1vGgktoiEWQHsh2htaqiXwj01X5JhC8/s 7rpE6Cgdfy2A9pFSGC6AF+pBVgWwSsun+6MlwAi04+qyTDZNUbo9rCKIofjlTIBmaTgj bCdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=hKZcTZti; 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 q2si2066849ywi.122.2018.01.18.20.59.49 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 18 Jan 2018 20:59:50 -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=hKZcTZti; 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]:52336 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecOmL-0005mM-L0 for patch@linaro.org; Thu, 18 Jan 2018 23:59:49 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58614) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecOhY-00028h-99 for qemu-devel@nongnu.org; Thu, 18 Jan 2018 23:54:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ecOhW-0008Te-Ap 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]:33532) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ecOhW-0008TI-2u for qemu-devel@nongnu.org; Thu, 18 Jan 2018 23:54:50 -0500 Received: by mail-pf0-x243.google.com with SMTP id t5so537828pfi.0 for ; Thu, 18 Jan 2018 20:54:49 -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=cqrA8CU4eKHFUueqSZ+9jYOSEtrX5Z7lO22SsZclNa8=; b=hKZcTZtipnou93Si/P8M65jD2QZkAz+Gzk3k/kXmIAIJwNaLbrpgv8/y16ZE6AhPFf iKRr+gr2MzKcFrMW5jAE2TubvN4bOdet3OdxEgRMNzNYOx6h6mPF2pTEMtiqm/OF6QrW BrCCpjbcWcywqG9gEpd2wwMhFAhRlIUIoZCxI= 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=cqrA8CU4eKHFUueqSZ+9jYOSEtrX5Z7lO22SsZclNa8=; b=SQW9tCpm4WQey4UyF0YZmMIFp+k7qtJViiXGUZfQplqZKSBHXPUwrx1q1cumbG/cYf suT2+rYMo46KFeo0rrONCD9FTX37JCx0nOYlohKFitScFXtuqG3Zbuj/IqxRTQ2KhM7z TDEHAa7iOLbPM/RnH/pIOr1yZNh4vzemrbFV+5Gwbf3z0O7CtYcgwHrq/kHm+jSvXXG0 oGo6gaYoGa0Z4gDyh5ZNJmgh+wkwvBZlQ+WNrVFrV1ymDKRBe7F9wPg4iGUVuQ61hsFb jwSyW06gN5IbacorKDYpvxeHQzM9GYwRerYhRtJeG++BfAdI4A9puuXTxyEe7LVAOyc/ icqA== X-Gm-Message-State: AKGB3mKjoqN95I3Y4m7Sli1FB9Qp3sMr2hABtKCbK0M6OoPYgA5RoJZe lqZ6mzSWVF76z/xQ3XNlmiiFEa/l4sQ= X-Received: by 10.99.175.66 with SMTP id s2mr39379313pgo.168.1516337688489; Thu, 18 Jan 2018 20:54:48 -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.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Jan 2018 20:54:47 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 18 Jan 2018 20:54:25 -0800 Message-Id: <20180119045438.28582-4-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 03/16] target/arm: Use pointers in neon zip/uzp helpers 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 regnos to the helpers, pass pointers to the vector registers 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 | 20 +++--- target/arm/neon_helper.c | 162 +++++++++++++++++++++++++---------------------- target/arm/translate.c | 42 ++++++------ 3 files changed, 120 insertions(+), 104 deletions(-) -- 2.14.3 Reviewed-by: Alex Bennée Reviewed-by: Alex Bennée diff --git a/target/arm/helper.h b/target/arm/helper.h index 688380af6b..dbdc38fcb7 100644 --- a/target/arm/helper.h +++ b/target/arm/helper.h @@ -511,16 +511,16 @@ DEF_HELPER_3(iwmmxt_muladdsl, i64, i64, i32, i32) DEF_HELPER_3(iwmmxt_muladdsw, i64, i64, i32, i32) DEF_HELPER_3(iwmmxt_muladdswl, i64, i64, i32, i32) -DEF_HELPER_3(neon_unzip8, void, env, i32, i32) -DEF_HELPER_3(neon_unzip16, void, env, i32, i32) -DEF_HELPER_3(neon_qunzip8, void, env, i32, i32) -DEF_HELPER_3(neon_qunzip16, void, env, i32, i32) -DEF_HELPER_3(neon_qunzip32, void, env, i32, i32) -DEF_HELPER_3(neon_zip8, void, env, i32, i32) -DEF_HELPER_3(neon_zip16, void, env, i32, i32) -DEF_HELPER_3(neon_qzip8, void, env, i32, i32) -DEF_HELPER_3(neon_qzip16, void, env, i32, i32) -DEF_HELPER_3(neon_qzip32, void, env, i32, i32) +DEF_HELPER_FLAGS_2(neon_unzip8, TCG_CALL_NO_RWG, void, ptr, ptr) +DEF_HELPER_FLAGS_2(neon_unzip16, TCG_CALL_NO_RWG, void, ptr, ptr) +DEF_HELPER_FLAGS_2(neon_qunzip8, TCG_CALL_NO_RWG, void, ptr, ptr) +DEF_HELPER_FLAGS_2(neon_qunzip16, TCG_CALL_NO_RWG, void, ptr, ptr) +DEF_HELPER_FLAGS_2(neon_qunzip32, TCG_CALL_NO_RWG, void, ptr, ptr) +DEF_HELPER_FLAGS_2(neon_zip8, TCG_CALL_NO_RWG, void, ptr, ptr) +DEF_HELPER_FLAGS_2(neon_zip16, TCG_CALL_NO_RWG, void, ptr, ptr) +DEF_HELPER_FLAGS_2(neon_qzip8, TCG_CALL_NO_RWG, void, ptr, ptr) +DEF_HELPER_FLAGS_2(neon_qzip16, TCG_CALL_NO_RWG, void, ptr, ptr) +DEF_HELPER_FLAGS_2(neon_qzip32, TCG_CALL_NO_RWG, void, ptr, ptr) DEF_HELPER_FLAGS_3(crypto_aese, TCG_CALL_NO_RWG, void, ptr, ptr, i32) DEF_HELPER_FLAGS_3(crypto_aesmc, TCG_CALL_NO_RWG, void, ptr, ptr, i32) diff --git a/target/arm/neon_helper.c b/target/arm/neon_helper.c index ebdf7c9b10..689491cad3 100644 --- a/target/arm/neon_helper.c +++ b/target/arm/neon_helper.c @@ -2027,12 +2027,12 @@ uint64_t HELPER(neon_acgt_f64)(uint64_t a, uint64_t b, void *fpstp) #define ELEM(V, N, SIZE) (((V) >> ((N) * (SIZE))) & ((1ull << (SIZE)) - 1)) -void HELPER(neon_qunzip8)(CPUARMState *env, uint32_t rd, uint32_t rm) +void HELPER(neon_qunzip8)(void *vd, void *vm) { - uint64_t zm0 = float64_val(env->vfp.regs[rm]); - uint64_t zm1 = float64_val(env->vfp.regs[rm + 1]); - uint64_t zd0 = float64_val(env->vfp.regs[rd]); - uint64_t zd1 = float64_val(env->vfp.regs[rd + 1]); + uint64_t *rd = vd, *rm = vm; + uint64_t zd0 = rd[0], zd1 = rd[1]; + uint64_t zm0 = rm[0], zm1 = rm[1]; + uint64_t d0 = ELEM(zd0, 0, 8) | (ELEM(zd0, 2, 8) << 8) | (ELEM(zd0, 4, 8) << 16) | (ELEM(zd0, 6, 8) << 24) | (ELEM(zd1, 0, 8) << 32) | (ELEM(zd1, 2, 8) << 40) @@ -2049,18 +2049,19 @@ void HELPER(neon_qunzip8)(CPUARMState *env, uint32_t rd, uint32_t rm) | (ELEM(zm0, 5, 8) << 16) | (ELEM(zm0, 7, 8) << 24) | (ELEM(zm1, 1, 8) << 32) | (ELEM(zm1, 3, 8) << 40) | (ELEM(zm1, 5, 8) << 48) | (ELEM(zm1, 7, 8) << 56); - env->vfp.regs[rm] = make_float64(m0); - env->vfp.regs[rm + 1] = make_float64(m1); - env->vfp.regs[rd] = make_float64(d0); - env->vfp.regs[rd + 1] = make_float64(d1); + + rm[0] = m0; + rm[1] = m1; + rd[0] = d0; + rd[1] = d1; } -void HELPER(neon_qunzip16)(CPUARMState *env, uint32_t rd, uint32_t rm) +void HELPER(neon_qunzip16)(void *vd, void *vm) { - uint64_t zm0 = float64_val(env->vfp.regs[rm]); - uint64_t zm1 = float64_val(env->vfp.regs[rm + 1]); - uint64_t zd0 = float64_val(env->vfp.regs[rd]); - uint64_t zd1 = float64_val(env->vfp.regs[rd + 1]); + uint64_t *rd = vd, *rm = vm; + uint64_t zd0 = rd[0], zd1 = rd[1]; + uint64_t zm0 = rm[0], zm1 = rm[1]; + uint64_t d0 = ELEM(zd0, 0, 16) | (ELEM(zd0, 2, 16) << 16) | (ELEM(zd1, 0, 16) << 32) | (ELEM(zd1, 2, 16) << 48); uint64_t d1 = ELEM(zm0, 0, 16) | (ELEM(zm0, 2, 16) << 16) @@ -2069,32 +2070,35 @@ void HELPER(neon_qunzip16)(CPUARMState *env, uint32_t rd, uint32_t rm) | (ELEM(zd1, 1, 16) << 32) | (ELEM(zd1, 3, 16) << 48); uint64_t m1 = ELEM(zm0, 1, 16) | (ELEM(zm0, 3, 16) << 16) | (ELEM(zm1, 1, 16) << 32) | (ELEM(zm1, 3, 16) << 48); - env->vfp.regs[rm] = make_float64(m0); - env->vfp.regs[rm + 1] = make_float64(m1); - env->vfp.regs[rd] = make_float64(d0); - env->vfp.regs[rd + 1] = make_float64(d1); + + rm[0] = m0; + rm[1] = m1; + rd[0] = d0; + rd[1] = d1; } -void HELPER(neon_qunzip32)(CPUARMState *env, uint32_t rd, uint32_t rm) +void HELPER(neon_qunzip32)(void *vd, void *vm) { - uint64_t zm0 = float64_val(env->vfp.regs[rm]); - uint64_t zm1 = float64_val(env->vfp.regs[rm + 1]); - uint64_t zd0 = float64_val(env->vfp.regs[rd]); - uint64_t zd1 = float64_val(env->vfp.regs[rd + 1]); + uint64_t *rd = vd, *rm = vm; + uint64_t zd0 = rd[0], zd1 = rd[1]; + uint64_t zm0 = rm[0], zm1 = rm[1]; + uint64_t d0 = ELEM(zd0, 0, 32) | (ELEM(zd1, 0, 32) << 32); uint64_t d1 = ELEM(zm0, 0, 32) | (ELEM(zm1, 0, 32) << 32); uint64_t m0 = ELEM(zd0, 1, 32) | (ELEM(zd1, 1, 32) << 32); uint64_t m1 = ELEM(zm0, 1, 32) | (ELEM(zm1, 1, 32) << 32); - env->vfp.regs[rm] = make_float64(m0); - env->vfp.regs[rm + 1] = make_float64(m1); - env->vfp.regs[rd] = make_float64(d0); - env->vfp.regs[rd + 1] = make_float64(d1); + + rm[0] = m0; + rm[1] = m1; + rd[0] = d0; + rd[1] = d1; } -void HELPER(neon_unzip8)(CPUARMState *env, uint32_t rd, uint32_t rm) +void HELPER(neon_unzip8)(void *vd, void *vm) { - uint64_t zm = float64_val(env->vfp.regs[rm]); - uint64_t zd = float64_val(env->vfp.regs[rd]); + uint64_t *rd = vd, *rm = vm; + uint64_t zd = rd[0], zm = rm[0]; + uint64_t d0 = ELEM(zd, 0, 8) | (ELEM(zd, 2, 8) << 8) | (ELEM(zd, 4, 8) << 16) | (ELEM(zd, 6, 8) << 24) | (ELEM(zm, 0, 8) << 32) | (ELEM(zm, 2, 8) << 40) @@ -2103,28 +2107,31 @@ void HELPER(neon_unzip8)(CPUARMState *env, uint32_t rd, uint32_t rm) | (ELEM(zd, 5, 8) << 16) | (ELEM(zd, 7, 8) << 24) | (ELEM(zm, 1, 8) << 32) | (ELEM(zm, 3, 8) << 40) | (ELEM(zm, 5, 8) << 48) | (ELEM(zm, 7, 8) << 56); - env->vfp.regs[rm] = make_float64(m0); - env->vfp.regs[rd] = make_float64(d0); + + rm[0] = m0; + rd[0] = d0; } -void HELPER(neon_unzip16)(CPUARMState *env, uint32_t rd, uint32_t rm) +void HELPER(neon_unzip16)(void *vd, void *vm) { - uint64_t zm = float64_val(env->vfp.regs[rm]); - uint64_t zd = float64_val(env->vfp.regs[rd]); + uint64_t *rd = vd, *rm = vm; + uint64_t zd = rd[0], zm = rm[0]; + uint64_t d0 = ELEM(zd, 0, 16) | (ELEM(zd, 2, 16) << 16) | (ELEM(zm, 0, 16) << 32) | (ELEM(zm, 2, 16) << 48); uint64_t m0 = ELEM(zd, 1, 16) | (ELEM(zd, 3, 16) << 16) | (ELEM(zm, 1, 16) << 32) | (ELEM(zm, 3, 16) << 48); - env->vfp.regs[rm] = make_float64(m0); - env->vfp.regs[rd] = make_float64(d0); + + rm[0] = m0; + rd[0] = d0; } -void HELPER(neon_qzip8)(CPUARMState *env, uint32_t rd, uint32_t rm) +void HELPER(neon_qzip8)(void *vd, void *vm) { - uint64_t zm0 = float64_val(env->vfp.regs[rm]); - uint64_t zm1 = float64_val(env->vfp.regs[rm + 1]); - uint64_t zd0 = float64_val(env->vfp.regs[rd]); - uint64_t zd1 = float64_val(env->vfp.regs[rd + 1]); + uint64_t *rd = vd, *rm = vm; + uint64_t zd0 = rd[0], zd1 = rd[1]; + uint64_t zm0 = rm[0], zm1 = rm[1]; + uint64_t d0 = ELEM(zd0, 0, 8) | (ELEM(zm0, 0, 8) << 8) | (ELEM(zd0, 1, 8) << 16) | (ELEM(zm0, 1, 8) << 24) | (ELEM(zd0, 2, 8) << 32) | (ELEM(zm0, 2, 8) << 40) @@ -2141,18 +2148,19 @@ void HELPER(neon_qzip8)(CPUARMState *env, uint32_t rd, uint32_t rm) | (ELEM(zd1, 5, 8) << 16) | (ELEM(zm1, 5, 8) << 24) | (ELEM(zd1, 6, 8) << 32) | (ELEM(zm1, 6, 8) << 40) | (ELEM(zd1, 7, 8) << 48) | (ELEM(zm1, 7, 8) << 56); - env->vfp.regs[rm] = make_float64(m0); - env->vfp.regs[rm + 1] = make_float64(m1); - env->vfp.regs[rd] = make_float64(d0); - env->vfp.regs[rd + 1] = make_float64(d1); + + rm[0] = m0; + rm[1] = m1; + rd[0] = d0; + rd[1] = d1; } -void HELPER(neon_qzip16)(CPUARMState *env, uint32_t rd, uint32_t rm) +void HELPER(neon_qzip16)(void *vd, void *vm) { - uint64_t zm0 = float64_val(env->vfp.regs[rm]); - uint64_t zm1 = float64_val(env->vfp.regs[rm + 1]); - uint64_t zd0 = float64_val(env->vfp.regs[rd]); - uint64_t zd1 = float64_val(env->vfp.regs[rd + 1]); + uint64_t *rd = vd, *rm = vm; + uint64_t zd0 = rd[0], zd1 = rd[1]; + uint64_t zm0 = rm[0], zm1 = rm[1]; + uint64_t d0 = ELEM(zd0, 0, 16) | (ELEM(zm0, 0, 16) << 16) | (ELEM(zd0, 1, 16) << 32) | (ELEM(zm0, 1, 16) << 48); uint64_t d1 = ELEM(zd0, 2, 16) | (ELEM(zm0, 2, 16) << 16) @@ -2161,32 +2169,35 @@ void HELPER(neon_qzip16)(CPUARMState *env, uint32_t rd, uint32_t rm) | (ELEM(zd1, 1, 16) << 32) | (ELEM(zm1, 1, 16) << 48); uint64_t m1 = ELEM(zd1, 2, 16) | (ELEM(zm1, 2, 16) << 16) | (ELEM(zd1, 3, 16) << 32) | (ELEM(zm1, 3, 16) << 48); - env->vfp.regs[rm] = make_float64(m0); - env->vfp.regs[rm + 1] = make_float64(m1); - env->vfp.regs[rd] = make_float64(d0); - env->vfp.regs[rd + 1] = make_float64(d1); + + rm[0] = m0; + rm[1] = m1; + rd[0] = d0; + rd[1] = d1; } -void HELPER(neon_qzip32)(CPUARMState *env, uint32_t rd, uint32_t rm) +void HELPER(neon_qzip32)(void *vd, void *vm) { - uint64_t zm0 = float64_val(env->vfp.regs[rm]); - uint64_t zm1 = float64_val(env->vfp.regs[rm + 1]); - uint64_t zd0 = float64_val(env->vfp.regs[rd]); - uint64_t zd1 = float64_val(env->vfp.regs[rd + 1]); + uint64_t *rd = vd, *rm = vm; + uint64_t zd0 = rd[0], zd1 = rd[1]; + uint64_t zm0 = rm[0], zm1 = rm[1]; + uint64_t d0 = ELEM(zd0, 0, 32) | (ELEM(zm0, 0, 32) << 32); uint64_t d1 = ELEM(zd0, 1, 32) | (ELEM(zm0, 1, 32) << 32); uint64_t m0 = ELEM(zd1, 0, 32) | (ELEM(zm1, 0, 32) << 32); uint64_t m1 = ELEM(zd1, 1, 32) | (ELEM(zm1, 1, 32) << 32); - env->vfp.regs[rm] = make_float64(m0); - env->vfp.regs[rm + 1] = make_float64(m1); - env->vfp.regs[rd] = make_float64(d0); - env->vfp.regs[rd + 1] = make_float64(d1); + + rm[0] = m0; + rm[1] = m1; + rd[0] = d0; + rd[1] = d1; } -void HELPER(neon_zip8)(CPUARMState *env, uint32_t rd, uint32_t rm) +void HELPER(neon_zip8)(void *vd, void *vm) { - uint64_t zm = float64_val(env->vfp.regs[rm]); - uint64_t zd = float64_val(env->vfp.regs[rd]); + uint64_t *rd = vd, *rm = vm; + uint64_t zd = rd[0], zm = rm[0]; + uint64_t d0 = ELEM(zd, 0, 8) | (ELEM(zm, 0, 8) << 8) | (ELEM(zd, 1, 8) << 16) | (ELEM(zm, 1, 8) << 24) | (ELEM(zd, 2, 8) << 32) | (ELEM(zm, 2, 8) << 40) @@ -2195,20 +2206,23 @@ void HELPER(neon_zip8)(CPUARMState *env, uint32_t rd, uint32_t rm) | (ELEM(zd, 5, 8) << 16) | (ELEM(zm, 5, 8) << 24) | (ELEM(zd, 6, 8) << 32) | (ELEM(zm, 6, 8) << 40) | (ELEM(zd, 7, 8) << 48) | (ELEM(zm, 7, 8) << 56); - env->vfp.regs[rm] = make_float64(m0); - env->vfp.regs[rd] = make_float64(d0); + + rm[0] = m0; + rd[0] = d0; } -void HELPER(neon_zip16)(CPUARMState *env, uint32_t rd, uint32_t rm) +void HELPER(neon_zip16)(void *vd, void *vm) { - uint64_t zm = float64_val(env->vfp.regs[rm]); - uint64_t zd = float64_val(env->vfp.regs[rd]); + uint64_t *rd = vd, *rm = vm; + uint64_t zd = rd[0], zm = rm[0]; + uint64_t d0 = ELEM(zd, 0, 16) | (ELEM(zm, 0, 16) << 16) | (ELEM(zd, 1, 16) << 32) | (ELEM(zm, 1, 16) << 48); uint64_t m0 = ELEM(zd, 2, 16) | (ELEM(zm, 2, 16) << 16) | (ELEM(zd, 3, 16) << 32) | (ELEM(zm, 3, 16) << 48); - env->vfp.regs[rm] = make_float64(m0); - env->vfp.regs[rd] = make_float64(d0); + + rm[0] = m0; + rd[0] = d0; } /* Helper function for 64 bit polynomial multiply case: diff --git a/target/arm/translate.c b/target/arm/translate.c index 7b5db15861..6f02c56abb 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -4687,22 +4687,23 @@ static inline TCGv_i32 neon_get_scalar(int size, int reg) static int gen_neon_unzip(int rd, int rm, int size, int q) { - TCGv_i32 tmp, tmp2; + TCGv_ptr pd, pm; + if (!q && size == 2) { return 1; } - tmp = tcg_const_i32(rd); - tmp2 = tcg_const_i32(rm); + pd = vfp_reg_ptr(true, rd); + pm = vfp_reg_ptr(true, rm); if (q) { switch (size) { case 0: - gen_helper_neon_qunzip8(cpu_env, tmp, tmp2); + gen_helper_neon_qunzip8(pd, pm); break; case 1: - gen_helper_neon_qunzip16(cpu_env, tmp, tmp2); + gen_helper_neon_qunzip16(pd, pm); break; case 2: - gen_helper_neon_qunzip32(cpu_env, tmp, tmp2); + gen_helper_neon_qunzip32(pd, pm); break; default: abort(); @@ -4710,38 +4711,39 @@ static int gen_neon_unzip(int rd, int rm, int size, int q) } else { switch (size) { case 0: - gen_helper_neon_unzip8(cpu_env, tmp, tmp2); + gen_helper_neon_unzip8(pd, pm); break; case 1: - gen_helper_neon_unzip16(cpu_env, tmp, tmp2); + gen_helper_neon_unzip16(pd, pm); break; default: abort(); } } - tcg_temp_free_i32(tmp); - tcg_temp_free_i32(tmp2); + tcg_temp_free_ptr(pd); + tcg_temp_free_ptr(pm); return 0; } static int gen_neon_zip(int rd, int rm, int size, int q) { - TCGv_i32 tmp, tmp2; + TCGv_ptr pd, pm; + if (!q && size == 2) { return 1; } - tmp = tcg_const_i32(rd); - tmp2 = tcg_const_i32(rm); + pd = vfp_reg_ptr(true, rd); + pm = vfp_reg_ptr(true, rm); if (q) { switch (size) { case 0: - gen_helper_neon_qzip8(cpu_env, tmp, tmp2); + gen_helper_neon_qzip8(pd, pm); break; case 1: - gen_helper_neon_qzip16(cpu_env, tmp, tmp2); + gen_helper_neon_qzip16(pd, pm); break; case 2: - gen_helper_neon_qzip32(cpu_env, tmp, tmp2); + gen_helper_neon_qzip32(pd, pm); break; default: abort(); @@ -4749,17 +4751,17 @@ static int gen_neon_zip(int rd, int rm, int size, int q) } else { switch (size) { case 0: - gen_helper_neon_zip8(cpu_env, tmp, tmp2); + gen_helper_neon_zip8(pd, pm); break; case 1: - gen_helper_neon_zip16(cpu_env, tmp, tmp2); + gen_helper_neon_zip16(pd, pm); break; default: abort(); } } - tcg_temp_free_i32(tmp); - tcg_temp_free_i32(tmp2); + tcg_temp_free_ptr(pd); + tcg_temp_free_ptr(pm); return 0; } 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); From patchwork Fri Jan 19 04:54:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 125081 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp131716ljf; Thu, 18 Jan 2018 21:01:18 -0800 (PST) X-Google-Smtp-Source: ACJfBovx9zbDP7SD05EDM/kGTGmdY4p0dq4Shst0mdajObl8DvXptyKobPzkg/KO68LYBTeTGqiQ X-Received: by 10.37.211.11 with SMTP id e11mr18537345ybf.243.1516338078535; Thu, 18 Jan 2018 21:01:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516338078; cv=none; d=google.com; s=arc-20160816; b=shNWfW0k48IZNg7qBZU7/VgKTe0vnP4hwQPFkl4ZcOgOs7bDU47H16YIzBJ1A1vdBU zdwHPddMW3lSvQxGSs2lCLEW8449iewPhf90NwDxj6g78F35NNtM+nCcgSwsv1mE9xPQ PRpE/YYHtUZUZNYk09mEzPI+tLFfTXpI4IFWjMNZk6zHP3oD9Mf3iXlZCYB9P5S5sK3Q VUWiwKI6POl3dI8r4dH8PtYYhDKmB/mrYfiSHelAKvt+rUW43C3FfBa/lrPHHMReFe38 /fmQZlnIHvwR1tQQjsq0bEtAQYJuPN4RlfbcKvEHsSJ3IqEmCXMYDZBo1MF7cmYJbUGM Dqhw== 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=Yo+KKaXQDW/cSbgDkS0iYkcPRfDiRNJyQO+3skiGz7Q=; b=bh9yFVjLL1H3KIXimbrQtFz76TxcNUsoZErvHItHxt5pnIpZQZwgSPeaT8AuEo7GTr P5vX4nLkxImeFRF6WGN24K1ZHFC05RohYVTeI9RksNCV0sEpnXvbnYf0+kVhZsEIidxX mMt4FXu9utIIRi58JZ+vq+nfDlJTxxuKiF8HlHU/YMwKjBxdnBgU0K8UCWtpu8raU7va kqTQuBZGj4DsybWz7HtoArwR/FyMZfDgO/PZTpWujydlQYZTJDP8cd9fs4YPlmr+F71c vx50gxeBBgSG+1cYNEwx5rv15Tv5GSG9hnP9rCJOzPyO3Dk3lZK20eE9XHJNxl1dGuCC a0ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=JlKeIgMG; 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 r185si450270ybf.180.2018.01.18.21.01.18 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 18 Jan 2018 21:01:18 -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=JlKeIgMG; 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]:52368 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecOnl-0007hP-SF for patch@linaro.org; Fri, 19 Jan 2018 00:01:17 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58665) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecOhe-0002Dp-FX for qemu-devel@nongnu.org; Thu, 18 Jan 2018 23:55:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ecOhZ-000082-EK for qemu-devel@nongnu.org; Thu, 18 Jan 2018 23:54:58 -0500 Received: from mail-pg0-x244.google.com ([2607:f8b0:400e:c05::244]:44270) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ecOhZ-00007D-7G for qemu-devel@nongnu.org; Thu, 18 Jan 2018 23:54:53 -0500 Received: by mail-pg0-x244.google.com with SMTP id m20so542856pgc.11 for ; Thu, 18 Jan 2018 20:54:53 -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=Yo+KKaXQDW/cSbgDkS0iYkcPRfDiRNJyQO+3skiGz7Q=; b=JlKeIgMGea6C+ZiqNEV0aJ3PZEz0nbg8qvNQr0g7G6o3Wg/7tVMivrxFgU7LmhoJ1o YVFPllyG58kPrdV6RcNWEfa4jt2qU4AcvkbYq9FC/iFj96DcHdu8kTeyYPTl+HOnZS0b rXq5vEmKf5pupfh6VUAqPqd2c1XBly+bRs77c= 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=Yo+KKaXQDW/cSbgDkS0iYkcPRfDiRNJyQO+3skiGz7Q=; b=TBZ4qzjR7v93OtypFnJhKY1w4sb1m0uRAuHt4gj12P+2V+TFM+I7wq94yZsMPZbFvH eGwkiEBcfNG8deAG9Y0qrSXdNqfCiTsomfNwayA0W3uEITtJgjLNbdwA3EVNkqaIENgj EG+nZXkVgBqLfiwFguo718ACEh9pkIZe8Zvq1AOSjju38h2pZp66Q+rpoeE3hwof812G m9RLOmxd/EiIA6qAtEoDUfmHFuT+JkG4pW1S9k126erm+ua4cQGhB1Jba3ChWWVSDi50 6TBQwxulIZPop0QCkwKWo2M0wyDcoyFdg6Y6rfKZarQMVGuj2UdQlX2V+oSec+o+43oS 4Ocw== X-Gm-Message-State: AKwxyteksKfhDLT3R/vPsVqIK6+0u9KPcDz3M31aRdR+fDqCLaTtADsz HUI04YWrX6HIj1Kfgk/BzvUppLYqNOQ= X-Received: by 2002:a17:902:748b:: with SMTP id h11-v6mr969379pll.259.1516337691732; Thu, 18 Jan 2018 20:54:51 -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.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Jan 2018 20:54:50 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 18 Jan 2018 20:54:27 -0800 Message-Id: <20180119045438.28582-6-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:c05::244 Subject: [Qemu-devel] [PATCH v2 05/16] target/arm: Change the type of vfp.regs 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" All direct users of this field want an integral value. Drop all of the extra casting between uint64_t and float64. Signed-off-by: Richard Henderson --- target/arm/cpu.h | 2 +- target/arm/arch_dump.c | 4 ++-- target/arm/helper.c | 20 ++++++++++---------- target/arm/machine.c | 2 +- target/arm/translate-a64.c | 8 ++++---- target/arm/translate.c | 2 +- 6 files changed, 19 insertions(+), 19 deletions(-) -- 2.14.3 Reviewed-by: Alex Bennée diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 96316700dd..76ab7953a6 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -492,7 +492,7 @@ typedef struct CPUARMState { * the two execution states, and means we do not need to explicitly * map these registers when changing states. */ - float64 regs[64]; + uint64_t regs[64]; uint32_t xregs[16]; /* We store these fpcsr fields separately for convenience. */ diff --git a/target/arm/arch_dump.c b/target/arm/arch_dump.c index 9e5b2fb31c..0c43e0eef8 100644 --- a/target/arm/arch_dump.c +++ b/target/arm/arch_dump.c @@ -100,7 +100,7 @@ static int aarch64_write_elf64_prfpreg(WriteCoreDumpFunction f, aarch64_note_init(¬e, s, "CORE", 5, NT_PRFPREG, sizeof(note.vfp)); for (i = 0; i < 64; ++i) { - note.vfp.vregs[i] = cpu_to_dump64(s, float64_val(env->vfp.regs[i])); + note.vfp.vregs[i] = cpu_to_dump64(s, env->vfp.regs[i]); } if (s->dump_info.d_endian == ELFDATA2MSB) { @@ -229,7 +229,7 @@ static int arm_write_elf32_vfp(WriteCoreDumpFunction f, CPUARMState *env, arm_note_init(¬e, s, "LINUX", 6, NT_ARM_VFP, sizeof(note.vfp)); for (i = 0; i < 32; ++i) { - note.vfp.vregs[i] = cpu_to_dump64(s, float64_val(env->vfp.regs[i])); + note.vfp.vregs[i] = cpu_to_dump64(s, env->vfp.regs[i]); } note.vfp.fpscr = cpu_to_dump32(s, vfp_get_fpscr(env)); diff --git a/target/arm/helper.c b/target/arm/helper.c index c83c901a86..8fda797582 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -64,15 +64,15 @@ static int vfp_gdb_get_reg(CPUARMState *env, uint8_t *buf, int reg) /* VFP data registers are always little-endian. */ nregs = arm_feature(env, ARM_FEATURE_VFP3) ? 32 : 16; if (reg < nregs) { - stfq_le_p(buf, env->vfp.regs[reg]); + stq_le_p(buf, env->vfp.regs[reg]); return 8; } if (arm_feature(env, ARM_FEATURE_NEON)) { /* Aliases for Q regs. */ nregs += 16; if (reg < nregs) { - stfq_le_p(buf, env->vfp.regs[(reg - 32) * 2]); - stfq_le_p(buf + 8, env->vfp.regs[(reg - 32) * 2 + 1]); + stq_le_p(buf, env->vfp.regs[(reg - 32) * 2]); + stq_le_p(buf + 8, env->vfp.regs[(reg - 32) * 2 + 1]); return 16; } } @@ -90,14 +90,14 @@ static int vfp_gdb_set_reg(CPUARMState *env, uint8_t *buf, int reg) nregs = arm_feature(env, ARM_FEATURE_VFP3) ? 32 : 16; if (reg < nregs) { - env->vfp.regs[reg] = ldfq_le_p(buf); + env->vfp.regs[reg] = ldq_le_p(buf); return 8; } if (arm_feature(env, ARM_FEATURE_NEON)) { nregs += 16; if (reg < nregs) { - env->vfp.regs[(reg - 32) * 2] = ldfq_le_p(buf); - env->vfp.regs[(reg - 32) * 2 + 1] = ldfq_le_p(buf + 8); + env->vfp.regs[(reg - 32) * 2] = ldq_le_p(buf); + env->vfp.regs[(reg - 32) * 2 + 1] = ldq_le_p(buf + 8); return 16; } } @@ -114,8 +114,8 @@ static int aarch64_fpu_gdb_get_reg(CPUARMState *env, uint8_t *buf, int reg) switch (reg) { case 0 ... 31: /* 128 bit FP register */ - stfq_le_p(buf, env->vfp.regs[reg * 2]); - stfq_le_p(buf + 8, env->vfp.regs[reg * 2 + 1]); + stq_le_p(buf, env->vfp.regs[reg * 2]); + stq_le_p(buf + 8, env->vfp.regs[reg * 2 + 1]); return 16; case 32: /* FPSR */ @@ -135,8 +135,8 @@ static int aarch64_fpu_gdb_set_reg(CPUARMState *env, uint8_t *buf, int reg) switch (reg) { case 0 ... 31: /* 128 bit FP register */ - env->vfp.regs[reg * 2] = ldfq_le_p(buf); - env->vfp.regs[reg * 2 + 1] = ldfq_le_p(buf + 8); + env->vfp.regs[reg * 2] = ldq_le_p(buf); + env->vfp.regs[reg * 2 + 1] = ldq_le_p(buf + 8); return 16; case 32: /* FPSR */ diff --git a/target/arm/machine.c b/target/arm/machine.c index 176274629c..a85c2430d3 100644 --- a/target/arm/machine.c +++ b/target/arm/machine.c @@ -50,7 +50,7 @@ static const VMStateDescription vmstate_vfp = { .minimum_version_id = 3, .needed = vfp_needed, .fields = (VMStateField[]) { - VMSTATE_FLOAT64_ARRAY(env.vfp.regs, ARMCPU, 64), + VMSTATE_UINT64_ARRAY(env.vfp.regs, ARMCPU, 64), /* The xregs array is a little awkward because element 1 (FPSCR) * requires a specific accessor, so we have to split it up in * the vmstate: diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 6d9b3af64c..c14fb4185c 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -165,12 +165,12 @@ void aarch64_cpu_dump_state(CPUState *cs, FILE *f, if (flags & CPU_DUMP_FPU) { int numvfpregs = 32; for (i = 0; i < numvfpregs; i += 2) { - uint64_t vlo = float64_val(env->vfp.regs[i * 2]); - uint64_t vhi = float64_val(env->vfp.regs[(i * 2) + 1]); + uint64_t vlo = env->vfp.regs[i * 2]; + uint64_t vhi = env->vfp.regs[(i * 2) + 1]; cpu_fprintf(f, "q%02d=%016" PRIx64 ":%016" PRIx64 " ", i, vhi, vlo); - vlo = float64_val(env->vfp.regs[(i + 1) * 2]); - vhi = float64_val(env->vfp.regs[((i + 1) * 2) + 1]); + vlo = env->vfp.regs[(i + 1) * 2]; + vhi = env->vfp.regs[((i + 1) * 2) + 1]; cpu_fprintf(f, "q%02d=%016" PRIx64 ":%016" PRIx64 "\n", i + 1, vhi, vlo); } diff --git a/target/arm/translate.c b/target/arm/translate.c index 852d2a75b1..cfe49bf579 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -12572,7 +12572,7 @@ void arm_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf, numvfpregs += 16; } for (i = 0; i < numvfpregs; i++) { - uint64_t v = float64_val(env->vfp.regs[i]); + uint64_t v = env->vfp.regs[i]; cpu_fprintf(f, "s%02d=%08x s%02d=%08x d%02d=%016" PRIx64 "\n", i * 2, (uint32_t)v, i * 2 + 1, (uint32_t)(v >> 32), From patchwork Fri Jan 19 04:54:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 125085 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp134642ljf; Thu, 18 Jan 2018 21:11:37 -0800 (PST) X-Google-Smtp-Source: ACJfBouOF33ZNub3ONSJnbWeNBhJ4uHfZhEnCrk1vwWUDDBM8D1dQqrWaFtOdRplN+SOfKy26Akk X-Received: by 10.37.26.133 with SMTP id a127mr34693473yba.74.1516338697343; Thu, 18 Jan 2018 21:11:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516338697; cv=none; d=google.com; s=arc-20160816; b=TuosUdznMwCCXgflzrLeWfOnIGwnpTywIBe+7LE75QyIoCQzBbkqrxh30y8pPlARYe Ek5ZoE6AMV5vv35W5dSYyGfNA5dNYSYczzX63nAs03J/zAqo+UiliGf5qlkP4lA8uLw7 FjZiov+e2aLDMJD12qhUQ84b2s1VgyUghrTQA4Hmh2AvmAIpKEf7kDCnrctPPMxzEFAV ncfc7BTN+F7zeDe7xUG1IZUXaSRrmGetjdua1W4fAmP+kzxn5wXjwe5aJ7F8k8abK9Re HyWJYrTatPRRT+Z13882I6zAqRiJxqv4s71NdIHjqZVC5Ndw+50Vy5Lo4Sfw2hOaCmvV d6pg== 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=wNCg7VIDMxstWeTWxnzb6LvCNhNXgzhbqScGgn4Sk/A=; b=0uw9wpaNfwYYHO6FwllhGTpy3HnB3eSwzp8nCh3ZrcfRuCkVyDR0zC41ViqyWyqaGK dV7m5MPEFDNm+VM0q4s3h/Nf85kR5Nrg+vtpW+1wR32SEr6sOs1S+n6zCylpKhRQuOio 80pqsQQe1xmCx/tG5GQG1CuhPAX7OVx3hhbbUVmMAmBy7if9n+toOCZinqz4gh6hlymN 0nlyF7rLan9ejEUM4MjiaGIqoinEs5fAAbm5f4fTQbqYfpK/I/MXJAcRNTd3KlYMI5Vh IJLyxFoRAPsFpVkQdbBP1uncdF2YKdJ24vwq/H4cqzdmGEmJP+h1cc2J+zJFuFzIkTok 5nYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=NdLmk6Ie; 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 g141si461020ybf.366.2018.01.18.21.11.37 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 18 Jan 2018 21:11:37 -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=NdLmk6Ie; 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]:52664 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecOxk-0007jw-LU for patch@linaro.org; Fri, 19 Jan 2018 00:11:36 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58675) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecOhf-0002EM-3o for qemu-devel@nongnu.org; Thu, 18 Jan 2018 23:55:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ecOhb-0000AA-7k for qemu-devel@nongnu.org; Thu, 18 Jan 2018 23:54:59 -0500 Received: from mail-pg0-x244.google.com ([2607:f8b0:400e:c05::244]:40568) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ecOha-00008v-VT for qemu-devel@nongnu.org; Thu, 18 Jan 2018 23:54:55 -0500 Received: by mail-pg0-x244.google.com with SMTP id g16so547338pgn.7 for ; Thu, 18 Jan 2018 20:54:54 -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=wNCg7VIDMxstWeTWxnzb6LvCNhNXgzhbqScGgn4Sk/A=; b=NdLmk6Ie+wFDu+JFpiMbdRPLgWEzF78JyU6Zy3c1ZesEP2W0EFPSHQWPYMgcl7Qzvy nUiSd0jbmhXfsUumXQXzcmaNA/gzSYbwOhap9jfR6ErVonHHkuOw62X00RwhFGg4d8IC lGUme6C1QsDi0ThN5jBRijDWSnp8JCKBtaecc= 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=wNCg7VIDMxstWeTWxnzb6LvCNhNXgzhbqScGgn4Sk/A=; b=Bs+T0mWVAQdAyknqqr3jey/Ma+K1koUSlOolMm6WRee4BjdX7Mpka2303CP51G8opG ZYR7Zb2bap8vo5X7J1pYsbeT/R69AolsEd8ZjWOkVdOSDp05asTj0vmXERwb37Y036tI TqFDbqvIneWhWkBTNfhB3YbeIDcDbTGqai1NCC5IQ0s2GkrSGiKhyHpJqoLC2OUKKeYN OcEPJIp9ottWVYmYYZ9W7NmEG7oBMkMWYRNAaAHxxqgQvlzMGSQp4LSPg9O7ahZ43Lpp qqMVWsVMWIC5a3lY110OPWcPnHRorQCpTHvi++6uW4PbI9N/fE0uOFs//NMcTtRDf8Hv AwPA== X-Gm-Message-State: AKwxytfS0feQf6ZCN7jR07dfrDKRGm2Mm4TkIZWkC8P+9dg5ckTZecfg N3sH8NyjtLJCYUA9VGS4lL9LyDpPg9c= X-Received: by 10.99.129.199 with SMTP id t190mr17342351pgd.120.1516337693393; Thu, 18 Jan 2018 20:54:53 -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.51 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Jan 2018 20:54:52 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 18 Jan 2018 20:54:28 -0800 Message-Id: <20180119045438.28582-7-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:c05::244 Subject: [Qemu-devel] [PATCH v2 06/16] target/arm: Add aa{32, 64}_vfp_{dreg, qreg} helpers 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" Helpers that return a pointer into env->vfp.regs so that we isolate the logic of how to index the regs array for different cpu modes. Signed-off-by: Richard Henderson --- target/arm/cpu.h | 27 +++++++++++++++++++++++++++ linux-user/signal.c | 22 ++++++++++++---------- target/arm/arch_dump.c | 8 +++++--- target/arm/helper-a64.c | 5 +++-- target/arm/helper.c | 32 ++++++++++++++++++++------------ target/arm/kvm32.c | 4 ++-- target/arm/kvm64.c | 31 ++++++++++--------------------- target/arm/translate-a64.c | 25 ++++++++----------------- target/arm/translate.c | 16 +++++++++------- 9 files changed, 96 insertions(+), 74 deletions(-) -- 2.14.3 Reviewed-by: Alex Bennée diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 76ab7953a6..7d396606f3 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -2885,4 +2885,31 @@ static inline void *arm_get_el_change_hook_opaque(ARMCPU *cpu) return cpu->el_change_hook_opaque; } +/** + * aa32_vfp_dreg: + * Return a pointer to the Dn register within env in 32-bit mode. + */ +static inline uint64_t *aa32_vfp_dreg(CPUARMState *env, unsigned regno) +{ + return &env->vfp.regs[regno]; +} + +/** + * aa32_vfp_qreg: + * Return a pointer to the Qn register within env in 32-bit mode. + */ +static inline uint64_t *aa32_vfp_qreg(CPUARMState *env, unsigned regno) +{ + return &env->vfp.regs[2 * regno]; +} + +/** + * aa64_vfp_qreg: + * Return a pointer to the Qn register within env in 64-bit mode. + */ +static inline uint64_t *aa64_vfp_qreg(CPUARMState *env, unsigned regno) +{ + return &env->vfp.regs[2 * regno]; +} + #endif diff --git a/linux-user/signal.c b/linux-user/signal.c index f85f0dd780..5321f9e795 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -1487,12 +1487,13 @@ static int target_setup_sigframe(struct target_rt_sigframe *sf, } for (i = 0; i < 32; i++) { + uint64_t *q = aa64_vfp_qreg(env, i); #ifdef TARGET_WORDS_BIGENDIAN - __put_user(env->vfp.regs[i * 2], &aux->fpsimd.vregs[i * 2 + 1]); - __put_user(env->vfp.regs[i * 2 + 1], &aux->fpsimd.vregs[i * 2]); + __put_user(q[0], &aux->fpsimd.vregs[i * 2 + 1]); + __put_user(q[1], &aux->fpsimd.vregs[i * 2]); #else - __put_user(env->vfp.regs[i * 2], &aux->fpsimd.vregs[i * 2]); - __put_user(env->vfp.regs[i * 2 + 1], &aux->fpsimd.vregs[i * 2 + 1]); + __put_user(q[0], &aux->fpsimd.vregs[i * 2]); + __put_user(q[1], &aux->fpsimd.vregs[i * 2 + 1]); #endif } __put_user(vfp_get_fpsr(env), &aux->fpsimd.fpsr); @@ -1539,12 +1540,13 @@ static int target_restore_sigframe(CPUARMState *env, } for (i = 0; i < 32; i++) { + uint64_t *q = aa64_vfp_qreg(env, i); #ifdef TARGET_WORDS_BIGENDIAN - __get_user(env->vfp.regs[i * 2], &aux->fpsimd.vregs[i * 2 + 1]); - __get_user(env->vfp.regs[i * 2 + 1], &aux->fpsimd.vregs[i * 2]); + __get_user(q[0], &aux->fpsimd.vregs[i * 2 + 1]); + __get_user(q[1], &aux->fpsimd.vregs[i * 2]); #else - __get_user(env->vfp.regs[i * 2], &aux->fpsimd.vregs[i * 2]); - __get_user(env->vfp.regs[i * 2 + 1], &aux->fpsimd.vregs[i * 2 + 1]); + __get_user(q[0], &aux->fpsimd.vregs[i * 2]); + __get_user(q[1], &aux->fpsimd.vregs[i * 2 + 1]); #endif } __get_user(fpsr, &aux->fpsimd.fpsr); @@ -1903,7 +1905,7 @@ static abi_ulong *setup_sigframe_v2_vfp(abi_ulong *regspace, CPUARMState *env) __put_user(TARGET_VFP_MAGIC, &vfpframe->magic); __put_user(sizeof(*vfpframe), &vfpframe->size); for (i = 0; i < 32; i++) { - __put_user(float64_val(env->vfp.regs[i]), &vfpframe->ufp.fpregs[i]); + __put_user(*aa32_vfp_dreg(env, i), &vfpframe->ufp.fpregs[i]); } __put_user(vfp_get_fpscr(env), &vfpframe->ufp.fpscr); __put_user(env->vfp.xregs[ARM_VFP_FPEXC], &vfpframe->ufp_exc.fpexc); @@ -2210,7 +2212,7 @@ static abi_ulong *restore_sigframe_v2_vfp(CPUARMState *env, abi_ulong *regspace) return 0; } for (i = 0; i < 32; i++) { - __get_user(float64_val(env->vfp.regs[i]), &vfpframe->ufp.fpregs[i]); + __get_user(*aa32_vfp_dreg(env, i), &vfpframe->ufp.fpregs[i]); } __get_user(fpscr, &vfpframe->ufp.fpscr); vfp_set_fpscr(env, fpscr); diff --git a/target/arm/arch_dump.c b/target/arm/arch_dump.c index 0c43e0eef8..26a2c09868 100644 --- a/target/arm/arch_dump.c +++ b/target/arm/arch_dump.c @@ -99,8 +99,10 @@ static int aarch64_write_elf64_prfpreg(WriteCoreDumpFunction f, aarch64_note_init(¬e, s, "CORE", 5, NT_PRFPREG, sizeof(note.vfp)); - for (i = 0; i < 64; ++i) { - note.vfp.vregs[i] = cpu_to_dump64(s, env->vfp.regs[i]); + for (i = 0; i < 32; ++i) { + uint64_t *q = aa64_vfp_qreg(env, i); + note.vfp.vregs[2*i + 0] = cpu_to_dump64(s, q[0]); + note.vfp.vregs[2*i + 1] = cpu_to_dump64(s, q[1]); } if (s->dump_info.d_endian == ELFDATA2MSB) { @@ -229,7 +231,7 @@ static int arm_write_elf32_vfp(WriteCoreDumpFunction f, CPUARMState *env, arm_note_init(¬e, s, "LINUX", 6, NT_ARM_VFP, sizeof(note.vfp)); for (i = 0; i < 32; ++i) { - note.vfp.vregs[i] = cpu_to_dump64(s, env->vfp.regs[i]); + note.vfp.vregs[i] = cpu_to_dump64(s, *aa32_vfp_dreg(env, i)); } note.vfp.fpscr = cpu_to_dump32(s, vfp_get_fpscr(env)); diff --git a/target/arm/helper-a64.c b/target/arm/helper-a64.c index 3e00a9ead1..06fd321fae 100644 --- a/target/arm/helper-a64.c +++ b/target/arm/helper-a64.c @@ -153,13 +153,14 @@ uint64_t HELPER(simd_tbl)(CPUARMState *env, uint64_t result, uint64_t indices, if (index < 16 * numregs) { /* Convert index (a byte offset into the virtual table * which is a series of 128-bit vectors concatenated) - * into the correct vfp.regs[] element plus a bit offset + * into the correct register element plus a bit offset * into that element, bearing in mind that the table * can wrap around from V31 to V0. */ int elt = (rn * 2 + (index >> 3)) % 64; int bitidx = (index & 7) * 8; - uint64_t val = extract64(env->vfp.regs[elt], bitidx, 8); + uint64_t *q = aa64_vfp_qreg(env, elt >> 1); + uint64_t val = extract64(q[elt & 1], bitidx, 8); result = deposit64(result, shift, 8, val); } diff --git a/target/arm/helper.c b/target/arm/helper.c index 8fda797582..6705903301 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -64,15 +64,16 @@ static int vfp_gdb_get_reg(CPUARMState *env, uint8_t *buf, int reg) /* VFP data registers are always little-endian. */ nregs = arm_feature(env, ARM_FEATURE_VFP3) ? 32 : 16; if (reg < nregs) { - stq_le_p(buf, env->vfp.regs[reg]); + stq_le_p(buf, *aa32_vfp_dreg(env, reg)); return 8; } if (arm_feature(env, ARM_FEATURE_NEON)) { /* Aliases for Q regs. */ nregs += 16; if (reg < nregs) { - stq_le_p(buf, env->vfp.regs[(reg - 32) * 2]); - stq_le_p(buf + 8, env->vfp.regs[(reg - 32) * 2 + 1]); + uint64_t *q = aa32_vfp_qreg(env, reg - 32); + stq_le_p(buf, q[0]); + stq_le_p(buf + 8, q[1]); return 16; } } @@ -90,14 +91,15 @@ static int vfp_gdb_set_reg(CPUARMState *env, uint8_t *buf, int reg) nregs = arm_feature(env, ARM_FEATURE_VFP3) ? 32 : 16; if (reg < nregs) { - env->vfp.regs[reg] = ldq_le_p(buf); + *aa32_vfp_dreg(env, reg) = ldq_le_p(buf); return 8; } if (arm_feature(env, ARM_FEATURE_NEON)) { nregs += 16; if (reg < nregs) { - env->vfp.regs[(reg - 32) * 2] = ldq_le_p(buf); - env->vfp.regs[(reg - 32) * 2 + 1] = ldq_le_p(buf + 8); + uint64_t *q = aa32_vfp_qreg(env, reg - 32); + q[0] = ldq_le_p(buf); + q[1] = ldq_le_p(buf + 8); return 16; } } @@ -114,9 +116,12 @@ static int aarch64_fpu_gdb_get_reg(CPUARMState *env, uint8_t *buf, int reg) switch (reg) { case 0 ... 31: /* 128 bit FP register */ - stq_le_p(buf, env->vfp.regs[reg * 2]); - stq_le_p(buf + 8, env->vfp.regs[reg * 2 + 1]); - return 16; + { + uint64_t *q = aa64_vfp_qreg(env, reg); + stq_le_p(buf, q[0]); + stq_le_p(buf + 8, q[1]); + return 16; + } case 32: /* FPSR */ stl_p(buf, vfp_get_fpsr(env)); @@ -135,9 +140,12 @@ static int aarch64_fpu_gdb_set_reg(CPUARMState *env, uint8_t *buf, int reg) switch (reg) { case 0 ... 31: /* 128 bit FP register */ - env->vfp.regs[reg * 2] = ldq_le_p(buf); - env->vfp.regs[reg * 2 + 1] = ldq_le_p(buf + 8); - return 16; + { + uint64_t *q = aa64_vfp_qreg(env, reg); + q[0] = ldq_le_p(buf); + q[1] = ldq_le_p(buf + 8); + return 16; + } case 32: /* FPSR */ vfp_set_fpsr(env, ldl_p(buf)); diff --git a/target/arm/kvm32.c b/target/arm/kvm32.c index f925a21481..f77c9c494b 100644 --- a/target/arm/kvm32.c +++ b/target/arm/kvm32.c @@ -358,7 +358,7 @@ int kvm_arch_put_registers(CPUState *cs, int level) /* VFP registers */ r.id = KVM_REG_ARM | KVM_REG_SIZE_U64 | KVM_REG_ARM_VFP; for (i = 0; i < 32; i++) { - r.addr = (uintptr_t)(&env->vfp.regs[i]); + r.addr = (uintptr_t)aa32_vfp_dreg(env, i); ret = kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, &r); if (ret) { return ret; @@ -445,7 +445,7 @@ int kvm_arch_get_registers(CPUState *cs) /* VFP registers */ r.id = KVM_REG_ARM | KVM_REG_SIZE_U64 | KVM_REG_ARM_VFP; for (i = 0; i < 32; i++) { - r.addr = (uintptr_t)(&env->vfp.regs[i]); + r.addr = (uintptr_t)aa32_vfp_dreg(env, i); ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, &r); if (ret) { return ret; diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c index 6554c30007..ac728494a4 100644 --- a/target/arm/kvm64.c +++ b/target/arm/kvm64.c @@ -696,21 +696,16 @@ int kvm_arch_put_registers(CPUState *cs, int level) } } - /* Advanced SIMD and FP registers - * We map Qn = regs[2n+1]:regs[2n] - */ + /* Advanced SIMD and FP registers. */ for (i = 0; i < 32; i++) { - int rd = i << 1; - uint64_t fp_val[2]; + uint64_t *q = aa64_vfp_qreg(env, i); #ifdef HOST_WORDS_BIGENDIAN - fp_val[0] = env->vfp.regs[rd + 1]; - fp_val[1] = env->vfp.regs[rd]; + uint64_t fp_val[2] = { q[1], q[0] }; + reg.addr = (uintptr_t)fp_val; #else - fp_val[1] = env->vfp.regs[rd + 1]; - fp_val[0] = env->vfp.regs[rd]; + reg.addr = (uintptr_t)q; #endif reg.id = AARCH64_SIMD_CORE_REG(fp_regs.vregs[i]); - reg.addr = (uintptr_t)(&fp_val); ret = kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, ®); if (ret) { return ret; @@ -837,24 +832,18 @@ int kvm_arch_get_registers(CPUState *cs) env->spsr = env->banked_spsr[i]; } - /* Advanced SIMD and FP registers - * We map Qn = regs[2n+1]:regs[2n] - */ + /* Advanced SIMD and FP registers */ for (i = 0; i < 32; i++) { - uint64_t fp_val[2]; + uint64_t *q = aa64_vfp_qreg(env, i); reg.id = AARCH64_SIMD_CORE_REG(fp_regs.vregs[i]); - reg.addr = (uintptr_t)(&fp_val); + reg.addr = (uintptr_t)q; ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, ®); if (ret) { return ret; } else { - int rd = i << 1; #ifdef HOST_WORDS_BIGENDIAN - env->vfp.regs[rd + 1] = fp_val[0]; - env->vfp.regs[rd] = fp_val[1]; -#else - env->vfp.regs[rd + 1] = fp_val[1]; - env->vfp.regs[rd] = fp_val[0]; + uint64_t t; + t = q[0], q[0] = q[1], q[1] = t; #endif } } diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index c14fb4185c..eed64c73e5 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -164,15 +164,12 @@ void aarch64_cpu_dump_state(CPUState *cs, FILE *f, if (flags & CPU_DUMP_FPU) { int numvfpregs = 32; - for (i = 0; i < numvfpregs; i += 2) { - uint64_t vlo = env->vfp.regs[i * 2]; - uint64_t vhi = env->vfp.regs[(i * 2) + 1]; - cpu_fprintf(f, "q%02d=%016" PRIx64 ":%016" PRIx64 " ", - i, vhi, vlo); - vlo = env->vfp.regs[(i + 1) * 2]; - vhi = env->vfp.regs[((i + 1) * 2) + 1]; - cpu_fprintf(f, "q%02d=%016" PRIx64 ":%016" PRIx64 "\n", - i + 1, vhi, vlo); + for (i = 0; i < numvfpregs; i++) { + uint64_t *q = aa64_vfp_qreg(env, i); + uint64_t vlo = q[0]; + uint64_t vhi = q[1]; + cpu_fprintf(f, "q%02d=%016" PRIx64 ":%016" PRIx64 "%c", + i, vhi, vlo, (i & 1 ? '\n' : ' ')); } cpu_fprintf(f, "FPCR: %08x FPSR: %08x\n", vfp_get_fpcr(env), vfp_get_fpsr(env)); @@ -558,19 +555,13 @@ static TCGv_ptr vec_full_reg_ptr(DisasContext *s, int regno) */ static inline int fp_reg_offset(DisasContext *s, int regno, TCGMemOp size) { - int offs = offsetof(CPUARMState, vfp.regs[regno * 2]); -#ifdef HOST_WORDS_BIGENDIAN - offs += (8 - (1 << size)); -#endif - assert_fp_access_checked(s); - return offs; + return vec_reg_offset(s, regno, 0, size); } /* Offset of the high half of the 128 bit vector Qn */ static inline int fp_reg_hi_offset(DisasContext *s, int regno) { - assert_fp_access_checked(s); - return offsetof(CPUARMState, vfp.regs[regno * 2 + 1]); + return vec_reg_offset(s, regno, 1, MO_64); } /* Convenience accessors for reading and writing single and double diff --git a/target/arm/translate.c b/target/arm/translate.c index cfe49bf579..55826b7e5a 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -1515,14 +1515,16 @@ static inline void gen_vfp_st(DisasContext *s, int dp, TCGv_i32 addr) static inline long vfp_reg_offset (int dp, int reg) { - if (dp) + if (dp) { return offsetof(CPUARMState, vfp.regs[reg]); - else if (reg & 1) { - return offsetof(CPUARMState, vfp.regs[reg >> 1]) - + offsetof(CPU_DoubleU, l.upper); } else { - return offsetof(CPUARMState, vfp.regs[reg >> 1]) - + offsetof(CPU_DoubleU, l.lower); + long ofs = offsetof(CPUARMState, vfp.regs[reg >> 1]); + if (reg & 1) { + ofs += offsetof(CPU_DoubleU, l.upper); + } else { + ofs += offsetof(CPU_DoubleU, l.lower); + } + return ofs; } } @@ -12572,7 +12574,7 @@ void arm_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf, numvfpregs += 16; } for (i = 0; i < numvfpregs; i++) { - uint64_t v = env->vfp.regs[i]; + uint64_t v = *aa32_vfp_dreg(env, i); cpu_fprintf(f, "s%02d=%08x s%02d=%08x d%02d=%016" PRIx64 "\n", i * 2, (uint32_t)v, i * 2 + 1, (uint32_t)(v >> 32), From patchwork Fri Jan 19 04:54:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 125074 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp130530ljf; Thu, 18 Jan 2018 20:57:47 -0800 (PST) X-Google-Smtp-Source: ACJfBot5zayQ3mmPk2DV3ZjDSXymOdXp4cATo67cgvs50xrzK8eRrUlLOZXIiLGk+z+21aKOuLVm X-Received: by 10.37.219.133 with SMTP id g127mr13562485ybf.425.1516337867707; Thu, 18 Jan 2018 20:57:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516337867; cv=none; d=google.com; s=arc-20160816; b=wKcTrfNm//7HlMKb0T+FwVdBJ/Q6UcfPap5sUhcV6raPmbL7wZ3ohZRWtUU8bg6xIt QaVirLsJC7H9pSMDRcWl6t27c7nY+/toesQjY3f6K3DWbT0bJ55yZhl9J8+8q5l8OOaO Rf8vJN1ViJwnv3JnuuBYm29/XQ5AwLPoY37Y1fshrahqSDNAo30e0Fi2YOHPBQ03+sur cLXFfnOoPyiqGNZgksq4Bt3fJUAB22ZtnnQj5h0EiupUCsfVutP1Awg8QPKyeifWazU7 c2XVNdRYcKuOcgP1/D9NWwClKu4zEpsrX8kW1Yavv1RIhOQadmhjo+fPP1w+9Zq/XBiY b6Hg== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=x9PA8yjdEe9Kvb1NLwDZCFpm0U0h6iWdOQkgNTDHrIg=; b=CNfe7IrdfXND6dXKpDHkFMdxwsTRVBzHp83jzDdOTTFoLXKVjcCuSXPupS2Z8z6LgD WqUcsv6vsNGjptukqJyg2JZBrsGE7zzuelpskQZuot57nL90lXr22+zTvKpAwalwI159 5g+L2vLfuUAECzHmirngpkqww587jljM8E94aXSksFi0Y4RBJsyAb42hlmknDxJe8J5i vCwIKvSac2QRoQ5gEzYPmb2McghrRF4PzUl9QOL2vRAmrUtVaHvaSb8geKRkvgP4dA7P AQTs2g1fOnYk6AkkN6aHIhGPqHXJrqwZ2vM0YcV7a4xjpMSI+nMlz73Uu9BY7B2w+Snl GzMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=OMy+5GPM; 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 x66si457570yba.276.2018.01.18.20.57.47 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 18 Jan 2018 20:57:47 -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=OMy+5GPM; 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]:52266 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecOkN-0003aU-2s for patch@linaro.org; Thu, 18 Jan 2018 23:57:47 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58664) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecOhe-0002Dn-FJ for qemu-devel@nongnu.org; Thu, 18 Jan 2018 23:54:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ecOhc-0000C1-KU for qemu-devel@nongnu.org; Thu, 18 Jan 2018 23:54:58 -0500 Received: from mail-pf0-x242.google.com ([2607:f8b0:400e:c00::242]:45122) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ecOhc-0000Aw-Ea for qemu-devel@nongnu.org; Thu, 18 Jan 2018 23:54:56 -0500 Received: by mail-pf0-x242.google.com with SMTP id a88so515686pfe.12 for ; Thu, 18 Jan 2018 20:54:56 -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 :mime-version:content-transfer-encoding; bh=x9PA8yjdEe9Kvb1NLwDZCFpm0U0h6iWdOQkgNTDHrIg=; b=OMy+5GPMpcPjniyJX3YLuejtVarh4MjwfU26uXYdyvh1SKSmRwqviejT6zn88dI8vj eTBGzFyzkYiD7j8zsYwWDLj08E6U3lNvUBAz/XXfzQw2yEn7OAH3+6ank2fNg34PAxzl JhHmFMdNRD/sGwyriSPUqnmhioqOSuyDIyk1Q= 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=x9PA8yjdEe9Kvb1NLwDZCFpm0U0h6iWdOQkgNTDHrIg=; b=gr6DjnkG3HGXqTxPZYhHDQOMkTH3a4FtzSs4LLJcLpVfg44n9cVgPtH7xfrXFoU44d gqml25/Er22V9hGiTQa2UZQR6+kj8/S6dUbUOWsxt98Cz4tM7POQ3kwSD5Qw5j7+exZf XzLxAyfWaaRGYpW8AX5Ar7nSshmLUc7Dw8k8BIgbhBKaeWSAxPo1Calby5L8ETDZ6VAu w3RkgASzERWF3ZebaqFeDFnexeeo0VaAWPiLpurTzHDmxavRxx6rpmzWzceGnFxOXgBl 45I3iLdjGf1WTD/PAYTtn5CH9rLKpR2JNMi+rDbXLLpGuxD0K2tIXsqlJeIZeE25BTDa h19w== X-Gm-Message-State: AKwxytfYt2/WR62F2frpPhHjaAKpLI5M5+04F81mFTRSv09QKbqkaFGj kBoxXkKt0CqtXSOFFgAb69fScQ8OGk0= X-Received: by 10.101.65.205 with SMTP id b13mr5856533pgq.280.1516337694962; Thu, 18 Jan 2018 20:54:54 -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.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Jan 2018 20:54:54 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 18 Jan 2018 20:54:29 -0800 Message-Id: <20180119045438.28582-8-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> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::242 Subject: [Qemu-devel] [PATCH v2 07/16] vmstate: Add VMSTATE_UINT64_SUB_ARRAY 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" At the same time, move VMSTATE_UINT32_SUB_ARRAY beside the other UINT32 definitions. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- include/migration/vmstate.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) -- 2.14.3 Reviewed-by: Alex Bennée diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h index 88b55df5ae..8c3889433c 100644 --- a/include/migration/vmstate.h +++ b/include/migration/vmstate.h @@ -905,6 +905,9 @@ extern const VMStateInfo vmstate_info_qtailq; #define VMSTATE_UINT32_ARRAY(_f, _s, _n) \ VMSTATE_UINT32_ARRAY_V(_f, _s, _n, 0) +#define VMSTATE_UINT32_SUB_ARRAY(_f, _s, _start, _num) \ + VMSTATE_SUB_ARRAY(_f, _s, _start, _num, 0, vmstate_info_uint32, uint32_t) + #define VMSTATE_UINT32_2DARRAY(_f, _s, _n1, _n2) \ VMSTATE_UINT32_2DARRAY_V(_f, _s, _n1, _n2, 0) @@ -914,6 +917,9 @@ extern const VMStateInfo vmstate_info_qtailq; #define VMSTATE_UINT64_ARRAY(_f, _s, _n) \ VMSTATE_UINT64_ARRAY_V(_f, _s, _n, 0) +#define VMSTATE_UINT64_SUB_ARRAY(_f, _s, _start, _num) \ + VMSTATE_SUB_ARRAY(_f, _s, _start, _num, 0, vmstate_info_uint64, uint64_t) + #define VMSTATE_UINT64_2DARRAY(_f, _s, _n1, _n2) \ VMSTATE_UINT64_2DARRAY_V(_f, _s, _n1, _n2, 0) @@ -932,9 +938,6 @@ extern const VMStateInfo vmstate_info_qtailq; #define VMSTATE_INT32_ARRAY(_f, _s, _n) \ VMSTATE_INT32_ARRAY_V(_f, _s, _n, 0) -#define VMSTATE_UINT32_SUB_ARRAY(_f, _s, _start, _num) \ - VMSTATE_SUB_ARRAY(_f, _s, _start, _num, 0, vmstate_info_uint32, uint32_t) - #define VMSTATE_INT64_ARRAY_V(_f, _s, _n, _v) \ VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_int64, int64_t) From patchwork Fri Jan 19 04:54:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 125082 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp132676ljf; Thu, 18 Jan 2018 21:04:24 -0800 (PST) X-Google-Smtp-Source: ACJfBovX64yO/D3FQkaYp8HD2W9zGWcapGQIp9NpIlOiYtxULFv0QfFJvNiq4nvypHpRla6t9YsU X-Received: by 10.37.186.201 with SMTP id a9mr5770838ybk.183.1516338264329; Thu, 18 Jan 2018 21:04:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516338264; cv=none; d=google.com; s=arc-20160816; b=d1rJ9lpTZcvTAuWnkHnIMV8CDvFAQjQ8hV5yTO70X6rCXz9TmSxFGIFVI2HOam8fn8 q0OiiWlATsYu9ieOLLumNeoW7v6CO3DwKP0iXzROjmWTA3UP7UEdDRZH91dbr9VaH1MD 3vzGc6AWUdGGBTxduTrarxsvgg3HFVnh6sv/+f2I8vGiV9UImHJ4m/rkMCwzSOtBYZEj u+C9N/k3ptnAKU+LcqgD8JsRAvZuhsh9KvrPrRhUJHZhRWe6Sznh3sgCujnaG2GOat10 Nsv3Zjqd7ot01dA5nWoS8EQsSXpdWKnhLKt33mshYQ0LmP4PI+rtmT1HAfw2DZHkXk/E QzWg== 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=qxDzcIlKQRosE14177xscLtAWidKgy33kZlQKUZbJ2Q=; b=ApDALAZ/ANls762fPRiYDJsfXS10fqDnux5t9Ibyuhk1JubowQmTaqaQHziXYUdOT+ 2BNFOMGID60PW9LexwcnDxYokPn1dqdhG+KLYAo9SrzCc4rJE7+yR7VQsYDEeq3dTEnG 9mCa22RVuRb9xS1rDIoBISCFhUzAPeUss+UVKhY0idXpZa7fV60y2TpFt1Q9vt89er6h vzH3DR1s9nMYqruNqoKzjc4mmUXzKuDh0+jUhLr+d2fYxmTkFXJ3ylSN7nclBmtt9gqy 41RzBN+pPpOPMrrrcitARse7LFdt+uxr5mBreJc9TRpEii6Is9ndNTTZ6Kr3A+eNAIup Z/eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=MM9MtZSA; 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 t68si459857ybf.240.2018.01.18.21.04.24 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 18 Jan 2018 21:04:24 -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=MM9MtZSA; 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]:52457 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecOql-0001st-Mu for patch@linaro.org; Fri, 19 Jan 2018 00:04:23 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58684) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecOhf-0002Ej-JJ for qemu-devel@nongnu.org; Thu, 18 Jan 2018 23:55:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ecOhd-0000Er-UR for qemu-devel@nongnu.org; Thu, 18 Jan 2018 23:54:59 -0500 Received: from mail-pg0-x244.google.com ([2607:f8b0:400e:c05::244]:43301) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ecOhd-0000DD-Lz for qemu-devel@nongnu.org; Thu, 18 Jan 2018 23:54:57 -0500 Received: by mail-pg0-x244.google.com with SMTP id n17so540335pgf.10 for ; Thu, 18 Jan 2018 20:54:57 -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=qxDzcIlKQRosE14177xscLtAWidKgy33kZlQKUZbJ2Q=; b=MM9MtZSARxt/dgx9vkRScBc7afU+mg2f2YRsM3V2Z+WSyHY+dK6scLzivgc+/EP2/T 7svWjnlztIvmfUzfzMpbdAHoBxBvg8srfFd33R3mRApDEZnEn3HPZHKLk6Q0ysHYVEmS ebFWSM8FWbg5e3hJk83+8H95ni2nDkaR9ukUE= 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=qxDzcIlKQRosE14177xscLtAWidKgy33kZlQKUZbJ2Q=; b=mw7fWH818y1NQGgWz7UBa0vWcLCBhljLkhfy+FTyCfyGwQRbGxUCSVnsha2tasm7aR kUHiEmXgAdlA3n+hKG19h0tDgNRet0KOqkZT4sqqvdzqZedfMs7fUarRKOstkZP/z292 UZ/8si1sClkGsDNaeadsI8QiarsfXHTYKqKa+SPBSdt0NJrn78MSqvUH3Y/AXyfusPne Cr6NIeIoPDTMeT4POI4i73m6DDxbpDWoE5FyVWxUxyq5lnnOeknG98MlnCs8uzYHhvqo ETLGDKCmwQnj0xmlKegDgqqTxs1/xLXhm1K2vzFdLSo3QSFy9U20LqfNKbBQwVYoUc3S Uw9g== X-Gm-Message-State: AKGB3mKLxoOBpMlJ4mbVrc3iIQQtawmTPjgYBn9t+Ux3dsddlX8e6LEj uONwL190krV8Kio7fg4vIb5xe9rqDk8= X-Received: by 10.99.96.67 with SMTP id u64mr36291331pgb.118.1516337696250; Thu, 18 Jan 2018 20:54:56 -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.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Jan 2018 20:54:55 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 18 Jan 2018 20:54:30 -0800 Message-Id: <20180119045438.28582-9-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:c05::244 Subject: [Qemu-devel] [PATCH v2 08/16] target/arm: Expand vector registers for SVE 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" Change vfp.regs as a uint64_t to vfp.zregs as an ARMVectorReg. The previous patches have made the change in representation relatively painless. Signed-off-by: Richard Henderson --- target/arm/cpu.h | 57 ++++++++++++++++++++++++++++++---------------- target/arm/machine.c | 35 +++++++++++++++++++++++++++- target/arm/translate-a64.c | 8 +++---- target/arm/translate.c | 7 +++--- 4 files changed, 79 insertions(+), 28 deletions(-) -- 2.14.3 Reviewed-by: Alex Bennée diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 7d396606f3..57d805b5d8 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -153,6 +153,40 @@ typedef struct { uint32_t base_mask; } TCR; +/* Define a maximum sized vector register. + * For 32-bit, this is a 128-bit NEON/AdvSIMD register. + * For 64-bit, this is a 2048-bit SVE register. + * + * Note that the mapping between S, D, and Q views of the register bank + * differs between AArch64 and AArch32. + * In AArch32: + * Qn = regs[n].d[1]:regs[n].d[0] + * Dn = regs[n / 2].d[n & 1] + * Sn = regs[n / 4].d[n % 4 / 2], + * bits 31..0 for even n, and bits 63..32 for odd n + * (and regs[16] to regs[31] are inaccessible) + * In AArch64: + * Zn = regs[n].d[*] + * Qn = regs[n].d[1]:regs[n].d[0] + * Dn = regs[n].d[0] + * Sn = regs[n].d[0] bits 31..0 + * + * This corresponds to the architecturally defined mapping between + * the two execution states, and means we do not need to explicitly + * map these registers when changing states. + */ + +#ifdef TARGET_AARCH64 +# define ARM_MAX_VQ 16 +#else +# define ARM_MAX_VQ 1 +#endif + +typedef struct ARMVectorReg { + uint64_t d[2 * ARM_MAX_VQ] QEMU_ALIGNED(16); +} ARMVectorReg; + + typedef struct CPUARMState { /* Regs for current mode. */ uint32_t regs[16]; @@ -477,22 +511,7 @@ typedef struct CPUARMState { /* VFP coprocessor state. */ struct { - /* VFP/Neon register state. Note that the mapping between S, D and Q - * views of the register bank differs between AArch64 and AArch32: - * In AArch32: - * Qn = regs[2n+1]:regs[2n] - * Dn = regs[n] - * Sn = regs[n/2] bits 31..0 for even n, and bits 63..32 for odd n - * (and regs[32] to regs[63] are inaccessible) - * In AArch64: - * Qn = regs[2n+1]:regs[2n] - * Dn = regs[2n] - * Sn = regs[2n] bits 31..0 - * This corresponds to the architecturally defined mapping between - * the two execution states, and means we do not need to explicitly - * map these registers when changing states. - */ - uint64_t regs[64]; + ARMVectorReg zregs[32]; uint32_t xregs[16]; /* We store these fpcsr fields separately for convenience. */ @@ -2891,7 +2910,7 @@ static inline void *arm_get_el_change_hook_opaque(ARMCPU *cpu) */ static inline uint64_t *aa32_vfp_dreg(CPUARMState *env, unsigned regno) { - return &env->vfp.regs[regno]; + return &env->vfp.zregs[regno >> 1].d[regno & 1]; } /** @@ -2900,7 +2919,7 @@ static inline uint64_t *aa32_vfp_dreg(CPUARMState *env, unsigned regno) */ static inline uint64_t *aa32_vfp_qreg(CPUARMState *env, unsigned regno) { - return &env->vfp.regs[2 * regno]; + return &env->vfp.zregs[regno].d[0]; } /** @@ -2909,7 +2928,7 @@ static inline uint64_t *aa32_vfp_qreg(CPUARMState *env, unsigned regno) */ static inline uint64_t *aa64_vfp_qreg(CPUARMState *env, unsigned regno) { - return &env->vfp.regs[2 * regno]; + return &env->vfp.zregs[regno].d[0]; } #endif diff --git a/target/arm/machine.c b/target/arm/machine.c index a85c2430d3..cb0e1c92bb 100644 --- a/target/arm/machine.c +++ b/target/arm/machine.c @@ -50,7 +50,40 @@ static const VMStateDescription vmstate_vfp = { .minimum_version_id = 3, .needed = vfp_needed, .fields = (VMStateField[]) { - VMSTATE_UINT64_ARRAY(env.vfp.regs, ARMCPU, 64), + /* For compatibility, store Qn out of Zn here. */ + VMSTATE_UINT64_SUB_ARRAY(env.vfp.zregs[0].d, ARMCPU, 0, 2), + VMSTATE_UINT64_SUB_ARRAY(env.vfp.zregs[1].d, ARMCPU, 0, 2), + VMSTATE_UINT64_SUB_ARRAY(env.vfp.zregs[2].d, ARMCPU, 0, 2), + VMSTATE_UINT64_SUB_ARRAY(env.vfp.zregs[3].d, ARMCPU, 0, 2), + VMSTATE_UINT64_SUB_ARRAY(env.vfp.zregs[4].d, ARMCPU, 0, 2), + VMSTATE_UINT64_SUB_ARRAY(env.vfp.zregs[5].d, ARMCPU, 0, 2), + VMSTATE_UINT64_SUB_ARRAY(env.vfp.zregs[6].d, ARMCPU, 0, 2), + VMSTATE_UINT64_SUB_ARRAY(env.vfp.zregs[7].d, ARMCPU, 0, 2), + VMSTATE_UINT64_SUB_ARRAY(env.vfp.zregs[8].d, ARMCPU, 0, 2), + VMSTATE_UINT64_SUB_ARRAY(env.vfp.zregs[9].d, ARMCPU, 0, 2), + VMSTATE_UINT64_SUB_ARRAY(env.vfp.zregs[10].d, ARMCPU, 0, 2), + VMSTATE_UINT64_SUB_ARRAY(env.vfp.zregs[11].d, ARMCPU, 0, 2), + VMSTATE_UINT64_SUB_ARRAY(env.vfp.zregs[12].d, ARMCPU, 0, 2), + VMSTATE_UINT64_SUB_ARRAY(env.vfp.zregs[13].d, ARMCPU, 0, 2), + VMSTATE_UINT64_SUB_ARRAY(env.vfp.zregs[14].d, ARMCPU, 0, 2), + VMSTATE_UINT64_SUB_ARRAY(env.vfp.zregs[15].d, ARMCPU, 0, 2), + VMSTATE_UINT64_SUB_ARRAY(env.vfp.zregs[16].d, ARMCPU, 0, 2), + VMSTATE_UINT64_SUB_ARRAY(env.vfp.zregs[17].d, ARMCPU, 0, 2), + VMSTATE_UINT64_SUB_ARRAY(env.vfp.zregs[18].d, ARMCPU, 0, 2), + VMSTATE_UINT64_SUB_ARRAY(env.vfp.zregs[19].d, ARMCPU, 0, 2), + VMSTATE_UINT64_SUB_ARRAY(env.vfp.zregs[20].d, ARMCPU, 0, 2), + VMSTATE_UINT64_SUB_ARRAY(env.vfp.zregs[21].d, ARMCPU, 0, 2), + VMSTATE_UINT64_SUB_ARRAY(env.vfp.zregs[22].d, ARMCPU, 0, 2), + VMSTATE_UINT64_SUB_ARRAY(env.vfp.zregs[23].d, ARMCPU, 0, 2), + VMSTATE_UINT64_SUB_ARRAY(env.vfp.zregs[24].d, ARMCPU, 0, 2), + VMSTATE_UINT64_SUB_ARRAY(env.vfp.zregs[25].d, ARMCPU, 0, 2), + VMSTATE_UINT64_SUB_ARRAY(env.vfp.zregs[26].d, ARMCPU, 0, 2), + VMSTATE_UINT64_SUB_ARRAY(env.vfp.zregs[27].d, ARMCPU, 0, 2), + VMSTATE_UINT64_SUB_ARRAY(env.vfp.zregs[28].d, ARMCPU, 0, 2), + VMSTATE_UINT64_SUB_ARRAY(env.vfp.zregs[29].d, ARMCPU, 0, 2), + VMSTATE_UINT64_SUB_ARRAY(env.vfp.zregs[30].d, ARMCPU, 0, 2), + VMSTATE_UINT64_SUB_ARRAY(env.vfp.zregs[31].d, ARMCPU, 0, 2), + /* The xregs array is a little awkward because element 1 (FPSCR) * requires a specific accessor, so we have to split it up in * the vmstate: diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index eed64c73e5..10eef870fe 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -517,8 +517,8 @@ static inline int vec_reg_offset(DisasContext *s, int regno, { int offs = 0; #ifdef HOST_WORDS_BIGENDIAN - /* This is complicated slightly because vfp.regs[2n] is - * still the low half and vfp.regs[2n+1] the high half + /* This is complicated slightly because vfp.zregs[n].d[0] is + * still the low half and vfp.zregs[n].d[1] the high half * of the 128 bit vector, even on big endian systems. * Calculate the offset assuming a fully bigendian 128 bits, * then XOR to account for the order of the two 64 bit halves. @@ -528,7 +528,7 @@ static inline int vec_reg_offset(DisasContext *s, int regno, #else offs += element * (1 << size); #endif - offs += offsetof(CPUARMState, vfp.regs[regno * 2]); + offs += offsetof(CPUARMState, vfp.zregs[regno]); assert_fp_access_checked(s); return offs; } @@ -537,7 +537,7 @@ static inline int vec_reg_offset(DisasContext *s, int regno, static inline int vec_full_reg_offset(DisasContext *s, int regno) { assert_fp_access_checked(s); - return offsetof(CPUARMState, vfp.regs[regno * 2]); + return offsetof(CPUARMState, vfp.zregs[regno]); } /* Return a newly allocated pointer to the vector register. */ diff --git a/target/arm/translate.c b/target/arm/translate.c index 55826b7e5a..a8c13d3758 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -1512,13 +1512,12 @@ static inline void gen_vfp_st(DisasContext *s, int dp, TCGv_i32 addr) } } -static inline long -vfp_reg_offset (int dp, int reg) +static inline long vfp_reg_offset(bool dp, unsigned reg) { if (dp) { - return offsetof(CPUARMState, vfp.regs[reg]); + return offsetof(CPUARMState, vfp.zregs[reg >> 1].d[reg & 1]); } else { - long ofs = offsetof(CPUARMState, vfp.regs[reg >> 1]); + long ofs = offsetof(CPUARMState, vfp.zregs[reg >> 2].d[(reg >> 1) & 1]); if (reg & 1) { ofs += offsetof(CPU_DoubleU, l.upper); } else { From patchwork Fri Jan 19 04:54:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 125075 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp130537ljf; Thu, 18 Jan 2018 20:57:49 -0800 (PST) X-Google-Smtp-Source: ACJfBovO7G2GJPYYui5/oZr9rnTZTL+k/3F+B+3XPIc6Is8gLyem4sJNVb3RkeUeWLBFV4+vXCz7 X-Received: by 10.37.199.11 with SMTP id w11mr38477859ybe.285.1516337868906; Thu, 18 Jan 2018 20:57:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516337868; cv=none; d=google.com; s=arc-20160816; b=KlNz+KHkOAmagQUmWUFh8Poy6s6lYCQE0/8fELIZ36Zz3coPLGiE4tSzf+qJudVkm0 NA74crwlVjKbxwe3Vpy4gtEEvV/shYIBJZgUxuqZeJXPvFoJxNGBSOxDHcttlOz2zGxS mARelTGMhoa4SJFdHeAZAeKv2ZZiJCCDbcgPEc7d8jb4Rv4z90bWdqQPkDhJFDJP+iUe QKI5z3RdxIxmwbgaQ5/ThiK1NMZF4u9gSxCGbtt48fAC+RwfvxAYYhoOXvw001DmeJTr qKqYBtRrHzKMLcpiRF5ByGmTlwHdfIYbrsdALuSDzvLZ4YCqBGp1n95EITLtxJoEwQx8 +OCw== 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=0CxMIlWhojUfXTrDvwY6qWshYlW8bQTO3vjIfqHU3hQ=; b=DRzxGKsY9f1PSErbcpHk17CcfmlV/7KYPqT3a5abSbfuZKb/mDHZCVPM72JjJf6n8J yMGnuo2o9J1l1jikzwvOlb4GzJJMMkk3sG+clOU0AXFXyhZSnrTsa1wAMq6L9dHtspzT rDP+ZiR2lpy0x+pcs52vFP9I12+VdPereDcThYWopHr+RzhfgZZnO4jHjU906FNnIkNP cVgBK43TrPBZw/U/kICI9fT0hTRjlfRn1A9l6f61io17zl/Ky6YVQ0AsrEsV7XdIiKVw 2iuxa5RI6oPFVrOVLuuHPRBujSLAxaZggAGdjNrTek11JRAhclbhKaAviSlg7k5ChWSE ZX8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=hxvDCnrm; 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 v9si442292ybk.584.2018.01.18.20.57.48 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 18 Jan 2018 20:57: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=hxvDCnrm; 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]:52267 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecOkO-0003bs-9Z for patch@linaro.org; Thu, 18 Jan 2018 23:57:48 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58690) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecOhg-0002FA-2j for qemu-devel@nongnu.org; Thu, 18 Jan 2018 23:55:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ecOhf-0000Ik-7A for qemu-devel@nongnu.org; Thu, 18 Jan 2018 23:55:00 -0500 Received: from mail-pg0-x244.google.com ([2607:f8b0:400e:c05::244]:39721) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ecOhf-0000Gg-1s for qemu-devel@nongnu.org; Thu, 18 Jan 2018 23:54:59 -0500 Received: by mail-pg0-x244.google.com with SMTP id w17so547151pgv.6 for ; Thu, 18 Jan 2018 20:54:58 -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=0CxMIlWhojUfXTrDvwY6qWshYlW8bQTO3vjIfqHU3hQ=; b=hxvDCnrmhEHqkF6sTpxw3PrCOCF+233jRd+8nIxoo9rliqFhh5d5kCZfhcaLs1jPAV 4vWcko+9O9EJbtGrzwh4PpAyO/rGUa3jFXR4MO/rTPp1HBYe1tjYdIkxIMoMUX/E66W+ VAafrj6CCC09YbojYJIoSeEfA+q0gkhJRg38M= 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=0CxMIlWhojUfXTrDvwY6qWshYlW8bQTO3vjIfqHU3hQ=; b=diuoYsNHEHzPtxAd1VKyBz8EZEN449L5lsY1evkAE3DadbJ0KNKWBA3Nou9g9r1nNo BfAaFshw+hA9RPgIEWA4IuJ09nHdqAaHlJGnLDGIU0bAztKwp+tNU8sV94GobWBoYLy7 IvBH6KH9XpKtrXbTVt6vQ/GdK2f7bE3FFTqv5BdjHfSCTJOQM+JNzPuNtuTsRV8daomd 98aCEIIenc/jzdrLLAAAS83vvJaQhUijXtbXiIBMUeGIe5YS4yWW0MjLY8d4uDq1dvoI EkEX5cOirHi40P1BCszla02J7qz1PrYvkyabFWQF586qohtgAac+XYPetKXg3HXUd1r9 ID0A== X-Gm-Message-State: AKGB3mJGmt4gyUXLugJqDJfCT0w4kL59aqh6UPFHHfpr8fl1N59AtsdV C3QAPJjUN5Uy5hAYtf5s3cLW5BaHirM= X-Received: by 10.101.78.134 with SMTP id b6mr37929917pgs.381.1516337697768; Thu, 18 Jan 2018 20:54:57 -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.56 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Jan 2018 20:54:56 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 18 Jan 2018 20:54:31 -0800 Message-Id: <20180119045438.28582-10-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:c05::244 Subject: [Qemu-devel] [PATCH v2 09/16] target/arm: Add predicate registers for SVE 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" Signed-off-by: Richard Henderson --- target/arm/cpu.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) -- 2.14.3 diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 57d805b5d8..132da359b5 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -186,6 +186,15 @@ typedef struct ARMVectorReg { uint64_t d[2 * ARM_MAX_VQ] QEMU_ALIGNED(16); } ARMVectorReg; +/* In AArch32 mode, predicate registers do not exist at all. */ +typedef struct ARMPredicateReg { +#ifdef TARGET_AARCH64 + uint64_t p[2 * ARM_MAX_VQ / 8] QEMU_ALIGNED(16); +#else + uint64_t p[0]; +#endif +} ARMPredicateReg; + typedef struct CPUARMState { /* Regs for current mode. */ @@ -513,6 +522,9 @@ typedef struct CPUARMState { struct { ARMVectorReg zregs[32]; + /* Store FFR as pregs[16] to make it easier to treat as any other. */ + ARMPredicateReg pregs[17]; + uint32_t xregs[16]; /* We store these fpcsr fields separately for convenience. */ int vec_len; From patchwork Fri Jan 19 04:54:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 125084 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp133961ljf; Thu, 18 Jan 2018 21:09:12 -0800 (PST) X-Google-Smtp-Source: ACJfBov/zmScOC59wVOeN5fWu/3d2N+hxOaRo9b7S2xmQq3ZXJMSgv3RhPx1N0ySbE7EofwBsxeV X-Received: by 10.37.130.18 with SMTP id q18mr15061155ybk.255.1516338552710; Thu, 18 Jan 2018 21:09:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516338552; cv=none; d=google.com; s=arc-20160816; b=CRbPFBVphqfzJkph4GGtUnyUDoqKuEld/kGfGn/hrj90OHu4KJROxrou7ZQb2SqVSD o8lS3h0hzS9SDbFGFm/IQVP9qdbg8dtxJa8BD9idfPI5D6jPkHNaobwA2XFupmITkqY7 X3YMv+mLx6JRcrtMUXAc63b13ZG2HRiqV3iRe9X8DRVe8Z9T1cvycx7K3f+xlnMSfG0U +2UrzTZ9HfsHdcgWij2VNgh1FRjXRHT/tDJv3Pi1KscDC1VtlK45Zm6EuxQJvZdYG8bq FxPh0PhzwJsEvNXuhS3Y2l9ohNsf9n9oW9a0hv49IOvkLVk78RPLza0A0SjQz7z/uUW/ bzsw== 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=KlaxOBSHgQAc7vreH1EYmk6NLDntdGTsLksVrRYUrEs=; b=OjRJEw6egUr1J8JcHQwKcXYPbXxlKs72IY+0f/bmn80lF18UgGHaTr9rP5CuB3+wxD JqY1/FzDKWoC2GtJY3ZOnjCDKWFmBSbgOz0DqdusE1sssUsbWaFClro7QyVWQ1o1RBFw p6pr1KhHsRh1e6VYJqTHVmsaBceEUU/Q0Uga6NiTN8ypFOMZfT97UpJ899SpB06HvC4e QT3a0GcHxMy1rXIlTycwOvOKCnCkI+nfb8PTE5gGteP8zZ/ypyQFpcOD31WnWaXcTAT+ TQiRf0IFuJkZeKmI4NUB//3hiLYKrZreFIatroD+RDNJUja/xPJlSmbgiaXH3VenlNwA 0fSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=WfQsCL8J; 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 v142si469718ybv.406.2018.01.18.21.09.12 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 18 Jan 2018 21:09:12 -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=WfQsCL8J; 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]:52621 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecOvQ-0005bK-3I for patch@linaro.org; Fri, 19 Jan 2018 00:09:12 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58713) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecOhh-0002GJ-8P for qemu-devel@nongnu.org; Thu, 18 Jan 2018 23:55:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ecOhg-0000Lt-GP for qemu-devel@nongnu.org; Thu, 18 Jan 2018 23:55:01 -0500 Received: from mail-pg0-x244.google.com ([2607:f8b0:400e:c05::244]:42705) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ecOhg-0000Jz-AS for qemu-devel@nongnu.org; Thu, 18 Jan 2018 23:55:00 -0500 Received: by mail-pg0-x244.google.com with SMTP id q67so544133pga.9 for ; Thu, 18 Jan 2018 20:55:00 -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=KlaxOBSHgQAc7vreH1EYmk6NLDntdGTsLksVrRYUrEs=; b=WfQsCL8Jnx+MUEBRToE0EYe+x0nXM/uXuFPqxTOEkcdprKfdlDr/vOyh8357eoQTCx 3kZyKAlcE+lOizntMcSvApFu6mxypIYj1GRJJnUEmK3CgH1Fxv/O+tenFSsDlpKEP4tH yxry4mVYcY68VA34tH7u01LgxtqWqihO/ncUM= 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=KlaxOBSHgQAc7vreH1EYmk6NLDntdGTsLksVrRYUrEs=; b=HECYn0TUi0wSWlAVGRk8AFJJU6g6a+Bnp+2qEERd9PpN2efLGpAEmEYD9KLwvjARek INSymez01RYyeEfNblMPy0PTqr4XQXFBJMeo+E4k6BKZgX8xSGwo96QkkZvP7QfV20GH G57H8a6tFzmcz1nbCfsgC7UwjIzYGCHTOsY5JqEIffQTeqGRjzlkThJnNBbIh6KlNInM dNgDkktKiyZknEBCkwyyEWrTBnmroV4CH+/XkPcxXd/Xs8OLHdAucG/NeLF6sQdZOmIm KDa3lNRBp5MAZ6gZ9IiEmpdpB7qGeFnMr45CZgcXO3YqWaMh2p1Tjr4EebC8XJnpvVxM IM0Q== X-Gm-Message-State: AKGB3mI2C19O7e/x9AIdR5AfJ8hHkQWfe5p+I0a8X83kKM9+kepNMNfn KW1iaJz7nLmLdNYnaDMAjWv8rrNXTcs= X-Received: by 10.99.184.17 with SMTP id p17mr39680938pge.357.1516337699063; Thu, 18 Jan 2018 20:54:59 -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.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Jan 2018 20:54:58 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 18 Jan 2018 20:54:32 -0800 Message-Id: <20180119045438.28582-11-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:c05::244 Subject: [Qemu-devel] [PATCH v2 10/16] target/arm: Add ARM_FEATURE_SVE 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" Not enabled anywhere so far. Signed-off-by: Richard Henderson --- target/arm/cpu.h | 1 + 1 file changed, 1 insertion(+) -- 2.14.3 Reviewed-by: Alex Bennée diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 132da359b5..0a923e42d8 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -1371,6 +1371,7 @@ enum arm_features { ARM_FEATURE_VBAR, /* has cp15 VBAR */ ARM_FEATURE_M_SECURITY, /* M profile Security Extension */ ARM_FEATURE_JAZELLE, /* has (trivial) Jazelle implementation */ + ARM_FEATURE_SVE, /* has Scalable Vector Extension */ }; static inline int arm_feature(CPUARMState *env, int feature) From patchwork Fri Jan 19 04:54:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 125086 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp135183ljf; Thu, 18 Jan 2018 21:13:39 -0800 (PST) X-Google-Smtp-Source: ACJfBouGhLo5YtYv09egTBr+CbC/kbNVXnMnm84RtN/pPO+oKKTDxvcPLC+rvshR7X3ycqhVvbbz X-Received: by 10.129.101.68 with SMTP id z65mr8222579ywb.49.1516338819288; Thu, 18 Jan 2018 21:13:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516338819; cv=none; d=google.com; s=arc-20160816; b=x1HFn4oEfO7UrpBqfeUTY9k4vpN5J4w5OcnuYjtHpoREXe2wAuqkiMN8wO12CSwWs9 X/aBnzPRK1QQnriHTaoLxrCa/itSnUg4itjGoD/FSz6b7BTfiAr/aP2fyqm+2C58eCzH dyTRqxCOP8Dm47ki90x3B9+85lr7QkFR0WJ12ieAa03rZYcpaWqqQyufOx4H1e/9UAUc JFyD/vZhxSq2AfV/8B81J1V+yEZmc3Wk6bTiMPNfH5l1GMt2qycst8ym7jcJfMQyMkZa A22SFjNfe/Cgc+nF22GGzSpiqdn2VtSMfqt22jyfAZifSPFrQsp6Ox8EfnjX612wc7u2 Cwpw== 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=rtUJek3aPDGG5LW/JtqEYY8tEezLcf4E59P/pioBFKI=; b=fMuiJVS1hVtOofEhZH7th6DVAfzIWy4mvwzRFg1VjOUPgq1COeitZ1iW1PsBcGH0Yx 4XPHrs6Di859WphRTE4U8gF7wtDLU92OJyLwNj8UAv+Q2bfroC6QIgnzDHLZ8c1Fd5Nb BIMZsVrYEz76+UnDoyWie+evXiym5gV5fqIcwdnle8Dp9FglUluYXZ3V2m6Dcq1d5kgJ 8FQhaYmnro+3hZDus55hIMxp5ILToNOCUs1zV0rcjU8ibo1dVGgCi1Iah6Uh7cvn2tcN DZ22F4sOOHl3K54jb+riZoB4bKXXEZahWJrqpKDSbh71aBgWrgJhFi3dgS5Vdpf0GKvg LkRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=CXz/b4Po; 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 i8si1037749ywm.416.2018.01.18.21.13.39 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 18 Jan 2018 21:13:39 -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=CXz/b4Po; 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]:52960 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecOzi-0001Le-Mi for patch@linaro.org; Fri, 19 Jan 2018 00:13:38 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58738) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecOhi-0002Hl-Pv for qemu-devel@nongnu.org; Thu, 18 Jan 2018 23:55:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ecOhh-0000Oa-RM for qemu-devel@nongnu.org; Thu, 18 Jan 2018 23:55:02 -0500 Received: from mail-pg0-x243.google.com ([2607:f8b0:400e:c05::243]:42705) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ecOhh-0000NC-Ku for qemu-devel@nongnu.org; Thu, 18 Jan 2018 23:55:01 -0500 Received: by mail-pg0-x243.google.com with SMTP id q67so544220pga.9 for ; Thu, 18 Jan 2018 20:55:01 -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=rtUJek3aPDGG5LW/JtqEYY8tEezLcf4E59P/pioBFKI=; b=CXz/b4PoW5wRvfI94OcgvLhJifAGlbJ/fiFUcIuD/J0Y5CDU+Gbwl/HchkSM5DolWE zaX/lBzxGH3B0+WAUlZU1zR0SsZgB/k7EKsA+f2RE3Zi0rH2RlKGNdjnww4WpCNyrFd6 vkXKupKJWtT3cP26KjZviCg7RS/QGV0r1ymIU= 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=rtUJek3aPDGG5LW/JtqEYY8tEezLcf4E59P/pioBFKI=; b=dD5O2P4u75Qq7nHWpXahDmZV6L8XWrcYJgrOQdcub1BuGPVmU6sHvHxLny2i5FOsQo Lwhcsy4POurRZRwyTM47/2uyW+Qwf6vZyzvnxERQKCMz7VHPzgD4uMfsqJqFKFcOSWpu /9AC0D3mQruuDXqfUqsCKX2mpVk4pq4t4SKUJLCZM2+1QU/CWUafaq3SeoiDOzNRYYBO CNbrAisnGeefiE0yo7w1TutbhQ01DLWxYfogJymRN4+M2uKjDQkEx3d3Hwc209v629cP pbA/5Uv27cDJuN9Pueaa/LA/5usL/tyq3PZ/r26pGM3rnBEdFuu1gNMte2dUESNt9LWt jw4g== X-Gm-Message-State: AKwxytcuYRMWCeZ9JfAXzSH9jnhPrGxyys3SI6oc8psgHXilnx4LLsZA 1sKrSeSQOu9hvTqW1eFL6VgGr4nbkdM= X-Received: by 10.99.164.25 with SMTP id c25mr3248606pgf.430.1516337700197; Thu, 18 Jan 2018 20:55:00 -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.59 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Jan 2018 20:54:59 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 18 Jan 2018 20:54:33 -0800 Message-Id: <20180119045438.28582-12-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:c05::243 Subject: [Qemu-devel] [PATCH v2 11/16] target/arm: Add SVE to migration state 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" Save the high parts of the Zregs and all of the Pregs. The ZCR_ELx registers are migrated via the CP mechanism. Signed-off-by: Richard Henderson --- target/arm/machine.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) -- 2.14.3 diff --git a/target/arm/machine.c b/target/arm/machine.c index cb0e1c92bb..2c8b43062f 100644 --- a/target/arm/machine.c +++ b/target/arm/machine.c @@ -122,6 +122,56 @@ static const VMStateDescription vmstate_iwmmxt = { } }; +#ifdef TARGET_AARCH64 +/* The expression ARM_MAX_VQ - 2 is 0 for pure AArch32 build, + * and ARMPredicateReg is actively empty. This triggers errors + * in the expansion of the VMSTATE macros. + */ + +static bool sve_needed(void *opaque) +{ + ARMCPU *cpu = opaque; + CPUARMState *env = &cpu->env; + + return arm_feature(env, ARM_FEATURE_SVE); +} + +/* The first two words of each Zreg is stored in VFP state. */ +static const VMStateDescription vmstate_zreg_hi_reg = { + .name = "cpu/sve/zreg_hi", + .version_id = 1, + .minimum_version_id = 1, + .fields = (VMStateField[]) { + VMSTATE_UINT64_SUB_ARRAY(d, ARMVectorReg, 2, ARM_MAX_VQ - 2), + VMSTATE_END_OF_LIST() + } +}; + +static const VMStateDescription vmstate_preg_reg = { + .name = "cpu/sve/preg", + .version_id = 1, + .minimum_version_id = 1, + .fields = (VMStateField[]) { + VMSTATE_UINT64_ARRAY(p, ARMPredicateReg, 2 * ARM_MAX_VQ / 8), + VMSTATE_END_OF_LIST() + } +}; + +static const VMStateDescription vmstate_sve = { + .name = "cpu/sve", + .version_id = 1, + .minimum_version_id = 1, + .needed = sve_needed, + .fields = (VMStateField[]) { + VMSTATE_STRUCT_ARRAY(env.vfp.zregs, ARMCPU, 32, 0, + vmstate_zreg_hi_reg, ARMVectorReg), + VMSTATE_STRUCT_ARRAY(env.vfp.pregs, ARMCPU, 17, 0, + vmstate_preg_reg, ARMPredicateReg), + VMSTATE_END_OF_LIST() + } +}; +#endif /* AARCH64 */ + static bool m_needed(void *opaque) { ARMCPU *cpu = opaque; @@ -586,6 +636,9 @@ const VMStateDescription vmstate_arm_cpu = { &vmstate_pmsav7, &vmstate_pmsav8, &vmstate_m_security, +#ifdef TARGET_AARCH64 + &vmstate_sve, +#endif NULL } }; From patchwork Fri Jan 19 04:54:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 125087 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp135260ljf; Thu, 18 Jan 2018 21:13:57 -0800 (PST) X-Google-Smtp-Source: ACJfBosfABEaj+gJEFrklSmgWEZX/56sbsbpZbSuzKxjiOp8azWVVDtvJVCeG4RvLJuSorJZYy/S X-Received: by 10.37.49.11 with SMTP id x11mr44357817ybx.472.1516338837694; Thu, 18 Jan 2018 21:13:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516338837; cv=none; d=google.com; s=arc-20160816; b=hZnxvW775VVQDSwtPbz4SBYtSzPpFVZRLhzNoU0x4P53Kp0Dpdrc0IY4dfPfpYvwtG LVsJwYrxHwCdmxLO0ffxL0Gsfz4I6pqUkyUdA5+Bfj2Jg1oaBtIeA2GY4b7YTkq1RYd9 Q+jn8jMV/kdiOc0irbMZIy+Y6YQH3jQzOIkR70TuXiCNs1SbimyPIISppky5cHn3K8dp o/UOlKZ71dR3UXKpVtWtiwyEfjMtzNCUNhZaIpFsf5zgbekV9IE0MUb220j09PdIAyEd 94Bq2hXBvxJwik+MF0UGxdENxzOY+am5YIsv9zcg6d7LRw9D3wpxupFgo6wK1JKt5aKM kcBA== 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=T0Ku/m+OPVIQXrjRjLLbX1WOvUqKhYXtYKJWBCusNt0=; b=m8q2vXl91K/gRiQP8h07gm97/YkpHZBPlkr3KTsFsD5qqGSbrE+2iPbvGmwkMvMS71 DUYNPo96EGfjN23elhApNkufTw5rX3cEgXov83CUf13e8he0EESChE3lbKfcFKJF1hbG PPFaNspZTcAqgVwwtW4R3AL/qiwJAM5MU8ULYqg9vt+D/XqLoZrM/teyCI+6i+VkOaqC ayHZMOp6PWT7zGfaRu4aclgJchDu1tkIjbITwrydUmDDSAYxqcBIVi0crvATupgARpDJ duUEhj/0PCBWxWyqyP0rXdH/SaECZVko6DAyo6/tSIQwdXI6sW+4pTX0asOR3MsChAiR PCFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=b52bjVEh; 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 v18si2166277ywg.282.2018.01.18.21.13.57 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 18 Jan 2018 21:13:57 -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=b52bjVEh; 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]:52982 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecP01-000278-3H for patch@linaro.org; Fri, 19 Jan 2018 00:13:57 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58749) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecOhk-0002IM-4O for qemu-devel@nongnu.org; Thu, 18 Jan 2018 23:55:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ecOhj-0000Qf-3i for qemu-devel@nongnu.org; Thu, 18 Jan 2018 23:55:04 -0500 Received: from mail-pg0-x242.google.com ([2607:f8b0:400e:c05::242]:41850) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ecOhi-0000Pf-UF for qemu-devel@nongnu.org; Thu, 18 Jan 2018 23:55:03 -0500 Received: by mail-pg0-x242.google.com with SMTP id 136so545866pgd.8 for ; Thu, 18 Jan 2018 20:55:02 -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=T0Ku/m+OPVIQXrjRjLLbX1WOvUqKhYXtYKJWBCusNt0=; b=b52bjVEhVq0Ltp0vm1xjWV6tOtRCY3wWpZQAdbFhDKaP8S+2gmfxj8PpkD3qVk16Fo Y71zpxeMb0sKOPEqX/Tc13ngAuKfsWp0zd8ZXpIkKPlaAjrHRA1XvXgjvPzLM174FXn3 IwbdVdRkdVIMrizGgFrdd8K2yFOAGNT5XpA1Y= 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=T0Ku/m+OPVIQXrjRjLLbX1WOvUqKhYXtYKJWBCusNt0=; b=VrAEBcQNhOsxi/2NJNeK/peRVd8KtP/SgBP4yOkIsNIwO5Bjbx+9JIDSp5gzszkHlh IKrfKHPMpP3HXXyyjg+qn1ztd/E4/PjdKTgCdEjsHcymifrFiX39nwNoJEXqZLwPvP1w LZzeOfz/mR4f8alOvd/rhMxyPUvONHQHsHq1Bph3XgkvoLa0FeqeSPVS8zgH/EJ5lOlD 3jYifnA1AhJiOOqWb1q8SwcKfQSlnbYCBA33BwvrN1ZfRHU+OUB6RLy/opogPyG867QP rPv+fHiNbMWZZyRXwAB5LRU0SnhwxLCaHyNtojiGbvdVEWDvGUGz3AniAg/H/caEn9uC qwXw== X-Gm-Message-State: AKwxytcQskx/02HYWIlBd8/qYUW+rJ6YqvKMijiKoXo8Mz1BdzdkwJSb nnYFhdRCB30UWh/sYQuLdJxz2yqWeWQ= X-Received: by 10.101.85.138 with SMTP id j10mr27067544pgs.144.1516337701575; Thu, 18 Jan 2018 20:55:01 -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.55.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Jan 2018 20:55:00 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 18 Jan 2018 20:54:34 -0800 Message-Id: <20180119045438.28582-13-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:c05::242 Subject: [Qemu-devel] [PATCH v2 12/16] target/arm: Add ZCR_ELx 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" Define ZCR_EL[1-3]. Signed-off-by: Richard Henderson --- target/arm/cpu.h | 5 ++++ target/arm/helper.c | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+) -- 2.14.3 diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 0a923e42d8..c8e8155b6e 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -547,6 +547,9 @@ typedef struct CPUARMState { */ float_status fp_status; float_status standard_fp_status; + + /* ZCR_EL[1-3] */ + uint64_t zcr_el[4]; } vfp; uint64_t exclusive_addr; uint64_t exclusive_val; @@ -921,6 +924,8 @@ void pmccntr_sync(CPUARMState *env); #define CPTR_TCPAC (1U << 31) #define CPTR_TTA (1U << 20) #define CPTR_TFP (1U << 10) +#define CPTR_TZ (1U << 8) /* CPTR_EL2 */ +#define CPTR_EZ (1U << 8) /* CPTR_EL3 */ #define MDCR_EPMAD (1U << 21) #define MDCR_EDAD (1U << 20) diff --git a/target/arm/helper.c b/target/arm/helper.c index 6705903301..984a4b1306 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -4266,6 +4266,82 @@ static const ARMCPRegInfo debug_lpae_cp_reginfo[] = { REGINFO_SENTINEL }; +/* Return the exception level to which SVE-disabled exceptions should + * be taken, or 0 if SVE is enabled. + */ +static int sve_exception_el(CPUARMState *env) +{ +#ifndef CONFIG_USER_ONLY + int highest_el = arm_highest_el(env); + int current_el = arm_current_el(env); + int i; + + for (i = highest_el; i >= MAX(1, current_el); --i) { + switch (i) { + case 3: + if ((env->cp15.cptr_el[3] & CPTR_EZ) == 0) { + return 3; + } + break; + case 2: + if (env->cp15.cptr_el[2] & CPTR_TZ) { + return 2; + } + break; + case 1: + switch (extract32(env->cp15.cpacr_el1, 16, 2)) { + case 1: + return current_el == 0 ? 1 : 0; + case 3: + return 0; + default: + return 1; + } + } + } +#endif + return 0; +} + +static CPAccessResult zcr_access(CPUARMState *env, const ARMCPRegInfo *ri, + bool isread) +{ + switch (sve_exception_el(env)) { + case 3: + return CP_ACCESS_TRAP_EL3; + case 2: + return CP_ACCESS_TRAP_EL2; + case 1: + return CP_ACCESS_TRAP; + } + return CP_ACCESS_OK; +} + +static void zcr_write(CPUARMState *env, const ARMCPRegInfo *ri, + uint64_t value) +{ + /* Bits other than [3:0] are RAZ/WI. */ + raw_write(env, ri, value & 0xf); +} + +static const ARMCPRegInfo sve_cp_reginfo[] = { + { .name = "ZCR_EL1", .state = ARM_CP_STATE_AA64, + .opc0 = 2, .opc1 = 0, .crn = 1, .crm = 2, .opc2 = 0, + .access = PL1_RW, .accessfn = zcr_access, .type = ARM_CP_64BIT, + .fieldoffset = offsetof(CPUARMState, vfp.zcr_el[1]), + .writefn = zcr_write, .raw_writefn = raw_write, }, + { .name = "ZCR_EL2", .state = ARM_CP_STATE_AA64, + .opc0 = 2, .opc1 = 4, .crn = 1, .crm = 2, .opc2 = 0, + .access = PL2_RW, .accessfn = zcr_access, .type = ARM_CP_64BIT, + .fieldoffset = offsetof(CPUARMState, vfp.zcr_el[2]), + .writefn = zcr_write, .raw_writefn = raw_write, }, + { .name = "ZCR_EL3", .state = ARM_CP_STATE_AA64, + .opc0 = 2, .opc1 = 6, .crn = 1, .crm = 2, .opc2 = 0, + .access = PL1_RW, .accessfn = zcr_access, .type = ARM_CP_64BIT, + .fieldoffset = offsetof(CPUARMState, vfp.zcr_el[3]), + .writefn = zcr_write, .raw_writefn = raw_write, }, +}; + void hw_watchpoint_update(ARMCPU *cpu, int n) { CPUARMState *env = &cpu->env; @@ -5332,6 +5408,10 @@ void register_cp_regs_for_features(ARMCPU *cpu) } define_one_arm_cp_reg(cpu, &sctlr); } + + if (arm_feature(env, ARM_FEATURE_SVE)) { + define_arm_cp_regs(cpu, sve_cp_reginfo); + } } void arm_cpu_register_gdb_regs_for_features(ARMCPU *cpu) From patchwork Fri Jan 19 04:54:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 125080 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp131370ljf; Thu, 18 Jan 2018 21:00:26 -0800 (PST) X-Google-Smtp-Source: ACJfBosZDnH2hHEKWDFvfvSjPGDFOKqiAEdJcLEpeC2OL6dihSKUTuSYGKjYQlUHyaNbGeOXeynd X-Received: by 10.129.200.7 with SMTP id n7mr8183043ywi.316.1516338026280; Thu, 18 Jan 2018 21:00:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516338026; cv=none; d=google.com; s=arc-20160816; b=Ut9cX+e2+lM9GtTHD9ggH+/Og/WJ/HZtyFh2YE5UOFuHsNrDhHti9KkoNm5MqQLRFw 9lQakVoKsbMFRpaYVDKJA5PRY64TlQ/abUcBUN+msLuZqFo/5DHB5E2EUF9ta9qNDsl3 MeuCzJcvn6TVZ5wNrPY04cgo5ohDWQBmZGjh5NZyieoukOqS+BHvGgceJYLncujOoGB+ I/iPaC+FUO3E2m8RiqXI+pKfT5FP4F3lMd6uTX1YcfikVQWtNcUPPh2VQ9EbmgnUBuDK d+FFYCGu6YGizqb3MD8Q/rp/7MUXCy/hT0f02GRKm5yBsnJuqHrIl4TmuqGhR7Zpej7l DfJg== 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=s7E2o85/dcpWdQTn4z5qcP4kMRPC74IMQXUycCabu/c=; b=Wi+yHwaXMDUkcbHQsdI5I+RG/fP0iQunh+bmb61MkHQSg6tqTih7fZK7a64y0mxQy1 Vqt3pqrZ8E1k0toeKQ0d4ryh/N33HVg86xBVOlNz0J62PBm9Y3t+qJhwDG/Boqa5M9FX xxb53lBudBeGdQoclc0RbupkHerD04nyS2J15FuqU5ZvYiVIBeGXTo+4uwTf1gIV1+Qz EPWpgZKnrAS4qa1dByhESfH41dKEYs1l/EdchQ3LJdPzieKKv7txvJmOcMRKdBMJyNuG 3YgHu9+pr/OIxQKbvxOGVPMxBslnz9mU8j126q4BaceHYffVzDbM3zw84aV2/n5/45KS kTmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=SuIzDsFJ; 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 e19si446317ybh.676.2018.01.18.21.00.26 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 18 Jan 2018 21:00:26 -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=SuIzDsFJ; 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]:52353 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecOmv-00070o-K6 for patch@linaro.org; Fri, 19 Jan 2018 00:00:25 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58780) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecOhp-0002NY-3m for qemu-devel@nongnu.org; Thu, 18 Jan 2018 23:55:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ecOhk-0000Sj-Lh for qemu-devel@nongnu.org; Thu, 18 Jan 2018 23:55:09 -0500 Received: from mail-pf0-x242.google.com ([2607:f8b0:400e:c00::242]:33988) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ecOhk-0000Rr-Dc for qemu-devel@nongnu.org; Thu, 18 Jan 2018 23:55:04 -0500 Received: by mail-pf0-x242.google.com with SMTP id e76so538729pfk.1 for ; Thu, 18 Jan 2018 20:55:04 -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=s7E2o85/dcpWdQTn4z5qcP4kMRPC74IMQXUycCabu/c=; b=SuIzDsFJA2l0k2IprwMRXdHZq9LpU6q1eR7KtIwsw7+si73QWLZUtIvi8xIV2lmSQs yFdpU/8auIqmVW1gkKZsLLyuae1e6IGbeObBlgfD+et/ESCm1y0PO/V1J1NBhKH9cSvW 4enG6JcbjJfYadOVWvqkbrKMRs8WlKKuk7IKM= 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=s7E2o85/dcpWdQTn4z5qcP4kMRPC74IMQXUycCabu/c=; b=hHhZq8Vrrx4E+yY/PvrvJDBcuHKg4Od1SWNX4mabw3HWebo9nXeUPEN4iviYBjKG2q bL/d921B0q0ybkWQsHu4DGmfMT/1ekbREAyVqn1cRViIS/zNQhhbfUpXUMP66bsdmOOU tEuwPmhn5xjjHTdPWfxnYDSjzcJPyX8iLQRgUp0v8i4OpjT/E22aZ5EfNMJmybOGWXw3 cfcSOFI4DAMLF1q3Yl+Q9+uS6nsD48zjN9AjH5UQqCoGdFYYQQosY4SBJw6onhR3MY6J DXj5/snUjmY0nGALJiqFg5p5grCt8GYMeZwo/VK7n/YfMiRWIKzbySlt4snKuUbE+hw5 2nmA== X-Gm-Message-State: AKGB3mLeD7fkm9OeYphtIr9fu968J7/JYmb9d2dki/XvHekohWkJZyMQ Nnwc6ocYAeoxAMCosOhaQh23ZrY+IN4= X-Received: by 10.101.100.204 with SMTP id t12mr39493003pgv.135.1516337702921; Thu, 18 Jan 2018 20:55:02 -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.55.01 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Jan 2018 20:55:02 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 18 Jan 2018 20:54:35 -0800 Message-Id: <20180119045438.28582-14-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::242 Subject: [Qemu-devel] [PATCH v2 13/16] target/arm: Move cpu_get_tb_cpu_state out of line 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" Signed-off-by: Richard Henderson --- target/arm/cpu.h | 127 +--------------------------------------------------- target/arm/helper.c | 126 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 128 insertions(+), 125 deletions(-) -- 2.14.3 diff --git a/target/arm/cpu.h b/target/arm/cpu.h index c8e8155b6e..2de1afb53a 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -2703,71 +2703,6 @@ static inline bool bswap_code(bool sctlr_b) #endif } -/* Return the exception level to which FP-disabled exceptions should - * be taken, or 0 if FP is enabled. - */ -static inline int fp_exception_el(CPUARMState *env) -{ - int fpen; - int cur_el = arm_current_el(env); - - /* CPACR and the CPTR registers don't exist before v6, so FP is - * always accessible - */ - if (!arm_feature(env, ARM_FEATURE_V6)) { - return 0; - } - - /* The CPACR controls traps to EL1, or PL1 if we're 32 bit: - * 0, 2 : trap EL0 and EL1/PL1 accesses - * 1 : trap only EL0 accesses - * 3 : trap no accesses - */ - fpen = extract32(env->cp15.cpacr_el1, 20, 2); - switch (fpen) { - case 0: - case 2: - if (cur_el == 0 || cur_el == 1) { - /* Trap to PL1, which might be EL1 or EL3 */ - if (arm_is_secure(env) && !arm_el_is_aa64(env, 3)) { - return 3; - } - return 1; - } - if (cur_el == 3 && !is_a64(env)) { - /* Secure PL1 running at EL3 */ - return 3; - } - break; - case 1: - if (cur_el == 0) { - return 1; - } - break; - case 3: - break; - } - - /* For the CPTR registers we don't need to guard with an ARM_FEATURE - * check because zero bits in the registers mean "don't trap". - */ - - /* CPTR_EL2 : present in v7VE or v8 */ - if (cur_el <= 2 && extract32(env->cp15.cptr_el[2], 10, 1) - && !arm_is_secure_below_el3(env)) { - /* Trap FP ops at EL2, NS-EL1 or NS-EL0 to EL2 */ - return 2; - } - - /* CPTR_EL3 : present in v8 */ - if (extract32(env->cp15.cptr_el[3], 10, 1)) { - /* Trap all FP ops to EL3 */ - return 3; - } - - return 0; -} - #ifdef CONFIG_USER_ONLY static inline bool arm_cpu_bswap_data(CPUARMState *env) { @@ -2814,66 +2749,8 @@ static inline uint32_t arm_regime_tbi1(CPUARMState *env, ARMMMUIdx mmu_idx) } #endif -static inline void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, - target_ulong *cs_base, uint32_t *flags) -{ - ARMMMUIdx mmu_idx = core_to_arm_mmu_idx(env, cpu_mmu_index(env, false)); - if (is_a64(env)) { - *pc = env->pc; - *flags = ARM_TBFLAG_AARCH64_STATE_MASK; - /* Get control bits for tagged addresses */ - *flags |= (arm_regime_tbi0(env, mmu_idx) << ARM_TBFLAG_TBI0_SHIFT); - *flags |= (arm_regime_tbi1(env, mmu_idx) << ARM_TBFLAG_TBI1_SHIFT); - } else { - *pc = env->regs[15]; - *flags = (env->thumb << ARM_TBFLAG_THUMB_SHIFT) - | (env->vfp.vec_len << ARM_TBFLAG_VECLEN_SHIFT) - | (env->vfp.vec_stride << ARM_TBFLAG_VECSTRIDE_SHIFT) - | (env->condexec_bits << ARM_TBFLAG_CONDEXEC_SHIFT) - | (arm_sctlr_b(env) << ARM_TBFLAG_SCTLR_B_SHIFT); - if (!(access_secure_reg(env))) { - *flags |= ARM_TBFLAG_NS_MASK; - } - if (env->vfp.xregs[ARM_VFP_FPEXC] & (1 << 30) - || arm_el_is_aa64(env, 1)) { - *flags |= ARM_TBFLAG_VFPEN_MASK; - } - *flags |= (extract32(env->cp15.c15_cpar, 0, 2) - << ARM_TBFLAG_XSCALE_CPAR_SHIFT); - } - - *flags |= (arm_to_core_mmu_idx(mmu_idx) << ARM_TBFLAG_MMUIDX_SHIFT); - - /* The SS_ACTIVE and PSTATE_SS bits correspond to the state machine - * states defined in the ARM ARM for software singlestep: - * SS_ACTIVE PSTATE.SS State - * 0 x Inactive (the TB flag for SS is always 0) - * 1 0 Active-pending - * 1 1 Active-not-pending - */ - if (arm_singlestep_active(env)) { - *flags |= ARM_TBFLAG_SS_ACTIVE_MASK; - if (is_a64(env)) { - if (env->pstate & PSTATE_SS) { - *flags |= ARM_TBFLAG_PSTATE_SS_MASK; - } - } else { - if (env->uncached_cpsr & PSTATE_SS) { - *flags |= ARM_TBFLAG_PSTATE_SS_MASK; - } - } - } - if (arm_cpu_data_is_big_endian(env)) { - *flags |= ARM_TBFLAG_BE_DATA_MASK; - } - *flags |= fp_exception_el(env) << ARM_TBFLAG_FPEXC_EL_SHIFT; - - if (arm_v7m_is_handler_mode(env)) { - *flags |= ARM_TBFLAG_HANDLER_MASK; - } - - *cs_base = 0; -} +void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, + target_ulong *cs_base, uint32_t *flags); enum { QEMU_PSCI_CONDUIT_DISABLED = 0, diff --git a/target/arm/helper.c b/target/arm/helper.c index 984a4b1306..9e673bb672 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -11701,3 +11701,129 @@ uint32_t HELPER(crc32c)(uint32_t acc, uint32_t val, uint32_t bytes) /* Linux crc32c converts the output to one's complement. */ return crc32c(acc, buf, bytes) ^ 0xffffffff; } + +/* Return the exception level to which FP-disabled exceptions should + * be taken, or 0 if FP is enabled. + */ +static inline int fp_exception_el(CPUARMState *env) +{ + int fpen; + int cur_el = arm_current_el(env); + + /* CPACR and the CPTR registers don't exist before v6, so FP is + * always accessible + */ + if (!arm_feature(env, ARM_FEATURE_V6)) { + return 0; + } + + /* The CPACR controls traps to EL1, or PL1 if we're 32 bit: + * 0, 2 : trap EL0 and EL1/PL1 accesses + * 1 : trap only EL0 accesses + * 3 : trap no accesses + */ + fpen = extract32(env->cp15.cpacr_el1, 20, 2); + switch (fpen) { + case 0: + case 2: + if (cur_el == 0 || cur_el == 1) { + /* Trap to PL1, which might be EL1 or EL3 */ + if (arm_is_secure(env) && !arm_el_is_aa64(env, 3)) { + return 3; + } + return 1; + } + if (cur_el == 3 && !is_a64(env)) { + /* Secure PL1 running at EL3 */ + return 3; + } + break; + case 1: + if (cur_el == 0) { + return 1; + } + break; + case 3: + break; + } + + /* For the CPTR registers we don't need to guard with an ARM_FEATURE + * check because zero bits in the registers mean "don't trap". + */ + + /* CPTR_EL2 : present in v7VE or v8 */ + if (cur_el <= 2 && extract32(env->cp15.cptr_el[2], 10, 1) + && !arm_is_secure_below_el3(env)) { + /* Trap FP ops at EL2, NS-EL1 or NS-EL0 to EL2 */ + return 2; + } + + /* CPTR_EL3 : present in v8 */ + if (extract32(env->cp15.cptr_el[3], 10, 1)) { + /* Trap all FP ops to EL3 */ + return 3; + } + + return 0; +} + +void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, + target_ulong *cs_base, uint32_t *flags) +{ + ARMMMUIdx mmu_idx = core_to_arm_mmu_idx(env, cpu_mmu_index(env, false)); + if (is_a64(env)) { + *pc = env->pc; + *flags = ARM_TBFLAG_AARCH64_STATE_MASK; + /* Get control bits for tagged addresses */ + *flags |= (arm_regime_tbi0(env, mmu_idx) << ARM_TBFLAG_TBI0_SHIFT); + *flags |= (arm_regime_tbi1(env, mmu_idx) << ARM_TBFLAG_TBI1_SHIFT); + } else { + *pc = env->regs[15]; + *flags = (env->thumb << ARM_TBFLAG_THUMB_SHIFT) + | (env->vfp.vec_len << ARM_TBFLAG_VECLEN_SHIFT) + | (env->vfp.vec_stride << ARM_TBFLAG_VECSTRIDE_SHIFT) + | (env->condexec_bits << ARM_TBFLAG_CONDEXEC_SHIFT) + | (arm_sctlr_b(env) << ARM_TBFLAG_SCTLR_B_SHIFT); + if (!(access_secure_reg(env))) { + *flags |= ARM_TBFLAG_NS_MASK; + } + if (env->vfp.xregs[ARM_VFP_FPEXC] & (1 << 30) + || arm_el_is_aa64(env, 1)) { + *flags |= ARM_TBFLAG_VFPEN_MASK; + } + *flags |= (extract32(env->cp15.c15_cpar, 0, 2) + << ARM_TBFLAG_XSCALE_CPAR_SHIFT); + } + + *flags |= (arm_to_core_mmu_idx(mmu_idx) << ARM_TBFLAG_MMUIDX_SHIFT); + + /* The SS_ACTIVE and PSTATE_SS bits correspond to the state machine + * states defined in the ARM ARM for software singlestep: + * SS_ACTIVE PSTATE.SS State + * 0 x Inactive (the TB flag for SS is always 0) + * 1 0 Active-pending + * 1 1 Active-not-pending + */ + if (arm_singlestep_active(env)) { + *flags |= ARM_TBFLAG_SS_ACTIVE_MASK; + if (is_a64(env)) { + if (env->pstate & PSTATE_SS) { + *flags |= ARM_TBFLAG_PSTATE_SS_MASK; + } + } else { + if (env->uncached_cpsr & PSTATE_SS) { + *flags |= ARM_TBFLAG_PSTATE_SS_MASK; + } + } + } + if (arm_cpu_data_is_big_endian(env)) { + *flags |= ARM_TBFLAG_BE_DATA_MASK; + } + *flags |= fp_exception_el(env) << ARM_TBFLAG_FPEXC_EL_SHIFT; + + if (arm_v7m_is_handler_mode(env)) { + *flags |= ARM_TBFLAG_HANDLER_MASK; + } + + *cs_base = 0; +} From patchwork Fri Jan 19 04:54:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 125083 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp133065ljf; Thu, 18 Jan 2018 21:05:51 -0800 (PST) X-Google-Smtp-Source: ACJfBovlXzNhK/a0t6kaQZ+Jb5sKHXUxYSc+8mF3o12uKyqdCMeQpWmSwnhXfFRXRBRyDQMz2uGw X-Received: by 10.37.197.74 with SMTP id v71mr36325120ybe.258.1516338351037; Thu, 18 Jan 2018 21:05:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516338351; cv=none; d=google.com; s=arc-20160816; b=ScPyDm3XV+J98y5560O2+qHGQzk+2laHdTb/zptHBbOZLg76zZpWQJRROR0G+vcJ6D vzRdSihnMORb5ltmNKARJmzzffAo9w7cVDJYA8F1tFrdQG7R4n5FlE3Aqvy+rsk5dY86 EGx2n/s5GIU8dluuy38nYDFrIJbhnFXG9S0VXkWsppO1lCKaB8sMmDwRL45E3wMwJnad VEHkOAuiXlni7WLWucr4h3RVHy10dgoiIxujLuWhXNw/jnTyJOPwR68pd/hlhIxQRdTB fEOqvk6HL2twRC9QdhCrN+BYu63ZQnx3hQKAish9M91uilj0aMPW52gf+eW01UpU1K2R qH0w== 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=MrUbi1cyBrCCWqcwORQqONge1KIiagmroE4y1V6paR4=; b=T+5yDimWFidZavatl5EsR8+4t26ZZzeI6DY7xv/om8FTKh2X/h8jDQLJp4XKdiVIjC DdMu9WM3XLJDCYVvAl6hXkR/c+1x4taOOZTeqAWDQHiLzo57tJajHqyAc0+v7kg9PkYt Ezhl/+rFGVc0E05lAIJGkdu0cR7gQZ6HbZKm1f+vrXNGe2vRjwvQELyp4w5bxG53qzHG ax/GJtHOv1RdtYNCAXt9k0tmgKBEIXla0i9wu4/iix8zbdwRSG7anJVa9FobuJmf1Yjr iAMgZfZ9Ys0r2eER3BF4Q3X2osDeAxzj48piBDomnazn0YLQumJvdD/s6XHVp3UWRzKJ UpqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=fsLcWhlC; 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 11si355402ywz.427.2018.01.18.21.05.50 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 18 Jan 2018 21:05:51 -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=fsLcWhlC; 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]:52459 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecOsA-0002GX-EU for patch@linaro.org; Fri, 19 Jan 2018 00:05:50 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58784) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecOhp-0002Na-4s for qemu-devel@nongnu.org; Thu, 18 Jan 2018 23:55:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ecOhm-0000T8-1j for qemu-devel@nongnu.org; Thu, 18 Jan 2018 23:55:09 -0500 Received: from mail-pf0-x242.google.com ([2607:f8b0:400e:c00::242]:35867) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ecOhl-0000Sx-R7 for qemu-devel@nongnu.org; Thu, 18 Jan 2018 23:55:05 -0500 Received: by mail-pf0-x242.google.com with SMTP id 23so534528pfp.3 for ; Thu, 18 Jan 2018 20:55:05 -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=MrUbi1cyBrCCWqcwORQqONge1KIiagmroE4y1V6paR4=; b=fsLcWhlCS2JXc7ANw3xBG9PjYuUeoecaJMJbEgqLEyYBmc59SOli5MIOLa6sAMuv/t JUvZCeRDFFPPOHYovg7UFtR/sbMFLmdT7IfitWWojhIzkD3SdqF3NniiHh4RKFCwiAVU b7CuRrT8G4XXXsIbb37s4NL591LLsRtNvk8vw= 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=MrUbi1cyBrCCWqcwORQqONge1KIiagmroE4y1V6paR4=; b=VPw7BcilUXJ9wTlZ7GMaufDPicf6S6l8GlxG/FLgK3DzURgOiyXtLLQE/UQqu3HhzW 9jirI8NMAksv2kEH2GGE7wuZpAjF9KyQELKh8DYN94MniVOk870IEYX9+CYuFshEz1nb 7az0kqVaDl087mGO3JKakqufCGcnyCjXlntwBs8z2Bqrg2PIOXEmG3vph/Lr4otaoDTq NAsJ62RLMoQHIHEnrsUfjVPLZoQmLu8qt6J/+CMmx92NKksAPbUq/MXaSDpsmr25lMl4 4an6r8A929JwkmTJygMyJUmKFfIUQDdR/nNmidq9xFPD3h9B7xRYW9SNi5bDfI1HD3JF M7jQ== X-Gm-Message-State: AKGB3mL85nzBf+Gi+GlDIo+Je84ZlzEWSjcerBSc4IRlBdP9D4IzDaw4 WWgp79/pJB/wfDNSVHO242TM1aGnsV8= X-Received: by 10.99.94.193 with SMTP id s184mr38254364pgb.397.1516337704480; Thu, 18 Jan 2018 20:55:04 -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.55.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Jan 2018 20:55:03 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 18 Jan 2018 20:54:36 -0800 Message-Id: <20180119045438.28582-15-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::242 Subject: [Qemu-devel] [PATCH v2 14/16] target/arm: Hoist store to flags output in cpu_get_tb_cpu_state 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" Signed-off-by: Richard Henderson --- target/arm/helper.c | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) -- 2.14.3 Reviewed-by: Alex Bennée diff --git a/target/arm/helper.c b/target/arm/helper.c index 9e673bb672..c0e5f321c5 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -11768,34 +11768,36 @@ static inline int fp_exception_el(CPUARMState *env) } void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, - target_ulong *cs_base, uint32_t *flags) + target_ulong *cs_base, uint32_t *pflags) { ARMMMUIdx mmu_idx = core_to_arm_mmu_idx(env, cpu_mmu_index(env, false)); + uint32_t flags; + if (is_a64(env)) { *pc = env->pc; - *flags = ARM_TBFLAG_AARCH64_STATE_MASK; + flags = ARM_TBFLAG_AARCH64_STATE_MASK; /* Get control bits for tagged addresses */ - *flags |= (arm_regime_tbi0(env, mmu_idx) << ARM_TBFLAG_TBI0_SHIFT); - *flags |= (arm_regime_tbi1(env, mmu_idx) << ARM_TBFLAG_TBI1_SHIFT); + flags |= (arm_regime_tbi0(env, mmu_idx) << ARM_TBFLAG_TBI0_SHIFT); + flags |= (arm_regime_tbi1(env, mmu_idx) << ARM_TBFLAG_TBI1_SHIFT); } else { *pc = env->regs[15]; - *flags = (env->thumb << ARM_TBFLAG_THUMB_SHIFT) + flags = (env->thumb << ARM_TBFLAG_THUMB_SHIFT) | (env->vfp.vec_len << ARM_TBFLAG_VECLEN_SHIFT) | (env->vfp.vec_stride << ARM_TBFLAG_VECSTRIDE_SHIFT) | (env->condexec_bits << ARM_TBFLAG_CONDEXEC_SHIFT) | (arm_sctlr_b(env) << ARM_TBFLAG_SCTLR_B_SHIFT); if (!(access_secure_reg(env))) { - *flags |= ARM_TBFLAG_NS_MASK; + flags |= ARM_TBFLAG_NS_MASK; } if (env->vfp.xregs[ARM_VFP_FPEXC] & (1 << 30) || arm_el_is_aa64(env, 1)) { - *flags |= ARM_TBFLAG_VFPEN_MASK; + flags |= ARM_TBFLAG_VFPEN_MASK; } - *flags |= (extract32(env->cp15.c15_cpar, 0, 2) - << ARM_TBFLAG_XSCALE_CPAR_SHIFT); + flags |= (extract32(env->cp15.c15_cpar, 0, 2) + << ARM_TBFLAG_XSCALE_CPAR_SHIFT); } - *flags |= (arm_to_core_mmu_idx(mmu_idx) << ARM_TBFLAG_MMUIDX_SHIFT); + flags |= (arm_to_core_mmu_idx(mmu_idx) << ARM_TBFLAG_MMUIDX_SHIFT); /* The SS_ACTIVE and PSTATE_SS bits correspond to the state machine * states defined in the ARM ARM for software singlestep: @@ -11805,25 +11807,26 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, * 1 1 Active-not-pending */ if (arm_singlestep_active(env)) { - *flags |= ARM_TBFLAG_SS_ACTIVE_MASK; + flags |= ARM_TBFLAG_SS_ACTIVE_MASK; if (is_a64(env)) { if (env->pstate & PSTATE_SS) { - *flags |= ARM_TBFLAG_PSTATE_SS_MASK; + flags |= ARM_TBFLAG_PSTATE_SS_MASK; } } else { if (env->uncached_cpsr & PSTATE_SS) { - *flags |= ARM_TBFLAG_PSTATE_SS_MASK; + flags |= ARM_TBFLAG_PSTATE_SS_MASK; } } } if (arm_cpu_data_is_big_endian(env)) { - *flags |= ARM_TBFLAG_BE_DATA_MASK; + flags |= ARM_TBFLAG_BE_DATA_MASK; } - *flags |= fp_exception_el(env) << ARM_TBFLAG_FPEXC_EL_SHIFT; + flags |= fp_exception_el(env) << ARM_TBFLAG_FPEXC_EL_SHIFT; if (arm_v7m_is_handler_mode(env)) { - *flags |= ARM_TBFLAG_HANDLER_MASK; + flags |= ARM_TBFLAG_HANDLER_MASK; } + *pflags = flags; *cs_base = 0; } From patchwork Fri Jan 19 04:54:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 125088 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp136080ljf; Thu, 18 Jan 2018 21:17:04 -0800 (PST) X-Google-Smtp-Source: ACJfBovuhVOyY7Rzcsoqx3T1KyY1CwAa8F+z3TMdFAbBJwPARRG/utqbXjNNMtBnpiKXX4hnK4PF X-Received: by 10.37.44.195 with SMTP id s186mr7243027ybs.284.1516339024635; Thu, 18 Jan 2018 21:17:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516339024; cv=none; d=google.com; s=arc-20160816; b=utUVnhQCticUTSVq2S94i0+ciVjDvot5EOVieaWZmSlwDKmozpjrZoVPnibTnEp6+U Q8YSXxlSXQA8EqsUiV+FK5NNI0eBTCn0XpriahLi99+tqhnND3zvdg79cdtTgZRjpf4L 0LAZ36KIptbAyUp4sIOrRLU76pgPvuY7ujtYtbq1btKvo92d1nWfNmGiMe1HRT/nFGEP U/C0Vqp0xbdMcjMvOZeLBAWXg810WN48CsVwXPgsnuOQo/8lQP2B1WEC2gI7ynAFl/VN hTSYJRIaC0JL3FoQhnGFe6hYNUdFGSps56AfwwhqHecdkljHJ5cw3DwtNQTN/j5CUoUf XDeg== 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=woNrRoz9pFHE/sWC8b64H8TxwAXuOSje5AvdLVnP+6Y=; b=M6NE715b3o61SJhiJNZlDnMs+LwDhCiH7Uz3JjoWiTbGobDrD7rAzYF4xdP9apegzr O8WJ9oVJ72HDPMcwjBFwGtlMPGUrllyXEaIqnUNDhKxFGUAHkQ5xizIYxA57s3G/ZENA urgDQzRHcIlx9mh7UDmxqcJhFfmeQese4jRuNGUQOdFPf83nkpQij651QJt1GtGVXwE/ btZJAh8eXhnDoBLKqxP6wPbhKNj+WXtd1Sw1+cVKONTx1u4pksliqjwBm2OcSk+l+w/S v07YuZ+Qhm93DLY2CfDyvlNwI7oLZhCoiqVpKCBDRG7ag5XaaPzqAUZu+N9WIC+Opywa F/gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Kehbnv9N; 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 f6si458936ybk.807.2018.01.18.21.17.04 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 18 Jan 2018 21:17:04 -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=Kehbnv9N; 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]:53125 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecP32-0003xz-29 for patch@linaro.org; Fri, 19 Jan 2018 00:17:04 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58783) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecOhp-0002NZ-4t for qemu-devel@nongnu.org; Thu, 18 Jan 2018 23:55:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ecOhn-0000Ud-Au for qemu-devel@nongnu.org; Thu, 18 Jan 2018 23:55:09 -0500 Received: from mail-pg0-x244.google.com ([2607:f8b0:400e:c05::244]:38313) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ecOhn-0000Te-4e for qemu-devel@nongnu.org; Thu, 18 Jan 2018 23:55:07 -0500 Received: by mail-pg0-x244.google.com with SMTP id y27so552965pgc.5 for ; Thu, 18 Jan 2018 20:55:06 -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=woNrRoz9pFHE/sWC8b64H8TxwAXuOSje5AvdLVnP+6Y=; b=Kehbnv9NUtBT0iBs5D4ObCZcJ/xGs4q1spQXBXkmJLt3BKiHp9iDQkAQGLxIpZKSts O03befPmSTxcq6CMOJQOKS4DZnvTMpYD5gYvIj7diWwHp6Sxi7nyWxZWk1YGVQHv2voW OfLnubzFmWPz5ZRFD8gWln5rGDYVtyFM6bFKI= 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=woNrRoz9pFHE/sWC8b64H8TxwAXuOSje5AvdLVnP+6Y=; b=TexZzmCqXyhFj1gDc2g9Tw1W9KKXT6SE0Mv+Fi2qfSFmcyD3GHUC1Wn/DWwcuI61R0 sVgFM4B2Ufgtq9OTYnUG3u7TpONVz3D3EfM2CfvOS3KmLpX8uWi6NLDkE0nBZkDziKkq YummGPv/Tm+CPD8qnbLBr2o0pUAsjoFcoN2j+bUvo36iZv15aN+VnaldN/LNFEqa6Fhf KuvF9j+46+2MWDAQ+5SoyD9WKZdhBGbFhgNrWDfETmJj2f12FxJymm6r6jkE7qHPuPj0 E1NXtHQxDSTr2x4NUHvdhdn4uPk0npG/UogKP4iyLmLMsORmz9Uk7kC3ZfnSVp8DFNh5 Pymw== X-Gm-Message-State: AKGB3mKc6OT3e6A8m/32cLF2wpQLU1Mb7s+vLWydUoc/wCDX5pbo0It6 v/8Z9g2apuGG0YmXy3k+UcbuHILYBag= X-Received: by 10.99.1.151 with SMTP id 145mr31245410pgb.229.1516337705845; Thu, 18 Jan 2018 20:55:05 -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.55.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Jan 2018 20:55:04 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 18 Jan 2018 20:54:37 -0800 Message-Id: <20180119045438.28582-16-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:c05::244 Subject: [Qemu-devel] [PATCH v2 15/16] target/arm: Simplify fp_exception_el for user-only 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" Signed-off-by: Richard Henderson --- target/arm/helper.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.14.3 Reviewed-by: Alex Bennée diff --git a/target/arm/helper.c b/target/arm/helper.c index c0e5f321c5..44814af99b 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -11707,6 +11707,7 @@ uint32_t HELPER(crc32c)(uint32_t acc, uint32_t val, uint32_t bytes) */ static inline int fp_exception_el(CPUARMState *env) { +#ifndef CONFIG_USER_ONLY int fpen; int cur_el = arm_current_el(env); @@ -11763,7 +11764,7 @@ static inline int fp_exception_el(CPUARMState *env) /* Trap all FP ops to EL3 */ return 3; } - +#endif return 0; } From patchwork Fri Jan 19 04:54:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 125078 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp131229ljf; Thu, 18 Jan 2018 21:00:02 -0800 (PST) X-Google-Smtp-Source: ACJfBotgzwnmq+0C61cKJtN0Nd9/dKTw6oL1WMUX4/Se7XviX+YLTLJmgyh3cmTI9S7hunyqJamh X-Received: by 10.13.237.194 with SMTP id w185mr8494431ywe.194.1516338001991; Thu, 18 Jan 2018 21:00:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516338001; cv=none; d=google.com; s=arc-20160816; b=agp+oagpUYsI+9GnqZ3B1LLGQuwaaS4sfT+0tti95Qc82Or36nXSpnEnKsrj4avBnY f10KybRJl//nIgKwuRtU6kQA72IKvQF6O/wnGx6xS0+ynu18uAhiA9BQsBST+s2edikW J1c2mxD8Y6r4RVC3DDklEwDp3QIC93ptp2ZEWLOJqTFFXzmJTD9Qpd4+aMa8/F5ksV7r yFbZWdR+j3zB7fmx9Vd8sPQUsytlmiyzpZUzbDi/k2oQCY1TAYJKsxM0zlnaNONEG2Xi LO8PBCUc7Z6KU76OLjpYgFreS/tKyJ+d1LpzgV5jXGT9A+sI8hZAPL1NDdyTRCdw894O s3lA== 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=NsYKHm75l4RdxnA2GN9YianVyXTxkU5IkMB6x4+lVTg=; b=X5jaNWeR1AwytJ7sfCwMUQKeI5+AMSXT1yGWMK7TgX+heQBHCHnSA2KGIGi1svRKG1 ndgjLKARSUCYuUdyYHUlH9P7OEoZLHLKrjkRKsDh7zMwiZVSkomzfvEgNQnlVKqdCSkZ B7bspBYzyZRSXcjjqew809qQnVP57SOf5NSwA+q5CX8XSPhHGfWCIzjAcrdqEzBNFzbH NDTepVYKkS+YYIkubCbPxeDBpL8Iwfm9hXoZWIN0JsGpu3OvmvSHLOM4jYQLG0LAUbZq CTv5ifznoavPx0UPuqRhV9n6kCFFDHnZiECZjNrvIe899dhKxiBGrLDqptw1Tccrceky V0zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=eW6IivKN; 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 i83si1016026ywi.85.2018.01.18.21.00.01 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 18 Jan 2018 21:00:01 -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=eW6IivKN; 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]:52337 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecOmX-000613-E9 for patch@linaro.org; Fri, 19 Jan 2018 00:00:01 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58794) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecOhp-0002Nb-JN for qemu-devel@nongnu.org; Thu, 18 Jan 2018 23:55:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ecOho-0000Wt-Ou for qemu-devel@nongnu.org; Thu, 18 Jan 2018 23:55:09 -0500 Received: from mail-pf0-x244.google.com ([2607:f8b0:400e:c00::244]:33536) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ecOho-0000Vp-Ih for qemu-devel@nongnu.org; Thu, 18 Jan 2018 23:55:08 -0500 Received: by mail-pf0-x244.google.com with SMTP id t5so538424pfi.0 for ; Thu, 18 Jan 2018 20:55:08 -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=NsYKHm75l4RdxnA2GN9YianVyXTxkU5IkMB6x4+lVTg=; b=eW6IivKNjHGwmEMMmOCIaDxm1cM2mVWMmB6TlU1v+p62yEUew8BBH0q/9fZqy0M8yK S0jhykU7L8RDq1d+55HrihWKJVley5wh8awFgqI/+vDJ2PAvfzdU+2ygg5SKrXHFy0sQ NPERGu+VNywpam8Mj0l+MZSbCSfO42LXRz0DE= 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=NsYKHm75l4RdxnA2GN9YianVyXTxkU5IkMB6x4+lVTg=; b=Pt4XRmESIdEt2H/bGVH1qV6hHo67vwzVKzHT0Du4BRQeTLDZpxIkNfWTHxOg/JkmWV 2oIJtj5v7CTIKduKsAMvmX53rvDLO19Pnp/iMzLmkRUAp5c0V4dopNtlVOwiLk1bPVk+ +w6JWIYNBK25/liw9qRKHF5Np4GQG5zIaS37gU7M9PcAsQV0JU3s9zJUmJ44Ybcgo/jV EYduec0elXgcQy/JbYGOOLxGqkO4IpEQgTgCFaRb3guv/4Px2eany88KSxsQuji0QAa6 IW9WRwyv6kJUrxxPeQ4BQbCXLs7D6oi0AhlxnxXCIPJ6ZpY40hjgSUzi98/KRRQ3RpM4 HAWw== X-Gm-Message-State: AKGB3mK3I03gXSojdTjACANH4Xz4cQvhRHFSjV9Enh9XjKPCOmCJ8LJb En+i3aHcLUw8TtrSdvIn+OwinP9m5gA= X-Received: by 10.98.32.151 with SMTP id m23mr38633400pfj.182.1516337707230; Thu, 18 Jan 2018 20:55:07 -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.55.05 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Jan 2018 20:55:06 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 18 Jan 2018 20:54:38 -0800 Message-Id: <20180119045438.28582-17-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::244 Subject: [Qemu-devel] [PATCH v2 16/16] target/arm: Add SVE state to TB->FLAGS 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" Add both SVE exception state and vector length. Signed-off-by: Richard Henderson --- target/arm/cpu.h | 4 ++++ target/arm/helper.c | 23 ++++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) -- 2.14.3 diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 2de1afb53a..d7208d56df 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -2646,6 +2646,10 @@ static inline bool arm_cpu_data_is_big_endian(CPUARMState *env) #define ARM_TBFLAG_TBI0_MASK (0x1ull << ARM_TBFLAG_TBI0_SHIFT) #define ARM_TBFLAG_TBI1_SHIFT 1 /* TBI1 for EL0/1 */ #define ARM_TBFLAG_TBI1_MASK (0x1ull << ARM_TBFLAG_TBI1_SHIFT) +#define ARM_TBFLAG_SVEEXC_EL_SHIFT 2 +#define ARM_TBFLAG_SVEEXC_EL_MASK (0x3 << ARM_TBFLAG_SVEEXC_EL_SHIFT) +#define ARM_TBFLAG_ZCR_LEN_SHIFT 4 +#define ARM_TBFLAG_ZCR_LEN_MASK (0xf << ARM_TBFLAG_ZCR_LEN_SHIFT) /* some convenience accessor macros */ #define ARM_TBFLAG_AARCH64_STATE(F) \ diff --git a/target/arm/helper.c b/target/arm/helper.c index 44814af99b..6072634ca8 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -11772,14 +11772,35 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, target_ulong *cs_base, uint32_t *pflags) { ARMMMUIdx mmu_idx = core_to_arm_mmu_idx(env, cpu_mmu_index(env, false)); + int fp_el = fp_exception_el(env); uint32_t flags; if (is_a64(env)) { + int sve_el = sve_exception_el(env); + uint32_t zcr_len; + *pc = env->pc; flags = ARM_TBFLAG_AARCH64_STATE_MASK; /* Get control bits for tagged addresses */ flags |= (arm_regime_tbi0(env, mmu_idx) << ARM_TBFLAG_TBI0_SHIFT); flags |= (arm_regime_tbi1(env, mmu_idx) << ARM_TBFLAG_TBI1_SHIFT); + flags |= sve_el << ARM_TBFLAG_SVEEXC_EL_SHIFT; + + /* If SVE is disabled, but FP is enabled, + then the effective len is 0. */ + if (sve_el != 0 && fp_el == 0) { + zcr_len = 0; + } else { + int highest_el = arm_highest_el(env); + int current_el = arm_current_el(env); + int i; + + zcr_len = 0xf & (uint32_t)env->vfp.zcr_el[highest_el]; + for (i = highest_el - 1; i >= MAX(1, current_el); --i) { + zcr_len = MIN(zcr_len, 0xf & (uint32_t)env->vfp.zcr_el[i]); + } + } + flags |= zcr_len << ARM_TBFLAG_ZCR_LEN_SHIFT; } else { *pc = env->regs[15]; flags = (env->thumb << ARM_TBFLAG_THUMB_SHIFT) @@ -11822,7 +11843,7 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, if (arm_cpu_data_is_big_endian(env)) { flags |= ARM_TBFLAG_BE_DATA_MASK; } - flags |= fp_exception_el(env) << ARM_TBFLAG_FPEXC_EL_SHIFT; + flags |= fp_el << ARM_TBFLAG_FPEXC_EL_SHIFT; if (arm_v7m_is_handler_mode(env)) { flags |= ARM_TBFLAG_HANDLER_MASK;