From patchwork Tue Dec 18 06:38:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 154109 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp3363221ljp; Mon, 17 Dec 2018 23:05:10 -0800 (PST) X-Google-Smtp-Source: AFSGD/XCwg8UCqaam+KklU8OcxjY1iTe3QJW5CSyAHxdN4aqvEfA3jQUBJ1vP31zfMvAfPE4U6S7 X-Received: by 2002:a37:bb82:: with SMTP id l124mr14044667qkf.188.1545116710311; Mon, 17 Dec 2018 23:05:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545116710; cv=none; d=google.com; s=arc-20160816; b=wi+oe2l/Xh1H5oJwhfF8BLG8/wk9EZ3+ACF7VHLD3fx1DX2qD3qZ7B+K52TNs2HGyF tqpzCx0aDY8mImSkXkg554fUA4ZLGV6faCyFK7+7pr1f7l2hRwWW7fCXVqUjHl2Rpuui y/e0W6/zGYPCG3WBOJJEek+uAK1VLZMvufos+n1WzO1Ku0sfJrdr4A+fIfCq9vcGScSv Vm6sfkbcx/XZqTqt9XsTHbNy/pS6sH9EKEcaOpFIewJYDy4gR97ZElyqZQwfv7HgNJ56 jZ2khDB7TKjZe/kmYboJ/jwrGHdS/JwS11QUMeVbNHUtWnblLLKmvzUht7HLY64NCKFX W0Rw== 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; bh=NU3R4FxI/x9lyPAEtypuA7Q9inpm7VB8r05LGRTMWNo=; b=fyOr0mFxmjI+9KCuzP+BJqgTJG6jjvchswW3Lg/6frQbzYnbHq3mYF1hQoANx55Gq1 qABVZeit7bCQvW8LzWcofpr4bFYA/sM8CvrEKQNOhpMgg04cr8F55yPpex4DndIFfSLm wxL6/6Woe7adjL7Yx+r5DeilEDA9eYQ2elAYJ8Jqbut9vCgqPNq11wfG6GXWe8e4I6Zr eoHgy9ces/IDcLa0UcM3kuhn86LsKwIr1/48u9QYJgbpLWvk/09qK5SilMy2xzzX3asI zvrrJBaZqzNhcJi+NYgd1alysqEs0QVHT3PG+uXl85dzHIaCtSHn1MKQi4LfuT5exd9+ EbKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=XACLYAdN; 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 i20si7190945qkh.98.2018.12.17.23.05.10 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 17 Dec 2018 23:05:10 -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=XACLYAdN; 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]:52174 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ9RF-0005jF-SO for patch@linaro.org; Tue, 18 Dec 2018 02:05:09 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53086) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ92y-0001j6-SK for qemu-devel@nongnu.org; Tue, 18 Dec 2018 01:40:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZ92s-0002tR-Ix for qemu-devel@nongnu.org; Tue, 18 Dec 2018 01:40:04 -0500 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]:35001) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gZ92s-00027p-0S for qemu-devel@nongnu.org; Tue, 18 Dec 2018 01:39:58 -0500 Received: by mail-pf1-x432.google.com with SMTP id z9so7657936pfi.2 for ; Mon, 17 Dec 2018 22:39:33 -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=NU3R4FxI/x9lyPAEtypuA7Q9inpm7VB8r05LGRTMWNo=; b=XACLYAdNu62Uqa+Lleee1xo63ruywpwwqPSE12DtkbLFcWyrHwrsXcFL911ZNcsdhK kVBSROoGetIRG5LWSpbMdzlXFjDeLCKWEQ2CVyAzTBBgYEvA21RbthdxJY/RwX+1X6FR cCriGRn8/JJTrSN6VyRYZNeYP2KB873ihNEvc= 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=NU3R4FxI/x9lyPAEtypuA7Q9inpm7VB8r05LGRTMWNo=; b=nqa2hLXSD2LJY6IhnBXXo97mV5uf8wbOJ3SIoOrgBIUWW8aMZHR3Ay/LJrpZrAGveq CO0XzQaRssdCCeTVPp4x/CpInUHY+b2WQ5GHQOd3RUtCWcX4Vymg1y8JzDIEdXaa78HX XW8Yfi7Vmf9K9uSHuGvXTLkGr/5ai41vmbAm0aROYryqNDuiiuTcSPDy8AgK8S6nq0vI ItUBjJI0v37p1ljCmYUrZe0HQrtUOzHkEpbxFu36xKGn4mO6cT8Z5PQ9GTKgUnofGuK9 1uITb8JmR47SGF9hxh6f/QR6LMbgCCsiBfi7EhV1LY4ZnzsnfekLYC3WcTOKfGo6tTwm d2uQ== X-Gm-Message-State: AA+aEWa8sdOGj2zBFbtpNHXOiX2/tUtD4fgu0Ekrzlwe0nSLRf8jufyq zCktsb6YxLHXLGNDlDsYgrmocrOjVEY= X-Received: by 2002:a62:a510:: with SMTP id v16mr15484837pfm.18.1545115172094; Mon, 17 Dec 2018 22:39:32 -0800 (PST) Received: from cloudburst.twiddle.net (97-126-115-157.tukw.qwest.net. [97.126.115.157]) by smtp.gmail.com with ESMTPSA id c7sm27072509pfh.18.2018.12.17.22.39.30 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 Dec 2018 22:39:31 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 17 Dec 2018 22:38:51 -0800 Message-Id: <20181218063911.2112-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181218063911.2112-1-richard.henderson@linaro.org> References: <20181218063911.2112-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::432 Subject: [Qemu-devel] [PATCH 14/34] target/ppc: switch FPR, VMX and VSX helpers to access data directly from cpu_env 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: qemu-ppc@nongnu.org, mark.cave-ayland@ilande.co.uk, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Mark Cave-Ayland Instead of accessing the FPR, VMX and VSX registers through static arrays of TCGv_i64 globals, remove them and change the helpers to load/store data directly within cpu_env. Signed-off-by: Mark Cave-Ayland Reviewed-by: Richard Henderson Message-Id: <20181217122405.18732-6-mark.cave-ayland@ilande.co.uk> --- target/ppc/translate.c | 59 ++++++++--------------------- target/ppc/translate/vsx-impl.inc.c | 4 +- 2 files changed, 18 insertions(+), 45 deletions(-) -- 2.17.2 Acked-by: David Gibson diff --git a/target/ppc/translate.c b/target/ppc/translate.c index fa3e8dc114..5923c688cd 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -55,15 +55,9 @@ /* global register indexes */ static char cpu_reg_names[10*3 + 22*4 /* GPR */ + 10*4 + 22*5 /* SPE GPRh */ - + 10*4 + 22*5 /* FPR */ - + 2*(10*6 + 22*7) /* AVRh, AVRl */ - + 10*5 + 22*6 /* VSR */ + 8*5 /* CRF */]; static TCGv cpu_gpr[32]; static TCGv cpu_gprh[32]; -static TCGv_i64 cpu_fpr[32]; -static TCGv_i64 cpu_avrh[32], cpu_avrl[32]; -static TCGv_i64 cpu_vsr[32]; static TCGv_i32 cpu_crf[8]; static TCGv cpu_nip; static TCGv cpu_msr; @@ -108,39 +102,6 @@ void ppc_translate_init(void) offsetof(CPUPPCState, gprh[i]), p); p += (i < 10) ? 4 : 5; cpu_reg_names_size -= (i < 10) ? 4 : 5; - - snprintf(p, cpu_reg_names_size, "fp%d", i); - cpu_fpr[i] = tcg_global_mem_new_i64(cpu_env, - offsetof(CPUPPCState, fpr[i]), p); - p += (i < 10) ? 4 : 5; - cpu_reg_names_size -= (i < 10) ? 4 : 5; - - snprintf(p, cpu_reg_names_size, "avr%dH", i); -#ifdef HOST_WORDS_BIGENDIAN - cpu_avrh[i] = tcg_global_mem_new_i64(cpu_env, - offsetof(CPUPPCState, avr[i].u64[0]), p); -#else - cpu_avrh[i] = tcg_global_mem_new_i64(cpu_env, - offsetof(CPUPPCState, avr[i].u64[1]), p); -#endif - p += (i < 10) ? 6 : 7; - cpu_reg_names_size -= (i < 10) ? 6 : 7; - - snprintf(p, cpu_reg_names_size, "avr%dL", i); -#ifdef HOST_WORDS_BIGENDIAN - cpu_avrl[i] = tcg_global_mem_new_i64(cpu_env, - offsetof(CPUPPCState, avr[i].u64[1]), p); -#else - cpu_avrl[i] = tcg_global_mem_new_i64(cpu_env, - offsetof(CPUPPCState, avr[i].u64[0]), p); -#endif - p += (i < 10) ? 6 : 7; - cpu_reg_names_size -= (i < 10) ? 6 : 7; - snprintf(p, cpu_reg_names_size, "vsr%d", i); - cpu_vsr[i] = tcg_global_mem_new_i64(cpu_env, - offsetof(CPUPPCState, vsr[i]), p); - p += (i < 10) ? 5 : 6; - cpu_reg_names_size -= (i < 10) ? 5 : 6; } cpu_nip = tcg_global_mem_new(cpu_env, @@ -6696,22 +6657,34 @@ GEN_TM_PRIV_NOOP(trechkpt); static inline void get_fpr(TCGv_i64 dst, int regno) { - tcg_gen_mov_i64(dst, cpu_fpr[regno]); + tcg_gen_ld_i64(dst, cpu_env, offsetof(CPUPPCState, fpr[regno])); } static inline void set_fpr(int regno, TCGv_i64 src) { - tcg_gen_mov_i64(cpu_fpr[regno], src); + tcg_gen_st_i64(src, cpu_env, offsetof(CPUPPCState, fpr[regno])); } static inline void get_avr64(TCGv_i64 dst, int regno, bool high) { - tcg_gen_mov_i64(dst, (high ? cpu_avrh : cpu_avrl)[regno]); +#ifdef HOST_WORDS_BIGENDIAN + tcg_gen_ld_i64(dst, cpu_env, offsetof(CPUPPCState, + avr[regno].u64[(high ? 0 : 1)])); +#else + tcg_gen_ld_i64(dst, cpu_env, offsetof(CPUPPCState, + avr[regno].u64[(high ? 1 : 0)])); +#endif } static inline void set_avr64(int regno, TCGv_i64 src, bool high) { - tcg_gen_mov_i64((high ? cpu_avrh : cpu_avrl)[regno], src); +#ifdef HOST_WORDS_BIGENDIAN + tcg_gen_st_i64(src, cpu_env, offsetof(CPUPPCState, + avr[regno].u64[(high ? 0 : 1)])); +#else + tcg_gen_st_i64(src, cpu_env, offsetof(CPUPPCState, + avr[regno].u64[(high ? 1 : 0)])); +#endif } #include "translate/fp-impl.inc.c" diff --git a/target/ppc/translate/vsx-impl.inc.c b/target/ppc/translate/vsx-impl.inc.c index e9a05d66f7..20e1fd9324 100644 --- a/target/ppc/translate/vsx-impl.inc.c +++ b/target/ppc/translate/vsx-impl.inc.c @@ -2,12 +2,12 @@ static inline void get_vsr(TCGv_i64 dst, int n) { - tcg_gen_mov_i64(dst, cpu_vsr[n]); + tcg_gen_ld_i64(dst, cpu_env, offsetof(CPUPPCState, vsr[n])); } static inline void set_vsr(int n, TCGv_i64 src) { - tcg_gen_mov_i64(cpu_vsr[n], src); + tcg_gen_st_i64(src, cpu_env, offsetof(CPUPPCState, vsr[n])); } static inline void get_cpu_vsrh(TCGv_i64 dst, int n)