From nobody Tue Nov 4 18:42:09 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1530545045219814.3176904559112; Mon, 2 Jul 2018 08:24:05 -0700 (PDT) Received: from localhost ([::1]:33511 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fa0gJ-0005Qq-8v for importer@patchew.org; Mon, 02 Jul 2018 11:23:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48766) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fa0Tr-00047L-8Q for qemu-devel@nongnu.org; Mon, 02 Jul 2018 11:11:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fa0To-0007ve-Gb for qemu-devel@nongnu.org; Mon, 02 Jul 2018 11:11:07 -0400 Received: from mail-pl0-x22d.google.com ([2607:f8b0:400e:c01::22d]:35517) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fa0To-0007v2-An for qemu-devel@nongnu.org; Mon, 02 Jul 2018 11:11:04 -0400 Received: by mail-pl0-x22d.google.com with SMTP id k1-v6so8099958plt.2 for ; Mon, 02 Jul 2018 08:11:04 -0700 (PDT) Received: from localhost (g90.124-44-6.ppp.wakwak.ne.jp. [124.44.6.90]) by smtp.gmail.com with ESMTPSA id q77-v6sm44327351pfk.152.2018.07.02.08.11.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 02 Jul 2018 08:11:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=BpXhKplcmVzaEgYPHqOAQOcTQDA7dzSkA3kbaZ3R+rw=; b=pzzVBlXNg9ATc2Q/woK5UySSDlCXcOgBBnUmhvZuTuIwdQl5ix1qP32zleCmJbxBNC w0G1rhW60Y1nHXkasW6bKQjrev/9Suy4jsYeW8G95me7W05gyZuwcxhpWUvgRaEDB4dP IOGcle1ceRlgpR20qdW1VhTTAwScg6EuVkd2nUlYH07iRSL3bG6dSr5UM8G1bSOCRCWN hXLPVnw4WmMuEHMphBZuQNeHLQ7vLD55aTjOWtvoujJjNJFP4f6QmBUi+V21bUu2vAeD m/Ma2dCrsQ3fbZ9ZyW5nQcDcr1oBg3vcT7BwlONT07ydCjhvDMR3X5tCGfwFJLwPLxeo 20IA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BpXhKplcmVzaEgYPHqOAQOcTQDA7dzSkA3kbaZ3R+rw=; b=g8mpOFI6+RknFd6gAFZulJZS+hhU9AkjQmLLRQHjB0NiPYsWJXg19ihYn9lax9VG9i rsdxRNjkry6Pas97jbSOfbA2PNKNjXUofpljrPfqCrASoexOiifRGyvSbQaPMrkMqSCI kSoo0kSOQcGbMsdQ00lYMSV8XVhXCxNK2UZKVDnvgUbgTUuHPPaA7HO221c1E9tKswAt jITjdOk0RG924hHQ6JXDuczZYZvunBsA0gei5jxUK+Ry+dB5elaDyAB+3fpCj7ejMpw5 9d7SdbjhqG8uZkZvhEFwFmSmTvSc0/xn25eMOU3vQqkYiGYCM4zLY56m0+DF0+eN5SMx zlgw== X-Gm-Message-State: APt69E1LBnUACKrp7GpIKJQf0S/TarFg1hFb86idGvVeeMv0k2KJn/D1 FsFYmFDUkxafj1cSIDEIGF0igDus X-Google-Smtp-Source: AAOMgpdz6AQU4tQ94QL4ZG8E6bq1ofI/Kx2X16DDvgqYHUVaO8OzYqw7dFlOpKQSrMNu3xUWXcaWBw== X-Received: by 2002:a17:902:7e43:: with SMTP id a3-v6mr25495382pln.151.1530544263594; Mon, 02 Jul 2018 08:11:03 -0700 (PDT) From: Stafford Horne To: Peter Maydell Date: Tue, 3 Jul 2018 00:10:08 +0900 Message-Id: <20180702151023.24532-11-shorne@gmail.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180702151023.24532-1-shorne@gmail.com> References: <20180702151023.24532-1-shorne@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::22d Subject: [Qemu-devel] [PULL v2 10/25] target/openrisc: Form the spr index from tcg 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: Stafford Horne , Richard Henderson , QEMU Development Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Richard Henderson Rather than pass base+offset to the helper, pass the full index. In most cases the base is r0 and optimization yields a constant. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson Signed-off-by: Stafford Horne --- target/openrisc/helper.h | 4 ++-- target/openrisc/sys_helper.c | 9 +++------ target/openrisc/translate.c | 16 +++++++++------- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/target/openrisc/helper.h b/target/openrisc/helper.h index e37dabc77a..9db9bf3963 100644 --- a/target/openrisc/helper.h +++ b/target/openrisc/helper.h @@ -56,5 +56,5 @@ FOP_CMP(le) DEF_HELPER_FLAGS_1(rfe, 0, void, env) =20 /* sys */ -DEF_HELPER_FLAGS_4(mtspr, 0, void, env, tl, tl, tl) -DEF_HELPER_FLAGS_4(mfspr, TCG_CALL_NO_WG, tl, env, tl, tl, tl) +DEF_HELPER_FLAGS_3(mtspr, 0, void, env, tl, tl) +DEF_HELPER_FLAGS_3(mfspr, TCG_CALL_NO_WG, tl, env, tl, tl) diff --git a/target/openrisc/sys_helper.c b/target/openrisc/sys_helper.c index 2f337363ec..2c959f63f4 100644 --- a/target/openrisc/sys_helper.c +++ b/target/openrisc/sys_helper.c @@ -27,13 +27,11 @@ =20 #define TO_SPR(group, number) (((group) << 11) + (number)) =20 -void HELPER(mtspr)(CPUOpenRISCState *env, - target_ulong ra, target_ulong rb, target_ulong offset) +void HELPER(mtspr)(CPUOpenRISCState *env, target_ulong spr, target_ulong r= b) { #ifndef CONFIG_USER_ONLY OpenRISCCPU *cpu =3D openrisc_env_get_cpu(env); CPUState *cs =3D CPU(cpu); - int spr =3D (ra | offset); int idx; =20 switch (spr) { @@ -202,13 +200,12 @@ void HELPER(mtspr)(CPUOpenRISCState *env, #endif } =20 -target_ulong HELPER(mfspr)(CPUOpenRISCState *env, - target_ulong rd, target_ulong ra, uint32_t offs= et) +target_ulong HELPER(mfspr)(CPUOpenRISCState *env, target_ulong rd, + target_ulong spr) { #ifndef CONFIG_USER_ONLY OpenRISCCPU *cpu =3D openrisc_env_get_cpu(env); CPUState *cs =3D CPU(cpu); - int spr =3D (ra | offset); int idx; =20 switch (spr) { diff --git a/target/openrisc/translate.c b/target/openrisc/translate.c index 59605aacca..64b5e84630 100644 --- a/target/openrisc/translate.c +++ b/target/openrisc/translate.c @@ -865,9 +865,10 @@ static bool trans_l_mfspr(DisasContext *dc, arg_l_mfsp= r *a, uint32_t insn) if (is_user(dc)) { gen_illegal_exception(dc); } else { - TCGv_i32 ti =3D tcg_const_i32(a->k); - gen_helper_mfspr(cpu_R[a->d], cpu_env, cpu_R[a->d], cpu_R[a->a], t= i); - tcg_temp_free_i32(ti); + TCGv spr =3D tcg_temp_new(); + tcg_gen_ori_tl(spr, cpu_R[a->a], a->k); + gen_helper_mfspr(cpu_R[a->d], cpu_env, cpu_R[a->d], spr); + tcg_temp_free(spr); } return true; } @@ -877,7 +878,7 @@ static bool trans_l_mtspr(DisasContext *dc, arg_l_mtspr= *a, uint32_t insn) if (is_user(dc)) { gen_illegal_exception(dc); } else { - TCGv_i32 ti; + TCGv spr; =20 /* For SR, we will need to exit the TB to recognize the new * exception state. For NPC, in theory this counts as a branch @@ -892,9 +893,10 @@ static bool trans_l_mtspr(DisasContext *dc, arg_l_mtsp= r *a, uint32_t insn) } dc->base.is_jmp =3D DISAS_EXIT; =20 - ti =3D tcg_const_i32(a->k); - gen_helper_mtspr(cpu_env, cpu_R[a->a], cpu_R[a->b], ti); - tcg_temp_free_i32(ti); + spr =3D tcg_temp_new(); + tcg_gen_ori_tl(spr, cpu_R[a->a], a->k); + gen_helper_mtspr(cpu_env, spr, cpu_R[a->b]); + tcg_temp_free(spr); } return true; } --=20 2.17.0