From patchwork Mon Dec 18 17:30:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 122284 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3145281qgn; Mon, 18 Dec 2017 10:03:02 -0800 (PST) X-Google-Smtp-Source: ACJfBovQtKAz+bvzS5ri/6m7W6LagWuprMMA4VVBMbuiER9iwJsj6CFHjo5csUlxjfOvnVTmU05K X-Received: by 10.37.12.132 with SMTP id 126mr497545ybm.457.1513620182463; Mon, 18 Dec 2017 10:03:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513620182; cv=none; d=google.com; s=arc-20160816; b=vtmNdGKXlMusl2ZTlPVyz+p0099URYd7kRZALHTFwHXQSu8H3fBFIth/34K4IVwx8+ T/ogoHeScWtNGPFtBGoILarBhtKiBeY2LVvpPmJOnGggQCSeVnsqOBQhNqMobU+jvWwz jD41ExE1N2/Je97DjWbN8q6uSb/L9V1F+VYzbc7hiRPnIVn1OxLSDCgktLOVeSWfv7sJ oFrdJYtCgjd/xk3TJw9Z8Ic1MMC4FhWQ6kI19LvC77jFB7oAu97sKIm+GKnqnOdPsUx4 SQO0dMvYDogopSz/EURuuTiPFJ0MFGb//SRW9MyMqgMmaCOEnBOrBNFvCCp2L86NCpTf Qx5Q== 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=W93ah91u8A5c8lGsoOsfCn5H4dV1elhaDMwT3JRL7sY=; b=cf8cUpBMKFXwlG0vPON0tVSxVBtsD8FKVu51EOrabhD91LxzmdrFa7TAACTFfOHzBa WGu2EpBi6mUsWZPeGjMVxz/9wdpwmjhTCcnEU1YIh9WMK1hV9ioFgoduBI7ncY3ynExN Vbqsr1JJAb9oLRgegssrz0V3ISd/89YCWUEnFsGg90WNwBjJ4u3YwyhqZAKL8t8s7ZmD ecKQkFA8ynA0w12w8qIdlkcyJS0VRkxv92BfF8b1TvhcbYWIdTeIxolk3Uar1yu5M++K 1Ok32wMmZyLn6S+Ru8IP5kHhQsHLueaUKU2Wrp+zGvIu6dhkw0O/BF0OZDRZrLvj2qCk W2wQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=UOwvzZZA; 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 r2si2499142ywa.368.2017.12.18.10.03.02 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 18 Dec 2017 10:03:02 -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=UOwvzZZA; 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]:60132 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQzkj-0006lx-SJ for patch@linaro.org; Mon, 18 Dec 2017 13:03:01 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44147) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQzFF-0002XU-EH for qemu-devel@nongnu.org; Mon, 18 Dec 2017 12:30:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eQzFD-0004bD-Tz for qemu-devel@nongnu.org; Mon, 18 Dec 2017 12:30:29 -0500 Received: from mail-pl0-x242.google.com ([2607:f8b0:400e:c01::242]:40286) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eQzFD-0004ZK-KW for qemu-devel@nongnu.org; Mon, 18 Dec 2017 12:30:27 -0500 Received: by mail-pl0-x242.google.com with SMTP id 62so3774707pld.7 for ; Mon, 18 Dec 2017 09:30:27 -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=W93ah91u8A5c8lGsoOsfCn5H4dV1elhaDMwT3JRL7sY=; b=UOwvzZZAyIqvy6/gvivLJHEGEnIuczgjDk2f2nv9Nz/EWOkt2d9efpG0IZ37+afEg+ ez33E7X0rc6iZMcjwuo12dFYkc0O84SqQXGBmBUufULwXAMrYFXiqIdbYNaYjsPlyUBw BZFSmX88a34qJIyEuvzmWHw99p/jFmvGYcoas= 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=W93ah91u8A5c8lGsoOsfCn5H4dV1elhaDMwT3JRL7sY=; b=TZMbXbW27ei5JSJvMSjCAIC87FMnnXJcg2+pj8cQeUSSKcx1r4KdkNK6Kf4qGGUlOR Csg0ZJsAsTz6Kk8URru74v8vxKEOucscxuLpdknoBydI1TkshscWKQXbGiPncTr7Xoli vPJryjsMfd3k+Pf7ob3qIcNMmEEekk7otIIYNld0V2S7k9cP8OKl7BFq0eZ8z+sAai8q amZg47c9NX8D4I3OuS4/XoWLegu/C953kF2poyhA+gotk/xfh8anrm1ig4LAGt1VfR45 IgJTMSZy5/bmY7wQ75RL3mSykjlgGSPI98cChSLkYaAtAtRyhqpF0uDN/EJC9whvLuQh JZrg== X-Gm-Message-State: AKGB3mJKp1IMBEmmjqds8YB9X6wJCq8zEtWzm8czf+6jfoBw2wd1sL+5 vY12ZnzZN3NVjc6cf+xAmIGbnjqGcdM= X-Received: by 10.84.245.15 with SMTP id i15mr452074pll.402.1513618226396; Mon, 18 Dec 2017 09:30:26 -0800 (PST) Received: from cloudburst.twiddle.net (174-21-7-63.tukw.qwest.net. [174.21.7.63]) by smtp.gmail.com with ESMTPSA id h69sm26553411pfe.107.2017.12.18.09.30.24 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Dec 2017 09:30:25 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 18 Dec 2017 09:30:14 -0800 Message-Id: <20171218173022.18418-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171218173022.18418-1-richard.henderson@linaro.org> References: <20171218173022.18418-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:c01::242 Subject: [Qemu-devel] [PATCH 1/9] 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, qemu-arm@nongnu.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. Signed-off-by: Richard Henderson --- target/arm/translate.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.14.3 Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Peter Maydell 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 Mon Dec 18 17:30:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 122291 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3155979qgn; Mon, 18 Dec 2017 10:12:24 -0800 (PST) X-Google-Smtp-Source: ACJfBouVpb/Q0doipfSJA80l4wgFa6kM8LAUtQ1UaEqX4uf0R3jspSoV66yvijiUi7OO5sb8Yoat X-Received: by 10.37.129.140 with SMTP id p12mr567826ybk.166.1513620744252; Mon, 18 Dec 2017 10:12:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513620744; cv=none; d=google.com; s=arc-20160816; b=Ljcm+0owyZDgyCr9mfONUavmgVUwaeWBs0bXep4mGtQXBL1e1MmF6AIcHN97Po9Rhk M71/l3U91okzlmiScsFXdDbWomtOnmBXLVtJBcb0XgXJtbpJnbLDumEbgbOcv5ZpmuOv s1a7EgxPmwq/M5z7985T/Fb9REZv3N2zpzOKbuSih36Uvyc1UPQWuBfSg7MRQtytPXfI JsBLhlgscNb6vtKKB8f+D7vK3VBzuF717OkiwGFuvjXKKpy+5ErhbXf2WN8Pz3W42IGv vnOwT3+iRvKTII2XOxblvYvbG/fywd8KQlOhTLquV0TUtDKs8yPj0to+uJMkqf/2CSlo do+Q== 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=GbLmNQ7xuX7XFvqzi98fqbMwaMefB+kCgTWymv093lc=; b=lY4Sy2sDkSYAoQ6GgCTNQH1o2yqNOTyQb52wcSvy46YsI1jN5d12CpBrIlDruuAX89 ZLu39YB7QzaXVb5NPkYL08O45ZaWs3rdC5jVGC0P8XnJTtVERqqmBAxAnY5SX9b6n8Tf 7rbz9D/f2kAXeeyOaOITdqA7/AwFwoGHpDVqe9IeAPORs3JrUtbiijFSa7OP+yeru64t yYtfGS6sGXJSTRmToQqopic25ir22lq5G2CAT46sUsLsRbbWr4cQGkidpeXfqFC8Zhn8 S8W9q8mXHXhCRa6C6tcWjieVk3DRamcr/VulOUR3YxkiqV3itmbgz6W47+goeBP+zT7r mfig== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=buhBeDFJ; 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 t17si2515032ybg.578.2017.12.18.10.12.24 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 18 Dec 2017 10:12: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=buhBeDFJ; 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]:60228 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQztn-0007Vz-Ms for patch@linaro.org; Mon, 18 Dec 2017 13:12:23 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44321) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQzFK-0002dF-UT for qemu-devel@nongnu.org; Mon, 18 Dec 2017 12:30:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eQzFG-0004e0-5R for qemu-devel@nongnu.org; Mon, 18 Dec 2017 12:30:34 -0500 Received: from mail-pg0-x244.google.com ([2607:f8b0:400e:c05::244]:33264) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eQzFF-0004cc-DF for qemu-devel@nongnu.org; Mon, 18 Dec 2017 12:30:29 -0500 Received: by mail-pg0-x244.google.com with SMTP id g7so9428154pgs.0 for ; Mon, 18 Dec 2017 09:30:29 -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=GbLmNQ7xuX7XFvqzi98fqbMwaMefB+kCgTWymv093lc=; b=buhBeDFJeXf/rV8yQh0Ow5vuyPieh7NZpcMxnzyT22+tq506aqNrCBQh+DI26/aZm0 wWXrtmz8chsXzfDrPh/g/EXaN9Qi6ap/z1C4oBBCtcy3YlB1R326vOR6/w0QbEdOopLG 4Jmkk1tUpbpm95CcE5X6Mky6JaH9Ajg5GnFOs= 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=GbLmNQ7xuX7XFvqzi98fqbMwaMefB+kCgTWymv093lc=; b=UWkWaT8p2hDEMpt9ZQCzr0yWpPgZPQc9cYB8kWkp8XD5MwLGPgJUW1izj0Hs3/pPR5 0Ia78pdm+KmMfnHoDvUb7+49k1C9vyZxuNcE7oD9wFZi3R4sOvEQvLz+I++XKTqRO/F9 /+te55biOzEXPCcybEN31VR5Q67G18Cs89fkzZDlF5l+8D7vN6JcDcAQahR6e5yDKiX5 L9mRvQEbec6BkaIJZFWbx1SIDT0rFdcHYU0lmIwvyGenAXVnikFI4TlV8uCLYf0hGsXR s+1I9lB+2bewv/j+uoBEauJSb77h+AEFw8XQJkX3kaAl/XlJFUWzOPmw/gM1FvBq5eIP lVpA== X-Gm-Message-State: AKGB3mIqXL2bd3rLJnqUXw9koG1GiFUMrS5GEZ1BfqVZ48JLIzwGPdrp AJzqR8ilgGTYt0K3eNK/T6pAnoC6c6c= X-Received: by 10.101.82.65 with SMTP id q1mr386312pgp.55.1513618227876; Mon, 18 Dec 2017 09:30:27 -0800 (PST) Received: from cloudburst.twiddle.net (174-21-7-63.tukw.qwest.net. [174.21.7.63]) by smtp.gmail.com with ESMTPSA id h69sm26553411pfe.107.2017.12.18.09.30.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Dec 2017 09:30:26 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 18 Dec 2017 09:30:15 -0800 Message-Id: <20171218173022.18418-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171218173022.18418-1-richard.henderson@linaro.org> References: <20171218173022.18418-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 2/9] 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, qemu-arm@nongnu.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[]. Signed-off-by: Richard Henderson --- target/arm/helper.h | 18 ++--- target/arm/crypto_helper.c | 184 +++++++++++++++++---------------------------- target/arm/translate-a64.c | 68 +++++++++-------- target/arm/translate.c | 68 +++++++++-------- 4 files changed, 154 insertions(+), 184 deletions(-) -- 2.14.3 Reviewed-by: Peter Maydell diff --git a/target/arm/helper.h b/target/arm/helper.h index 5b6333347d..f9dd7432c1 100644 --- a/target/arm/helper.h +++ b/target/arm/helper.h @@ -539,17 +539,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 79fede35c1..d246e8f6b5 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -81,8 +81,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); /* Note that the gvec expanders operate on offsets + sizes. */ typedef void GVecGen2Fn(unsigned, uint32_t, uint32_t, uint32_t, uint32_t); @@ -556,6 +557,14 @@ static inline int vec_full_reg_size(DisasContext *s) return 128 / 8; } +/* 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). @@ -12455,8 +12464,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) { @@ -12490,18 +12500,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); } @@ -12518,8 +12524,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) { @@ -12558,23 +12564,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 @@ -12589,9 +12595,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); @@ -12625,13 +12631,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 490e120b0b..0c35c39069 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -1560,6 +1560,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 @@ -5614,6 +5621,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 @@ -5660,34 +5668,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; case NEON_3R_VPADD_VQRDMLAH: @@ -7238,8 +7246,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) @@ -7247,12 +7255,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: @@ -7260,13 +7268,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) { @@ -7280,15 +7288,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 Mon Dec 18 17:30:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 122281 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3142392qgn; Mon, 18 Dec 2017 10:01:04 -0800 (PST) X-Google-Smtp-Source: ACJfBovMm1MStDEoGzmHkSXwqiAM44hTUBHLHOXPBWdQygJUXDgpoJGSHrQgfPeXqVu4yIX4upox X-Received: by 10.37.124.71 with SMTP id x68mr529153ybc.278.1513620064113; Mon, 18 Dec 2017 10:01:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513620064; cv=none; d=google.com; s=arc-20160816; b=Ka2gLWksKRGZknwW1MNnjbXQGhEQeXhG3jaSV2mwMXqqnp2kQjNbZSlkcSZ+0WZNis b9ER/wSnX0b+GtiEeyOxJKYQGlIff01wXADgXE9qW+72XquQvGk3r9Hr+oE/NNZEeflU V8ARIctLaHv8toO2YnqgjM9GV14HACDi210mtLgcP0wlQdlPr6i7MFudAJiiMUgZ/LSW yKBXCmujUWzMBd31a28wYk6WtmoE7FqePHx+TQ6kMHFRa4kgUI2LGtiENf5kXUKb5InD yjVQJ4EhkVzyTJApgqdGRS3kJ6szACjnoR3fjXuM/BF77iXoAGWe1FrRIJHj5Nwan2zF TGBA== 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=Z9slflrqdu44S5FcR6VciGdSdyJ4Puo4CACj/wvVVL4=; b=ueDqsYHwzs8M1h58GxlgzBwOnLHuAaZF3iMC6FgbtRJq5Jq5QxOma8nrN+eSY2w8c5 fz6AoXfEEB7ozJUIT+PpAUw4DiCPVIn+5igjA6W8ZOQgNtIxoQQiFTdpN1IPasnojSQb IbbU6E5pFL5kerPfNQSbEls9YDs9sW9f/5CU9h3raLBnv2zDY4YoXEGdZGuJTTvzslI9 SwqISvIOv5c4tYpBjmdHCyUJdrfz5N68aVq4uDV+buzjQhq904+TYz36EaBf6Kt3nnmX kzoQ4YWQIs7s7EBihy/HrOqXVhk1rbOeWmww50G5liKvchPKARxu2mRjLTsG1ueCeXET vX/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=PdTTqyIK; 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 w139si2639332ybb.342.2017.12.18.10.01.04 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 18 Dec 2017 10:01: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=PdTTqyIK; 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]:59844 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQzip-0004sa-GE for patch@linaro.org; Mon, 18 Dec 2017 13:01:03 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44369) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQzFM-0002fJ-Ep for qemu-devel@nongnu.org; Mon, 18 Dec 2017 12:30:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eQzFH-0004fn-Ju for qemu-devel@nongnu.org; Mon, 18 Dec 2017 12:30:36 -0500 Received: from mail-pg0-x242.google.com ([2607:f8b0:400e:c05::242]:38663) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eQzFH-0004er-5S for qemu-devel@nongnu.org; Mon, 18 Dec 2017 12:30:31 -0500 Received: by mail-pg0-x242.google.com with SMTP id f12so9416295pgo.5 for ; Mon, 18 Dec 2017 09:30:31 -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=Z9slflrqdu44S5FcR6VciGdSdyJ4Puo4CACj/wvVVL4=; b=PdTTqyIKwqMAuAUK/Wfs9zaEfyrBaBeIGCzX7m1W4O1kp0DhHY1DQV2SmUy8z9GdVz XrRQ0UoygvvOgb7A2JXmLHN/g1zCfmPIm7wqX6ZejR+AISMRFmO93El5ilDN8OA2rzTy dikyoVMen7TQO3DOlwD2+rYwZ0freosWNSoEU= 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=Z9slflrqdu44S5FcR6VciGdSdyJ4Puo4CACj/wvVVL4=; b=MJ+Gsua72Jxy60J4zaw6/Aftlh/KLsmVRaY8QME+SmbRGz+heU0ay7CATzDXskGFgW TmTg1P1cH/IVzcyXQ3aHFhMJpf0CNSk3044+My15vSKr7jr6oGaDbv9pnB19vpczaWmK gWDP1vNltQ4cExXOuqffDEvVFbLuKE3zur/aH8CnFzFtZTkL7DWlzBCYTCI+fPTyCJCe 3VCZ0hnpgkFFsxj/2MkGeljTGvACRd+JRwMvpJshwJOSTpaDwmBv2c8jENiN71+G2nbw 20sq6/8PVz9FWS3dGvt9C/ICTkSxUnsIjq/jwR6s/toxg0lTf5s+EjAnm9g1ENBtud55 BAPQ== X-Gm-Message-State: AKGB3mIEW2hmvuuBidTU2XPWAnX9bCB08n0qw+QTqEkjvdCx4/SHKA0b okb9YhFK4pU6nqLHx+iGoGD8zCnN0Yg= X-Received: by 10.101.68.129 with SMTP id l1mr383764pgq.53.1513618229507; Mon, 18 Dec 2017 09:30:29 -0800 (PST) Received: from cloudburst.twiddle.net (174-21-7-63.tukw.qwest.net. [174.21.7.63]) by smtp.gmail.com with ESMTPSA id h69sm26553411pfe.107.2017.12.18.09.30.27 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Dec 2017 09:30:28 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 18 Dec 2017 09:30:16 -0800 Message-Id: <20171218173022.18418-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171218173022.18418-1-richard.henderson@linaro.org> References: <20171218173022.18418-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 3/9] 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, qemu-arm@nongnu.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[]. 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: Peter Maydell diff --git a/target/arm/helper.h b/target/arm/helper.h index f9dd7432c1..d39ca11cbd 100644 --- a/target/arm/helper.h +++ b/target/arm/helper.h @@ -528,16 +528,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 0c35c39069..68e928640f 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -4688,22 +4688,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(); @@ -4711,38 +4712,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(); @@ -4750,17 +4752,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 Mon Dec 18 17:30:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 122279 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3139169qgn; Mon, 18 Dec 2017 09:58:05 -0800 (PST) X-Google-Smtp-Source: ACJfBosZz02FUEqGezFzzBTxJq68A47NyIBGa4w4wQhQBDlPDKHNqMF3CEqoWuM0WQDTF77wKm/i X-Received: by 10.37.171.48 with SMTP id u45mr506600ybi.108.1513619885431; Mon, 18 Dec 2017 09:58:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513619885; cv=none; d=google.com; s=arc-20160816; b=u+8PzhuQujIiQiFyAv4LTMMNa/W/ERQ/amcx477aSw/qugDsPrVDEEJama/l80Qr7y 6/I2z2x291UaQ/RFepUAPzO3kVasNqxxwyDLP7eAznHg3B+3z8Y0Y43NvDcjHQPNaNSI 2OV1jUhaBdM7jHnzXmdrYvNq4lZrLNKcnZfafmV2u3KhxfCthCMwrrVN1TSOCLpfFJlR pjRJFysnXAnjwwkzYUjZikDR4MdcPcdhMeT35SYccxJv5aXCFyc51PWXCCqFO3vDkHe/ R5N8OIOQhbehbNEs4jmIYsbug0H4YZuWmPQTEJvb7LVNAbCK21sD//JDPw6nfw122OHR 394g== 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=w97zHg5wUthGNuq+jeq9m01tyUZWy6RWue7I9jUXJeY=; b=OrL16BoHI7ZUoSb4Lv0a9sEEIeszvrMZSmeB23ixxh2YmusW0qo2D11ghbI4PQ9tvm kPdBxRYH0/ucsNCar8+blVqJK/y72wU2uHOMwj83+WPkl+MGCW7rve0/r9sJxyWe6pfi 9aRv0g+eQ1uaBY5fVgCIybqiovxPZ177JotwMchc2QsDSo6m8LxreD2dpzlDAm43SIaj Oj5wbu/CwQ4HVCoMfV/Y6TKIdmdp6KXwu3wATiC/NZfOUW2eyM1wFzDJMYdZeKC5jBHd VSEzJXcZJG7wTx3bXWIQYc7IvfMGVwaYaY30hq3agT7FrufLTTwswCXA+vZ4mTv/VUWH Jumw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=brS4wGpI; 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 u123si2612904ybf.509.2017.12.18.09.58.05 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 18 Dec 2017 09:58:05 -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=brS4wGpI; 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]:59730 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQzfx-0002FY-07 for patch@linaro.org; Mon, 18 Dec 2017 12:58:05 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44330) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQzFL-0002da-61 for qemu-devel@nongnu.org; Mon, 18 Dec 2017 12:30:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eQzFJ-0004h5-7n for qemu-devel@nongnu.org; Mon, 18 Dec 2017 12:30:35 -0500 Received: from mail-pf0-x241.google.com ([2607:f8b0:400e:c00::241]:36814) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eQzFI-0004g3-Ds for qemu-devel@nongnu.org; Mon, 18 Dec 2017 12:30:32 -0500 Received: by mail-pf0-x241.google.com with SMTP id p84so9958320pfd.3 for ; Mon, 18 Dec 2017 09:30:32 -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=w97zHg5wUthGNuq+jeq9m01tyUZWy6RWue7I9jUXJeY=; b=brS4wGpInY67iIfHqFY4TgtdQY02Ugw6ZeQdRm8wRIl3Cxwf3SP5h7RuZvN38MJtEF DD47op3Sqyg07R7uN1ANE9ZJVYJgfI/YJsPw2E16VtzzMLuKmaPpK+r+ry5IqeGhxaDe jCpdq1M9SxeK6CiTFVOJbx6lUznJzPbQxTamg= 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=w97zHg5wUthGNuq+jeq9m01tyUZWy6RWue7I9jUXJeY=; b=s3cuT4dPOmmi+mCzDjdIDGX/wbeq6EwZvZvQ9aI31hDkJJYA5Ml/GErqxc9eQZ20ib I4MOX1gbWgFabCmUZtcM1BXZ3ozDXqBAKigaztGND4ffi4MQuJVEhK+3Mqz8sscZozCb 053EDlva3soupf/Rl8MXvE2ceBjVwlGYWQ+XmcZmcTEpBGXVxudA9b4WtOBP+csCK4fM zIgbpzVrqokdjjvgxTdM7uLG5R4KNMKnGR9q6GmfYKBSUDbKQTcK8gZpYCR98FtTlxjg l/B7hZz5YSTjIhJ4chuAQVbY8srk0fJhGJgA2JsSDRJtyaVV+3GP0wrz+0evO4FP6dGT yE1Q== X-Gm-Message-State: AKGB3mI0XwzkQTt8osg/Hmonv6mYDqjpgJfChUNJ268asW/A3Kq7JKo/ ZzdYGj4repODAO7IiS0Xa8UYzJMPVy8= X-Received: by 10.101.85.3 with SMTP id f3mr384392pgr.45.1513618231159; Mon, 18 Dec 2017 09:30:31 -0800 (PST) Received: from cloudburst.twiddle.net (174-21-7-63.tukw.qwest.net. [174.21.7.63]) by smtp.gmail.com with ESMTPSA id h69sm26553411pfe.107.2017.12.18.09.30.29 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Dec 2017 09:30:30 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 18 Dec 2017 09:30:17 -0800 Message-Id: <20171218173022.18418-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171218173022.18418-1-richard.henderson@linaro.org> References: <20171218173022.18418-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::241 Subject: [Qemu-devel] [PATCH 4/9] 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, qemu-arm@nongnu.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[]. 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: Peter Maydell diff --git a/target/arm/helper.h b/target/arm/helper.h index d39ca11cbd..206e39a207 100644 --- a/target/arm/helper.h +++ b/target/arm/helper.h @@ -201,7 +201,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 c2bb4f3a43..df3aab170b 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 68e928640f..55afd29b21 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -7623,9 +7623,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); @@ -7634,9 +7634,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 Mon Dec 18 17:30:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 122289 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3153546qgn; Mon, 18 Dec 2017 10:10:01 -0800 (PST) X-Google-Smtp-Source: ACJfBovIX1egLB9O39hUt8n6raXgHusLAoQPxDvbLg1ZzElV52hf/OLNYJwWTPYTKUSNBr9omVDv X-Received: by 10.129.82.79 with SMTP id g76mr521415ywb.94.1513620601352; Mon, 18 Dec 2017 10:10:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513620601; cv=none; d=google.com; s=arc-20160816; b=ta5D/0ar0au1e3HIT1+m1c/tl/L1g53tC/WdWQf7AYA7Ymk5uBTYc9Q0qLaJcfLOQY /wAqIrUeVYFZbwAcXMGWDEaCnq8GiFDL4A/EEgXaVuKEUr9PGMzHhXDyxhhP1SC1GQac S/neufUjjedBo8yloM9Na74NDC9QVJfGX/C9R2igq2+29NEBadtiss5GMkIxSTV8btre 4LJ44LluawUql2o2dal12TXYawwlxseq+A2Z590beWM8MkCgdhP1rNe5Vw+YCkGFop8x kI6o++hBUzVHTAGE5zFu8YN+uOsbKTK9+HnZkIeM56wrMn310VEXjopmwLjhLAS0ME4J JZiw== 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=FQf6glxcaldRv3XVm7caVixckARRsaMc5X+WPvrI+1Q=; b=Pl5CSePVtIGBCaskLifE5ix14L2jeNQfSyt9/amAVhgDWumhZ/FPZXXRKgqHGSr867 UmWvBE73eBXxLy1Nv/blle2kJfwLltFqXmywgRfJGvE+dz29HebNywy/RXoGIZ+YAF9d RJuHEXbR5aODl/gE9Mk0bhGrwjKPpTB/LZrS0DH/iyntUDNqs8BwTXu2yS/qOaOVE6TU GX7d/B4SWwNmDmkdQnifhqX64wN2qGMk6tF7WovyWzyu/ehcAv9Wr5OwSm1lwGY69lWA tMfVtQWIHreHoOrs7xGT5RsfzaWNmOi7kylJDqdykcLBfsRXn8dyrHceJinYv8hFXOgB tEzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Gjd2EjxW; 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 a6si2570704ybk.620.2017.12.18.10.10.01 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 18 Dec 2017 10:10: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=Gjd2EjxW; 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]:60205 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQzrU-0003wL-PN for patch@linaro.org; Mon, 18 Dec 2017 13:10:00 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44410) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQzFO-0002gV-W7 for qemu-devel@nongnu.org; Mon, 18 Dec 2017 12:30:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eQzFK-0004iI-Fq for qemu-devel@nongnu.org; Mon, 18 Dec 2017 12:30:38 -0500 Received: from mail-pl0-x241.google.com ([2607:f8b0:400e:c01::241]:33657) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eQzFK-0004hU-68 for qemu-devel@nongnu.org; Mon, 18 Dec 2017 12:30:34 -0500 Received: by mail-pl0-x241.google.com with SMTP id 1so3764049plv.0 for ; Mon, 18 Dec 2017 09:30:34 -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=FQf6glxcaldRv3XVm7caVixckARRsaMc5X+WPvrI+1Q=; b=Gjd2EjxW4VUsIGGnletlH6KD5vulAJhZ+eHORSEu5usSL7bipoTSvZsbC3uOxtq+H1 sE3MIJl/gx9isPpHjZrC2ID9f31uaWZeki55IMhOK+1N981v3Hrn2WCjp3Oer9AB4Qvr 0mNbzL/QzSI1QvZQGGuQxp/+jkRg5KJn4ahmw= 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=FQf6glxcaldRv3XVm7caVixckARRsaMc5X+WPvrI+1Q=; b=Yofix0W/SAK6qVQHAvqI5p6KURoH6WNo2RpdBtSGYDrOEPC5W4XYbjZbJmoiDO/8nj LY5dpU6RLtn1F4fc2Ehz7kyT+dvoaMQxo2GQxfugku/WYyjEFjxNFCPfbVxqPE09ODW3 FuT388X84/1Laty7IP8FXj2J05RhrMJXDYBoe09Wshi3JQr188ZyIpypldtbTEbn4gAg +zbbldr5tAXz5jJRWqpxvZhF20KZsLnflvfEStrZ7EsHkP93jJe9PFZ4bXecG5cLEO+/ k3TBkBHNrHjFelKiNRHLQi7+vUm/R+0OgL53KNCsn55gHDwKV2Ti55ymAg1DK4h54PaE JMjA== X-Gm-Message-State: AKGB3mLzIJXIY51vRTEOzVA9VxZQtLzP5gCYZXklzPmGA39abHx4ZF/7 DEf+HXjbNTMyrMp49hohs/s/HEK7SKU= X-Received: by 10.159.255.71 with SMTP id u7mr451945pls.376.1513618232606; Mon, 18 Dec 2017 09:30:32 -0800 (PST) Received: from cloudburst.twiddle.net (174-21-7-63.tukw.qwest.net. [174.21.7.63]) by smtp.gmail.com with ESMTPSA id h69sm26553411pfe.107.2017.12.18.09.30.31 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Dec 2017 09:30:31 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 18 Dec 2017 09:30:18 -0800 Message-Id: <20171218173022.18418-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171218173022.18418-1-richard.henderson@linaro.org> References: <20171218173022.18418-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:c01::241 Subject: [Qemu-devel] [PATCH 5/9] target/arm: Add aa32_vfp_dreg/aa64_vfp_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, qemu-arm@nongnu.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 | 20 +++++++++++++++++++- linux-user/signal.c | 22 ++++++++++++---------- target/arm/arch_dump.c | 8 +++++--- target/arm/helper-a64.c | 13 +++++++------ target/arm/helper.c | 32 ++++++++++++++++++++------------ target/arm/kvm32.c | 4 ++-- target/arm/kvm64.c | 31 ++++++++++--------------------- target/arm/machine.c | 2 +- target/arm/translate-a64.c | 25 ++++++++----------------- target/arm/translate.c | 16 +++++++++------- 10 files changed, 93 insertions(+), 80 deletions(-) -- 2.14.3 diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 7a705a09a1..e1a8e2880d 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -493,7 +493,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] QEMU_ALIGNED(16); + uint64_t regs[64] QEMU_ALIGNED(16); uint32_t xregs[16]; /* We store these fpcsr fields separately for convenience. */ @@ -2899,4 +2899,22 @@ 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]; +} + +/** + * aa64_vfp_dreg: + * 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 cf35473671..a9a3f41721 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); @@ -1899,7 +1901,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); @@ -2206,7 +2208,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 9e5b2fb31c..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, float64_val(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, float64_val(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 0bcf02eeb5..750a088803 100644 --- a/target/arm/helper-a64.c +++ b/target/arm/helper-a64.c @@ -146,20 +146,21 @@ uint64_t HELPER(simd_tbl)(CPUARMState *env, uint64_t result, uint64_t indices, * the table starts, and numregs the number of registers in the table. * We return the results of the lookups. */ - int shift; + unsigned shift; for (shift = 0; shift < 64; shift += 8) { - int index = extract64(indices, shift, 8); + unsigned index = extract64(indices, shift, 8); 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); + unsigned elt = (rn * 2 + (index >> 3)) % 64; + unsigned bitidx = (index & 7) * 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 02d1b57501..7f304111f0 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) { - stfq_le_p(buf, env->vfp.regs[reg]); + stfq_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) { - stfq_le_p(buf, env->vfp.regs[(reg - 32) * 2]); - stfq_le_p(buf + 8, env->vfp.regs[(reg - 32) * 2 + 1]); + uint64_t *q = aa32_vfp_dreg(env, (reg - 32) * 2); + stfq_le_p(buf, q[0]); + stfq_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] = ldfq_le_p(buf); + *aa32_vfp_dreg(env, reg) = ldfq_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); + uint64_t *q = aa32_vfp_dreg(env, (reg - 32) * 2); + q[0] = ldfq_le_p(buf); + q[1] = ldfq_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 */ - stfq_le_p(buf, env->vfp.regs[reg * 2]); - stfq_le_p(buf + 8, env->vfp.regs[reg * 2 + 1]); - return 16; + { + uint64_t *q = aa64_vfp_qreg(env, reg); + stfq_le_p(buf, q[0]); + stfq_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] = ldfq_le_p(buf); - env->vfp.regs[reg * 2 + 1] = ldfq_le_p(buf + 8); - return 16; + { + uint64_t *q = aa64_vfp_qreg(env, reg); + q[0] = ldfq_le_p(buf); + q[1] = ldfq_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/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 d246e8f6b5..e17c7269d4 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -170,15 +170,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]); - 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]); - 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)); @@ -572,19 +569,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 55afd29b21..a93e26498e 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -1516,14 +1516,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; } } @@ -12770,7 +12772,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 = *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 Mon Dec 18 17:30:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 122308 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3187176qgn; Mon, 18 Dec 2017 10:43:56 -0800 (PST) X-Google-Smtp-Source: ACJfBosi7eNCCay2lror2HgVaKAsOe776POuVX1JH2nIEWhpohkvXP5ZCEK1uWOUYmoyqGCNaxQr X-Received: by 10.37.186.11 with SMTP id t11mr595773ybg.487.1513622636890; Mon, 18 Dec 2017 10:43:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513622636; cv=none; d=google.com; s=arc-20160816; b=Hj98UW6h9hfbvzocYZtcQw8/KXHAF1rdoqM0d18D2uHpO40YCXxwRRwRx++r6k0Mt1 yaIzfOZ4UXTig+twWK6PrLduXyE0EgAOa/JcjOaLLimj5JKMqt8HE+XAj+G1S5UOYCCD Q6mZIqkmaPPZFf0+QvGrG0fzimMd6p77ucsRp4IpCu6gxSUs0+befpRvUlqgdJ8lYtDx a9I1WtPhDoQ20vHq5CmjTd2e7CibQ4c2kfZja7iCfZQnSerrJvQKv/uPd1o1OjaM37q5 qHgqrrf1rDnhVY1uN9EogPGubQ5S5e6SxFanWzKneyRXJ1TZ9JO0H19Tls7URCxOVDLD uSQg== 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=ENRXS9h8V/c69uI8RDsb604KEPZbwbCQK6rOp4tGF+0=; b=qcvcPy37dau9z0nsAm+XbK10ADT4rGT00PZR+uDC8cKr9gozJ65VGif6BaYHBVJes4 RYqdgRxtLApYS70qSD9qKMkG/xuFk5jFmvQgvrfEaUXEnENDEQqsPTnM9NPoFtVziTT9 Holzp23dMHqYAUrW2ffyuti0FS/7cqimj7YYWnz4qoXvzIBgx1bMyLyz/IKkQVnxle1g AEn579GQrvK/2mUzyRGFRjltJyjIiwMO/Kr4aolBF9DmFL7YHdo5p8rxWg96A8cxsk02 bEghC1EQnc3bRWy1gXwcYx7u/gRDv8GhMoTWRWE+MJpK6w0N8Y42nHwbxCXXNmfpU5EF aIBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=GAI0lLCO; 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 x15si2540051ywj.361.2017.12.18.10.43.56 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 18 Dec 2017 10:43:56 -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=GAI0lLCO; 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]:52324 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eR0OK-0008AG-Bh for patch@linaro.org; Mon, 18 Dec 2017 13:43:56 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44403) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQzFO-0002gU-JF for qemu-devel@nongnu.org; Mon, 18 Dec 2017 12:30:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eQzFL-0004jj-IA for qemu-devel@nongnu.org; Mon, 18 Dec 2017 12:30:38 -0500 Received: from mail-pl0-x244.google.com ([2607:f8b0:400e:c01::244]:34488) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eQzFL-0004il-BB for qemu-devel@nongnu.org; Mon, 18 Dec 2017 12:30:35 -0500 Received: by mail-pl0-x244.google.com with SMTP id d21so5210906pll.1 for ; Mon, 18 Dec 2017 09:30:35 -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=ENRXS9h8V/c69uI8RDsb604KEPZbwbCQK6rOp4tGF+0=; b=GAI0lLCOJPGQ20OkTy+kPEmjC6D0i+/r+6wETWvkL4Tnb47Mwr7tDySVTpoj9/bosB 8Ep2inBB7qL9Xl2GrR8sNyQwGnXEQ1p/8V7cfzJnCyLcJv6pX1kMKAUnzcoalvzERjhh iPMruL9kjq+zWEO4HsJ4yVhW2I3iAItHULw5s= 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=ENRXS9h8V/c69uI8RDsb604KEPZbwbCQK6rOp4tGF+0=; b=o+8k08swVS9bS0fIkpEQpoWMtORhw0KF0KC0XBRwQWMz1tlR+uCCCGwpeOls7ANy6A nf/ECf+ATjhDZhIuxe9RCORXajM0tFVVI5JOVkbV1pzB2urb9xf7EQ5Ju5XWnvhGcak3 Q9KwbhFUunT4Muncjpx0tyyyiIP95zsa84K9Aj7fg3NporDZpoHxIvDNIi8zIlaO9hPP ksGLddNCJ1lJlzWlML/kbPk0TEw0NgcFvrLatlAmOYktS51Aa+Knf+M7il1TRu6dBoPl 844W1pS9IJyTB+XOEIvjyvAsb360b6ZKxre4VfNVtfukkWJTOYFmaYT5QPRPkkFbBZC3 WvMw== X-Gm-Message-State: AKGB3mKL+SwBrr9g6jsTrss2zhz04/MlaoteNbr8AzhHqvt3IZHZwPDj kMpZV1e5hz+lGzFE2DilHxCPsalE+xU= X-Received: by 10.159.196.130 with SMTP id c2mr434568plo.123.1513618234037; Mon, 18 Dec 2017 09:30:34 -0800 (PST) Received: from cloudburst.twiddle.net (174-21-7-63.tukw.qwest.net. [174.21.7.63]) by smtp.gmail.com with ESMTPSA id h69sm26553411pfe.107.2017.12.18.09.30.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Dec 2017 09:30:33 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 18 Dec 2017 09:30:19 -0800 Message-Id: <20171218173022.18418-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171218173022.18418-1-richard.henderson@linaro.org> References: <20171218173022.18418-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:c01::244 Subject: [Qemu-devel] [PATCH 6/9] 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, qemu-arm@nongnu.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. Signed-off-by: Richard Henderson --- include/migration/vmstate.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) -- 2.14.3 Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Peter Maydell 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 Mon Dec 18 17:30:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 122285 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3147225qgn; Mon, 18 Dec 2017 10:04:31 -0800 (PST) X-Google-Smtp-Source: ACJfBotSeRsrjwibKfxc8/RwxSpyo1pP0bMrvxfUHz+0DgBxdnQraSrvvD9E7O2y/4VK8dkPLc2o X-Received: by 10.13.221.133 with SMTP id g127mr473039ywe.125.1513620271052; Mon, 18 Dec 2017 10:04:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513620271; cv=none; d=google.com; s=arc-20160816; b=mXd4YGOH6oDJ/oqYKuJytpyOWuVqXaGFPqjwbGIvnkFaRDHNA0dLxzwRuPSYPwr/3E 4WN1gkxpLhAALhDiJnmAT1CkX1BZ5detfe6XRhGDAeF7GZMlA1Il41tbfAGJ9MCQqpVK CXrQtmi36eYLArbt76fyeq6vNnjmqpKiNHWq5FnREk0bKf2HgJ2fOHAkpp3RDcvqHdqB Ivdblnayzu7rOuccUOopN3XO6NVSGJl06naESiMBQKDGvT9wt45+0Hz7eKp6trJ1LRge vbyeF+uwpchDsw/rqfRrEbmPFcl0zRwXghUSznA7frTuk7kNPrGrWrVFASAbdlS7kKa7 0rsQ== 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=rXxxF9Yz0b20U9CO8JKna+xOxWBVcEYLOBmHvJ+JsMs=; b=RHZ95W7yUdtrELev9SWMs1boFGGmePxS0E0A9bN+I9wDDel+QT8ER6gE9UI0bsZtRW FCwsfSuDK7C7Hiq7X9T218w9qgSyhCBdTr7ZcDebOom02jwV+O0GLqHPUGlAC0xsXdpN MtzYiSvYcU1JNoUegckQe6eeaOZwhNuOeK77mVSEr705MJRqlpDZ8SdPPBZeg9JjjSlw Y63PaFNn3WKTKsVfPd5WmnB7h7p1B4Duy6PbJtKXvzHH22VPxkTBRhBVm8ssI3tN22+v FV5aaQLd23IDCm2nkrNT9FAGoj0f7IM2IWRgiYXNJkL3/gjUKdLWSv68MyyEaPRdvlfU rsWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=WArk4NjT; 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 e189si2479562ywc.433.2017.12.18.10.04.30 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 18 Dec 2017 10:04:31 -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=WArk4NjT; 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]:60147 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQzmA-0008AY-Gq for patch@linaro.org; Mon, 18 Dec 2017 13:04:30 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44433) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQzFP-0002ga-Ki for qemu-devel@nongnu.org; Mon, 18 Dec 2017 12:30:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eQzFN-0004kh-5A for qemu-devel@nongnu.org; Mon, 18 Dec 2017 12:30:39 -0500 Received: from mail-pl0-x242.google.com ([2607:f8b0:400e:c01::242]:46598) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eQzFM-0004kB-Rz for qemu-devel@nongnu.org; Mon, 18 Dec 2017 12:30:37 -0500 Received: by mail-pl0-x242.google.com with SMTP id i6so5222753plt.13 for ; Mon, 18 Dec 2017 09:30:36 -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=rXxxF9Yz0b20U9CO8JKna+xOxWBVcEYLOBmHvJ+JsMs=; b=WArk4NjT8ABI49gI39Jv833fF/nr3hiD2IP3+VXu+/vN8zEbk5FyF6z2U6uxZBun+U 82PF3lQDX3gmfmyKxjGF7SaRq4F4mpKdC2wsWkojBdlnRlaNK6sVu6Eoa7PKfAJVtoQy XskLvI+MoJ1I10e4i/CFtzeoz3prMs1VYhFDU= 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=rXxxF9Yz0b20U9CO8JKna+xOxWBVcEYLOBmHvJ+JsMs=; b=GCMtZ42tpum8X16Z4gej4gmoeX/POXRecqIM+CgosZbKlA4/iUbaK5tVz0IzVHpIKv xWiLRMeJglguFU1aW34CtxI/WwWFUWxxtGeSfN2KcFkz+IDyEaBFsfkf/uWD/X3DWiPB 4xHHuhCpAXe3xJSl+E2UwrhdK0JYOpHGqzGUKEBe2jwKbHJTpzJnpE7sgIiBlcPtjBbP hU9+FHyjNlgdnrs5wC+Na4dajcSCXjrTctixD9C/owwdUB10RXERC2ki1Jal79ebPfVz qMViKr2IJ5jsupaDAxNfrv5GcjRqo3VX5w2WdL4NGGdkkNn1nX9XYJAS2HEPCwxvb0D6 3Axw== X-Gm-Message-State: AKGB3mIwdX2/snYVNNCFr9mWJU9W+XfvuumTguvJnT0GnIV2N/7J39pV y/6vpHJGGUA9h1ztTGq6AeWpVMIcHW0= X-Received: by 10.159.245.145 with SMTP id a17mr452166pls.276.1513618235393; Mon, 18 Dec 2017 09:30:35 -0800 (PST) Received: from cloudburst.twiddle.net (174-21-7-63.tukw.qwest.net. [174.21.7.63]) by smtp.gmail.com with ESMTPSA id h69sm26553411pfe.107.2017.12.18.09.30.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Dec 2017 09:30:34 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 18 Dec 2017 09:30:20 -0800 Message-Id: <20171218173022.18418-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171218173022.18418-1-richard.henderson@linaro.org> References: <20171218173022.18418-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:c01::242 Subject: [Qemu-devel] [PATCH 7/9] 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, qemu-arm@nongnu.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. Add vfp.pregs as an ARMPredicateReg. Let FFR be P16 to make it easier to treat it as for any other predicate. Signed-off-by: Richard Henderson --- target/arm/cpu.h | 64 ++++++++++++++++++++++++++++++++-------------- target/arm/machine.c | 37 ++++++++++++++++++++++++++- target/arm/translate-a64.c | 8 +++--- target/arm/translate.c | 12 ++++----- 4 files changed, 90 insertions(+), 31 deletions(-) -- 2.14.3 diff --git a/target/arm/cpu.h b/target/arm/cpu.h index e1a8e2880d..150b0d9d84 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -153,6 +153,47 @@ 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 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. */ uint32_t regs[16]; @@ -477,23 +518,8 @@ 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 - * Hn = regs[2n] bits 15..0 for even n, and bits 31..16 for odd n - * 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] QEMU_ALIGNED(16); + ARMVectorReg zregs[32]; + ARMPredicateReg pregs[17]; /* ffr is pregs[16] */ uint32_t xregs[16]; /* We store these fpcsr fields separately for convenience. */ @@ -2905,7 +2931,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]; } /** @@ -2914,7 +2940,7 @@ static inline uint64_t *aa32_vfp_dreg(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..39f3123b10 100644 --- a/target/arm/machine.c +++ b/target/arm/machine.c @@ -50,7 +50,42 @@ 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. */ + /* TODO: store the other quadwords in another subsection, + along with predicate registers and ZCR_EL[1-3]. */ + 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 e17c7269d4..487408a7a7 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -523,8 +523,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. @@ -534,7 +534,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; } @@ -543,7 +543,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 the byte size of the "whole" vector register, VL / 8. */ diff --git a/target/arm/translate.c b/target/arm/translate.c index a93e26498e..7a5e493333 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -1513,19 +1513,17 @@ 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 r = offsetof(CPUARMState, vfp.zregs[reg >> 2].d[(reg >> 1) & 1]); if (reg & 1) { - ofs += offsetof(CPU_DoubleU, l.upper); + return r + offsetof(CPU_DoubleU, l.upper); } else { - ofs += offsetof(CPU_DoubleU, l.lower); + return r + offsetof(CPU_DoubleU, l.lower); } - return ofs; } } From patchwork Mon Dec 18 17:30:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 122290 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3154092qgn; Mon, 18 Dec 2017 10:10:35 -0800 (PST) X-Google-Smtp-Source: ACJfBosU4HCMoSukb/xp5n5vdm2SQhJORnSvW9wOVPaJpdYuQ1fWFpC6S8XgJkjG0qPS2MvaiMd1 X-Received: by 10.37.44.17 with SMTP id s17mr540860ybs.266.1513620634970; Mon, 18 Dec 2017 10:10:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513620634; cv=none; d=google.com; s=arc-20160816; b=s6M/3Pxi4hB8/g82Cdw4IdiKMjFyHlDimpo5rCsIcsppRC418blLt5g08LYA7wqwQZ 6vrDc5KkAhfxo85cDt2mYXXf6fjy7joRq7KTHW3BWiWQyCm7WwzB7r7dLQaRBu4rlq/w kSvHKiIblwFZ5y5pUPXjL1akJ+mCXpxT4XDD4pfxfAkgucmD6JP0DsjXhNHAANs93Y6g +tVCzIyopoEKSvogroZgfb0dRz0BXJH+Mn8HD/iGqI7R6Dk9tCGStTk0Yo/3iuXlgLOQ eR8A2fyu9CSsMa4Ck0a/Oz/bkfR+RjlnISO9T7fotOg4YG5PnYgg6GEfgX8VfRgf7FUq sZRA== 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=uZn8DyBSzzAyRqStKhwVrbUlyvDwb/10aZ4fIRI9/8o=; b=Tritl4EFSA9ldhlN+Pta8P8qEJ6xLBab1mNNd/6W9BqwIEmO3xLYIyJEeG6nt2JPQ5 i07wDtJGuBcGzVLTGaM+4clmcdqENHT/FdeMifXdFsXFsnOkDFaZC9dAFeyWs40ptywY x/BcEmqJiIAw8bnuwyBQxfYSKtM5uSo8g9DutLkeTwWiStnRNlhNnWz11Mm+4Q9s0aDk y6yjtKASCmDsDQX4Y8+uswjCWY84y/aXN6E5Y0FmKDOd5piQ/ovIUiW/5YFQHuhwL5Y8 5mNLkE51/2pKJZHgR+EfOep6tMOEolklWiglvlNzcAkLtd/oRir4j6lvPugdFT0bdGp/ k5vQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=ZvX+jBJA; 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 x82si2488000ywa.47.2017.12.18.10.10.34 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 18 Dec 2017 10:10:34 -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=ZvX+jBJA; 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]:60215 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQzs2-0005rJ-7y for patch@linaro.org; Mon, 18 Dec 2017 13:10:34 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44458) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQzFQ-0002hk-Ho for qemu-devel@nongnu.org; Mon, 18 Dec 2017 12:30:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eQzFO-0004lR-HM for qemu-devel@nongnu.org; Mon, 18 Dec 2017 12:30:40 -0500 Received: from mail-pl0-x243.google.com ([2607:f8b0:400e:c01::243]:40289) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eQzFO-0004l6-8e for qemu-devel@nongnu.org; Mon, 18 Dec 2017 12:30:38 -0500 Received: by mail-pl0-x243.google.com with SMTP id 62so3775023pld.7 for ; Mon, 18 Dec 2017 09:30:38 -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=uZn8DyBSzzAyRqStKhwVrbUlyvDwb/10aZ4fIRI9/8o=; b=ZvX+jBJAekmsbFR0JUqf561EvUbUs5IzqsJ2WSO0WYrXndql9hHgFPoNirRrgaSYWu gPXH21RaxvhPfgIR5fMVjJXlgIbsO3tBd6oJa2f6SvFXrHFhD7uuQvbT74ocs4HEwJjd 713W7pVOZlczRVQo9O2N3/3T4PWOmwtwwQeSM= 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=uZn8DyBSzzAyRqStKhwVrbUlyvDwb/10aZ4fIRI9/8o=; b=doqKi+2hBluhI0oqlMTuKimnhMu4NhzvKLATHgPWXDs8AHNnyAP+xdT27UrnMcIYyv ttq4284OcIa7i+bu+g0A4f40N3Uhl30QVBxXclahNlgLqq3PsSG/HZmv77qbTnd8y/mX 3GqNeZJ4RXYCGfo2tnh0QhqB0AMEJjbhSfMM9AsTdlKB8NiefKuGW1F+Tgph5Ck9EXJN u0wPnUTUGZ6sF1dm7qO9c6aTTKMbQ4Zq1ghHzTqkHDPJ1Ln2Qnrok4Xgh6pCvKcUzFFX y4NsHdexpiCeLjiTg89yaSCXBeGRUqIhbzboD12QGj8ccnDXuc9+dhaWHRab4+fVInH5 LosA== X-Gm-Message-State: AKGB3mK6EjUo4fuhpV+uQ7eyqEek7E7sbx3/2nxYttdbBnF2F1392H60 ssDW5678Mah9xkchls6ANGKGEsimybQ= X-Received: by 10.84.168.101 with SMTP id e92mr456140plb.34.1513618236944; Mon, 18 Dec 2017 09:30:36 -0800 (PST) Received: from cloudburst.twiddle.net (174-21-7-63.tukw.qwest.net. [174.21.7.63]) by smtp.gmail.com with ESMTPSA id h69sm26553411pfe.107.2017.12.18.09.30.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Dec 2017 09:30:35 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 18 Dec 2017 09:30:21 -0800 Message-Id: <20171218173022.18418-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171218173022.18418-1-richard.henderson@linaro.org> References: <20171218173022.18418-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:c01::243 Subject: [Qemu-devel] [PATCH 8/9] target/arm: Add ZCR.LEN 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, qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This has a stub(-ish) implementation of ZCR, in that it does not implement _EL[123], or wire up the system register properly. However, it is enough for CONFIG_USER_ONLY. We will need VQ in tb->flags in order to pass the true vector size to the generic vector expanders. Signed-off-by: Richard Henderson --- target/arm/cpu.h | 48 ++++++++++++++++++++++++++++++---------------- target/arm/translate.h | 1 + target/arm/cpu.c | 2 ++ target/arm/translate-a64.c | 5 ++--- 4 files changed, 37 insertions(+), 19 deletions(-) -- 2.14.3 diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 150b0d9d84..37b8cef2e2 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -553,6 +553,12 @@ typedef struct CPUARMState { float_status fp_status; float_status fp_status_f16; float_status standard_fp_status; + + /* TODO: For system mode, represent all of zcr_el{1,2,3}. + * In the meantime, the composite value exposed to el0. + * Only the low 4 bits are defined, and set via syscall. + */ + uint32_t zcr_el; } vfp; uint64_t exclusive_addr; uint64_t exclusive_val; @@ -2649,6 +2655,8 @@ 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_ZCR_LEN_SHIFT 2 /* Composite ZCR_EL1/2/3.LEN */ +#define ARM_TBFLAG_ZCR_LEN_MASK (0xfull << ARM_TBFLAG_ZCR_LEN_SHIFT) /* some convenience accessor macros */ #define ARM_TBFLAG_AARCH64_STATE(F) \ @@ -2685,6 +2693,8 @@ static inline bool arm_cpu_data_is_big_endian(CPUARMState *env) (((F) & ARM_TBFLAG_TBI0_MASK) >> ARM_TBFLAG_TBI0_SHIFT) #define ARM_TBFLAG_TBI1(F) \ (((F) & ARM_TBFLAG_TBI1_MASK) >> ARM_TBFLAG_TBI1_SHIFT) +#define ARM_TBFLAG_ZCR_LEN(F) \ + (((F) & ARM_TBFLAG_ZCR_LEN_MASK) >> ARM_TBFLAG_ZCR_LEN_SHIFT) static inline bool bswap_code(bool sctlr_b) { @@ -2818,34 +2828,39 @@ 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) + 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); + /* Get SVE vector length */ + flags |= ((env->vfp.zcr_el << ARM_TBFLAG_ZCR_LEN_SHIFT) + & ARM_TBFLAG_ZCR_LEN_MASK); } 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: @@ -2855,26 +2870,27 @@ static inline 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; } diff --git a/target/arm/translate.h b/target/arm/translate.h index 3f4df91e5e..2b0a2d7aa6 100644 --- a/target/arm/translate.h +++ b/target/arm/translate.h @@ -34,6 +34,7 @@ typedef struct DisasContext { bool vfp_enabled; /* FP enabled via FPSCR.EN */ int vec_len; int vec_stride; + int sve_len; /* SVE vector length in bytes */ bool v7m_handler_mode; bool v8m_secure; /* true if v8M and we're in Secure mode */ /* Immediate value in AArch32 SVC insn; must be set if is_jmp == DISAS_SWI diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 6cd8ae1459..10b68ea16f 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -149,6 +149,8 @@ static void arm_cpu_reset(CPUState *s) env->cp15.sctlr_el[1] |= SCTLR_UCT | SCTLR_UCI | SCTLR_DZE; /* and to the FP/Neon instructions */ env->cp15.cpacr_el1 = deposit64(env->cp15.cpacr_el1, 20, 2, 3); + /* Set the SVE vector length to maximum. */ + env->vfp.zcr_el = ARM_MAX_VQ - 1; #else /* Reset into the highest available EL */ if (arm_feature(env, ARM_FEATURE_EL3)) { diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 487408a7a7..ecb72e4d9c 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -549,9 +549,7 @@ static inline int vec_full_reg_offset(DisasContext *s, int regno) /* Return the byte size of the "whole" vector register, VL / 8. */ static inline int vec_full_reg_size(DisasContext *s) { - /* FIXME SVE: We should put the composite ZCR_EL* value into tb->flags. - In the meantime this is just the AdvSIMD length of 128. */ - return 128 / 8; + return s->sve_len; } /* Return a newly allocated pointer to the vector register. */ @@ -12771,6 +12769,7 @@ static int aarch64_tr_init_disas_context(DisasContextBase *dcbase, dc->fp_excp_el = ARM_TBFLAG_FPEXC_EL(dc->base.tb->flags); dc->vec_len = 0; dc->vec_stride = 0; + dc->sve_len = (ARM_TBFLAG_ZCR_LEN(dc->base.tb->flags) + 1) * 16; dc->cp_regs = arm_cpu->cp_regs; dc->features = env->features; From patchwork Mon Dec 18 17:30:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 122292 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3161518qgn; Mon, 18 Dec 2017 10:17:48 -0800 (PST) X-Google-Smtp-Source: ACJfBosO38xoDsCYxUzPbvZLT09giXfMIzUgyggcIAfX4Jg/4+fFS3TTYNX7bEuhoWAkL0deSxBv X-Received: by 10.37.15.137 with SMTP id 131mr558877ybp.301.1513621068163; Mon, 18 Dec 2017 10:17:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513621068; cv=none; d=google.com; s=arc-20160816; b=oiXzsmF8ObhKbT7oizOLncsQuVgrs3tNmnNARUsSTfpftW4NMQLOkA3l85029TAd8F Wume9ZYIeFkXqvpoR6zjrljGGdWv3LR+1HLrCPGPcQL4cmPlGlA2XBEUXp64U7ScyPTb nM6TPrCZXEdnvQviUogtXJANsj3h2/IcOwfbe0kzDsct9LK0eu4UCC5BsUcihrfxBwB+ mS4hrnWF9uvtVZZbxG3G1XwznwdSH/UgyAuebJ68iGnFMuw4l9d7zwPOvj9iEITgcOLl mKmJIpjr4Z16OZalOkiu7nzILnQUHxJAJGi3V3dxq2HiZN6GXzwgAmHRcgXdR3bYqTXz xcOQ== 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=805GdzO1VDtAQUydyknMqA/OvRmWH/xy6j89TGjAx5A=; b=OaQYUBevEs8PIG1cD47aJYLmXg41xo5C6PQ4ejpkHkYN2oBJ22SVJ3qQSnro2HWxr0 PU2QFc4Dthec5efhbfSF370QBNgzJ/SKSWDjKdsEUBofGuAqQw12crP1gSsht1G6QQru PPaEuHILHoTENcTLytin2vLvo0ueuATMm3XOjTCKNKGgZHGh2NQZuIvSLRFEoFEYfVCX ksoPGAsoxNh7IY+skfSyg1oNXWhb3zxpftbQBu8+ttlUb3wa8SUKkEvwXkYI/dXS1yrU m+Z8V/3PORn1v+18yqFcOFQDMfOwbqeoNmJEZv0kwC5wyPrJhe+IcREAPbl5BSwKEvFp TNOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=dvm1M93C; 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 x185si956348ybe.780.2017.12.18.10.17.48 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 18 Dec 2017 10:17: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=dvm1M93C; 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]:60604 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQzz1-0003b2-N4 for patch@linaro.org; Mon, 18 Dec 2017 13:17:47 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44470) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQzFR-0002is-AM for qemu-devel@nongnu.org; Mon, 18 Dec 2017 12:30:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eQzFQ-0004nO-3z for qemu-devel@nongnu.org; Mon, 18 Dec 2017 12:30:41 -0500 Received: from mail-pl0-x244.google.com ([2607:f8b0:400e:c01::244]:45035) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eQzFP-0004mK-U6 for qemu-devel@nongnu.org; Mon, 18 Dec 2017 12:30:40 -0500 Received: by mail-pl0-x244.google.com with SMTP id n13so5214239plp.11 for ; Mon, 18 Dec 2017 09:30:39 -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=805GdzO1VDtAQUydyknMqA/OvRmWH/xy6j89TGjAx5A=; b=dvm1M93CeFiDdGVTBCWJsVaK/emysmW9pKrQjS78cFwisrVN5ve8SmrgJTNXOvhwqH zqBEjBZu34Dr7Ye5mdzZh8s8znn8hY61Pofm1oByb7tBO/en+pnkxor4o+F4kki4Q3X0 pSLnDFyz9S5xTxUxIDsHn1SjcnLJktKzXtK9Y= 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=805GdzO1VDtAQUydyknMqA/OvRmWH/xy6j89TGjAx5A=; b=gSVk0kPSlA96BZibIMQtapogIFPKLe4tvBUOgr4RBbhnp91IA6OtKJSMuPTjAfArSm ikaDyOgMWb5q1DLJ/GdW1WpJXUSIi5oWmt8s/sPvU28ZL+2FesCNI/Z6jejspd/J+9rg ZAsKke8r8GJPyzTgMOZm9OAYW+vU/Asma7yYA3faaoqXp3viJ0cVGkYp7yXhOs/dfWHv zYIj+MILEgxXWwbhon+/2e5DapbiTJH0X3C0PRplWFZLrWHhc7z5jUNLmF2mlCToQXuH G8xkWCNyZgEfu2uTSHEBbzdTCL8/FlD0uQi8fQbi/ablJqdm/ppXHE2QyfJHPLRk6Fng 0/mQ== X-Gm-Message-State: AKGB3mJ1CUHkhLH6wWzqWZfc88kn4Tk5MsBox/88/QcTy0XSUAdKLTSe VPNEW9E7Eo+5EwTeN2mtiTLtC1io2c4= X-Received: by 10.159.230.3 with SMTP id u3mr442740plq.2.1513618238582; Mon, 18 Dec 2017 09:30:38 -0800 (PST) Received: from cloudburst.twiddle.net (174-21-7-63.tukw.qwest.net. [174.21.7.63]) by smtp.gmail.com with ESMTPSA id h69sm26553411pfe.107.2017.12.18.09.30.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Dec 2017 09:30:37 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 18 Dec 2017 09:30:22 -0800 Message-Id: <20171218173022.18418-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171218173022.18418-1-richard.henderson@linaro.org> References: <20171218173022.18418-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:c01::244 Subject: [Qemu-devel] [PATCH 9/9] 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, qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Enable it for the "any" CPU used by aarch64-linux-user. Signed-off-by: Richard Henderson --- target/arm/cpu.h | 1 + target/arm/cpu64.c | 1 + 2 files changed, 2 insertions(+) -- 2.14.3 diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 37b8cef2e2..652e00d957 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -1386,6 +1386,7 @@ enum arm_features { ARM_FEATURE_V8_1_SIMD, /* has ARMv8.1-SIMD */ ARM_FEATURE_V8_FP16, /* implements v8.2 half-precision float */ ARM_FEATURE_V8_FCMA, /* has complex number part of v8.3 extensions. */ + ARM_FEATURE_SVE, /* has SVE extension */ }; static inline int arm_feature(CPUARMState *env, int feature) diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index 43b42f95fd..366ab2eeee 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -229,6 +229,7 @@ static void aarch64_any_initfn(Object *obj) set_feature(&cpu->env, ARM_FEATURE_V8_1_SIMD); set_feature(&cpu->env, ARM_FEATURE_V8_FP16); set_feature(&cpu->env, ARM_FEATURE_V8_FCMA); + set_feature(&cpu->env, ARM_FEATURE_SVE); cpu->ctr = 0x80038003; /* 32 byte I and D cacheline size, VIPT icache */ cpu->dcz_blocksize = 7; /* 512 bytes */ }