From patchwork Wed Sep 4 20:44:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 173083 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp459333ilq; Wed, 4 Sep 2019 14:28:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqyEgCYrTHLdfynLzsQisMZW+OvsA8Qc8r9fyjJP8zPDH2wYOErizyBrpla8qtn7kb/XU0dh X-Received: by 2002:a37:2f05:: with SMTP id v5mr42221842qkh.143.1567632500263; Wed, 04 Sep 2019 14:28:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567632500; cv=none; d=google.com; s=arc-20160816; b=eC4uyQ6ENd9FppkT84XzEBIbTPBn+Srv+M/xI9ZzB9QKH8BqOtHvz1MLmFiA5/Mor5 SMPwYVrwMSe0CaTc1Cqz5/SgcF/bP5GiSVY4vFwruRsoWfL3Kl5DmadN5lryQ4+pegzo LiUq+uu36jwzSGewdbInfmJrDXto0J9QKQ0vv816+caoUARbvjBXnmHiKumlsu4o0HHW 3KUMTNhlhcm1Jcojbr6Hc13LS5W5xc92SXcf097dmcjwRl/8qcofIKhughTdYWFzDujk nPiONHc8HxL3ekSaYpIJBQzYGBPc2os/5rFMaL+M/vtsSXB2zk2rJszZdf1U8OOINKSd H6uQ== 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=ahxD9fosMvb1g5phzerFB+P0cZoPHlkyqtQ2Wc64cSg=; b=rwFQPCiwErH+Q6ojwqzj4GR3h0jZLIH8QSuhfPkkS3kt+LQgO2R9Lm5uyZ1XzHPC1Q Eo7bdPCJr4LCnue++TV+1OsKBNtLENKnpqKVHtP7RpnhmDV1N2+MDNpO1eG6fiCqYl+0 1EqVYW0Fs+NBrGGcydxYUWziWN0Wx/ORbyy+KofM2ojRYR2TtaBkya/ul/+c+sX+Re4r d5jLXelX0sfVUyQrZ3d66aDXuDevriAYiR2FO8kSZ3SOAps3FKwAaH6PclS3IrTizQYf X2AK4tyvmusA/NGTFgpifLnoT1oYWt/RaTgR2dSmJYLDBNRIYbL3Ql2YRx1xo6qYlghe evzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=fQ9FYqH0; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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. [209.51.188.17]) by mx.google.com with ESMTPS id t10si2294163qtt.302.2019.09.04.14.28.19 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 04 Sep 2019 14:28:20 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=fQ9FYqH0; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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]:40176 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5cp9-00013N-5o for patch@linaro.org; Wed, 04 Sep 2019 17:28:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52772) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5c9S-0005zq-Jz for qemu-devel@nongnu.org; Wed, 04 Sep 2019 16:45:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5c9Q-0006fU-4I for qemu-devel@nongnu.org; Wed, 04 Sep 2019 16:45:14 -0400 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]:38780) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i5c9P-0006f0-SB for qemu-devel@nongnu.org; Wed, 04 Sep 2019 16:45:12 -0400 Received: by mail-pf1-x442.google.com with SMTP id h195so36729pfe.5 for ; Wed, 04 Sep 2019 13:45:11 -0700 (PDT) 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=ahxD9fosMvb1g5phzerFB+P0cZoPHlkyqtQ2Wc64cSg=; b=fQ9FYqH0+U7b2+59Xv0YlyCWmlmeVKSyKcAKW+mIO17JQL4fX7nyAh7Z7BJkBbTtb/ KlSgoGbFQBU3zmyx78NTo0bKVaG5SZZKVSjasbysVpXjAle8ai5UIRWppS5d1truVhlL vpRvkTYyI+ISAEA9Ni1c28nAACxWclFvPe5wO7osJTpsBBRl5c55LSpmTFPEyBi7a+2g dFQK0dGFRS9iljNoPCTPXwTQ6a74LC9ZT1Yb9tyLOdCJz2C/bcNM46MjKj8HNcF1jvx4 s0s8zY98+Qtxeyww/Xo+OsxOFhJb8WypaaRClK4WzJekivVbQNIzurcwjCdeKuuKl0pD lrYQ== 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=ahxD9fosMvb1g5phzerFB+P0cZoPHlkyqtQ2Wc64cSg=; b=CcKNdCoeqh7N9U9GCaWOskDtKJpeWmdsR38mApjGMTmrEi0G+owOyN3Ld0maPiDSgE t4rNqoqCIrEPMFd1qC3HiudLnZBoU3EgLguZG7KXqn3fymZ1yhNfsiVUYESOh4NCtFR9 rMVMOFo96fA9FOraIADK1vEogdKcs9LIndUKNIJb7sE/FB5qWyKEYbzOC5KK45deFsjJ QCkKcgmmKKWX4UAXhOOTyfuZnNWMaDeXwKEh3VreQum8ac3s+vquXuIjjJjRYg0hNIWB AaVZ7Gxvi5yIK9mGqqXZdnpeUlJqZMBS6bvatI9lV8t8jaqeFrjccinv/HqdOsNrthDQ CLWw== X-Gm-Message-State: APjAAAWwOl/VNfEGmyA4b5Kgkuwoa0yapFKDylIyM+eQPYeHMF48cwAh HQ3/pNJNRbCe4LyTysqCaQ31wMpETi4= X-Received: by 2002:a62:e80e:: with SMTP id c14mr47206pfi.4.1567629910311; Wed, 04 Sep 2019 13:45:10 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id n66sm8104610pfn.90.2019.09.04.13.45.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2019 13:45:09 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 4 Sep 2019 13:44:55 -0700 Message-Id: <20190904204507.32457-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190904204507.32457-1-richard.henderson@linaro.org> References: <20190904204507.32457-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::442 Subject: [Qemu-devel] [PULL 01/13] target/openrisc: Add DisasContext parameter to check_r0_write X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We will need this context in the next patch. Reviewed-by: Stafford Horne Signed-off-by: Richard Henderson --- target/openrisc/translate.c | 96 +++++++++++++++++++------------------ 1 file changed, 49 insertions(+), 47 deletions(-) -- 2.17.1 diff --git a/target/openrisc/translate.c b/target/openrisc/translate.c index b189c506c5..8d72edf9b7 100644 --- a/target/openrisc/translate.c +++ b/target/openrisc/translate.c @@ -163,14 +163,16 @@ static void check_ov64s(DisasContext *dc) } #endif*/ -/* We're about to write to REG. On the off-chance that the user is - writing to R0, re-instate the architectural register. */ -#define check_r0_write(reg) \ - do { \ - if (unlikely(reg == 0)) { \ - cpu_R[0] = cpu_R0; \ - } \ - } while (0) +/* + * We're about to write to REG. On the off-chance that the user is + * writing to R0, re-instate the architectural register. + */ +static void check_r0_write(DisasContext *dc, int reg) +{ + if (unlikely(reg == 0)) { + cpu_R[0] = cpu_R0; + } +} static void gen_ove_cy(DisasContext *dc) { @@ -436,98 +438,98 @@ static void gen_msbu(DisasContext *dc, TCGv srca, TCGv srcb) static bool trans_l_add(DisasContext *dc, arg_dab *a) { - check_r0_write(a->d); + check_r0_write(dc, a->d); gen_add(dc, cpu_R[a->d], cpu_R[a->a], cpu_R[a->b]); return true; } static bool trans_l_addc(DisasContext *dc, arg_dab *a) { - check_r0_write(a->d); + check_r0_write(dc, a->d); gen_addc(dc, cpu_R[a->d], cpu_R[a->a], cpu_R[a->b]); return true; } static bool trans_l_sub(DisasContext *dc, arg_dab *a) { - check_r0_write(a->d); + check_r0_write(dc, a->d); gen_sub(dc, cpu_R[a->d], cpu_R[a->a], cpu_R[a->b]); return true; } static bool trans_l_and(DisasContext *dc, arg_dab *a) { - check_r0_write(a->d); + check_r0_write(dc, a->d); tcg_gen_and_tl(cpu_R[a->d], cpu_R[a->a], cpu_R[a->b]); return true; } static bool trans_l_or(DisasContext *dc, arg_dab *a) { - check_r0_write(a->d); + check_r0_write(dc, a->d); tcg_gen_or_tl(cpu_R[a->d], cpu_R[a->a], cpu_R[a->b]); return true; } static bool trans_l_xor(DisasContext *dc, arg_dab *a) { - check_r0_write(a->d); + check_r0_write(dc, a->d); tcg_gen_xor_tl(cpu_R[a->d], cpu_R[a->a], cpu_R[a->b]); return true; } static bool trans_l_sll(DisasContext *dc, arg_dab *a) { - check_r0_write(a->d); + check_r0_write(dc, a->d); tcg_gen_shl_tl(cpu_R[a->d], cpu_R[a->a], cpu_R[a->b]); return true; } static bool trans_l_srl(DisasContext *dc, arg_dab *a) { - check_r0_write(a->d); + check_r0_write(dc, a->d); tcg_gen_shr_tl(cpu_R[a->d], cpu_R[a->a], cpu_R[a->b]); return true; } static bool trans_l_sra(DisasContext *dc, arg_dab *a) { - check_r0_write(a->d); + check_r0_write(dc, a->d); tcg_gen_sar_tl(cpu_R[a->d], cpu_R[a->a], cpu_R[a->b]); return true; } static bool trans_l_ror(DisasContext *dc, arg_dab *a) { - check_r0_write(a->d); + check_r0_write(dc, a->d); tcg_gen_rotr_tl(cpu_R[a->d], cpu_R[a->a], cpu_R[a->b]); return true; } static bool trans_l_exths(DisasContext *dc, arg_da *a) { - check_r0_write(a->d); + check_r0_write(dc, a->d); tcg_gen_ext16s_tl(cpu_R[a->d], cpu_R[a->a]); return true; } static bool trans_l_extbs(DisasContext *dc, arg_da *a) { - check_r0_write(a->d); + check_r0_write(dc, a->d); tcg_gen_ext8s_tl(cpu_R[a->d], cpu_R[a->a]); return true; } static bool trans_l_exthz(DisasContext *dc, arg_da *a) { - check_r0_write(a->d); + check_r0_write(dc, a->d); tcg_gen_ext16u_tl(cpu_R[a->d], cpu_R[a->a]); return true; } static bool trans_l_extbz(DisasContext *dc, arg_da *a) { - check_r0_write(a->d); + check_r0_write(dc, a->d); tcg_gen_ext8u_tl(cpu_R[a->d], cpu_R[a->a]); return true; } @@ -536,7 +538,7 @@ static bool trans_l_cmov(DisasContext *dc, arg_dab *a) { TCGv zero; - check_r0_write(a->d); + check_r0_write(dc, a->d); zero = tcg_const_tl(0); tcg_gen_movcond_tl(TCG_COND_NE, cpu_R[a->d], cpu_sr_f, zero, cpu_R[a->a], cpu_R[a->b]); @@ -546,7 +548,7 @@ static bool trans_l_cmov(DisasContext *dc, arg_dab *a) static bool trans_l_ff1(DisasContext *dc, arg_da *a) { - check_r0_write(a->d); + check_r0_write(dc, a->d); tcg_gen_ctzi_tl(cpu_R[a->d], cpu_R[a->a], -1); tcg_gen_addi_tl(cpu_R[a->d], cpu_R[a->d], 1); return true; @@ -554,7 +556,7 @@ static bool trans_l_ff1(DisasContext *dc, arg_da *a) static bool trans_l_fl1(DisasContext *dc, arg_da *a) { - check_r0_write(a->d); + check_r0_write(dc, a->d); tcg_gen_clzi_tl(cpu_R[a->d], cpu_R[a->a], TARGET_LONG_BITS); tcg_gen_subfi_tl(cpu_R[a->d], TARGET_LONG_BITS, cpu_R[a->d]); return true; @@ -562,28 +564,28 @@ static bool trans_l_fl1(DisasContext *dc, arg_da *a) static bool trans_l_mul(DisasContext *dc, arg_dab *a) { - check_r0_write(a->d); + check_r0_write(dc, a->d); gen_mul(dc, cpu_R[a->d], cpu_R[a->a], cpu_R[a->b]); return true; } static bool trans_l_mulu(DisasContext *dc, arg_dab *a) { - check_r0_write(a->d); + check_r0_write(dc, a->d); gen_mulu(dc, cpu_R[a->d], cpu_R[a->a], cpu_R[a->b]); return true; } static bool trans_l_div(DisasContext *dc, arg_dab *a) { - check_r0_write(a->d); + check_r0_write(dc, a->d); gen_div(dc, cpu_R[a->d], cpu_R[a->a], cpu_R[a->b]); return true; } static bool trans_l_divu(DisasContext *dc, arg_dab *a) { - check_r0_write(a->d); + check_r0_write(dc, a->d); gen_divu(dc, cpu_R[a->d], cpu_R[a->a], cpu_R[a->b]); return true; } @@ -671,7 +673,7 @@ static bool trans_l_lwa(DisasContext *dc, arg_load *a) { TCGv ea; - check_r0_write(a->d); + check_r0_write(dc, a->d); ea = tcg_temp_new(); tcg_gen_addi_tl(ea, cpu_R[a->a], a->i); tcg_gen_qemu_ld_tl(cpu_R[a->d], ea, dc->mem_idx, MO_TEUL); @@ -685,7 +687,7 @@ static void do_load(DisasContext *dc, arg_load *a, MemOp mop) { TCGv ea; - check_r0_write(a->d); + check_r0_write(dc, a->d); ea = tcg_temp_new(); tcg_gen_addi_tl(ea, cpu_R[a->a], a->i); tcg_gen_qemu_ld_tl(cpu_R[a->d], ea, dc->mem_idx, mop); @@ -798,7 +800,7 @@ static bool trans_l_addi(DisasContext *dc, arg_rri *a) { TCGv t0; - check_r0_write(a->d); + check_r0_write(dc, a->d); t0 = tcg_const_tl(a->i); gen_add(dc, cpu_R[a->d], cpu_R[a->a], t0); tcg_temp_free(t0); @@ -809,7 +811,7 @@ static bool trans_l_addic(DisasContext *dc, arg_rri *a) { TCGv t0; - check_r0_write(a->d); + check_r0_write(dc, a->d); t0 = tcg_const_tl(a->i); gen_addc(dc, cpu_R[a->d], cpu_R[a->a], t0); tcg_temp_free(t0); @@ -820,7 +822,7 @@ static bool trans_l_muli(DisasContext *dc, arg_rri *a) { TCGv t0; - check_r0_write(a->d); + check_r0_write(dc, a->d); t0 = tcg_const_tl(a->i); gen_mul(dc, cpu_R[a->d], cpu_R[a->a], t0); tcg_temp_free(t0); @@ -839,28 +841,28 @@ static bool trans_l_maci(DisasContext *dc, arg_l_maci *a) static bool trans_l_andi(DisasContext *dc, arg_rrk *a) { - check_r0_write(a->d); + check_r0_write(dc, a->d); tcg_gen_andi_tl(cpu_R[a->d], cpu_R[a->a], a->k); return true; } static bool trans_l_ori(DisasContext *dc, arg_rrk *a) { - check_r0_write(a->d); + check_r0_write(dc, a->d); tcg_gen_ori_tl(cpu_R[a->d], cpu_R[a->a], a->k); return true; } static bool trans_l_xori(DisasContext *dc, arg_rri *a) { - check_r0_write(a->d); + check_r0_write(dc, a->d); tcg_gen_xori_tl(cpu_R[a->d], cpu_R[a->a], a->i); return true; } static bool trans_l_mfspr(DisasContext *dc, arg_l_mfspr *a) { - check_r0_write(a->d); + check_r0_write(dc, a->d); if (is_user(dc)) { gen_illegal_exception(dc); @@ -927,42 +929,42 @@ static bool trans_l_msbu(DisasContext *dc, arg_ab *a) static bool trans_l_slli(DisasContext *dc, arg_dal *a) { - check_r0_write(a->d); + check_r0_write(dc, a->d); tcg_gen_shli_tl(cpu_R[a->d], cpu_R[a->a], a->l & (TARGET_LONG_BITS - 1)); return true; } static bool trans_l_srli(DisasContext *dc, arg_dal *a) { - check_r0_write(a->d); + check_r0_write(dc, a->d); tcg_gen_shri_tl(cpu_R[a->d], cpu_R[a->a], a->l & (TARGET_LONG_BITS - 1)); return true; } static bool trans_l_srai(DisasContext *dc, arg_dal *a) { - check_r0_write(a->d); + check_r0_write(dc, a->d); tcg_gen_sari_tl(cpu_R[a->d], cpu_R[a->a], a->l & (TARGET_LONG_BITS - 1)); return true; } static bool trans_l_rori(DisasContext *dc, arg_dal *a) { - check_r0_write(a->d); + check_r0_write(dc, a->d); tcg_gen_rotri_tl(cpu_R[a->d], cpu_R[a->a], a->l & (TARGET_LONG_BITS - 1)); return true; } static bool trans_l_movhi(DisasContext *dc, arg_l_movhi *a) { - check_r0_write(a->d); + check_r0_write(dc, a->d); tcg_gen_movi_tl(cpu_R[a->d], a->k << 16); return true; } static bool trans_l_macrc(DisasContext *dc, arg_l_macrc *a) { - check_r0_write(a->d); + check_r0_write(dc, a->d); tcg_gen_trunc_i64_tl(cpu_R[a->d], cpu_mac); tcg_gen_movi_i64(cpu_mac, 0); return true; @@ -1134,7 +1136,7 @@ static bool trans_l_rfe(DisasContext *dc, arg_l_rfe *a) static void do_fp2(DisasContext *dc, arg_da *a, void (*fn)(TCGv, TCGv_env, TCGv)) { - check_r0_write(a->d); + check_r0_write(dc, a->d); fn(cpu_R[a->d], cpu_env, cpu_R[a->a]); gen_helper_update_fpcsr(cpu_env); } @@ -1142,7 +1144,7 @@ static void do_fp2(DisasContext *dc, arg_da *a, static void do_fp3(DisasContext *dc, arg_dab *a, void (*fn)(TCGv, TCGv_env, TCGv, TCGv)) { - check_r0_write(a->d); + check_r0_write(dc, a->d); fn(cpu_R[a->d], cpu_env, cpu_R[a->a], cpu_R[a->b]); gen_helper_update_fpcsr(cpu_env); } @@ -1206,7 +1208,7 @@ static bool trans_lf_ftoi_s(DisasContext *dc, arg_da *a) static bool trans_lf_madd_s(DisasContext *dc, arg_dab *a) { - check_r0_write(a->d); + check_r0_write(dc, a->d); gen_helper_float_madd_s(cpu_R[a->d], cpu_env, cpu_R[a->d], cpu_R[a->a], cpu_R[a->b]); gen_helper_update_fpcsr(cpu_env); From patchwork Wed Sep 4 20:44:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 173061 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp447769ilq; Wed, 4 Sep 2019 14:15:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqxR1BT+tdQLRFEb3dg39vx3XPhCj9PS83KCwnsAH7Hvx6227tuoGbjPIznQ4EDTV68mlWqK X-Received: by 2002:a17:906:7c55:: with SMTP id g21mr69081ejp.177.1567631738049; Wed, 04 Sep 2019 14:15:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567631738; cv=none; d=google.com; s=arc-20160816; b=HqYiTx49NBFq56HnJvOa+4Nig+GvFIU1aDbOiRRrjNOU/v9rcD5G1KzurrKxnqvlZK jqY/j3vBfZOqZuOMz5lwW6CEOJL83DJPdemajvOLVf8D68ud72jdnEkqh6cRoWqKgtyz MjR5Q1OGFVxEpDgbLI4W66LLXPCJeAcfBWnOOojkZueeiPnWOunrVmcklALUXPNeZmal 357GFZ1AX1p9y35/NZX3pzn68As1ALUXNmsJHvXN2UYLzPK67o+3jjLjeuVGIFkAI/ga xPf/aXLUfNADoCKQ0bZ3c8CGKymVq5DHkdb6JrkNYP9/mB+LRcvxQXqMI3ZppZfDiy+f E9PA== 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=0GH6PQWyMN8qVVsEVdWkb1w1xlZ3eBiDk1i7JQaCd9s=; b=SaGMVN3gGMjS4GX1FIqhi2hC6iXzGjQwKEkcDFTygUK407jQkRpPbrHHrFJxbdFwcm IKiXvdDi6g7RMdl6g42gWb2JGg408fGnuNemcByqhNe62axQuEeob8tL6UukkgTFVoEB 8Q3wtB31JynO5JrhtRC4LKtNPKMKSjJmPk1BfKRu5+/2Va4xidiqWpU8GcAF3Cw3Guts OcWh+nWIwljMkmUCyKyYaMr4sZdm9xQZxzvBsXweSnq/Mx+2Y8RPxjrxL8HTa5U26/Wr AxQ/ruDkddi/gFgKXYO1M1lWgR23kztpecMuWhlUQG8oX1wAiVMiPeXJBxJkx/t7FHP2 rWSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=NGKbyIa8; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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. [209.51.188.17]) by mx.google.com with ESMTPS id g8si11362556edb.335.2019.09.04.14.15.37 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 04 Sep 2019 14:15:38 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=NGKbyIa8; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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]:39972 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5ccp-000465-T4 for patch@linaro.org; Wed, 04 Sep 2019 17:15:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52812) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5c9W-000667-5S for qemu-devel@nongnu.org; Wed, 04 Sep 2019 16:45:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5c9R-0006h1-NS for qemu-devel@nongnu.org; Wed, 04 Sep 2019 16:45:17 -0400 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]:42267) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i5c9R-0006fv-9R for qemu-devel@nongnu.org; Wed, 04 Sep 2019 16:45:13 -0400 Received: by mail-pg1-x542.google.com with SMTP id p3so60847pgb.9 for ; Wed, 04 Sep 2019 13:45:13 -0700 (PDT) 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=0GH6PQWyMN8qVVsEVdWkb1w1xlZ3eBiDk1i7JQaCd9s=; b=NGKbyIa8i/mejaB6g9tVBqTY2aMMO2i1tyzgM5rBUP9rsX7PBILhlqYX8ZjUkRHoQR QCRNcp6NY4bj10ZQNzkF17TQgcCU6Do3YzsU4XLz7j00PWBtY7qGvnvBVyLUFJpE1E4d 8ZD01VMcBZydHxFnGizWFz+ynsqwoWyBkykfQOwF8KFdrVovSSTrWLAscD94tX/ZjCqo Nz48651yft867dbCcuRZ7N1p2ppCxeTQ2enEzB8TVBCC7SC4up8dSl2riTqGmiQterKk xQcMpHX4XeSYaN9oY0bRhQbrDkxiOFatJb18XacKLNqf0W4B4Eieway0ZTXB7uxop3Nk t5dw== 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=0GH6PQWyMN8qVVsEVdWkb1w1xlZ3eBiDk1i7JQaCd9s=; b=rgbPP4TFwwu5+sq2nKVoVUPcPWPlVE6SwlySTWMysVs/Rp/qiN0xJ00AshqEBgflKk tPuO+qLS4ON3fDpFjnsPFhUqsgk3PfhvsrbfD965NdBsFj7UXkVCVHfEn+kEm5Eanqg9 V1MNtEOmQJx71Sal4ukzQMfzmmW7i9K9U8TcQNZCLRr2YhSHQ0vhvxTA8MpKnlEG8J5b qCkYqDmXHY67DuOasiIfatRkIJ0nStXMcLAHKJ3evkpbIHJ6i1+LBqwXx+jMRITaiCrF sxgN8OtrjUOfwZGcZoovRNicqxvE/uSYkIPegfZmbgheNYu/kpSDF+3uNyVNwm0apeRp CShg== X-Gm-Message-State: APjAAAWOBrVvkL3HgPXj3hNFW4adJKX8yq/uwMNb4yV6ejKxxoafbkkX NMI+5IPLYqAJe4wfD5mi5hebDkyFiic= X-Received: by 2002:aa7:998f:: with SMTP id k15mr34792670pfh.203.1567629911497; Wed, 04 Sep 2019 13:45:11 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id n66sm8104610pfn.90.2019.09.04.13.45.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2019 13:45:10 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 4 Sep 2019 13:44:56 -0700 Message-Id: <20190904204507.32457-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190904204507.32457-1-richard.henderson@linaro.org> References: <20190904204507.32457-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::542 Subject: [Qemu-devel] [PULL 02/13] target/openrisc: Replace cpu register array with a function X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The writes to cpu_R[0] are now a race across threads, now that we do code generation in parallel. Stage the change by introducing a function to return the temp for R0. Reviewed-by: Stafford Horne Signed-off-by: Richard Henderson --- target/openrisc/translate.c | 213 ++++++++++++++++++++---------------- 1 file changed, 116 insertions(+), 97 deletions(-) -- 2.17.1 diff --git a/target/openrisc/translate.c b/target/openrisc/translate.c index 8d72edf9b7..d635a46f7e 100644 --- a/target/openrisc/translate.c +++ b/target/openrisc/translate.c @@ -63,7 +63,7 @@ static inline bool is_user(DisasContext *dc) #include "decode.inc.c" static TCGv cpu_sr; -static TCGv cpu_R[32]; +static TCGv cpu_regs[32]; static TCGv cpu_R0; static TCGv cpu_pc; static TCGv jmp_pc; /* l.jr/l.jalr temp pc */ @@ -117,12 +117,12 @@ void openrisc_translate_init(void) offsetof(CPUOpenRISCState, mac), "mac"); for (i = 0; i < 32; i++) { - cpu_R[i] = tcg_global_mem_new(cpu_env, - offsetof(CPUOpenRISCState, - shadow_gpr[0][i]), - regnames[i]); + cpu_regs[i] = tcg_global_mem_new(cpu_env, + offsetof(CPUOpenRISCState, + shadow_gpr[0][i]), + regnames[i]); } - cpu_R0 = cpu_R[0]; + cpu_R0 = cpu_regs[0]; } static void gen_exception(DisasContext *dc, unsigned int excp) @@ -163,6 +163,11 @@ static void check_ov64s(DisasContext *dc) } #endif*/ +static TCGv cpu_R(DisasContext *dc, int reg) +{ + return cpu_regs[reg]; +} + /* * We're about to write to REG. On the off-chance that the user is * writing to R0, re-instate the architectural register. @@ -170,7 +175,7 @@ static void check_ov64s(DisasContext *dc) static void check_r0_write(DisasContext *dc, int reg) { if (unlikely(reg == 0)) { - cpu_R[0] = cpu_R0; + cpu_regs[0] = cpu_R0; } } @@ -439,98 +444,98 @@ static void gen_msbu(DisasContext *dc, TCGv srca, TCGv srcb) static bool trans_l_add(DisasContext *dc, arg_dab *a) { check_r0_write(dc, a->d); - gen_add(dc, cpu_R[a->d], cpu_R[a->a], cpu_R[a->b]); + gen_add(dc, cpu_R(dc, a->d), cpu_R(dc, a->a), cpu_R(dc, a->b)); return true; } static bool trans_l_addc(DisasContext *dc, arg_dab *a) { check_r0_write(dc, a->d); - gen_addc(dc, cpu_R[a->d], cpu_R[a->a], cpu_R[a->b]); + gen_addc(dc, cpu_R(dc, a->d), cpu_R(dc, a->a), cpu_R(dc, a->b)); return true; } static bool trans_l_sub(DisasContext *dc, arg_dab *a) { check_r0_write(dc, a->d); - gen_sub(dc, cpu_R[a->d], cpu_R[a->a], cpu_R[a->b]); + gen_sub(dc, cpu_R(dc, a->d), cpu_R(dc, a->a), cpu_R(dc, a->b)); return true; } static bool trans_l_and(DisasContext *dc, arg_dab *a) { check_r0_write(dc, a->d); - tcg_gen_and_tl(cpu_R[a->d], cpu_R[a->a], cpu_R[a->b]); + tcg_gen_and_tl(cpu_R(dc, a->d), cpu_R(dc, a->a), cpu_R(dc, a->b)); return true; } static bool trans_l_or(DisasContext *dc, arg_dab *a) { check_r0_write(dc, a->d); - tcg_gen_or_tl(cpu_R[a->d], cpu_R[a->a], cpu_R[a->b]); + tcg_gen_or_tl(cpu_R(dc, a->d), cpu_R(dc, a->a), cpu_R(dc, a->b)); return true; } static bool trans_l_xor(DisasContext *dc, arg_dab *a) { check_r0_write(dc, a->d); - tcg_gen_xor_tl(cpu_R[a->d], cpu_R[a->a], cpu_R[a->b]); + tcg_gen_xor_tl(cpu_R(dc, a->d), cpu_R(dc, a->a), cpu_R(dc, a->b)); return true; } static bool trans_l_sll(DisasContext *dc, arg_dab *a) { check_r0_write(dc, a->d); - tcg_gen_shl_tl(cpu_R[a->d], cpu_R[a->a], cpu_R[a->b]); + tcg_gen_shl_tl(cpu_R(dc, a->d), cpu_R(dc, a->a), cpu_R(dc, a->b)); return true; } static bool trans_l_srl(DisasContext *dc, arg_dab *a) { check_r0_write(dc, a->d); - tcg_gen_shr_tl(cpu_R[a->d], cpu_R[a->a], cpu_R[a->b]); + tcg_gen_shr_tl(cpu_R(dc, a->d), cpu_R(dc, a->a), cpu_R(dc, a->b)); return true; } static bool trans_l_sra(DisasContext *dc, arg_dab *a) { check_r0_write(dc, a->d); - tcg_gen_sar_tl(cpu_R[a->d], cpu_R[a->a], cpu_R[a->b]); + tcg_gen_sar_tl(cpu_R(dc, a->d), cpu_R(dc, a->a), cpu_R(dc, a->b)); return true; } static bool trans_l_ror(DisasContext *dc, arg_dab *a) { check_r0_write(dc, a->d); - tcg_gen_rotr_tl(cpu_R[a->d], cpu_R[a->a], cpu_R[a->b]); + tcg_gen_rotr_tl(cpu_R(dc, a->d), cpu_R(dc, a->a), cpu_R(dc, a->b)); return true; } static bool trans_l_exths(DisasContext *dc, arg_da *a) { check_r0_write(dc, a->d); - tcg_gen_ext16s_tl(cpu_R[a->d], cpu_R[a->a]); + tcg_gen_ext16s_tl(cpu_R(dc, a->d), cpu_R(dc, a->a)); return true; } static bool trans_l_extbs(DisasContext *dc, arg_da *a) { check_r0_write(dc, a->d); - tcg_gen_ext8s_tl(cpu_R[a->d], cpu_R[a->a]); + tcg_gen_ext8s_tl(cpu_R(dc, a->d), cpu_R(dc, a->a)); return true; } static bool trans_l_exthz(DisasContext *dc, arg_da *a) { check_r0_write(dc, a->d); - tcg_gen_ext16u_tl(cpu_R[a->d], cpu_R[a->a]); + tcg_gen_ext16u_tl(cpu_R(dc, a->d), cpu_R(dc, a->a)); return true; } static bool trans_l_extbz(DisasContext *dc, arg_da *a) { check_r0_write(dc, a->d); - tcg_gen_ext8u_tl(cpu_R[a->d], cpu_R[a->a]); + tcg_gen_ext8u_tl(cpu_R(dc, a->d), cpu_R(dc, a->a)); return true; } @@ -540,8 +545,8 @@ static bool trans_l_cmov(DisasContext *dc, arg_dab *a) check_r0_write(dc, a->d); zero = tcg_const_tl(0); - tcg_gen_movcond_tl(TCG_COND_NE, cpu_R[a->d], cpu_sr_f, zero, - cpu_R[a->a], cpu_R[a->b]); + tcg_gen_movcond_tl(TCG_COND_NE, cpu_R(dc, a->d), cpu_sr_f, zero, + cpu_R(dc, a->a), cpu_R(dc, a->b)); tcg_temp_free(zero); return true; } @@ -549,56 +554,56 @@ static bool trans_l_cmov(DisasContext *dc, arg_dab *a) static bool trans_l_ff1(DisasContext *dc, arg_da *a) { check_r0_write(dc, a->d); - tcg_gen_ctzi_tl(cpu_R[a->d], cpu_R[a->a], -1); - tcg_gen_addi_tl(cpu_R[a->d], cpu_R[a->d], 1); + tcg_gen_ctzi_tl(cpu_R(dc, a->d), cpu_R(dc, a->a), -1); + tcg_gen_addi_tl(cpu_R(dc, a->d), cpu_R(dc, a->d), 1); return true; } static bool trans_l_fl1(DisasContext *dc, arg_da *a) { check_r0_write(dc, a->d); - tcg_gen_clzi_tl(cpu_R[a->d], cpu_R[a->a], TARGET_LONG_BITS); - tcg_gen_subfi_tl(cpu_R[a->d], TARGET_LONG_BITS, cpu_R[a->d]); + tcg_gen_clzi_tl(cpu_R(dc, a->d), cpu_R(dc, a->a), TARGET_LONG_BITS); + tcg_gen_subfi_tl(cpu_R(dc, a->d), TARGET_LONG_BITS, cpu_R(dc, a->d)); return true; } static bool trans_l_mul(DisasContext *dc, arg_dab *a) { check_r0_write(dc, a->d); - gen_mul(dc, cpu_R[a->d], cpu_R[a->a], cpu_R[a->b]); + gen_mul(dc, cpu_R(dc, a->d), cpu_R(dc, a->a), cpu_R(dc, a->b)); return true; } static bool trans_l_mulu(DisasContext *dc, arg_dab *a) { check_r0_write(dc, a->d); - gen_mulu(dc, cpu_R[a->d], cpu_R[a->a], cpu_R[a->b]); + gen_mulu(dc, cpu_R(dc, a->d), cpu_R(dc, a->a), cpu_R(dc, a->b)); return true; } static bool trans_l_div(DisasContext *dc, arg_dab *a) { check_r0_write(dc, a->d); - gen_div(dc, cpu_R[a->d], cpu_R[a->a], cpu_R[a->b]); + gen_div(dc, cpu_R(dc, a->d), cpu_R(dc, a->a), cpu_R(dc, a->b)); return true; } static bool trans_l_divu(DisasContext *dc, arg_dab *a) { check_r0_write(dc, a->d); - gen_divu(dc, cpu_R[a->d], cpu_R[a->a], cpu_R[a->b]); + gen_divu(dc, cpu_R(dc, a->d), cpu_R(dc, a->a), cpu_R(dc, a->b)); return true; } static bool trans_l_muld(DisasContext *dc, arg_ab *a) { - gen_muld(dc, cpu_R[a->a], cpu_R[a->b]); + gen_muld(dc, cpu_R(dc, a->a), cpu_R(dc, a->b)); return true; } static bool trans_l_muldu(DisasContext *dc, arg_ab *a) { - gen_muldu(dc, cpu_R[a->a], cpu_R[a->b]); + gen_muldu(dc, cpu_R(dc, a->a), cpu_R(dc, a->b)); return true; } @@ -617,7 +622,7 @@ static bool trans_l_jal(DisasContext *dc, arg_l_jal *a) target_ulong tmp_pc = dc->base.pc_next + a->n * 4; target_ulong ret_pc = dc->base.pc_next + 8; - tcg_gen_movi_tl(cpu_R[9], ret_pc); + tcg_gen_movi_tl(cpu_regs[9], ret_pc); /* Optimize jal being used to load the PC for PIC. */ if (tmp_pc != ret_pc) { tcg_gen_movi_tl(jmp_pc, tmp_pc); @@ -656,15 +661,15 @@ static bool trans_l_bnf(DisasContext *dc, arg_l_bf *a) static bool trans_l_jr(DisasContext *dc, arg_l_jr *a) { - tcg_gen_mov_tl(jmp_pc, cpu_R[a->b]); + tcg_gen_mov_tl(jmp_pc, cpu_R(dc, a->b)); dc->delayed_branch = 2; return true; } static bool trans_l_jalr(DisasContext *dc, arg_l_jalr *a) { - tcg_gen_mov_tl(jmp_pc, cpu_R[a->b]); - tcg_gen_movi_tl(cpu_R[9], dc->base.pc_next + 8); + tcg_gen_mov_tl(jmp_pc, cpu_R(dc, a->b)); + tcg_gen_movi_tl(cpu_regs[9], dc->base.pc_next + 8); dc->delayed_branch = 2; return true; } @@ -675,10 +680,10 @@ static bool trans_l_lwa(DisasContext *dc, arg_load *a) check_r0_write(dc, a->d); ea = tcg_temp_new(); - tcg_gen_addi_tl(ea, cpu_R[a->a], a->i); - tcg_gen_qemu_ld_tl(cpu_R[a->d], ea, dc->mem_idx, MO_TEUL); + tcg_gen_addi_tl(ea, cpu_R(dc, a->a), a->i); + tcg_gen_qemu_ld_tl(cpu_R(dc, a->d), ea, dc->mem_idx, MO_TEUL); tcg_gen_mov_tl(cpu_lock_addr, ea); - tcg_gen_mov_tl(cpu_lock_value, cpu_R[a->d]); + tcg_gen_mov_tl(cpu_lock_value, cpu_R(dc, a->d)); tcg_temp_free(ea); return true; } @@ -689,8 +694,8 @@ static void do_load(DisasContext *dc, arg_load *a, MemOp mop) check_r0_write(dc, a->d); ea = tcg_temp_new(); - tcg_gen_addi_tl(ea, cpu_R[a->a], a->i); - tcg_gen_qemu_ld_tl(cpu_R[a->d], ea, dc->mem_idx, mop); + tcg_gen_addi_tl(ea, cpu_R(dc, a->a), a->i); + tcg_gen_qemu_ld_tl(cpu_R(dc, a->d), ea, dc->mem_idx, mop); tcg_temp_free(ea); } @@ -736,13 +741,13 @@ static bool trans_l_swa(DisasContext *dc, arg_store *a) TCGLabel *lab_fail, *lab_done; ea = tcg_temp_new(); - tcg_gen_addi_tl(ea, cpu_R[a->a], a->i); + tcg_gen_addi_tl(ea, cpu_R(dc, a->a), a->i); /* For TB_FLAGS_R0_0, the branch below invalidates the temporary assigned - to cpu_R[0]. Since l.swa is quite often immediately followed by a + to cpu_regs[0]. Since l.swa is quite often immediately followed by a branch, don't bother reallocating; finish the TB using the "real" R0. This also takes care of RB input across the branch. */ - cpu_R[0] = cpu_R0; + cpu_regs[0] = cpu_R0; lab_fail = gen_new_label(); lab_done = gen_new_label(); @@ -751,7 +756,7 @@ static bool trans_l_swa(DisasContext *dc, arg_store *a) val = tcg_temp_new(); tcg_gen_atomic_cmpxchg_tl(val, cpu_lock_addr, cpu_lock_value, - cpu_R[a->b], dc->mem_idx, MO_TEUL); + cpu_regs[a->b], dc->mem_idx, MO_TEUL); tcg_gen_setcond_tl(TCG_COND_EQ, cpu_sr_f, val, cpu_lock_value); tcg_temp_free(val); @@ -768,8 +773,8 @@ static bool trans_l_swa(DisasContext *dc, arg_store *a) static void do_store(DisasContext *dc, arg_store *a, MemOp mop) { TCGv t0 = tcg_temp_new(); - tcg_gen_addi_tl(t0, cpu_R[a->a], a->i); - tcg_gen_qemu_st_tl(cpu_R[a->b], t0, dc->mem_idx, mop); + tcg_gen_addi_tl(t0, cpu_R(dc, a->a), a->i); + tcg_gen_qemu_st_tl(cpu_R(dc, a->b), t0, dc->mem_idx, mop); tcg_temp_free(t0); } @@ -802,7 +807,7 @@ static bool trans_l_addi(DisasContext *dc, arg_rri *a) check_r0_write(dc, a->d); t0 = tcg_const_tl(a->i); - gen_add(dc, cpu_R[a->d], cpu_R[a->a], t0); + gen_add(dc, cpu_R(dc, a->d), cpu_R(dc, a->a), t0); tcg_temp_free(t0); return true; } @@ -813,7 +818,7 @@ static bool trans_l_addic(DisasContext *dc, arg_rri *a) check_r0_write(dc, a->d); t0 = tcg_const_tl(a->i); - gen_addc(dc, cpu_R[a->d], cpu_R[a->a], t0); + gen_addc(dc, cpu_R(dc, a->d), cpu_R(dc, a->a), t0); tcg_temp_free(t0); return true; } @@ -824,7 +829,7 @@ static bool trans_l_muli(DisasContext *dc, arg_rri *a) check_r0_write(dc, a->d); t0 = tcg_const_tl(a->i); - gen_mul(dc, cpu_R[a->d], cpu_R[a->a], t0); + gen_mul(dc, cpu_R(dc, a->d), cpu_R(dc, a->a), t0); tcg_temp_free(t0); return true; } @@ -834,7 +839,7 @@ static bool trans_l_maci(DisasContext *dc, arg_l_maci *a) TCGv t0; t0 = tcg_const_tl(a->i); - gen_mac(dc, cpu_R[a->a], t0); + gen_mac(dc, cpu_R(dc, a->a), t0); tcg_temp_free(t0); return true; } @@ -842,21 +847,21 @@ static bool trans_l_maci(DisasContext *dc, arg_l_maci *a) static bool trans_l_andi(DisasContext *dc, arg_rrk *a) { check_r0_write(dc, a->d); - tcg_gen_andi_tl(cpu_R[a->d], cpu_R[a->a], a->k); + tcg_gen_andi_tl(cpu_R(dc, a->d), cpu_R(dc, a->a), a->k); return true; } static bool trans_l_ori(DisasContext *dc, arg_rrk *a) { check_r0_write(dc, a->d); - tcg_gen_ori_tl(cpu_R[a->d], cpu_R[a->a], a->k); + tcg_gen_ori_tl(cpu_R(dc, a->d), cpu_R(dc, a->a), a->k); return true; } static bool trans_l_xori(DisasContext *dc, arg_rri *a) { check_r0_write(dc, a->d); - tcg_gen_xori_tl(cpu_R[a->d], cpu_R[a->a], a->i); + tcg_gen_xori_tl(cpu_R(dc, a->d), cpu_R(dc, a->a), a->i); return true; } @@ -868,8 +873,8 @@ static bool trans_l_mfspr(DisasContext *dc, arg_l_mfspr *a) gen_illegal_exception(dc); } else { TCGv spr = 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_gen_ori_tl(spr, cpu_R(dc, a->a), a->k); + gen_helper_mfspr(cpu_R(dc, a->d), cpu_env, cpu_R(dc, a->d), spr); tcg_temp_free(spr); } return true; @@ -896,8 +901,8 @@ static bool trans_l_mtspr(DisasContext *dc, arg_l_mtspr *a) dc->base.is_jmp = DISAS_EXIT; spr = 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_gen_ori_tl(spr, cpu_R(dc, a->a), a->k); + gen_helper_mtspr(cpu_env, spr, cpu_R(dc, a->b)); tcg_temp_free(spr); } return true; @@ -905,188 +910,202 @@ static bool trans_l_mtspr(DisasContext *dc, arg_l_mtspr *a) static bool trans_l_mac(DisasContext *dc, arg_ab *a) { - gen_mac(dc, cpu_R[a->a], cpu_R[a->b]); + gen_mac(dc, cpu_R(dc, a->a), cpu_R(dc, a->b)); return true; } static bool trans_l_msb(DisasContext *dc, arg_ab *a) { - gen_msb(dc, cpu_R[a->a], cpu_R[a->b]); + gen_msb(dc, cpu_R(dc, a->a), cpu_R(dc, a->b)); return true; } static bool trans_l_macu(DisasContext *dc, arg_ab *a) { - gen_macu(dc, cpu_R[a->a], cpu_R[a->b]); + gen_macu(dc, cpu_R(dc, a->a), cpu_R(dc, a->b)); return true; } static bool trans_l_msbu(DisasContext *dc, arg_ab *a) { - gen_msbu(dc, cpu_R[a->a], cpu_R[a->b]); + gen_msbu(dc, cpu_R(dc, a->a), cpu_R(dc, a->b)); return true; } static bool trans_l_slli(DisasContext *dc, arg_dal *a) { check_r0_write(dc, a->d); - tcg_gen_shli_tl(cpu_R[a->d], cpu_R[a->a], a->l & (TARGET_LONG_BITS - 1)); + tcg_gen_shli_tl(cpu_R(dc, a->d), cpu_R(dc, a->a), + a->l & (TARGET_LONG_BITS - 1)); return true; } static bool trans_l_srli(DisasContext *dc, arg_dal *a) { check_r0_write(dc, a->d); - tcg_gen_shri_tl(cpu_R[a->d], cpu_R[a->a], a->l & (TARGET_LONG_BITS - 1)); + tcg_gen_shri_tl(cpu_R(dc, a->d), cpu_R(dc, a->a), + a->l & (TARGET_LONG_BITS - 1)); return true; } static bool trans_l_srai(DisasContext *dc, arg_dal *a) { check_r0_write(dc, a->d); - tcg_gen_sari_tl(cpu_R[a->d], cpu_R[a->a], a->l & (TARGET_LONG_BITS - 1)); + tcg_gen_sari_tl(cpu_R(dc, a->d), cpu_R(dc, a->a), + a->l & (TARGET_LONG_BITS - 1)); return true; } static bool trans_l_rori(DisasContext *dc, arg_dal *a) { check_r0_write(dc, a->d); - tcg_gen_rotri_tl(cpu_R[a->d], cpu_R[a->a], a->l & (TARGET_LONG_BITS - 1)); + tcg_gen_rotri_tl(cpu_R(dc, a->d), cpu_R(dc, a->a), + a->l & (TARGET_LONG_BITS - 1)); return true; } static bool trans_l_movhi(DisasContext *dc, arg_l_movhi *a) { check_r0_write(dc, a->d); - tcg_gen_movi_tl(cpu_R[a->d], a->k << 16); + tcg_gen_movi_tl(cpu_R(dc, a->d), a->k << 16); return true; } static bool trans_l_macrc(DisasContext *dc, arg_l_macrc *a) { check_r0_write(dc, a->d); - tcg_gen_trunc_i64_tl(cpu_R[a->d], cpu_mac); + tcg_gen_trunc_i64_tl(cpu_R(dc, a->d), cpu_mac); tcg_gen_movi_i64(cpu_mac, 0); return true; } static bool trans_l_sfeq(DisasContext *dc, arg_ab *a) { - tcg_gen_setcond_tl(TCG_COND_EQ, cpu_sr_f, cpu_R[a->a], cpu_R[a->b]); + tcg_gen_setcond_tl(TCG_COND_EQ, cpu_sr_f, + cpu_R(dc, a->a), cpu_R(dc, a->b)); return true; } static bool trans_l_sfne(DisasContext *dc, arg_ab *a) { - tcg_gen_setcond_tl(TCG_COND_NE, cpu_sr_f, cpu_R[a->a], cpu_R[a->b]); + tcg_gen_setcond_tl(TCG_COND_NE, cpu_sr_f, + cpu_R(dc, a->a), cpu_R(dc, a->b)); return true; } static bool trans_l_sfgtu(DisasContext *dc, arg_ab *a) { - tcg_gen_setcond_tl(TCG_COND_GTU, cpu_sr_f, cpu_R[a->a], cpu_R[a->b]); + tcg_gen_setcond_tl(TCG_COND_GTU, cpu_sr_f, + cpu_R(dc, a->a), cpu_R(dc, a->b)); return true; } static bool trans_l_sfgeu(DisasContext *dc, arg_ab *a) { - tcg_gen_setcond_tl(TCG_COND_GEU, cpu_sr_f, cpu_R[a->a], cpu_R[a->b]); + tcg_gen_setcond_tl(TCG_COND_GEU, cpu_sr_f, + cpu_R(dc, a->a), cpu_R(dc, a->b)); return true; } static bool trans_l_sfltu(DisasContext *dc, arg_ab *a) { - tcg_gen_setcond_tl(TCG_COND_LTU, cpu_sr_f, cpu_R[a->a], cpu_R[a->b]); + tcg_gen_setcond_tl(TCG_COND_LTU, cpu_sr_f, + cpu_R(dc, a->a), cpu_R(dc, a->b)); return true; } static bool trans_l_sfleu(DisasContext *dc, arg_ab *a) { - tcg_gen_setcond_tl(TCG_COND_LEU, cpu_sr_f, cpu_R[a->a], cpu_R[a->b]); + tcg_gen_setcond_tl(TCG_COND_LEU, cpu_sr_f, + cpu_R(dc, a->a), cpu_R(dc, a->b)); return true; } static bool trans_l_sfgts(DisasContext *dc, arg_ab *a) { - tcg_gen_setcond_tl(TCG_COND_GT, cpu_sr_f, cpu_R[a->a], cpu_R[a->b]); + tcg_gen_setcond_tl(TCG_COND_GT, cpu_sr_f, + cpu_R(dc, a->a), cpu_R(dc, a->b)); return true; } static bool trans_l_sfges(DisasContext *dc, arg_ab *a) { - tcg_gen_setcond_tl(TCG_COND_GE, cpu_sr_f, cpu_R[a->a], cpu_R[a->b]); + tcg_gen_setcond_tl(TCG_COND_GE, cpu_sr_f, + cpu_R(dc, a->a), cpu_R(dc, a->b)); return true; } static bool trans_l_sflts(DisasContext *dc, arg_ab *a) { - tcg_gen_setcond_tl(TCG_COND_LT, cpu_sr_f, cpu_R[a->a], cpu_R[a->b]); + tcg_gen_setcond_tl(TCG_COND_LT, cpu_sr_f, + cpu_R(dc, a->a), cpu_R(dc, a->b)); return true; } static bool trans_l_sfles(DisasContext *dc, arg_ab *a) { - tcg_gen_setcond_tl(TCG_COND_LE, cpu_sr_f, cpu_R[a->a], cpu_R[a->b]); + tcg_gen_setcond_tl(TCG_COND_LE, + cpu_sr_f, cpu_R(dc, a->a), cpu_R(dc, a->b)); return true; } static bool trans_l_sfeqi(DisasContext *dc, arg_ai *a) { - tcg_gen_setcondi_tl(TCG_COND_EQ, cpu_sr_f, cpu_R[a->a], a->i); + tcg_gen_setcondi_tl(TCG_COND_EQ, cpu_sr_f, cpu_R(dc, a->a), a->i); return true; } static bool trans_l_sfnei(DisasContext *dc, arg_ai *a) { - tcg_gen_setcondi_tl(TCG_COND_NE, cpu_sr_f, cpu_R[a->a], a->i); + tcg_gen_setcondi_tl(TCG_COND_NE, cpu_sr_f, cpu_R(dc, a->a), a->i); return true; } static bool trans_l_sfgtui(DisasContext *dc, arg_ai *a) { - tcg_gen_setcondi_tl(TCG_COND_GTU, cpu_sr_f, cpu_R[a->a], a->i); + tcg_gen_setcondi_tl(TCG_COND_GTU, cpu_sr_f, cpu_R(dc, a->a), a->i); return true; } static bool trans_l_sfgeui(DisasContext *dc, arg_ai *a) { - tcg_gen_setcondi_tl(TCG_COND_GEU, cpu_sr_f, cpu_R[a->a], a->i); + tcg_gen_setcondi_tl(TCG_COND_GEU, cpu_sr_f, cpu_R(dc, a->a), a->i); return true; } static bool trans_l_sfltui(DisasContext *dc, arg_ai *a) { - tcg_gen_setcondi_tl(TCG_COND_LTU, cpu_sr_f, cpu_R[a->a], a->i); + tcg_gen_setcondi_tl(TCG_COND_LTU, cpu_sr_f, cpu_R(dc, a->a), a->i); return true; } static bool trans_l_sfleui(DisasContext *dc, arg_ai *a) { - tcg_gen_setcondi_tl(TCG_COND_LEU, cpu_sr_f, cpu_R[a->a], a->i); + tcg_gen_setcondi_tl(TCG_COND_LEU, cpu_sr_f, cpu_R(dc, a->a), a->i); return true; } static bool trans_l_sfgtsi(DisasContext *dc, arg_ai *a) { - tcg_gen_setcondi_tl(TCG_COND_GT, cpu_sr_f, cpu_R[a->a], a->i); + tcg_gen_setcondi_tl(TCG_COND_GT, cpu_sr_f, cpu_R(dc, a->a), a->i); return true; } static bool trans_l_sfgesi(DisasContext *dc, arg_ai *a) { - tcg_gen_setcondi_tl(TCG_COND_GE, cpu_sr_f, cpu_R[a->a], a->i); + tcg_gen_setcondi_tl(TCG_COND_GE, cpu_sr_f, cpu_R(dc, a->a), a->i); return true; } static bool trans_l_sfltsi(DisasContext *dc, arg_ai *a) { - tcg_gen_setcondi_tl(TCG_COND_LT, cpu_sr_f, cpu_R[a->a], a->i); + tcg_gen_setcondi_tl(TCG_COND_LT, cpu_sr_f, cpu_R(dc, a->a), a->i); return true; } static bool trans_l_sflesi(DisasContext *dc, arg_ai *a) { - tcg_gen_setcondi_tl(TCG_COND_LE, cpu_sr_f, cpu_R[a->a], a->i); + tcg_gen_setcondi_tl(TCG_COND_LE, cpu_sr_f, cpu_R(dc, a->a), a->i); return true; } @@ -1137,7 +1156,7 @@ static void do_fp2(DisasContext *dc, arg_da *a, void (*fn)(TCGv, TCGv_env, TCGv)) { check_r0_write(dc, a->d); - fn(cpu_R[a->d], cpu_env, cpu_R[a->a]); + fn(cpu_R(dc, a->d), cpu_env, cpu_R(dc, a->a)); gen_helper_update_fpcsr(cpu_env); } @@ -1145,7 +1164,7 @@ static void do_fp3(DisasContext *dc, arg_dab *a, void (*fn)(TCGv, TCGv_env, TCGv, TCGv)) { check_r0_write(dc, a->d); - fn(cpu_R[a->d], cpu_env, cpu_R[a->a], cpu_R[a->b]); + fn(cpu_R(dc, a->d), cpu_env, cpu_R(dc, a->a), cpu_R(dc, a->b)); gen_helper_update_fpcsr(cpu_env); } @@ -1154,9 +1173,9 @@ static void do_fpcmp(DisasContext *dc, arg_ab *a, bool inv, bool swap) { if (swap) { - fn(cpu_sr_f, cpu_env, cpu_R[a->b], cpu_R[a->a]); + fn(cpu_sr_f, cpu_env, cpu_R(dc, a->b), cpu_R(dc, a->a)); } else { - fn(cpu_sr_f, cpu_env, cpu_R[a->a], cpu_R[a->b]); + fn(cpu_sr_f, cpu_env, cpu_R(dc, a->a), cpu_R(dc, a->b)); } if (inv) { tcg_gen_xori_tl(cpu_sr_f, cpu_sr_f, 1); @@ -1209,8 +1228,8 @@ static bool trans_lf_ftoi_s(DisasContext *dc, arg_da *a) static bool trans_lf_madd_s(DisasContext *dc, arg_dab *a) { check_r0_write(dc, a->d); - gen_helper_float_madd_s(cpu_R[a->d], cpu_env, cpu_R[a->d], - cpu_R[a->a], cpu_R[a->b]); + gen_helper_float_madd_s(cpu_R(dc, a->d), cpu_env, cpu_R(dc, a->d), + cpu_R(dc, a->a), cpu_R(dc, a->b)); gen_helper_update_fpcsr(cpu_env); return true; } @@ -1273,9 +1292,9 @@ static void openrisc_tr_tb_start(DisasContextBase *db, CPUState *cs) /* Allow the TCG optimizer to see that R0 == 0, when it's true, which is the common case. */ if (dc->tb_flags & TB_FLAGS_R0_0) { - cpu_R[0] = tcg_const_tl(0); + cpu_regs[0] = tcg_const_tl(0); } else { - cpu_R[0] = cpu_R0; + cpu_regs[0] = cpu_R0; } } From patchwork Wed Sep 4 20:44:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 173088 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp465017ilq; Wed, 4 Sep 2019 14:34:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqx8LAeCYly7hAmioHWov0qAQSIyyx8+QK+h5A2KMf+EbhxIUQ9CuqNIHP5XnGuA9WGGlIDy X-Received: by 2002:ae9:e50f:: with SMTP id w15mr15894869qkf.129.1567632884753; Wed, 04 Sep 2019 14:34:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567632884; cv=none; d=google.com; s=arc-20160816; b=HGNWrDG3yWrWe9yjQh5qEbSOjZIdMaKRs6XCo/dBwaj10XMCTu03Ajjr5KmX7GpVRE f710MEBC2xJdReHyJJZCK8FDASxnT3hI0fzUnO4cDtgVGSfWDRrwq8TAxuA5fHNuL9hM /1wQqoNN30HWDMPA8EnTxPkBdrv2T0ZPw3FRoyQEcqiop4fLH1S+P9sZbstqEFoSUs53 pOgwel6vUXjYUnxtSf6RI3bQwb5Ay3Qk0AdXIK4eYS3MN/cE8njbtMYF+kWgznUm5Yxq HTCnLKDgLAuhgchdmQyX1ezX4PJ85vRlvPNuBoNOV9RfSp51QnBC8ONHxKZG+pdisAnZ gozA== 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=l5xF9L8hbrVx8UtpucRjuAJTrSqlDemzuCm3zQWWOUA=; b=C6J+e5zia55Krb65y/my3P5JyNyh+4aRmX1BXHU5EruRrot/4jWEHwYozmM2keHjLl 5CRyjBcmV/5OZ+DEo28uojPSIRFS5i9jfqNkBHk/582Ag02isBcJEB8OkCKRaXMP1yQU jfMuqVwrpqauFVPc3In6BrtM72VjNgFue2MA+NG3ALK8z3o2J8Texq+Nd3EP+/iIrIiM zh3eqj/j8Q8KbjD2419TnJLYzeYT+VJJ5pGF+1KOYBBv992N4PSUB9Y3AGVEqVwvWA8b 8ySfZLVucORj4f5oWesrnsSQxVQRxu7gB8/HC4caFJa7C8fcolv7rPOfjKjgtw7a8V+T y3Kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=JW+pzhK4; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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. [209.51.188.17]) by mx.google.com with ESMTPS id o60si8163272qte.17.2019.09.04.14.34.44 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 04 Sep 2019 14:34:44 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=JW+pzhK4; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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]:40274 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5cvK-0000jn-LX for patch@linaro.org; Wed, 04 Sep 2019 17:34:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52791) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5c9U-00063v-Qk for qemu-devel@nongnu.org; Wed, 04 Sep 2019 16:45:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5c9S-0006i0-Ri for qemu-devel@nongnu.org; Wed, 04 Sep 2019 16:45:16 -0400 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]:38889) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i5c9S-0006hF-KN for qemu-devel@nongnu.org; Wed, 04 Sep 2019 16:45:14 -0400 Received: by mail-pf1-x42a.google.com with SMTP id h195so36805pfe.5 for ; Wed, 04 Sep 2019 13:45:14 -0700 (PDT) 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=l5xF9L8hbrVx8UtpucRjuAJTrSqlDemzuCm3zQWWOUA=; b=JW+pzhK42qd7ZaM/De0bYUfVsqrtMjydtLu+17e6vIm9sCVJ67WhqV6xjeWbHBJfru oAfF+N9qgd07TYsTJYos9VWhofoiK3sTV6/acDN/DqEz4gTS2m0tVzkrG15c3x1uj5ca uKjQYvJE8EvzOVo4LOc8ZhNxTBUOy+FhI5hhrLhSfajeeFNqQQ5iTu4k5PrBwrhCwPtF zTV/uF0Z6+3yx963+O+TDNvVEM79qOVOnP+VnHyQ+U4Q7F0ULcSZb52BQ1MlORv0cYuQ 6syqOTTV7MeXyURbkSbrbquDxT8wpKZIZ/pY/uCOF6Ftr9Tn3p6rsHTC+tggIZssccmg Mclg== 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=l5xF9L8hbrVx8UtpucRjuAJTrSqlDemzuCm3zQWWOUA=; b=JOwZlD3M3qob65ojoq3cFS2TrH51fiu23PuC1Ya74gvNNnp79wtOL+XZK7yFIPzSjp NcbTwsi4/aRS+61U5bUuSHa0aThcs9nrxJwQoJUaaiSQyKAQ3shoQG11Qo1l+4K8DZ0u GSg/u6RmJmdWVFy6o+GkoK7fA6NDMIloZIdEMPNahE/xuj/nqmy4gaScpi/9wDnCUu77 po3qCiqKVVl2bU/uv69HICF8EYmAr3vYNNmZQrgImqvw41AUn2uLqPPLuP6kyJ6HMxcr lCpna9s+tG3RFJCrcRx6X0oXUblVl56+YmFzFz/qaWMYpATa6OUSHqJ7S+fN4JktySsU ysGA== X-Gm-Message-State: APjAAAX6KD7rgIYfNBYdYIuEazsc16Ky5UeVWmyuFiqXgl2dP6M5/Clr nnMqZadu7JlnM2Y2XmJdjm/I+RNVGUY= X-Received: by 2002:a63:484d:: with SMTP id x13mr71294pgk.122.1567629913011; Wed, 04 Sep 2019 13:45:13 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id n66sm8104610pfn.90.2019.09.04.13.45.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2019 13:45:12 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 4 Sep 2019 13:44:57 -0700 Message-Id: <20190904204507.32457-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190904204507.32457-1-richard.henderson@linaro.org> References: <20190904204507.32457-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::42a Subject: [Qemu-devel] [PULL 03/13] target/openrisc: Cache R0 in DisasContext X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Finish the race condition fix from the previous patch. Reviewed-by: Stafford Horne Signed-off-by: Richard Henderson --- target/openrisc/translate.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) -- 2.17.1 diff --git a/target/openrisc/translate.c b/target/openrisc/translate.c index d635a46f7e..341f923864 100644 --- a/target/openrisc/translate.c +++ b/target/openrisc/translate.c @@ -48,6 +48,9 @@ typedef struct DisasContext { /* If not -1, jmp_pc contains this value and so is a direct jump. */ target_ulong jmp_pc_imm; + + /* The temporary corresponding to register 0 for this compilation. */ + TCGv R0; } DisasContext; static inline bool is_user(DisasContext *dc) @@ -64,7 +67,6 @@ static inline bool is_user(DisasContext *dc) static TCGv cpu_sr; static TCGv cpu_regs[32]; -static TCGv cpu_R0; static TCGv cpu_pc; static TCGv jmp_pc; /* l.jr/l.jalr temp pc */ static TCGv cpu_ppc; @@ -122,7 +124,6 @@ void openrisc_translate_init(void) shadow_gpr[0][i]), regnames[i]); } - cpu_R0 = cpu_regs[0]; } static void gen_exception(DisasContext *dc, unsigned int excp) @@ -165,7 +166,11 @@ static void check_ov64s(DisasContext *dc) static TCGv cpu_R(DisasContext *dc, int reg) { - return cpu_regs[reg]; + if (reg == 0) { + return dc->R0; + } else { + return cpu_regs[reg]; + } } /* @@ -175,7 +180,7 @@ static TCGv cpu_R(DisasContext *dc, int reg) static void check_r0_write(DisasContext *dc, int reg) { if (unlikely(reg == 0)) { - cpu_regs[0] = cpu_R0; + dc->R0 = cpu_regs[0]; } } @@ -747,7 +752,7 @@ static bool trans_l_swa(DisasContext *dc, arg_store *a) to cpu_regs[0]. Since l.swa is quite often immediately followed by a branch, don't bother reallocating; finish the TB using the "real" R0. This also takes care of RB input across the branch. */ - cpu_regs[0] = cpu_R0; + dc->R0 = cpu_regs[0]; lab_fail = gen_new_label(); lab_done = gen_new_label(); @@ -1292,9 +1297,9 @@ static void openrisc_tr_tb_start(DisasContextBase *db, CPUState *cs) /* Allow the TCG optimizer to see that R0 == 0, when it's true, which is the common case. */ if (dc->tb_flags & TB_FLAGS_R0_0) { - cpu_regs[0] = tcg_const_tl(0); + dc->R0 = tcg_const_tl(0); } else { - cpu_regs[0] = cpu_R0; + dc->R0 = cpu_regs[0]; } } From patchwork Wed Sep 4 20:44:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 173060 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp446397ilq; Wed, 4 Sep 2019 14:14:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqzY6Zu6oTstFDPkCEITGgpPNerru7pJ+Xv8rmdaT2ZROoveP+PBYSXVDvdemWlEgzwN1sDs X-Received: by 2002:ad4:4c08:: with SMTP id bz8mr2921qvb.81.1567631647612; Wed, 04 Sep 2019 14:14:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567631647; cv=none; d=google.com; s=arc-20160816; b=aduQ92+nU1FSd5uqr1rKWkn4yHQHcGUWPlGKx3G4Ti/q8o021meQIw40qmdAT6rJbN UN2GQmYgdQcMsMNTc0N6s5hl4bALfsaa2O09xPqKSSOMoNiXDfZ1vqoMLp7vdc/dy8ek 6tc0jSj74mnBFWSYrYKA3Un4+k7Xv7cADJXXBUk0EMZOkGNEVwKTkNEuu2hgrBpBzXuD EIM3KeLQ3VIdEYvYzjrjuND0z7XP6b45BOGVSANTT4bc68tTXWvzdt0dDyKWj9jXHPzr 8Pq1Eq+GASIIg57Sk/h4U0lynuwPx8dd51KFB2CNo+Cr52HzcOa0LBf/u31Whfh7tft5 UgXw== 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=NUB/rqkFfUKu2v7QerAjMtUtZI3FXJ/o9W4GMo7Gy60=; b=pH7DIpkC7Eik62fs5HPl8g4tbvcLxp9cXueD3wWj6bCb1bhE92yNRvQ5KGjw/tkdjm OFzdXY6YHndW6ziQJzC15HycR6qD0/R75D+doiied7K5u1KOsnpF3I42NXxt9PnyAuUG 4UIGm+L+O8fFaITbSm6NtjlNB8Yl+LUHN13Io85lLB2WHFPdpEAPrbjAGjdpboH9EXaT 7uUD2cHsNC5eOnVRdZmNwXYEuLJSKN28upGEnxh5V+IYKEIhb9jp52hk7q1n2nf5Uj6M 7ywlWMYvN3zjFyaSomMumaSGvkiIwUVsnel4AY7s6+D1afvulWu4s8z7SlajxwT8THZt MsjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=rJ71HQIa; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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. [209.51.188.17]) by mx.google.com with ESMTPS id c8si7749540qtg.231.2019.09.04.14.14.07 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 04 Sep 2019 14:14:07 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=rJ71HQIa; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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]:39954 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5cbO-0002T8-Gd for patch@linaro.org; Wed, 04 Sep 2019 17:14:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52808) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5c9V-00065W-Ov for qemu-devel@nongnu.org; Wed, 04 Sep 2019 16:45:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5c9U-0006ix-6T for qemu-devel@nongnu.org; Wed, 04 Sep 2019 16:45:17 -0400 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]:41274) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i5c9T-0006i9-Si for qemu-devel@nongnu.org; Wed, 04 Sep 2019 16:45:16 -0400 Received: by mail-pl1-x633.google.com with SMTP id m9so89326pls.8 for ; Wed, 04 Sep 2019 13:45:15 -0700 (PDT) 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=NUB/rqkFfUKu2v7QerAjMtUtZI3FXJ/o9W4GMo7Gy60=; b=rJ71HQIaqEkUSz+KMQTIDAlS5TDNBjaTyZSB+VAlpy6Zv5f4wCKn4afr6ClPGN/X98 W/vLXrqavlnupmZaz6G7zNdCUx1ts/J54iqRSBbRSqqqeLnbYgFVSrmrrfQ/nLBbXsPf vgAOo/L6FB/7QcQEaNGWssDg67zAfSKvXnL0FIXLu2WcpkDWFWzIAeuLVGNaQM8RZu/R K7hye+ej+wRFHkZpAWEh2Vd/VhyO1vqmCRcQNcAllLzkgN8GUp8ryCM8TmS565F6V47I UsOUVlVQnUmV4pEc4zC/vJC3rN/LUvVEJg8cg9ygGw+VV2Jt2kS+VT8p7OHlPRUY1otK hNSw== 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=NUB/rqkFfUKu2v7QerAjMtUtZI3FXJ/o9W4GMo7Gy60=; b=uoDkX4Of/MVKvbqNCFbNV1cFvLH5ykQ3p34LLcg4TlQji+zvKiBFDju0tB4XYkIbdH +kh9Bu1ZUW4db/k9eIgPhKHfyEiMBD4Vbvg9bX3EbusqWjhDTw764+B6vKM/0v6fuzui ASGxFXslQ/nKQJY4GLuELNfMf8K1+g5vzNK+9CChTaPSDrP1jT3Z4QyD1kf0KAUAUSqn 5UrgSwBurGkCk2x6bXcRQkV7y4BWPndYttsb9hlHNz1OhcrkRaNjwJ5PabBNqw7Klz5n TnEpcLHwy2PiRSQ1ZeyMDtq02nCzUr4g0m0vW84ikbe1KQiuqENN0iGfUCjeAp2xxNRS fTZA== X-Gm-Message-State: APjAAAX6oDTC2+fdg2PIxNLq4Zb2Bm8AlJW7/2pLuYAGDbypICXFK5Kv xbrVUxXdfDbM+Qy4MdqeT11t4NXQUu4= X-Received: by 2002:a17:902:a415:: with SMTP id p21mr18702282plq.319.1567629914328; Wed, 04 Sep 2019 13:45:14 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id n66sm8104610pfn.90.2019.09.04.13.45.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2019 13:45:13 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 4 Sep 2019 13:44:58 -0700 Message-Id: <20190904204507.32457-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190904204507.32457-1-richard.henderson@linaro.org> References: <20190904204507.32457-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::633 Subject: [Qemu-devel] [PULL 04/13] target/openrisc: Make VR and PPC read-only X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" These SPRs are read-only. The writes can simply be ignored, as we already do for other read-only (or missing) registers. There is no reason to mask the value in env->vr. Reviewed-by: Stafford Horne Signed-off-by: Richard Henderson --- target/openrisc/cpu.h | 3 --- target/openrisc/sys_helper.c | 10 +--------- 2 files changed, 1 insertion(+), 12 deletions(-) -- 2.17.1 diff --git a/target/openrisc/cpu.h b/target/openrisc/cpu.h index 561f0f7fad..755282f95d 100644 --- a/target/openrisc/cpu.h +++ b/target/openrisc/cpu.h @@ -68,9 +68,6 @@ enum { (reg) |= ((v & 0x1f) << 2);\ } while (0) -/* Version Register */ -#define SPR_VR 0xFFFF003F - /* Interrupt */ #define NR_IRQS 32 diff --git a/target/openrisc/sys_helper.c b/target/openrisc/sys_helper.c index 1053409a04..d20f48b659 100644 --- a/target/openrisc/sys_helper.c +++ b/target/openrisc/sys_helper.c @@ -39,10 +39,6 @@ void HELPER(mtspr)(CPUOpenRISCState *env, target_ulong spr, target_ulong rb) int idx; switch (spr) { - case TO_SPR(0, 0): /* VR */ - env->vr = rb; - break; - case TO_SPR(0, 11): /* EVBAR */ env->evbar = rb; break; @@ -62,10 +58,6 @@ void HELPER(mtspr)(CPUOpenRISCState *env, target_ulong spr, target_ulong rb) cpu_set_sr(env, rb); break; - case TO_SPR(0, 18): /* PPC */ - env->ppc = rb; - break; - case TO_SPR(0, 32): /* EPCR */ env->epcr = rb; break; @@ -204,7 +196,7 @@ target_ulong HELPER(mfspr)(CPUOpenRISCState *env, target_ulong rd, switch (spr) { case TO_SPR(0, 0): /* VR */ - return env->vr & SPR_VR; + return env->vr; case TO_SPR(0, 1): /* UPR */ return env->upr; /* TT, DM, IM, UP present */ From patchwork Wed Sep 4 20:44:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 173085 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp462312ilq; Wed, 4 Sep 2019 14:31:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqxGunjB/WjfcMg3jSsYZYFmlbxxahvoe5eG27j9xxHqL2Xa9Fe7KV3gjbmmbKZ3hgi+FtdC X-Received: by 2002:a37:4b06:: with SMTP id y6mr14466572qka.395.1567632715154; Wed, 04 Sep 2019 14:31:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567632715; cv=none; d=google.com; s=arc-20160816; b=B5f0bbRuQ+adSxadKFntZGI1CALlUTFmugbEftyqv9YNSG/hWxKYirw+sEuJ71eVO4 q+0lnUUu0mmAlQSEsr1y8CZFKwuHDLs9vHhvF16V/DM8Lv05FmhzjSkwnp64LY/v9rK7 KDZPXrze86NRlro4+chmw+o7mJ0/XQ5OBBk4zPWDPDnYuyPwHgFORImavJc9SMygmtty LbMbMwjHvX+U26El8jXnav7nyx1EruQrCBQYGcHK8rC1fGtoIrjUHgnlQpT480/CI5D0 G34J7t+vMh6UIVtEU9qoLYGWhQIUR1WVPnISexjSfLofQdTGidN6kwTfSwlOnZzqHO/B Tkeg== 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=X84RCb73PaG8DYKiAA5H6xWmANPHPCwHIMuwva50q5I=; b=VT0SZxpm4Q8HTZ9yA87azMVTEnPZe0W/hRjvYPIB6Gl7z08Etd5N8Pr3BoK4QmQp2v URNeo17IyzPnFUdT5amu1nJXWfPXEgW1APRzyaqFFxSxYOKEXQIpDAEl+wDCgNkZd4nj UoS17h7dBh71m6G2OwVzERZktbxjRkgAvl3HtoP1aMogUqmW80dag9++PXD0+Slrh7G+ OF4IcRroauMJt2ctCaZp6dPn7MmBSry8UcQcY2wtVfTiroJZ8gJYADmqv63Cz6s30bn8 RK2WnIVnmeo75oKjOvq6i/rZl/xT81QsHUxxQJT8kSQ65CIhY8moMp+aX+tJtiaDkd/g 5+PA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=pNzuBxGZ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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. [209.51.188.17]) by mx.google.com with ESMTPS id c47si15752992qtb.98.2019.09.04.14.31.54 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 04 Sep 2019 14:31:55 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=pNzuBxGZ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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]:40222 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5csa-0004ri-63 for patch@linaro.org; Wed, 04 Sep 2019 17:31:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52826) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5c9X-00068U-7C for qemu-devel@nongnu.org; Wed, 04 Sep 2019 16:45:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5c9V-0006kY-Cr for qemu-devel@nongnu.org; Wed, 04 Sep 2019 16:45:18 -0400 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]:43598) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i5c9V-0006jK-1W for qemu-devel@nongnu.org; Wed, 04 Sep 2019 16:45:17 -0400 Received: by mail-pf1-x436.google.com with SMTP id d15so20792pfo.10 for ; Wed, 04 Sep 2019 13:45:16 -0700 (PDT) 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=X84RCb73PaG8DYKiAA5H6xWmANPHPCwHIMuwva50q5I=; b=pNzuBxGZqrLq9bInFa6+M5/RLw6wnLbVE0xKvLdxGmzWOqhkYmjaTSw5G4vHuj5HhH yNyT3qJPb6yyZeH3+VcTZOtCacIkIsThtGNnsHNjv9z+WodiyXY5khA3bKtRdhCvbyzl 9HL+hKEhGq1VapTU7t2e9ToOlpFDsjlNGYMvOIfTCtDCnRnHRKasdHw56ySu8nnOCaAG 7dNXDPYJYlQ/i4oTmmmB0GvaNvVPu0NG50z+Ykv0yBivpQGiED9RS3/ES8KQMfq54hbh MnL2S8gauIGw2U7F9cR06+HcvTZkmQID8onsJ/bzzgVO6ZWHdfX6MGCze+8gvegLKHty plxg== 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=X84RCb73PaG8DYKiAA5H6xWmANPHPCwHIMuwva50q5I=; b=b9o2lNg4iZiv9f00kr/kcUimAIztl2cKkLvDFohpEKPIQmwwK/ObtmGwSmYvRoD+mA smZFvx34jmFqoyVH3zBHJEijWgGD5P1PXDO0LeO3qBWl/R6EKifRZHiVx9oK5gQ7/fsj 7lVgXzna96SgJtt2U7xid9eEBXWZQM0VpYPF4TfG+63ACCqMkXftcgAfVBo/B1P7DNKP TJUhz8TjoCStA93amSUIk5qt6PkaWP7LL2+RnILF6e1TMt1hBcYEQM7PlA2bzGKoS9Sg zkAhOpjBt2EqJjwB4HzXCs05XwodjXudAzSqEQLIseyeHph1UqyDUwcu5Id2lIqSSH1g zCrg== X-Gm-Message-State: APjAAAWMhg35OOaFFEh34PomPqvySGKYHEuqWEH/2sKLxc9mbYCzbNI8 b5ItG02AHmxtUCee1XnZNyLS+3VMygw= X-Received: by 2002:a63:6c46:: with SMTP id h67mr67660pgc.248.1567629915524; Wed, 04 Sep 2019 13:45:15 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id n66sm8104610pfn.90.2019.09.04.13.45.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2019 13:45:14 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 4 Sep 2019 13:44:59 -0700 Message-Id: <20190904204507.32457-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190904204507.32457-1-richard.henderson@linaro.org> References: <20190904204507.32457-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::436 Subject: [Qemu-devel] [PULL 05/13] target/openrisc: Move VR, UPR, DMMCFGR, IMMCFGR to cpu init X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" These registers are read-only and implementation specific. Initiailize VR for the first time; take the OR1200 values from the verilog source. Note that moving fields within CPUOpenRISCState does not affect migration. Reviewed-by: Stafford Horne Signed-off-by: Richard Henderson --- target/openrisc/cpu.h | 8 ++++---- target/openrisc/cpu.c | 23 ++++++++++++++++------- target/openrisc/sys_helper.c | 4 ++-- 3 files changed, 22 insertions(+), 13 deletions(-) -- 2.17.1 diff --git a/target/openrisc/cpu.h b/target/openrisc/cpu.h index 755282f95d..18d7445e74 100644 --- a/target/openrisc/cpu.h +++ b/target/openrisc/cpu.h @@ -260,10 +260,6 @@ typedef struct CPUOpenRISCState { target_ulong sr_cy; /* the SR_CY bit, values 0, 1. */ target_long sr_ov; /* the SR_OV bit (in the sign bit only) */ uint32_t sr; /* Supervisor register, without SR_{F,CY,OV} */ - uint32_t vr; /* Version register */ - uint32_t upr; /* Unit presence register */ - uint32_t dmmucfgr; /* DMMU configure register */ - uint32_t immucfgr; /* IMMU configure register */ uint32_t esr; /* Exception supervisor register */ uint32_t evbar; /* Exception vector base address register */ uint32_t pmr; /* Power Management Register */ @@ -283,7 +279,11 @@ typedef struct CPUOpenRISCState { struct {} end_reset_fields; /* Fields from here on are preserved across CPU reset. */ + uint32_t vr; /* Version register */ + uint32_t upr; /* Unit presence register */ uint32_t cpucfgr; /* CPU configure register */ + uint32_t dmmucfgr; /* DMMU configure register */ + uint32_t immucfgr; /* IMMU configure register */ #ifndef CONFIG_USER_ONLY QEMUTimer *timer; diff --git a/target/openrisc/cpu.c b/target/openrisc/cpu.c index f19e482a55..d9f447e90c 100644 --- a/target/openrisc/cpu.c +++ b/target/openrisc/cpu.c @@ -56,13 +56,6 @@ static void openrisc_cpu_reset(CPUState *s) cpu->env.lock_addr = -1; s->exception_index = -1; - cpu->env.upr = UPR_UP | UPR_DMP | UPR_IMP | UPR_PICP | UPR_TTP | - UPR_PMP; - cpu->env.dmmucfgr = (DMMUCFGR_NTW & (0 << 2)) - | (DMMUCFGR_NTS & (ctz32(TLB_SIZE) << 2)); - cpu->env.immucfgr = (IMMUCFGR_NTW & (0 << 2)) - | (IMMUCFGR_NTS & (ctz32(TLB_SIZE) << 2)); - #ifndef CONFIG_USER_ONLY cpu->env.picmr = 0x00000000; cpu->env.picsr = 0x00000000; @@ -117,15 +110,31 @@ static void or1200_initfn(Object *obj) { OpenRISCCPU *cpu = OPENRISC_CPU(obj); + cpu->env.vr = 0x13000008; + cpu->env.upr = UPR_UP | UPR_DMP | UPR_IMP | UPR_PICP | UPR_TTP | UPR_PMP; cpu->env.cpucfgr = CPUCFGR_NSGF | CPUCFGR_OB32S | CPUCFGR_OF32S | CPUCFGR_EVBARP; + + /* 1Way, TLB_SIZE entries. */ + cpu->env.dmmucfgr = (DMMUCFGR_NTW & (0 << 2)) + | (DMMUCFGR_NTS & (ctz32(TLB_SIZE) << 2)); + cpu->env.immucfgr = (IMMUCFGR_NTW & (0 << 2)) + | (IMMUCFGR_NTS & (ctz32(TLB_SIZE) << 2)); } static void openrisc_any_initfn(Object *obj) { OpenRISCCPU *cpu = OPENRISC_CPU(obj); + cpu->env.vr = 0x13000000; + cpu->env.upr = UPR_UP | UPR_DMP | UPR_IMP | UPR_PICP | UPR_TTP | UPR_PMP; cpu->env.cpucfgr = CPUCFGR_NSGF | CPUCFGR_OB32S | CPUCFGR_EVBARP; + + /* 1Way, TLB_SIZE entries. */ + cpu->env.dmmucfgr = (DMMUCFGR_NTW & (0 << 2)) + | (DMMUCFGR_NTS & (ctz32(TLB_SIZE) << 2)); + cpu->env.immucfgr = (IMMUCFGR_NTW & (0 << 2)) + | (IMMUCFGR_NTS & (ctz32(TLB_SIZE) << 2)); } static void openrisc_cpu_class_init(ObjectClass *oc, void *data) diff --git a/target/openrisc/sys_helper.c b/target/openrisc/sys_helper.c index d20f48b659..a2b1f52294 100644 --- a/target/openrisc/sys_helper.c +++ b/target/openrisc/sys_helper.c @@ -199,13 +199,13 @@ target_ulong HELPER(mfspr)(CPUOpenRISCState *env, target_ulong rd, return env->vr; case TO_SPR(0, 1): /* UPR */ - return env->upr; /* TT, DM, IM, UP present */ + return env->upr; case TO_SPR(0, 2): /* CPUCFGR */ return env->cpucfgr; case TO_SPR(0, 3): /* DMMUCFGR */ - return env->dmmucfgr; /* 1Way, 64 entries */ + return env->dmmucfgr; case TO_SPR(0, 4): /* IMMUCFGR */ return env->immucfgr; From patchwork Wed Sep 4 20:45:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 173064 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp449528ilq; Wed, 4 Sep 2019 14:17:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqwXArabRMH1F2Vzlh9jMGlRJ9Yow62UVCL1cKGwTHpH35oc4bRfeMa5Can3+uGfFNgPz32j X-Received: by 2002:a37:6d2:: with SMTP id 201mr35415809qkg.106.1567631848406; Wed, 04 Sep 2019 14:17:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567631848; cv=none; d=google.com; s=arc-20160816; b=rnzuJNUP+i4vx8efLeGUNp+A1VuAqDJqSlKPfPa+bWcAtXTES5C/CRysXo9VLtnFAT Fwkz5NMxz+jGAlRN/UvY0hHITNGhiT9fkxQQ9ihN3TT051cCEqTRk27fUYxIoVrmrDLn yNGyN/Xm0YY+FWICF2fbRfMzlJK2u+8MEJEjMIUx+YBOPNWIc1mxMyXSdjybSHghMDnE zmD9nOJn+oyQh82gdiKrcj8PmOB6W6HFGbA6oCFX05hnHBicXm7XC2nwyeew3mP0YVY3 CvOojUeb6RdiCzkhNZQjpr6Pmdr6DS+YDcqzwGom0zAggSeU4euakT+S1OyFht6LfwFZ jCrQ== 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=ddiXQUCU6+mV9b5HLraEW0nl5fo+95ic0hgqPUZ1sNk=; b=k2W0//5Mbe5kCAd4EVqKHvtYJw6OqL1QQgLw6+AdhX4C/yviaxIQEpNVtD/LJCDPGz W5GnFJdgn8KDrBFl9JdLRDQEwca/7/hSVAxmiUdTAK+laHYNfgnXR+z9psXa3oP3j8o2 nU1kBYGvAmBs/QVdS5mImWJJrM5KXQCA4f2YwDNAXt0pzI6vohGu5oB6dpmK77IqlCMt 5NYCaM+cDO7QcTN1LuCFY0U9/0gP1HXrSS1BK6+GoysIkG5TMxIPd+bGJJWcYzSZ3c6z iNqIDBqeDF8oAdRcZqxU9xGCMr1Sx+VIRxY0iq53xMK21uZnHjG/wGEidZwU7X9aNagF QMHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=MSddaqDm; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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. [209.51.188.17]) by mx.google.com with ESMTPS id b206si147158qkc.330.2019.09.04.14.17.28 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 04 Sep 2019 14:17:28 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=MSddaqDm; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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]:40014 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5ced-0006LJ-26 for patch@linaro.org; Wed, 04 Sep 2019 17:17:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52835) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5c9X-0006A1-Vn for qemu-devel@nongnu.org; Wed, 04 Sep 2019 16:45:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5c9W-0006lB-B0 for qemu-devel@nongnu.org; Wed, 04 Sep 2019 16:45:19 -0400 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]:42625) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i5c9W-0006kd-3P for qemu-devel@nongnu.org; Wed, 04 Sep 2019 16:45:18 -0400 Received: by mail-pl1-x630.google.com with SMTP id y1so84045plp.9 for ; Wed, 04 Sep 2019 13:45:18 -0700 (PDT) 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=ddiXQUCU6+mV9b5HLraEW0nl5fo+95ic0hgqPUZ1sNk=; b=MSddaqDmsvrs+IxiQ14B8VDMy7wNo0Vt2EYZJek1dggV55FDVT0x5GlL6VdgzTMJbF MZ6ITu1ZxAt5wF9NnqfKZpC6cXe4iABpMf06vO7spIL72gfM9Lc6mRq/0qL5rz7Zta8o uU/E/rUhTLzMwppzep0CN4Jr40qIEdDorlKLqkavJ17VNaBxRLyhEXDlQGvmDKc3Vcw3 ktnpyndyd+qQQ53KAKQZScG1vw2/ljECNAYMposijavMiD6+tdYUJ52B/bxkPVy8195T fgPqz5owYB9BVfwXfz7Dri6xE9W0MTkUMexTNelWBJOjUo8Gh078podmqKKDxF5PGfwp HvEg== 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=ddiXQUCU6+mV9b5HLraEW0nl5fo+95ic0hgqPUZ1sNk=; b=pj1aJHC05FpLTjxWuJVl0gt2t60+F516VfNwyPv1L79maAOPcGm893l0K+h8ZGwIIl etFkfO1qb6GB52a49Lk4uVgXGSLF6Pl/mw6T5sFiDjpLw/owAW4K6b0W7VSR21/gLciW 5F+Ve0L0QSdwWJJ6j1SzBbymcSqaTQMy8JGKGaaAYqAmYSKYJTqpggaW5o0NdlGq1DE5 GZFLIOZzcIpZ4IaTFr/TgOdEV2ig5LZl3rfMJdR3nNk5fEZ4dmefVxEAtkGHyQj7ApCU 7xBeMyExOAiA2/NN84IpPAW3hgda8/N6TJQFx1V/z9CsDiVJQPgC5uB6sQEkWFPXsQcJ 2WpQ== X-Gm-Message-State: APjAAAVxuVCRGAQHVLz2r1eIbjZ1uaASHYjg0mrfa2gCLW+ms5in0VtU SkVkG5UFp+JbWTQ4FEo7SLlh3SE1KUg= X-Received: by 2002:a17:902:ab96:: with SMTP id f22mr43907220plr.147.1567629916793; Wed, 04 Sep 2019 13:45:16 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id n66sm8104610pfn.90.2019.09.04.13.45.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2019 13:45:16 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 4 Sep 2019 13:45:00 -0700 Message-Id: <20190904204507.32457-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190904204507.32457-1-richard.henderson@linaro.org> References: <20190904204507.32457-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::630 Subject: [Qemu-devel] [PULL 06/13] target/openrisc: Add VR2 and AVR special processor registers X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Update the CPUCFG bits to arch v1.3. Include support for AVRP for cpu "any". Signed-off-by: Richard Henderson --- target/openrisc/cpu.h | 11 +++++++---- target/openrisc/cpu.c | 8 ++++++-- target/openrisc/sys_helper.c | 6 ++++++ 3 files changed, 19 insertions(+), 6 deletions(-) -- 2.17.1 diff --git a/target/openrisc/cpu.h b/target/openrisc/cpu.h index 18d7445e74..71c5959828 100644 --- a/target/openrisc/cpu.h +++ b/target/openrisc/cpu.h @@ -96,11 +96,12 @@ enum { CPUCFGR_OF32S = (1 << 7), CPUCFGR_OF64S = (1 << 8), CPUCFGR_OV64S = (1 << 9), - /* CPUCFGR_ND = (1 << 10), */ - /* CPUCFGR_AVRP = (1 << 11), */ + CPUCFGR_ND = (1 << 10), + CPUCFGR_AVRP = (1 << 11), CPUCFGR_EVBARP = (1 << 12), - /* CPUCFGR_ISRP = (1 << 13), */ - /* CPUCFGR_AECSRP = (1 << 14), */ + CPUCFGR_ISRP = (1 << 13), + CPUCFGR_AECSRP = (1 << 14), + CPUCFGR_OF64A32S = (1 << 15), }; /* DMMU configure register */ @@ -280,6 +281,8 @@ typedef struct CPUOpenRISCState { /* Fields from here on are preserved across CPU reset. */ uint32_t vr; /* Version register */ + uint32_t vr2; /* Version register 2 */ + uint32_t avr; /* Architecture version register */ uint32_t upr; /* Unit presence register */ uint32_t cpucfgr; /* CPU configure register */ uint32_t dmmucfgr; /* DMMU configure register */ diff --git a/target/openrisc/cpu.c b/target/openrisc/cpu.c index d9f447e90c..9f566ad883 100644 --- a/target/openrisc/cpu.c +++ b/target/openrisc/cpu.c @@ -126,9 +126,13 @@ static void openrisc_any_initfn(Object *obj) { OpenRISCCPU *cpu = OPENRISC_CPU(obj); - cpu->env.vr = 0x13000000; + cpu->env.vr = 0x13000040; /* Obsolete VER + UVRP for new SPRs */ + cpu->env.vr2 = 0; /* No version specific id */ + cpu->env.avr = 0x01010000; /* Architecture v1.1 */ + cpu->env.upr = UPR_UP | UPR_DMP | UPR_IMP | UPR_PICP | UPR_TTP | UPR_PMP; - cpu->env.cpucfgr = CPUCFGR_NSGF | CPUCFGR_OB32S | CPUCFGR_EVBARP; + cpu->env.cpucfgr = CPUCFGR_NSGF | CPUCFGR_OB32S | + CPUCFGR_AVRP | CPUCFGR_EVBARP; /* 1Way, TLB_SIZE entries. */ cpu->env.dmmucfgr = (DMMUCFGR_NTW & (0 << 2)) diff --git a/target/openrisc/sys_helper.c b/target/openrisc/sys_helper.c index a2b1f52294..cf8e637b08 100644 --- a/target/openrisc/sys_helper.c +++ b/target/openrisc/sys_helper.c @@ -210,6 +210,12 @@ target_ulong HELPER(mfspr)(CPUOpenRISCState *env, target_ulong rd, case TO_SPR(0, 4): /* IMMUCFGR */ return env->immucfgr; + case TO_SPR(0, 9): /* VR2 */ + return env->vr2; + + case TO_SPR(0, 10): /* AVR */ + return env->avr; + case TO_SPR(0, 11): /* EVBAR */ return env->evbar; From patchwork Wed Sep 4 20:45:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 173067 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp452663ilq; Wed, 4 Sep 2019 14:20:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqzGbPazEmKcO6dGPq7/PQqV4zHtEnyw3DryMEGdoW01q6tYqKK26+vyfjTRYulseGTf3HPn X-Received: by 2002:a50:d70c:: with SMTP id t12mr380649edi.172.1567632045396; Wed, 04 Sep 2019 14:20:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567632045; cv=none; d=google.com; s=arc-20160816; b=Vi/T16iKDz1oY3eKCBMfRJlidldb0CY8cBNAkhtLIAjdVtmY/LHecRprajT+WLHLmk GNqmF2GZusR6h0/4FGX3ZtxSMMNngIh0gGNk3HsXtl8NMr5wB7M6ksJ6AvPPKXNfiFU5 wvoajWvQrqbSO6MBdpNJ+qoqoyfEfwYVUI5zNfWgP4+qqx5FNbA3YIA3rqEklDGxBbie vh9euO0IkJ8/ffMCououGMrmO1xujRYJ/eFmuMNdZpZxXXf+01EA30KGKY6kO6jPMMbH C0U/wklRp4wlzQCgT3nfTbkp8Zb/vFwHx32KE6k6+igbJXcUec3aeKeZgR2+i+TTvn0u a7LQ== 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=DCUh3pxo77uhgP+ZJoHLASbE9LI4j7qaNhsFo5dJ8X8=; b=nfUmbibZPlfh0RqyUHa9jIGvz2p3JiLhC+UVysau/78ZznymhmqBiFBgyKvYhiV31Y rsgUZvIaOP9Vui/SN3ngryD6rNlvef0qf5lI4SsUWcIPO1snlUUUvs/8ZdXnWjp/utN8 nxz4ilTOWs74UnxUcx5U3Upv262kRV+mEGYEHHBFNoiM+nCixj8/YYBUljiFALErRRV2 n8Z7TCWy5vUgL7fZPjang4dFR5frgOr2QO8I8MB34hWoo+ipWTK41jzUGj+m/kn+/6dY lUiDQBY0xKCygfnPw9UJUwRnf2f+5YTwMR3DeMbMq2irz8x1QxsWI6yY4z3F0s89bgVZ rBSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=X2bi62r7; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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. [209.51.188.17]) by mx.google.com with ESMTPS id n20si7041977edn.306.2019.09.04.14.20.45 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 04 Sep 2019 14:20:45 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=X2bi62r7; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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]:40062 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5chn-0001OQ-SL for patch@linaro.org; Wed, 04 Sep 2019 17:20:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52844) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5c9Y-0006Av-MD for qemu-devel@nongnu.org; Wed, 04 Sep 2019 16:45:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5c9X-0006li-C4 for qemu-devel@nongnu.org; Wed, 04 Sep 2019 16:45:20 -0400 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]:46604) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i5c9X-0006lF-3l for qemu-devel@nongnu.org; Wed, 04 Sep 2019 16:45:19 -0400 Received: by mail-pl1-x633.google.com with SMTP id t1so71297plq.13 for ; Wed, 04 Sep 2019 13:45:19 -0700 (PDT) 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=DCUh3pxo77uhgP+ZJoHLASbE9LI4j7qaNhsFo5dJ8X8=; b=X2bi62r7E6W+ANGD6dXapnAAlHBs1N3/il/xLnEE7kwqaqLsgvdMHhI2V1TnDsM9ch Gaz9tPsxLcbwTnHCZ40PstdFNm7Xcer9TwuSq/UAaZmbLXOM+Y2wKxaULda82NniwX3J qKsVxJROJUlSrkl+Uca9oK/RPc5d4U/u9TyzA9rN/LEfMVoWRA3IIwG29DYGnRbcdtcd ZWnSlctUGaRdwj4vNgjEy2VnQL99SbYwBBbvotgGzbseMv/9ZvIvBbC6UvxEl9zdPOCq Rjh3RyW84hJ2Fc5Tr0Ylhs0wSdGOMFHZeAS9GalIvjXSMsi7Rbv9fz+3yQSUWegjROaq 9vHw== 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=DCUh3pxo77uhgP+ZJoHLASbE9LI4j7qaNhsFo5dJ8X8=; b=ghMnbdi0RMyMqytOgqdXpAn162jqyj3tjU21KMajXIG3P/sX/Gz8WowsVCxyW3g5n6 CNObnsrOu7zX1qpAKSbs4Jy+3wiBWI+ypJijAv909BQMWFlcT5Scol12gAhpavbKMK9V TQg/ul5yvAUViur9t0OYY+zzaHxmA/hyYgc6YjcZ20dTvgjNIsBXEFbK4pDxi5lQkOq5 9RfdKF4PrkUg7VZ1Bp+DVO9lYWuBwp1Yc1nuXV7Rd46jKofxSnhcZYLyZcF/7lmhTlpG nHTe6VAFAsVfhaW5qI7lYz/JrmUok/seFYxEcXt9bKQAHznRJDXHs/+nxSWekzRDu9GL jsJg== X-Gm-Message-State: APjAAAX0ud7aSvVk4rw8Ou2Vmyy8uZZOFZyhe3Z5+lAK3vhD5xY4OrjV hPppApSW4jc15TCD2E1mKHi87eOqiRI= X-Received: by 2002:a17:902:44c:: with SMTP id 70mr41774517ple.225.1567629917984; Wed, 04 Sep 2019 13:45:17 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id n66sm8104610pfn.90.2019.09.04.13.45.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2019 13:45:17 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 4 Sep 2019 13:45:01 -0700 Message-Id: <20190904204507.32457-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190904204507.32457-1-richard.henderson@linaro.org> References: <20190904204507.32457-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::633 Subject: [Qemu-devel] [PULL 07/13] target/openrisc: Fix lf.ftoi.s X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The specification of this insn is round-to-zero. Reviewed-by: Stafford Horne Signed-off-by: Richard Henderson --- target/openrisc/fpu_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.17.1 diff --git a/target/openrisc/fpu_helper.c b/target/openrisc/fpu_helper.c index b9d2ebbb8c..4cc5b297c5 100644 --- a/target/openrisc/fpu_helper.c +++ b/target/openrisc/fpu_helper.c @@ -78,7 +78,7 @@ uint64_t HELPER(ftoid)(CPUOpenRISCState *env, uint64_t val) uint32_t HELPER(ftois)(CPUOpenRISCState *env, uint32_t val) { - return float32_to_int32(val, &env->fp_status); + return float32_to_int32_round_to_zero(val, &env->fp_status); } #define FLOAT_CALC(name) \ From patchwork Wed Sep 4 20:45:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 173092 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp468512ilq; Wed, 4 Sep 2019 14:38:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqzFB8PduK1SV6c4hOr7LXZvmGBPd0nNNxQnXpMYXkk/V+Y7VufNwrEJ07DDr02YXjw2SKBB X-Received: by 2002:a37:2784:: with SMTP id n126mr27530102qkn.302.1567633132653; Wed, 04 Sep 2019 14:38:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567633132; cv=none; d=google.com; s=arc-20160816; b=OEITAEYScqEVObvYbrCDNQxUJZZJtX2OcqUID50JD5HqHeSBYH8enutvHID5hM5ddh UXvvNFocvzzYrXS2HgDsaCCYD9aXxDLhOrATFW171KIYZMquMJ5Q+AGJEnnmW8DQgczH DMJgvI1uDrhPickz9sGKNBRXy7q/qb6bd9cKc5H4QHdLpw89b8zN0/9Ufvw+OXBHLrZN yH+3Q2SzdERJw68bGKaXdrHJHqmI2Tksmrd4L4wTNWvUeRaLFxBkfChLiYpLV8vREo/s JcGjUqkUsBTOFYC5kLZwQ8WJDy/bNZWoFLYxZbPxpe6U9OSObgnvV74W1qHy0Fwz/OpV ZYPg== 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=2GGld3+nyB6RGdDPwst4M2bW/fcpfjsi762a3svN9NQ=; b=UzKnlcieQ/6dTyzjIQBnYw8t1a3uuEWkXtIqGIz3V9rn7tH9BT5LUdSvSnGsuUc6Jx cg2U20U8AdqcXI0SnpdXIOmjvATZlUEd/6d1iqOCzmTDB6zM/y/FoULrjvFlhIWP9NsM SbOSqpxb4CIckbzpl0VDUgo0rqQrVearcMZKLdg+QuIKnvLROCDm5jeoHDSy2IO5b6tr DM1C05OftjrIbJsVgFJGqAkru0FAbHj1gkEfGMhg0LoOiBohbASL9pn3hA65Kc3Z74Kk ukcBZSwt3OykHH83b9aB4GZckRrpX2EO2PET2aH4sRbaHO7JdmZkhzGyu2RPB53YYhXm WzDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Z+SNo1wQ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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. [209.51.188.17]) by mx.google.com with ESMTPS id k42si165315qvc.5.2019.09.04.14.38.52 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 04 Sep 2019 14:38:52 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Z+SNo1wQ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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]:40330 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5czL-0004Re-Bb for patch@linaro.org; Wed, 04 Sep 2019 17:38:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52869) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5c9a-0006Ec-Kr for qemu-devel@nongnu.org; Wed, 04 Sep 2019 16:45:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5c9Y-0006nK-RQ for qemu-devel@nongnu.org; Wed, 04 Sep 2019 16:45:22 -0400 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]:39602) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i5c9Y-0006m5-IX for qemu-devel@nongnu.org; Wed, 04 Sep 2019 16:45:20 -0400 Received: by mail-pl1-x62d.google.com with SMTP id bd8so95431plb.6 for ; Wed, 04 Sep 2019 13:45:20 -0700 (PDT) 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=2GGld3+nyB6RGdDPwst4M2bW/fcpfjsi762a3svN9NQ=; b=Z+SNo1wQyA7Jh9KTwQTDa0Yn97hxRYfVBnO2a2HeEa9+B0baYabNxPUDzs/hXdRL+h W9H7qrvdyOfy0fB+gRKIL92Gh3jk+X0SE7p/nxEhjZlNHjVhPJpw2kSm3em8LqGalscP hv/Nl7gisyCf+2TRufDdiKM7ly3f9srfFm2Qbv6xRPoWlyr+P9F6Z3mp9GuzVHJqPV8j QrAjtYRNzQWUreGTLBsTnONNdBRA6r659ohCjBLdFVJP6yp5Hy1X6gB8RWxetptBXjSC uZ2/CvAt2PPtuclOck0C+tz+3imOQC2MhPS9JsFEHYqBYxLa6/xvZTTv1Ur3cLQSFWrt G5Zg== 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=2GGld3+nyB6RGdDPwst4M2bW/fcpfjsi762a3svN9NQ=; b=pwAHwZMsmt3FUx+onxGxinB+o2BStTdBlqpLRlCH1Mn2aZZYDWEW2vJoqXcbhpykJc uLSk7dB+4p1tvEly/bYLGVmSaeHvzV4UlVlC/z/hycOc5rhguy9C53AJl+UZUjkoSh94 et2w/gf4Le14OnOAo6cHP1/415Va9WfhoY3PxY8/yeuaDlxE2fzQbpOmVl+geMI8ae+e IbPdhxU6EVfR36dfg5Dz1Zdo5HIz6fhadHMjPRjq7YCX7xX4E2z3ItDvwAtP4XJL/Ha0 5A1qtem7CXz4gqW0RD4swr9b5DRcm7WcdKzDIUccD+1VLCWGggqiabVeCfbwhR6wG34B GipQ== X-Gm-Message-State: APjAAAXgZ+2cExkBwI+0mW51lLu+UPtbVhu0zqC1IPJ9L7hDZdXx5WvM H9zOWJL+Jig5U++toE1OClyaiT3AFrs= X-Received: by 2002:a17:902:9347:: with SMTP id g7mr7611218plp.0.1567629919179; Wed, 04 Sep 2019 13:45:19 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id n66sm8104610pfn.90.2019.09.04.13.45.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2019 13:45:18 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 4 Sep 2019 13:45:02 -0700 Message-Id: <20190904204507.32457-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190904204507.32457-1-richard.henderson@linaro.org> References: <20190904204507.32457-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::62d Subject: [Qemu-devel] [PULL 08/13] target/openrisc: Check CPUCFG_OF32S for float insns X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Make sure the OF32S insns are enabled before allowing execution. Include the missing bit for cpu "any". Reviewed-by: Stafford Horne Signed-off-by: Richard Henderson --- target/openrisc/cpu.c | 2 +- target/openrisc/translate.c | 84 ++++++++++++++++--------------------- 2 files changed, 36 insertions(+), 50 deletions(-) -- 2.17.1 diff --git a/target/openrisc/cpu.c b/target/openrisc/cpu.c index 9f566ad883..f3c8134531 100644 --- a/target/openrisc/cpu.c +++ b/target/openrisc/cpu.c @@ -131,7 +131,7 @@ static void openrisc_any_initfn(Object *obj) cpu->env.avr = 0x01010000; /* Architecture v1.1 */ cpu->env.upr = UPR_UP | UPR_DMP | UPR_IMP | UPR_PICP | UPR_TTP | UPR_PMP; - cpu->env.cpucfgr = CPUCFGR_NSGF | CPUCFGR_OB32S | + cpu->env.cpucfgr = CPUCFGR_NSGF | CPUCFGR_OB32S | CPUCFGR_OF32S | CPUCFGR_AVRP | CPUCFGR_EVBARP; /* 1Way, TLB_SIZE entries. */ diff --git a/target/openrisc/translate.c b/target/openrisc/translate.c index 341f923864..2f5c969f21 100644 --- a/target/openrisc/translate.c +++ b/target/openrisc/translate.c @@ -45,6 +45,7 @@ typedef struct DisasContext { uint32_t mem_idx; uint32_t tb_flags; uint32_t delayed_branch; + uint32_t cpucfgr; /* If not -1, jmp_pc contains this value and so is a direct jump. */ target_ulong jmp_pc_imm; @@ -140,30 +141,11 @@ static void gen_illegal_exception(DisasContext *dc) dc->base.is_jmp = DISAS_NORETURN; } -/* not used yet, open it when we need or64. */ -/*#ifdef TARGET_OPENRISC64 -static void check_ob64s(DisasContext *dc) +static bool check_of32s(DisasContext *dc) { - if (!(dc->flags & CPUCFGR_OB64S)) { - gen_illegal_exception(dc); - } + return dc->cpucfgr & CPUCFGR_OF32S; } -static void check_of64s(DisasContext *dc) -{ - if (!(dc->flags & CPUCFGR_OF64S)) { - gen_illegal_exception(dc); - } -} - -static void check_ov64s(DisasContext *dc) -{ - if (!(dc->flags & CPUCFGR_OV64S)) { - gen_illegal_exception(dc); - } -} -#endif*/ - static TCGv cpu_R(DisasContext *dc, int reg) { if (reg == 0) { @@ -1157,26 +1139,37 @@ static bool trans_l_rfe(DisasContext *dc, arg_l_rfe *a) return true; } -static void do_fp2(DisasContext *dc, arg_da *a, +static bool do_fp2(DisasContext *dc, arg_da *a, void (*fn)(TCGv, TCGv_env, TCGv)) { + if (!check_of32s(dc)) { + return false; + } check_r0_write(dc, a->d); fn(cpu_R(dc, a->d), cpu_env, cpu_R(dc, a->a)); gen_helper_update_fpcsr(cpu_env); + return true; } -static void do_fp3(DisasContext *dc, arg_dab *a, +static bool do_fp3(DisasContext *dc, arg_dab *a, void (*fn)(TCGv, TCGv_env, TCGv, TCGv)) { + if (!check_of32s(dc)) { + return false; + } check_r0_write(dc, a->d); fn(cpu_R(dc, a->d), cpu_env, cpu_R(dc, a->a), cpu_R(dc, a->b)); gen_helper_update_fpcsr(cpu_env); + return true; } -static void do_fpcmp(DisasContext *dc, arg_ab *a, +static bool do_fpcmp(DisasContext *dc, arg_ab *a, void (*fn)(TCGv, TCGv_env, TCGv, TCGv), bool inv, bool swap) { + if (!check_of32s(dc)) { + return false; + } if (swap) { fn(cpu_sr_f, cpu_env, cpu_R(dc, a->b), cpu_R(dc, a->a)); } else { @@ -1186,52 +1179,50 @@ static void do_fpcmp(DisasContext *dc, arg_ab *a, tcg_gen_xori_tl(cpu_sr_f, cpu_sr_f, 1); } gen_helper_update_fpcsr(cpu_env); + return true; } static bool trans_lf_add_s(DisasContext *dc, arg_dab *a) { - do_fp3(dc, a, gen_helper_float_add_s); - return true; + return do_fp3(dc, a, gen_helper_float_add_s); } static bool trans_lf_sub_s(DisasContext *dc, arg_dab *a) { - do_fp3(dc, a, gen_helper_float_sub_s); - return true; + return do_fp3(dc, a, gen_helper_float_sub_s); } static bool trans_lf_mul_s(DisasContext *dc, arg_dab *a) { - do_fp3(dc, a, gen_helper_float_mul_s); - return true; + return do_fp3(dc, a, gen_helper_float_mul_s); } static bool trans_lf_div_s(DisasContext *dc, arg_dab *a) { - do_fp3(dc, a, gen_helper_float_div_s); - return true; + return do_fp3(dc, a, gen_helper_float_div_s); } static bool trans_lf_rem_s(DisasContext *dc, arg_dab *a) { - do_fp3(dc, a, gen_helper_float_rem_s); + return do_fp3(dc, a, gen_helper_float_rem_s); return true; } static bool trans_lf_itof_s(DisasContext *dc, arg_da *a) { - do_fp2(dc, a, gen_helper_itofs); - return true; + return do_fp2(dc, a, gen_helper_itofs); } static bool trans_lf_ftoi_s(DisasContext *dc, arg_da *a) { - do_fp2(dc, a, gen_helper_ftois); - return true; + return do_fp2(dc, a, gen_helper_ftois); } static bool trans_lf_madd_s(DisasContext *dc, arg_dab *a) { + if (!check_of32s(dc)) { + return false; + } check_r0_write(dc, a->d); gen_helper_float_madd_s(cpu_R(dc, a->d), cpu_env, cpu_R(dc, a->d), cpu_R(dc, a->a), cpu_R(dc, a->b)); @@ -1241,38 +1232,32 @@ static bool trans_lf_madd_s(DisasContext *dc, arg_dab *a) static bool trans_lf_sfeq_s(DisasContext *dc, arg_ab *a) { - do_fpcmp(dc, a, gen_helper_float_eq_s, false, false); - return true; + return do_fpcmp(dc, a, gen_helper_float_eq_s, false, false); } static bool trans_lf_sfne_s(DisasContext *dc, arg_ab *a) { - do_fpcmp(dc, a, gen_helper_float_eq_s, true, false); - return true; + return do_fpcmp(dc, a, gen_helper_float_eq_s, true, false); } static bool trans_lf_sfgt_s(DisasContext *dc, arg_ab *a) { - do_fpcmp(dc, a, gen_helper_float_lt_s, false, true); - return true; + return do_fpcmp(dc, a, gen_helper_float_lt_s, false, true); } static bool trans_lf_sfge_s(DisasContext *dc, arg_ab *a) { - do_fpcmp(dc, a, gen_helper_float_le_s, false, true); - return true; + return do_fpcmp(dc, a, gen_helper_float_le_s, false, true); } static bool trans_lf_sflt_s(DisasContext *dc, arg_ab *a) { - do_fpcmp(dc, a, gen_helper_float_lt_s, false, false); - return true; + return do_fpcmp(dc, a, gen_helper_float_lt_s, false, false); } static bool trans_lf_sfle_s(DisasContext *dc, arg_ab *a) { - do_fpcmp(dc, a, gen_helper_float_le_s, false, false); - return true; + return do_fpcmp(dc, a, gen_helper_float_le_s, false, false); } static void openrisc_tr_init_disas_context(DisasContextBase *dcb, CPUState *cs) @@ -1284,6 +1269,7 @@ static void openrisc_tr_init_disas_context(DisasContextBase *dcb, CPUState *cs) dc->mem_idx = cpu_mmu_index(env, false); dc->tb_flags = dc->base.tb->flags; dc->delayed_branch = (dc->tb_flags & TB_FLAGS_DFLAG) != 0; + dc->cpucfgr = env->cpucfgr; dc->jmp_pc_imm = -1; bound = -(dc->base.pc_first | TARGET_PAGE_MASK) / 4; From patchwork Wed Sep 4 20:45:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 173066 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp451975ilq; Wed, 4 Sep 2019 14:20:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqw1F8tKROpLednCR6ZNmbnWeazlE+x7eXtRjS4JupnhCxRZ6z+zNuFBZEwrxXlLgA6YKJ8F X-Received: by 2002:a50:ad5b:: with SMTP id z27mr360473edc.252.1567632003461; Wed, 04 Sep 2019 14:20:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567632003; cv=none; d=google.com; s=arc-20160816; b=OTcz5Qq9WAhJzf/UvaT6ZllMZBs1aHclcd2vCCP7/Iyze4hfeCpOkNoUhrwQfm0au6 wJKkVT41CHtBDo684rXaqVECO51UBwom6FtnHmufkY8zlfoAlI6o9sWCWaT/ZhVz0Xe8 /0BYZ+XrkGs0+rypXIRfb1gShH7jR7hrL6M8xNCP16CTCVfS0uy0Lk3CPFuTKzDpfnuo m2R8fjJDs27HG71+ZnHTx26MnHH30bt5fytHeHneCiZK3IQ0YT1oZmLuHBbVVxLLp11w qPCWVaIoI5WtApp+ejYa4mGJ9yyU8e4ShbqN0CCtgAK7fUPr5YFYGQYsxX+FPIFB7woG kbtg== 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=IWUivciiEyIw5h23RCVrBi2UZhIQIIAcE0cBZIKJOZg=; b=ZjgNpRgynkrtRQ+JeQvOQeejm6zgs8DxDoqCBJombiy5dY3tagVjFgV/GzrN51dGBb 9Z/XZ30yeb4G6YYrdXTwV+FWh/OEDPReAq8l3Ol2gB4gsFUFA11pLhd/Jteu999CuKrk k5Oz9OhZgWx2mE87buHovfj39XNF/1TfpPCXRqRa5yHexR3meQ/k1bQxuuGe3tA7x1GM FcCxWPm3Xc/leotvePnrBF/2D/jEtljcyHAutSWjtsL9M0wNn+hIXSfRTIcY1NeJrXsw Z2U0Am+pACPzOWXsfB/i1xU+wqrFXdhnC8+tddXbtNayfnOTvpCTA7gzgYt5XFgwhqjB BsoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=d3oH9TLa; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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. [209.51.188.17]) by mx.google.com with ESMTPS id g19si121078ejo.386.2019.09.04.14.20.03 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 04 Sep 2019 14:20:03 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=d3oH9TLa; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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]:40030 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5ch7-0007nL-JN for patch@linaro.org; Wed, 04 Sep 2019 17:20:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52888) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5c9c-0006Ht-QG for qemu-devel@nongnu.org; Wed, 04 Sep 2019 16:45:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5c9a-0006qh-7L for qemu-devel@nongnu.org; Wed, 04 Sep 2019 16:45:24 -0400 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]:46606) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i5c9Z-0006ou-Ua for qemu-devel@nongnu.org; Wed, 04 Sep 2019 16:45:22 -0400 Received: by mail-pl1-x635.google.com with SMTP id t1so71357plq.13 for ; Wed, 04 Sep 2019 13:45:21 -0700 (PDT) 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=IWUivciiEyIw5h23RCVrBi2UZhIQIIAcE0cBZIKJOZg=; b=d3oH9TLaCZO/zio1uZr+YOyY8auAfEZwBJFDmZbEn/XqQCppVuwzO0HQwzfkXoS8ki iOZAkhWMVCdZX7UH1IhJtMBHPwUm5QEx10l83erw1zY9z7LpV0UGAgsNfFbzM7zYWzy1 ASRIXZtcGNQTZxCxIvFMyludOIuOZVW/CJj6mKrsUVYLDv/6ys14oqI8KME8kERBK2kd v+4uVLA+i9orjQqFBu5mCftu7EiFDYzg4PNJJSbqAJANHkzytSlFZ7SBouY/cT1F4Xqu zs9xIo8h35geD3yerWIoUiuPBCbQWw4wb2FgFNSuIHAHIOaKVt+g9CaQapZf8SNbokjJ Cwkw== 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=IWUivciiEyIw5h23RCVrBi2UZhIQIIAcE0cBZIKJOZg=; b=bJcCw9J2KMCVcjOjx2rTReRe0LB5uoNT1AJEz09B9aDRwZCvpAsXq+j1E2BWKXZKKa /7Dl1EAy+FUItqUnszQ70/sIjFgrbebx0e/RmSx3Ya9hcEP/qnYWosZv6iwsl7//QbR5 ltBwnS06NXXtvqFYtUHCU06v/c4GQsp4l+Ztv6Icu6Ivn5LB3XpdMoHMP4mZFnqgPkjt AaD2rly+3DyEo3CsR4rNl0wnRuIPbQicqjzSUjPEMqFFh2CtTxg6bNIjIAB5zFZXP/b+ X+GBBj2Mxr+LrBfGehHMD62vzuT1uR6Be7zykKzdaV4yg3eAi+iE9TJumV/L0+hDzt/y Iakg== X-Gm-Message-State: APjAAAUiEF7exTda+L75XFAdGr1GDDG4G9ykH9B2YfQCA/N+No2V2fTu qRvK8whXB8Pi5o8OYddcBoYP6UGvrf4= X-Received: by 2002:a17:902:788b:: with SMTP id q11mr42609133pll.308.1567629920532; Wed, 04 Sep 2019 13:45:20 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id n66sm8104610pfn.90.2019.09.04.13.45.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2019 13:45:19 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 4 Sep 2019 13:45:03 -0700 Message-Id: <20190904204507.32457-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190904204507.32457-1-richard.henderson@linaro.org> References: <20190904204507.32457-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::635 Subject: [Qemu-devel] [PULL 09/13] target/openrisc: Add support for ORFPX64A32 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This is hardware support for double-precision floating-point using pairs of 32-bit registers. Fix latent bugs in the heretofore unused helper_itofd and helper_ftoid. Include the bit for cpu "any". Change the default cpu for linux-user to "any". Reviewed-by: Stafford Horne Signed-off-by: Richard Henderson --- linux-user/openrisc/target_elf.h | 2 +- target/openrisc/helper.h | 2 + target/openrisc/cpu.c | 2 +- target/openrisc/disas.c | 56 ++++++++ target/openrisc/fpu_helper.c | 14 +- target/openrisc/translate.c | 230 +++++++++++++++++++++++++++++++ target/openrisc/insns.decode | 31 +++++ 7 files changed, 333 insertions(+), 4 deletions(-) -- 2.17.1 diff --git a/linux-user/openrisc/target_elf.h b/linux-user/openrisc/target_elf.h index 40ceb025c9..265ecd3079 100644 --- a/linux-user/openrisc/target_elf.h +++ b/linux-user/openrisc/target_elf.h @@ -9,6 +9,6 @@ #define OPENRISC_TARGET_ELF_H static inline const char *cpu_get_model(uint32_t eflags) { - return "or1200"; + return "any"; } #endif diff --git a/target/openrisc/helper.h b/target/openrisc/helper.h index 96d79a8113..94b823580e 100644 --- a/target/openrisc/helper.h +++ b/target/openrisc/helper.h @@ -30,6 +30,8 @@ DEF_HELPER_FLAGS_2(itofd, TCG_CALL_NO_RWG, i64, env, i64) DEF_HELPER_FLAGS_2(itofs, TCG_CALL_NO_RWG, i32, env, i32) DEF_HELPER_FLAGS_2(ftoid, TCG_CALL_NO_RWG, i64, env, i64) DEF_HELPER_FLAGS_2(ftois, TCG_CALL_NO_RWG, i32, env, i32) +DEF_HELPER_FLAGS_2(stod, TCG_CALL_NO_RWG, i64, env, i32) +DEF_HELPER_FLAGS_2(dtos, TCG_CALL_NO_RWG, i32, env, i64) DEF_HELPER_FLAGS_4(float_madd_s, TCG_CALL_NO_RWG, i32, env, i32, i32, i32) DEF_HELPER_FLAGS_4(float_madd_d, TCG_CALL_NO_RWG, i64, env, i64, i64, i64) diff --git a/target/openrisc/cpu.c b/target/openrisc/cpu.c index f3c8134531..b931605e62 100644 --- a/target/openrisc/cpu.c +++ b/target/openrisc/cpu.c @@ -132,7 +132,7 @@ static void openrisc_any_initfn(Object *obj) cpu->env.upr = UPR_UP | UPR_DMP | UPR_IMP | UPR_PICP | UPR_TTP | UPR_PMP; cpu->env.cpucfgr = CPUCFGR_NSGF | CPUCFGR_OB32S | CPUCFGR_OF32S | - CPUCFGR_AVRP | CPUCFGR_EVBARP; + CPUCFGR_AVRP | CPUCFGR_EVBARP | CPUCFGR_OF64A32S; /* 1Way, TLB_SIZE entries. */ cpu->env.dmmucfgr = (DMMUCFGR_NTW & (0 << 2)) diff --git a/target/openrisc/disas.c b/target/openrisc/disas.c index 7091832347..4de5c632de 100644 --- a/target/openrisc/disas.c +++ b/target/openrisc/disas.c @@ -166,3 +166,59 @@ FP_INSN(sfgt, s, "r%d, r%d", a->a, a->b) FP_INSN(sfge, s, "r%d, r%d", a->a, a->b) FP_INSN(sflt, s, "r%d, r%d", a->a, a->b) FP_INSN(sfle, s, "r%d, r%d", a->a, a->b) + +FP_INSN(add, d, "r%d,r%d, r%d,r%d, r%d,r%d", + a->d, a->d + a->dp + 1, + a->a, a->a + a->ap + 1, + a->b, a->b + a->bp + 1) +FP_INSN(sub, d, "r%d,r%d, r%d,r%d, r%d,r%d", + a->d, a->d + a->dp + 1, + a->a, a->a + a->ap + 1, + a->b, a->b + a->bp + 1) +FP_INSN(mul, d, "r%d,r%d, r%d,r%d, r%d,r%d", + a->d, a->d + a->dp + 1, + a->a, a->a + a->ap + 1, + a->b, a->b + a->bp + 1) +FP_INSN(div, d, "r%d,r%d, r%d,r%d, r%d,r%d", + a->d, a->d + a->dp + 1, + a->a, a->a + a->ap + 1, + a->b, a->b + a->bp + 1) +FP_INSN(rem, d, "r%d,r%d, r%d,r%d, r%d,r%d", + a->d, a->d + a->dp + 1, + a->a, a->a + a->ap + 1, + a->b, a->b + a->bp + 1) +FP_INSN(madd, d, "r%d,r%d, r%d,r%d, r%d,r%d", + a->d, a->d + a->dp + 1, + a->a, a->a + a->ap + 1, + a->b, a->b + a->bp + 1) + +FP_INSN(itof, d, "r%d,r%d, r%d,r%d", + a->d, a->d + a->dp + 1, + a->a, a->a + a->ap + 1) +FP_INSN(ftoi, d, "r%d,r%d, r%d,r%d", + a->d, a->d + a->dp + 1, + a->a, a->a + a->ap + 1) + +FP_INSN(stod, d, "r%d,r%d, r%d", + a->d, a->d + a->dp + 1, a->a) +FP_INSN(dtos, d, "r%d r%d,r%d", + a->d, a->a, a->a + a->ap + 1) + +FP_INSN(sfeq, d, "r%d,r%d, r%d,r%d", + a->a, a->a + a->ap + 1, + a->b, a->b + a->bp + 1) +FP_INSN(sfne, d, "r%d,r%d, r%d,r%d", + a->a, a->a + a->ap + 1, + a->b, a->b + a->bp + 1) +FP_INSN(sfgt, d, "r%d,r%d, r%d,r%d", + a->a, a->a + a->ap + 1, + a->b, a->b + a->bp + 1) +FP_INSN(sfge, d, "r%d,r%d, r%d,r%d", + a->a, a->a + a->ap + 1, + a->b, a->b + a->bp + 1) +FP_INSN(sflt, d, "r%d,r%d, r%d,r%d", + a->a, a->a + a->ap + 1, + a->b, a->b + a->bp + 1) +FP_INSN(sfle, d, "r%d,r%d, r%d,r%d", + a->a, a->a + a->ap + 1, + a->b, a->b + a->bp + 1) diff --git a/target/openrisc/fpu_helper.c b/target/openrisc/fpu_helper.c index 4cc5b297c5..9d7dfc0fb9 100644 --- a/target/openrisc/fpu_helper.c +++ b/target/openrisc/fpu_helper.c @@ -63,7 +63,7 @@ void HELPER(update_fpcsr)(CPUOpenRISCState *env) uint64_t HELPER(itofd)(CPUOpenRISCState *env, uint64_t val) { - return int32_to_float64(val, &env->fp_status); + return int64_to_float64(val, &env->fp_status); } uint32_t HELPER(itofs)(CPUOpenRISCState *env, uint32_t val) @@ -73,7 +73,7 @@ uint32_t HELPER(itofs)(CPUOpenRISCState *env, uint32_t val) uint64_t HELPER(ftoid)(CPUOpenRISCState *env, uint64_t val) { - return float32_to_int64(val, &env->fp_status); + return float64_to_int64_round_to_zero(val, &env->fp_status); } uint32_t HELPER(ftois)(CPUOpenRISCState *env, uint32_t val) @@ -81,6 +81,16 @@ uint32_t HELPER(ftois)(CPUOpenRISCState *env, uint32_t val) return float32_to_int32_round_to_zero(val, &env->fp_status); } +uint64_t HELPER(stod)(CPUOpenRISCState *env, uint32_t val) +{ + return float32_to_float64(val, &env->fp_status); +} + +uint32_t HELPER(dtos)(CPUOpenRISCState *env, uint64_t val) +{ + return float64_to_float32(val, &env->fp_status); +} + #define FLOAT_CALC(name) \ uint64_t helper_float_ ## name ## _d(CPUOpenRISCState *env, \ uint64_t fdt0, uint64_t fdt1) \ diff --git a/target/openrisc/translate.c b/target/openrisc/translate.c index 2f5c969f21..b8ef485903 100644 --- a/target/openrisc/translate.c +++ b/target/openrisc/translate.c @@ -146,6 +146,11 @@ static bool check_of32s(DisasContext *dc) return dc->cpucfgr & CPUCFGR_OF32S; } +static bool check_of64a32s(DisasContext *dc) +{ + return dc->cpucfgr & CPUCFGR_OF64A32S; +} + static TCGv cpu_R(DisasContext *dc, int reg) { if (reg == 0) { @@ -1260,6 +1265,231 @@ static bool trans_lf_sfle_s(DisasContext *dc, arg_ab *a) return do_fpcmp(dc, a, gen_helper_float_le_s, false, false); } +static bool check_pair(DisasContext *dc, int r, int p) +{ + return r + 1 + p < 32; +} + +static void load_pair(DisasContext *dc, TCGv_i64 t, int r, int p) +{ + tcg_gen_concat_i32_i64(t, cpu_R(dc, r + 1 + p), cpu_R(dc, r)); +} + +static void save_pair(DisasContext *dc, TCGv_i64 t, int r, int p) +{ + tcg_gen_extr_i64_i32(cpu_R(dc, r + 1 + p), cpu_R(dc, r), t); +} + +static bool do_dp3(DisasContext *dc, arg_dab_pair *a, + void (*fn)(TCGv_i64, TCGv_env, TCGv_i64, TCGv_i64)) +{ + TCGv_i64 t0, t1; + + if (!check_of64a32s(dc) || + !check_pair(dc, a->a, a->ap) || + !check_pair(dc, a->b, a->bp) || + !check_pair(dc, a->d, a->dp)) { + return false; + } + check_r0_write(dc, a->d); + + t0 = tcg_temp_new_i64(); + t1 = tcg_temp_new_i64(); + load_pair(dc, t0, a->a, a->ap); + load_pair(dc, t1, a->b, a->bp); + fn(t0, cpu_env, t0, t1); + save_pair(dc, t0, a->d, a->dp); + tcg_temp_free_i64(t0); + tcg_temp_free_i64(t1); + + gen_helper_update_fpcsr(cpu_env); + return true; +} + +static bool do_dp2(DisasContext *dc, arg_da_pair *a, + void (*fn)(TCGv_i64, TCGv_env, TCGv_i64)) +{ + TCGv_i64 t0; + + if (!check_of64a32s(dc) || + !check_pair(dc, a->a, a->ap) || + !check_pair(dc, a->d, a->dp)) { + return false; + } + check_r0_write(dc, a->d); + + t0 = tcg_temp_new_i64(); + load_pair(dc, t0, a->a, a->ap); + fn(t0, cpu_env, t0); + save_pair(dc, t0, a->d, a->dp); + tcg_temp_free_i64(t0); + + gen_helper_update_fpcsr(cpu_env); + return true; +} + +static bool do_dpcmp(DisasContext *dc, arg_ab_pair *a, + void (*fn)(TCGv, TCGv_env, TCGv_i64, TCGv_i64), + bool inv, bool swap) +{ + TCGv_i64 t0, t1; + + if (!check_of64a32s(dc) || + !check_pair(dc, a->a, a->ap) || + !check_pair(dc, a->b, a->bp)) { + return false; + } + + t0 = tcg_temp_new_i64(); + t1 = tcg_temp_new_i64(); + load_pair(dc, t0, a->a, a->ap); + load_pair(dc, t1, a->b, a->bp); + if (swap) { + fn(cpu_sr_f, cpu_env, t1, t0); + } else { + fn(cpu_sr_f, cpu_env, t0, t1); + } + tcg_temp_free_i64(t0); + tcg_temp_free_i64(t1); + + if (inv) { + tcg_gen_xori_tl(cpu_sr_f, cpu_sr_f, 1); + } + gen_helper_update_fpcsr(cpu_env); + return true; +} + +static bool trans_lf_add_d(DisasContext *dc, arg_dab_pair *a) +{ + return do_dp3(dc, a, gen_helper_float_add_d); +} + +static bool trans_lf_sub_d(DisasContext *dc, arg_dab_pair *a) +{ + return do_dp3(dc, a, gen_helper_float_sub_d); +} + +static bool trans_lf_mul_d(DisasContext *dc, arg_dab_pair *a) +{ + return do_dp3(dc, a, gen_helper_float_mul_d); +} + +static bool trans_lf_div_d(DisasContext *dc, arg_dab_pair *a) +{ + return do_dp3(dc, a, gen_helper_float_div_d); +} + +static bool trans_lf_rem_d(DisasContext *dc, arg_dab_pair *a) +{ + return do_dp3(dc, a, gen_helper_float_rem_d); +} + +static bool trans_lf_itof_d(DisasContext *dc, arg_da_pair *a) +{ + return do_dp2(dc, a, gen_helper_itofd); +} + +static bool trans_lf_ftoi_d(DisasContext *dc, arg_da_pair *a) +{ + return do_dp2(dc, a, gen_helper_ftoid); +} + +static bool trans_lf_stod_d(DisasContext *dc, arg_lf_stod_d *a) +{ + TCGv_i64 t0; + + if (!check_of64a32s(dc) || + !check_pair(dc, a->d, a->dp)) { + return false; + } + check_r0_write(dc, a->d); + + t0 = tcg_temp_new_i64(); + gen_helper_stod(t0, cpu_env, cpu_R(dc, a->a)); + save_pair(dc, t0, a->d, a->dp); + tcg_temp_free_i64(t0); + + gen_helper_update_fpcsr(cpu_env); + return true; +} + +static bool trans_lf_dtos_d(DisasContext *dc, arg_lf_dtos_d *a) +{ + TCGv_i64 t0; + + if (!check_of64a32s(dc) || + !check_pair(dc, a->a, a->ap)) { + return false; + } + check_r0_write(dc, a->d); + + t0 = tcg_temp_new_i64(); + load_pair(dc, t0, a->a, a->ap); + gen_helper_dtos(cpu_R(dc, a->d), cpu_env, t0); + tcg_temp_free_i64(t0); + + gen_helper_update_fpcsr(cpu_env); + return true; +} + +static bool trans_lf_madd_d(DisasContext *dc, arg_dab_pair *a) +{ + TCGv_i64 t0, t1, t2; + + if (!check_of64a32s(dc) || + !check_pair(dc, a->a, a->ap) || + !check_pair(dc, a->b, a->bp) || + !check_pair(dc, a->d, a->dp)) { + return false; + } + check_r0_write(dc, a->d); + + t0 = tcg_temp_new_i64(); + t1 = tcg_temp_new_i64(); + t2 = tcg_temp_new_i64(); + load_pair(dc, t0, a->d, a->dp); + load_pair(dc, t1, a->a, a->ap); + load_pair(dc, t2, a->b, a->bp); + gen_helper_float_madd_d(t0, cpu_env, t0, t1, t2); + save_pair(dc, t0, a->d, a->dp); + tcg_temp_free_i64(t0); + tcg_temp_free_i64(t1); + tcg_temp_free_i64(t2); + + gen_helper_update_fpcsr(cpu_env); + return true; +} + +static bool trans_lf_sfeq_d(DisasContext *dc, arg_ab_pair *a) +{ + return do_dpcmp(dc, a, gen_helper_float_eq_d, false, false); +} + +static bool trans_lf_sfne_d(DisasContext *dc, arg_ab_pair *a) +{ + return do_dpcmp(dc, a, gen_helper_float_eq_d, true, false); +} + +static bool trans_lf_sfgt_d(DisasContext *dc, arg_ab_pair *a) +{ + return do_dpcmp(dc, a, gen_helper_float_lt_d, false, true); +} + +static bool trans_lf_sfge_d(DisasContext *dc, arg_ab_pair *a) +{ + return do_dpcmp(dc, a, gen_helper_float_le_d, false, true); +} + +static bool trans_lf_sflt_d(DisasContext *dc, arg_ab_pair *a) +{ + return do_dpcmp(dc, a, gen_helper_float_lt_d, false, false); +} + +static bool trans_lf_sfle_d(DisasContext *dc, arg_ab_pair *a) +{ + return do_dpcmp(dc, a, gen_helper_float_le_d, false, false); +} + static void openrisc_tr_init_disas_context(DisasContextBase *dcb, CPUState *cs) { DisasContext *dc = container_of(dcb, DisasContext, base); diff --git a/target/openrisc/insns.decode b/target/openrisc/insns.decode index 7df81c1f22..334d4e9668 100644 --- a/target/openrisc/insns.decode +++ b/target/openrisc/insns.decode @@ -22,6 +22,9 @@ &ab a b &dal d a l &ai a i +&dab_pair d a b dp ap bp +&ab_pair a b ap bp +&da_pair d a dp ap #### # System Instructions @@ -187,3 +190,31 @@ lf_sfgt_s 110010 ----- a:5 b:5 --- 00001010 lf_sfge_s 110010 ----- a:5 b:5 --- 00001011 lf_sflt_s 110010 ----- a:5 b:5 --- 00001100 lf_sfle_s 110010 ----- a:5 b:5 --- 00001101 + +#### +# DP Instructions +#### + +@dab_pair ...... d:5 a:5 b:5 dp:1 ap:1 bp:1 ........ &dab_pair +@ab_pair ...... ..... a:5 b:5 . ap:1 bp:1 ........ &ab_pair +@da_pair ...... d:5 a:5 ..... dp:1 ap:1 . ........ &da_pair + +lf_add_d 110010 ..... ..... ..... ... 00010000 @dab_pair +lf_sub_d 110010 ..... ..... ..... ... 00010001 @dab_pair +lf_mul_d 110010 ..... ..... ..... ... 00010010 @dab_pair +lf_div_d 110010 ..... ..... ..... ... 00010011 @dab_pair +lf_rem_d 110010 ..... ..... ..... ... 00010110 @dab_pair +lf_madd_d 110010 ..... ..... ..... ... 00010111 @dab_pair + +lf_itof_d 110010 ..... ..... 00000 ..0 00010100 @da_pair +lf_ftoi_d 110010 ..... ..... 00000 ..0 00010101 @da_pair + +lf_stod_d 110010 d:5 a:5 00000 dp:1 0 0 00110100 +lf_dtos_d 110010 d:5 a:5 00000 0 ap:1 0 00110101 + +lf_sfeq_d 110010 00000 ..... ..... 0.. 00011000 @ab_pair +lf_sfne_d 110010 00000 ..... ..... 0.. 00011001 @ab_pair +lf_sfgt_d 110010 00000 ..... ..... 0.. 00011010 @ab_pair +lf_sfge_d 110010 00000 ..... ..... 0.. 00011011 @ab_pair +lf_sflt_d 110010 00000 ..... ..... 0.. 00011100 @ab_pair +lf_sfle_d 110010 00000 ..... ..... 0.. 00011101 @ab_pair From patchwork Wed Sep 4 20:45:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 173081 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp455399ilq; Wed, 4 Sep 2019 14:23:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqyc+8lDreKDB89ojtOTUWNgZ4N5RQ0U9fycUq9JLDfXWk07FjiixmFitz4Xg28VSN/xKr2F X-Received: by 2002:a05:620a:118c:: with SMTP id b12mr5463645qkk.336.1567632228536; Wed, 04 Sep 2019 14:23:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567632228; cv=none; d=google.com; s=arc-20160816; b=HnGzrRR0kTKw054q0+p/xA87EuTyJYKTgqYNkYFWVul/p41N0qpChDaVTgW5vba40u tFNPj88Q0OWLg+nszfd5xBxsLATjUjTlDelTwCuCt/LmAVqlrSy6IwPrRdORivaX8Hwb lBl6EGNAyvnyu6zSD5x+FwKER+fw0b6/Ajwfvn6z1egVfuNpO/7PqIuIDF9jrBQO2QrM bzfySCzLzr8AmI3UVaB8Resr2/LoG3+fop1qAkKM7coBUGFC383hPcQCGHNkYx/Ay6Ro sIS5+ItGTWRE7JmIwcOipBzc+/harujrqZn35soSeIVmCZT0B3yh8XBXisDbGIDg6DWQ L5fQ== 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=slEwt35AByzjU9Ubr6zMEmDVhlGjx8ZzwD/PYybphKw=; b=xMX9LKbI00LuU+IEwvaEORAZasu3D4HNpWTRoQlI/XbsVTlUgSgVpT7lk9DPbqzVtD K5eDSQYshMkDDYm6mbFDMg1FduPTUJmPR4rNCzUsZ0PE1JEmEq/bOeSav3LNmFj6ZfMQ BX5NoDX1Cbnv/ZXBDSWT30lojJmGLZUf23ZkWCcOwPdR9SZ8eDr3VrjKB7GWJodttNSz LkDFjxpWBeqixzhiZ1UUCt8HAJO/R5U0VOeJw3lWm13o6CKjMzDVrknO+UYBjkIB9ayU mS/x2243G/ukq29syYzQ1eECOI5uIJgixX+aRKozeN6nrxVsW1bQCPO0iGpd/ZJv73aD QnxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=UMnStrVY; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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. [209.51.188.17]) by mx.google.com with ESMTPS id j28si171171qkl.139.2019.09.04.14.23.48 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 04 Sep 2019 14:23:48 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=UMnStrVY; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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]:40122 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5ckl-00051y-Ib for patch@linaro.org; Wed, 04 Sep 2019 17:23:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52901) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5c9d-0006Je-UJ for qemu-devel@nongnu.org; Wed, 04 Sep 2019 16:45:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5c9b-0006sI-Dg for qemu-devel@nongnu.org; Wed, 04 Sep 2019 16:45:25 -0400 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]:36736) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i5c9b-0006rb-4w for qemu-devel@nongnu.org; Wed, 04 Sep 2019 16:45:23 -0400 Received: by mail-pf1-x430.google.com with SMTP id y22so42968pfr.3 for ; Wed, 04 Sep 2019 13:45:23 -0700 (PDT) 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=slEwt35AByzjU9Ubr6zMEmDVhlGjx8ZzwD/PYybphKw=; b=UMnStrVYvd/RNYanNLDF9REk42LeewIj8RBhxFMm9wS+KyxQXrllGOm/d7j+khGdLg dPbbRfM+mqAjUsJzOQ8HOrZHxnlo4VMvUlFc7ju/SfaQ3FuDCt4d6cpJ0qKL84GKPOc9 INq0MxB/BJENzLalp6LH7QTtPhz9QPksOOaViLI+gO/Lf/swUphHGUqptg7Qsgj56BZF qeVnN0WsCKz3jwM9M648Vj4WYIYPnMEQU6f7fA0zLgbAsxnKGLZlXwaVR2PK0JDlHTgZ MRClU4ITUO+s2WhBE3PwfU4pBOqQ4wCQyXJliw+IGVnMDI7Jx5t9Es7lDIYZ1WAmfKS+ uaBg== 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=slEwt35AByzjU9Ubr6zMEmDVhlGjx8ZzwD/PYybphKw=; b=eSF20GWxQknqJ217zn8c32mqd2CGA+2HxjgycFceHZRMvIke5uTLcxWNJSUeLsP0J8 iaHnkwsJXCF8N6OFHuWoW6HNwytivk+qsvCydNwpj6s9FLoBjVdZ32LU2JLqaAJSMwO+ DuDWF4moFz457ya3zoSF3ALY9Bf4Wej0NhcGXJRY62LZapK3Wm/G71e8t26AgPz60urj w/zC1MQhkqNDsW0JZHksExzL5veEprncOggJBnhd7hTqeHc577PHXfcDHcQ71k28nztD UxFhVN2399GU+rVxg6HydhO+hg/cLjEmbQH/8dDjL8tBz51wXaNCGyZ5I27z3G/yhWnN NQAA== X-Gm-Message-State: APjAAAWg3JJpQ7jP0S01NtR7HR9BNkddlsFmDxy5s9FkdUhr9dRP0ITf w4OQlOiboxBpPLSZhDnzPP7rKunOWIc= X-Received: by 2002:aa7:93a8:: with SMTP id x8mr15781391pff.151.1567629921841; Wed, 04 Sep 2019 13:45:21 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id n66sm8104610pfn.90.2019.09.04.13.45.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2019 13:45:20 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 4 Sep 2019 13:45:04 -0700 Message-Id: <20190904204507.32457-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190904204507.32457-1-richard.henderson@linaro.org> References: <20190904204507.32457-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::430 Subject: [Qemu-devel] [PULL 10/13] target/openrisc: Implement unordered fp comparisons X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" These were added to the 1.3 spec. For OF32S, validate AVR. But OF64A32 is itself new to 1.3 so no extra check needed. Reviewed-by: Stafford Horne Signed-off-by: Richard Henderson --- target/openrisc/helper.h | 4 ++ target/openrisc/disas.c | 24 ++++++++++ target/openrisc/fpu_helper.c | 20 +++++++++ target/openrisc/translate.c | 85 ++++++++++++++++++++++++++++++++++++ target/openrisc/insns.decode | 12 +++++ 5 files changed, 145 insertions(+) -- 2.17.1 diff --git a/target/openrisc/helper.h b/target/openrisc/helper.h index 94b823580e..d847814a28 100644 --- a/target/openrisc/helper.h +++ b/target/openrisc/helper.h @@ -52,6 +52,10 @@ DEF_HELPER_FLAGS_3(float_ ## op ## _d, TCG_CALL_NO_RWG, tl, env, i64, i64) FOP_CMP(eq) FOP_CMP(lt) FOP_CMP(le) +FOP_CMP(un) +FOP_CMP(ueq) +FOP_CMP(ule) +FOP_CMP(ult) #undef FOP_CMP /* interrupt */ diff --git a/target/openrisc/disas.c b/target/openrisc/disas.c index 4de5c632de..e51cbb24c6 100644 --- a/target/openrisc/disas.c +++ b/target/openrisc/disas.c @@ -166,6 +166,12 @@ FP_INSN(sfgt, s, "r%d, r%d", a->a, a->b) FP_INSN(sfge, s, "r%d, r%d", a->a, a->b) FP_INSN(sflt, s, "r%d, r%d", a->a, a->b) FP_INSN(sfle, s, "r%d, r%d", a->a, a->b) +FP_INSN(sfun, s, "r%d, r%d", a->a, a->b) +FP_INSN(sfueq, s, "r%d, r%d", a->a, a->b) +FP_INSN(sfuge, s, "r%d, r%d", a->a, a->b) +FP_INSN(sfugt, s, "r%d, r%d", a->a, a->b) +FP_INSN(sfule, s, "r%d, r%d", a->a, a->b) +FP_INSN(sfult, s, "r%d, r%d", a->a, a->b) FP_INSN(add, d, "r%d,r%d, r%d,r%d, r%d,r%d", a->d, a->d + a->dp + 1, @@ -222,3 +228,21 @@ FP_INSN(sflt, d, "r%d,r%d, r%d,r%d", FP_INSN(sfle, d, "r%d,r%d, r%d,r%d", a->a, a->a + a->ap + 1, a->b, a->b + a->bp + 1) +FP_INSN(sfun, d, "r%d,r%d, r%d,r%d", + a->a, a->a + a->ap + 1, + a->b, a->b + a->bp + 1) +FP_INSN(sfueq, d, "r%d,r%d, r%d,r%d", + a->a, a->a + a->ap + 1, + a->b, a->b + a->bp + 1) +FP_INSN(sfuge, d, "r%d,r%d, r%d,r%d", + a->a, a->a + a->ap + 1, + a->b, a->b + a->bp + 1) +FP_INSN(sfugt, d, "r%d,r%d, r%d,r%d", + a->a, a->a + a->ap + 1, + a->b, a->b + a->bp + 1) +FP_INSN(sfule, d, "r%d,r%d, r%d,r%d", + a->a, a->a + a->ap + 1, + a->b, a->b + a->bp + 1) +FP_INSN(sfult, d, "r%d,r%d, r%d,r%d", + a->a, a->a + a->ap + 1, + a->b, a->b + a->bp + 1) diff --git a/target/openrisc/fpu_helper.c b/target/openrisc/fpu_helper.c index 9d7dfc0fb9..7bcef9dc53 100644 --- a/target/openrisc/fpu_helper.c +++ b/target/openrisc/fpu_helper.c @@ -135,4 +135,24 @@ target_ulong helper_float_ ## name ## _s(CPUOpenRISCState *env, \ FLOAT_CMP(le, le) FLOAT_CMP(lt, lt) FLOAT_CMP(eq, eq_quiet) +FLOAT_CMP(un, unordered_quiet) #undef FLOAT_CMP + +#define FLOAT_UCMP(name, expr) \ +target_ulong helper_float_ ## name ## _d(CPUOpenRISCState *env, \ + uint64_t fdt0, uint64_t fdt1) \ +{ \ + int r = float64_compare_quiet(fdt0, fdt1, &env->fp_status); \ + return expr; \ +} \ +target_ulong helper_float_ ## name ## _s(CPUOpenRISCState *env, \ + uint32_t fdt0, uint32_t fdt1) \ +{ \ + int r = float32_compare_quiet(fdt0, fdt1, &env->fp_status); \ + return expr; \ +} + +FLOAT_UCMP(ueq, r == float_relation_equal || r == float_relation_unordered) +FLOAT_UCMP(ult, r == float_relation_less || r == float_relation_unordered) +FLOAT_UCMP(ule, r != float_relation_greater) +#undef FLOAT_UCMP diff --git a/target/openrisc/translate.c b/target/openrisc/translate.c index b8ef485903..6e8bc23568 100644 --- a/target/openrisc/translate.c +++ b/target/openrisc/translate.c @@ -46,6 +46,7 @@ typedef struct DisasContext { uint32_t tb_flags; uint32_t delayed_branch; uint32_t cpucfgr; + uint32_t avr; /* If not -1, jmp_pc contains this value and so is a direct jump. */ target_ulong jmp_pc_imm; @@ -141,6 +142,11 @@ static void gen_illegal_exception(DisasContext *dc) dc->base.is_jmp = DISAS_NORETURN; } +static bool check_v1_3(DisasContext *dc) +{ + return dc->avr >= 0x01030000; +} + static bool check_of32s(DisasContext *dc) { return dc->cpucfgr & CPUCFGR_OF32S; @@ -1265,6 +1271,54 @@ static bool trans_lf_sfle_s(DisasContext *dc, arg_ab *a) return do_fpcmp(dc, a, gen_helper_float_le_s, false, false); } +static bool trans_lf_sfueq_s(DisasContext *dc, arg_ab *a) +{ + if (!check_v1_3(dc)) { + return false; + } + return do_fpcmp(dc, a, gen_helper_float_ueq_s, false, false); +} + +static bool trans_lf_sfult_s(DisasContext *dc, arg_ab *a) +{ + if (!check_v1_3(dc)) { + return false; + } + return do_fpcmp(dc, a, gen_helper_float_ult_s, false, false); +} + +static bool trans_lf_sfugt_s(DisasContext *dc, arg_ab *a) +{ + if (!check_v1_3(dc)) { + return false; + } + return do_fpcmp(dc, a, gen_helper_float_ult_s, false, true); +} + +static bool trans_lf_sfule_s(DisasContext *dc, arg_ab *a) +{ + if (!check_v1_3(dc)) { + return false; + } + return do_fpcmp(dc, a, gen_helper_float_ule_s, false, false); +} + +static bool trans_lf_sfuge_s(DisasContext *dc, arg_ab *a) +{ + if (!check_v1_3(dc)) { + return false; + } + return do_fpcmp(dc, a, gen_helper_float_ule_s, false, true); +} + +static bool trans_lf_sfun_s(DisasContext *dc, arg_ab *a) +{ + if (!check_v1_3(dc)) { + return false; + } + return do_fpcmp(dc, a, gen_helper_float_un_s, false, false); +} + static bool check_pair(DisasContext *dc, int r, int p) { return r + 1 + p < 32; @@ -1490,6 +1544,36 @@ static bool trans_lf_sfle_d(DisasContext *dc, arg_ab_pair *a) return do_dpcmp(dc, a, gen_helper_float_le_d, false, false); } +static bool trans_lf_sfueq_d(DisasContext *dc, arg_ab_pair *a) +{ + return do_dpcmp(dc, a, gen_helper_float_ueq_d, false, false); +} + +static bool trans_lf_sfule_d(DisasContext *dc, arg_ab_pair *a) +{ + return do_dpcmp(dc, a, gen_helper_float_ule_d, false, false); +} + +static bool trans_lf_sfuge_d(DisasContext *dc, arg_ab_pair *a) +{ + return do_dpcmp(dc, a, gen_helper_float_ule_d, false, true); +} + +static bool trans_lf_sfult_d(DisasContext *dc, arg_ab_pair *a) +{ + return do_dpcmp(dc, a, gen_helper_float_ult_d, false, false); +} + +static bool trans_lf_sfugt_d(DisasContext *dc, arg_ab_pair *a) +{ + return do_dpcmp(dc, a, gen_helper_float_ult_d, false, true); +} + +static bool trans_lf_sfun_d(DisasContext *dc, arg_ab_pair *a) +{ + return do_dpcmp(dc, a, gen_helper_float_un_d, false, false); +} + static void openrisc_tr_init_disas_context(DisasContextBase *dcb, CPUState *cs) { DisasContext *dc = container_of(dcb, DisasContext, base); @@ -1500,6 +1584,7 @@ static void openrisc_tr_init_disas_context(DisasContextBase *dcb, CPUState *cs) dc->tb_flags = dc->base.tb->flags; dc->delayed_branch = (dc->tb_flags & TB_FLAGS_DFLAG) != 0; dc->cpucfgr = env->cpucfgr; + dc->avr = env->avr; dc->jmp_pc_imm = -1; bound = -(dc->base.pc_first | TARGET_PAGE_MASK) / 4; diff --git a/target/openrisc/insns.decode b/target/openrisc/insns.decode index 334d4e9668..71e0d740db 100644 --- a/target/openrisc/insns.decode +++ b/target/openrisc/insns.decode @@ -190,6 +190,12 @@ lf_sfgt_s 110010 ----- a:5 b:5 --- 00001010 lf_sfge_s 110010 ----- a:5 b:5 --- 00001011 lf_sflt_s 110010 ----- a:5 b:5 --- 00001100 lf_sfle_s 110010 ----- a:5 b:5 --- 00001101 +lf_sfueq_s 110010 ----- a:5 b:5 --- 00101000 +lf_sfuge_s 110010 ----- a:5 b:5 --- 00101011 +lf_sfugt_s 110010 ----- a:5 b:5 --- 00101010 +lf_sfule_s 110010 ----- a:5 b:5 --- 00101101 +lf_sfult_s 110010 ----- a:5 b:5 --- 00101100 +lf_sfun_s 110010 ----- a:5 b:5 --- 00101110 #### # DP Instructions @@ -218,3 +224,9 @@ lf_sfgt_d 110010 00000 ..... ..... 0.. 00011010 @ab_pair lf_sfge_d 110010 00000 ..... ..... 0.. 00011011 @ab_pair lf_sflt_d 110010 00000 ..... ..... 0.. 00011100 @ab_pair lf_sfle_d 110010 00000 ..... ..... 0.. 00011101 @ab_pair +lf_sfueq_d 110010 00000 ..... ..... 0.. 00111000 @ab_pair +lf_sfuge_d 110010 00000 ..... ..... 0.. 00111011 @ab_pair +lf_sfugt_d 110010 00000 ..... ..... 0.. 00111010 @ab_pair +lf_sfule_d 110010 00000 ..... ..... 0.. 00111101 @ab_pair +lf_sfult_d 110010 00000 ..... ..... 0.. 00111100 @ab_pair +lf_sfun_d 110010 00000 ..... ..... 0.. 00111110 @ab_pair From patchwork Wed Sep 4 20:45:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 173087 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp464737ilq; Wed, 4 Sep 2019 14:34:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqyhwPc9YkxLs5AwgJ2pk7p6JdDasndSSoWbVQEcOx65T91grWGpd4MWTuAx3E2lRYIS5gtO X-Received: by 2002:a37:9c81:: with SMTP id f123mr25132038qke.66.1567632865554; Wed, 04 Sep 2019 14:34:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567632865; cv=none; d=google.com; s=arc-20160816; b=HhNelyF3zHvlIjr5EZMNzyOVFrJF3I5NJmItZm4Fe7sywfAZo6DxKru77CLaZZkAHn JpH0wZnzw9lRaYXDu1lkjazZH9SMmAGrQmS/m8wXhD9nZCESBzg/hdsZzXMaLMdIUmjk VVxJFFgXwNvxuop7RnlL5BFlAbdviXuvri6VXflS/7XcY0/y9Xs5pJsxPe+nTApTwo2i XfmDEE3q1ow1ylxTXS5Rh5qdousZuYhQpE3XU+0sKNPU1YL69TPnO7lgRIGNX7vwlUMh igmRKdqajypz40G0+2XhS9A8MmvgaUjwpOJAVN6CNrxRG6qajh/twJNf8N2kE30cTAWJ kIPg== 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=5HAooVFLsWGcsosw6Q3OZtvuZFTGrXxCMoBP6XCwIK8=; b=oAOhdSFFEAGQPN9d6CxAFXAzHqgde4GgYeEKAloLiwhqnI93E4RJg4mkRHUJEWTcUH PV6XxAiY4/bsNXG7RJoTeWeWFkKaKnzo3eLNK/aLuwqnws+qrdFIooaRLIkGT8VidK+e P3mb3ejALecw0LRNvAOyNvvZkBNJulG4OqmtftvGE/PmGTqe/iae+IHWL2wt+0a/Q6zu 7xUO9F1h8RUmSUV5gDyFY1B7SxRYe8vLKL7TkaEfFOGsQuy6LFgUw4Q2R2JQhjt+sG6c ZQhHwYg2lnNi3A14e/lx7Vq7D7uH7LiLKRaRMX81HPg7RjLcYN7vGTCohBQ+gKti86gM 5a9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=R9rKGZKa; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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. [209.51.188.17]) by mx.google.com with ESMTPS id i6si138106qvg.72.2019.09.04.14.34.25 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 04 Sep 2019 14:34:25 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=R9rKGZKa; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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]:40270 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5cv2-0000Kg-4d for patch@linaro.org; Wed, 04 Sep 2019 17:34:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52906) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5c9e-0006Jp-5R for qemu-devel@nongnu.org; Wed, 04 Sep 2019 16:45:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5c9c-0006uA-FT for qemu-devel@nongnu.org; Wed, 04 Sep 2019 16:45:25 -0400 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]:44663) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i5c9c-0006t2-6o for qemu-devel@nongnu.org; Wed, 04 Sep 2019 16:45:24 -0400 Received: by mail-pl1-x630.google.com with SMTP id k1so76790pls.11 for ; Wed, 04 Sep 2019 13:45:24 -0700 (PDT) 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=5HAooVFLsWGcsosw6Q3OZtvuZFTGrXxCMoBP6XCwIK8=; b=R9rKGZKanh3PSjw2Xqc7ae9yWdK8ys8c4rZs+VEqCu7tzLHaKGbJynSXPfnp+zQ3P7 Dtl94ZWuGPezGl6LfT/xuyeChltCOItwg5o1/6vVDb+iWMv9qt9IrudHvUP9GbVCI+O6 fTpFfccMsnLAKclm2cMHfxl75ZPdDzarj/BmWsAqKQTuBn+9bL0J5hukCZGjZcS4Eg+f CXAoovQ/16ePNkkhpMaQx61VdB9CihQLiiMk3jyO15gkMKZp4BqLr9b8tQly7oBl8R4e 5INroTjndK+iRr7zeKvy8qc4gCxfpvNHB3SVFQc/BzYln0Xdg0zekBEZVDCvGqcjSJPZ p2AA== 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=5HAooVFLsWGcsosw6Q3OZtvuZFTGrXxCMoBP6XCwIK8=; b=TM4ePpjtZ6MR/iMyzgHLV8Y0CQejwawZH0PyahLotAnx3qWN5mxq3Ufr0oeN47xplm OaTNIJNUax0MVBQ/7l4b5IvkDr6/LvRcAa5AXF5QuwCfQGuthmlx2BJRGkmjJyVSke9x FMqpZLWyQLbGoZtMQ8Bwyy8hHbCovB43lmIoNEkLuus2UPpaGCNFiOW5V+KtgUEMJ1yu +6ygClnM9TM3U0GWGVYiEiE7AA3AqwaI0K5XNSgBPvfMDwz4xbHTYSFRhy3ZU3m/7LIT p1zHA79luOiDO+L9ClL0yOgj8tdZTgtU65nUWZZ79pF2sIWh6PuSW5dweTwFEAvhiSfy Bgtw== X-Gm-Message-State: APjAAAWSzkYOIDNOqWvcZGhwDPQeN4W1oWFedL8Fd0LD1WuoWLj1blZO INVSFa4u9fxysoBKY38ZvHSAjw3kJQI= X-Received: by 2002:a17:902:7441:: with SMTP id e1mr43091517plt.332.1567629923016; Wed, 04 Sep 2019 13:45:23 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id n66sm8104610pfn.90.2019.09.04.13.45.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2019 13:45:22 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 4 Sep 2019 13:45:05 -0700 Message-Id: <20190904204507.32457-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190904204507.32457-1-richard.henderson@linaro.org> References: <20190904204507.32457-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::630 Subject: [Qemu-devel] [PULL 11/13] target/openrisc: Implement move to/from FPCSR X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Stafford Horne Signed-off-by: Richard Henderson --- target/openrisc/cpu.h | 2 ++ target/openrisc/cpu.c | 1 + target/openrisc/fpu_helper.c | 13 +++++++++++++ target/openrisc/machine.c | 11 +++++++++++ target/openrisc/sys_helper.c | 18 ++++++++++++------ 5 files changed, 39 insertions(+), 6 deletions(-) -- 2.17.1 diff --git a/target/openrisc/cpu.h b/target/openrisc/cpu.h index 71c5959828..0ad02eab79 100644 --- a/target/openrisc/cpu.h +++ b/target/openrisc/cpu.h @@ -413,6 +413,8 @@ static inline void cpu_set_sr(CPUOpenRISCState *env, uint32_t val) env->sr = (val & ~(SR_F | SR_CY | SR_OV)) | SR_FO; } +void cpu_set_fpcsr(CPUOpenRISCState *env, uint32_t val); + #define CPU_INTERRUPT_TIMER CPU_INTERRUPT_TGT_INT_0 #endif /* OPENRISC_CPU_H */ diff --git a/target/openrisc/cpu.c b/target/openrisc/cpu.c index b931605e62..f96a69e278 100644 --- a/target/openrisc/cpu.c +++ b/target/openrisc/cpu.c @@ -55,6 +55,7 @@ static void openrisc_cpu_reset(CPUState *s) cpu->env.sr = SR_FO | SR_SM; cpu->env.lock_addr = -1; s->exception_index = -1; + cpu_set_fpcsr(&cpu->env, 0); #ifndef CONFIG_USER_ONLY cpu->env.picmr = 0x00000000; diff --git a/target/openrisc/fpu_helper.c b/target/openrisc/fpu_helper.c index 7bcef9dc53..59e1413279 100644 --- a/target/openrisc/fpu_helper.c +++ b/target/openrisc/fpu_helper.c @@ -61,6 +61,19 @@ void HELPER(update_fpcsr)(CPUOpenRISCState *env) } } +void cpu_set_fpcsr(CPUOpenRISCState *env, uint32_t val) +{ + static const int rm_to_sf[] = { + float_round_nearest_even, + float_round_to_zero, + float_round_up, + float_round_down + }; + + env->fpcsr = val & 0x7ff; + set_float_rounding_mode(rm_to_sf[extract32(val, 1, 2)], &env->fp_status); +} + uint64_t HELPER(itofd)(CPUOpenRISCState *env, uint64_t val) { return int64_to_float64(val, &env->fp_status); diff --git a/target/openrisc/machine.c b/target/openrisc/machine.c index 0a96404dc6..b92985d99b 100644 --- a/target/openrisc/machine.c +++ b/target/openrisc/machine.c @@ -121,10 +121,21 @@ static const VMStateDescription vmstate_env = { } }; +static int cpu_post_load(void *opaque, int version_id) +{ + OpenRISCCPU *cpu = opaque; + CPUOpenRISCState *env = &cpu->env; + + /* Update env->fp_status to match env->fpcsr. */ + cpu_set_fpcsr(env, env->fpcsr); + return 0; +} + const VMStateDescription vmstate_openrisc_cpu = { .name = "cpu", .version_id = 1, .minimum_version_id = 1, + .post_load = cpu_post_load, .fields = (VMStateField[]) { VMSTATE_CPU(), VMSTATE_STRUCT(env, OpenRISCCPU, 1, vmstate_env, CPUOpenRISCState), diff --git a/target/openrisc/sys_helper.c b/target/openrisc/sys_helper.c index cf8e637b08..d9fe6c5948 100644 --- a/target/openrisc/sys_helper.c +++ b/target/openrisc/sys_helper.c @@ -37,8 +37,10 @@ void HELPER(mtspr)(CPUOpenRISCState *env, target_ulong spr, target_ulong rb) CPUState *cs = env_cpu(env); target_ulong mr; int idx; +#endif switch (spr) { +#ifndef CONFIG_USER_ONLY case TO_SPR(0, 11): /* EVBAR */ env->evbar = rb; break; @@ -179,10 +181,12 @@ void HELPER(mtspr)(CPUOpenRISCState *env, target_ulong spr, target_ulong rb) } cpu_openrisc_timer_update(cpu); break; - default: +#endif + + case TO_SPR(0, 20): /* FPCSR */ + cpu_set_fpcsr(env, rb); break; } -#endif } target_ulong HELPER(mfspr)(CPUOpenRISCState *env, target_ulong rd, @@ -193,8 +197,10 @@ target_ulong HELPER(mfspr)(CPUOpenRISCState *env, target_ulong rd, OpenRISCCPU *cpu = env_archcpu(env); CPUState *cs = env_cpu(env); int idx; +#endif switch (spr) { +#ifndef CONFIG_USER_ONLY case TO_SPR(0, 0): /* VR */ return env->vr; @@ -303,12 +309,12 @@ target_ulong HELPER(mfspr)(CPUOpenRISCState *env, target_ulong rd, case TO_SPR(10, 1): /* TTCR */ cpu_openrisc_count_update(cpu); return cpu_openrisc_count_get(cpu); - - default: - break; - } #endif + case TO_SPR(0, 20): /* FPCSR */ + return env->fpcsr; + } + /* for rd is passed in, if rd unchanged, just keep it back. */ return rd; } From patchwork Wed Sep 4 20:45:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 173091 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp468211ilq; Wed, 4 Sep 2019 14:38:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqyiysazfqfr86/ccRlrIwlPINsfUJkp10R4rVRUoC7B2199PFMBs3Thjnfz1y2LRJ+zXoLO X-Received: by 2002:aa7:cd17:: with SMTP id b23mr432161edw.278.1567633109480; Wed, 04 Sep 2019 14:38:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567633109; cv=none; d=google.com; s=arc-20160816; b=Vs5oi+s21e4HbAPZ6XwmfqOGJXt1BE11A3SJBaDgaTRoq1qeturCR9RMOoIbbpCZbM KJ3B2JC+Dwqf2x27cMf0VWt95qAK7UHmXD4fbCweo9yzYZMlhe8euDX1Agbnwcod+B3e OkefpZgQ9JDe1AuAHynoTOXaru13D/om7vaEWTpHYshLBNhbZ8dbyzR98BeXyxUK+KRk o4qW2UQFuVJWVu2oY4j3VuQ2A4QxV4Vgshsv0o21kkkyi9qp7RtVy9N9SPtbqZYUkS9+ RQedutMvydHIgs6B7zRqsB7ZAYtyi469T5Vn7xq9snG31XLtLSNJaZrJUjlDIiRYZ78L M24w== 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=NowncHpSDSkPNMutAvoqlBrylOrG45DqZfrkIkTwcGo=; b=JyPqf4dh/GHwdMF5e2zF8l3PwRkFA2hfuBmWs5sRh43vukvGzphtltNaAsQm1r7TK1 iWGtO/zYXd0A3H1XyFlScfSKrRbHsKRLKHbIF9UkIcl6elrqOS/CgD9P9TbqhT973DTz exHg0Ff3sHLfgiv+HM5uGgcEh/Z+AgbxI6UM3TbHndcPq3mzpc5VOZHz08Xwytg/npgX tbrnnqRjPUF5x5TS0Ya0ZycIRiSlNdx3uwzZONMTS5dn7NmDMorSCBQ/nvFkhzM7mryE Ix820/ikidST18+eKWQLAjP3qYps6STMd2nYnhgyg/HO7CLgiMocDUCqtVEwXgOKimuh KAPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=U7dq5PIA; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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. [209.51.188.17]) by mx.google.com with ESMTPS id rv27si148329ejb.136.2019.09.04.14.38.29 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 04 Sep 2019 14:38:29 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=U7dq5PIA; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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]:40322 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5cyx-0003yQ-Qe for patch@linaro.org; Wed, 04 Sep 2019 17:38:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52946) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5c9f-0006Lo-VV for qemu-devel@nongnu.org; Wed, 04 Sep 2019 16:45:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5c9e-0006wr-6O for qemu-devel@nongnu.org; Wed, 04 Sep 2019 16:45:27 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]:36738) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i5c9d-0006uS-Rr for qemu-devel@nongnu.org; Wed, 04 Sep 2019 16:45:26 -0400 Received: by mail-pf1-x432.google.com with SMTP id y22so43020pfr.3 for ; Wed, 04 Sep 2019 13:45:25 -0700 (PDT) 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=NowncHpSDSkPNMutAvoqlBrylOrG45DqZfrkIkTwcGo=; b=U7dq5PIApEKMxfyC3GQLtXN64XNtz7tZ0YKauAe1qs31PFMxrzyRzGbyhkJtqIt+q1 R0NVD6GMI/TyJzv0Y8X2LROpA+PFNuUEEjg/XccJxKfXIcwzMyVj78fsdVDJ4F1sSZ9x 9Dp8WO5Qb9+MnWLnkWOu8SrNud9mkxZDyCOK5ppBY1M2hKF7UG3bAea/frFi+lLIYrB1 tc6X5w3keVpPfWyYU0acsyZMtvnwqcN0VawP1qzf+WNxqOYvA18XlRq2msw9/6JTCAVS Ki+HpdGrGcgjA8QXUln7Ti0Bs8SWwKFlgS4ablsJgtSE1gNw+K22m7H4grcDzGvdEHax tIMg== 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=NowncHpSDSkPNMutAvoqlBrylOrG45DqZfrkIkTwcGo=; b=KoAs6dmrIJE6CD9BpH0HnCDFMweRmuTD7T9t/rOs7YUHFhH0tb9Ylmnk2kRKJSPFy1 RfpQdwpijZSBSWnp4lqd2FmGurPFin6qogPuPV9g8l6Pv/m/oyWw3W9vjeTsOY6w1nbn AAzqtlAIFO00AL8tUss7l+OkdaHhgYM4eBh6ix2gnVs1heu5TFG6uGOkSY5FtFQBlg8S Dw0isHSTMoXmVCcXzSRyyOhXtDOQowIC52EIi3hAFVDtkc36FwKUT8b8JsVo5JdW4dF1 GDEWcXF/2W/vOg9TlRRD4SFSdfJB+P5e4rl4HYUwusmK0QywyekgPBg4Le6DLZQPwHey 1Amg== X-Gm-Message-State: APjAAAUtXnDS4qSn0iHW9EiUKPwh0i6qOkEKTNYO1IwQaY6lMbRZ4Pfj tSLwfK2kMiJRoP/NpcAPT27JducvHeM= X-Received: by 2002:a17:90a:f0c9:: with SMTP id fa9mr120822pjb.137.1567629924024; Wed, 04 Sep 2019 13:45:24 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id n66sm8104610pfn.90.2019.09.04.13.45.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2019 13:45:23 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 4 Sep 2019 13:45:06 -0700 Message-Id: <20190904204507.32457-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190904204507.32457-1-richard.henderson@linaro.org> References: <20190904204507.32457-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] [PULL 12/13] target/openrisc: Implement l.adrp X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This was added to the 1.3 spec. Reviewed-by: Stafford Horne Signed-off-by: Richard Henderson --- target/openrisc/disas.c | 1 + target/openrisc/translate.c | 13 +++++++++++++ target/openrisc/insns.decode | 2 ++ 3 files changed, 16 insertions(+) -- 2.17.1 diff --git a/target/openrisc/disas.c b/target/openrisc/disas.c index e51cbb24c6..ce112640b9 100644 --- a/target/openrisc/disas.c +++ b/target/openrisc/disas.c @@ -98,6 +98,7 @@ INSN(sw, "%d(r%d), r%d", a->i, a->a, a->b) INSN(sb, "%d(r%d), r%d", a->i, a->a, a->b) INSN(sh, "%d(r%d), r%d", a->i, a->a, a->b) INSN(nop, "") +INSN(adrp, "r%d, %d", a->d, a->i) INSN(addi, "r%d, r%d, %d", a->d, a->a, a->i) INSN(addic, "r%d, r%d, %d", a->d, a->a, a->i) INSN(muli, "r%d, r%d, %d", a->d, a->a, a->i) diff --git a/target/openrisc/translate.c b/target/openrisc/translate.c index 6e8bc23568..6addbac8d6 100644 --- a/target/openrisc/translate.c +++ b/target/openrisc/translate.c @@ -799,6 +799,19 @@ static bool trans_l_nop(DisasContext *dc, arg_l_nop *a) return true; } +static bool trans_l_adrp(DisasContext *dc, arg_l_adrp *a) +{ + if (!check_v1_3(dc)) { + return false; + } + check_r0_write(dc, a->d); + + tcg_gen_movi_i32(cpu_R(dc, a->d), + (dc->base.pc_next & TARGET_PAGE_MASK) + + ((target_long)a->i << TARGET_PAGE_BITS)); + return true; +} + static bool trans_l_addi(DisasContext *dc, arg_rri *a) { TCGv t0; diff --git a/target/openrisc/insns.decode b/target/openrisc/insns.decode index 71e0d740db..0d6f7c29f8 100644 --- a/target/openrisc/insns.decode +++ b/target/openrisc/insns.decode @@ -102,6 +102,8 @@ l_maci 010011 ----- a:5 i:s16 l_movhi 000110 d:5 ----0 k:16 l_macrc 000110 d:5 ----1 00000000 00000000 +l_adrp 000010 d:5 i:s21 + #### # Arithmetic Instructions #### From patchwork Wed Sep 4 20:45:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 173069 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp453953ilq; Wed, 4 Sep 2019 14:22:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqzEc72GCE8AZnIFyCQIs94DXuc1GY+RXx/LnauJV0QG1nYN6tia8aZm0d8jm+MKHxplKE1O X-Received: by 2002:a05:6402:332:: with SMTP id q18mr350398edw.149.1567632136090; Wed, 04 Sep 2019 14:22:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567632136; cv=none; d=google.com; s=arc-20160816; b=PrAMAyY/meCdlm0pPaJ8xdYBCd2rAtA/4qlfi9aysVejyzFbcwYqslYeFEgpfEIpRd B9DR/5gk1n/hQq0qokjW8TRf1HEk3mySIB+qEXKI3nZl7nZ1LBmXIWOSeVjpzhSvhc6u R5vR4wGpJ5GXcnebNFpEkyIyRg0utmDyGmWlE3bk6hOHdJ21NgMrB0StzZTI1yWFbgir A15EDOVjudVZt2VJ7PmdLXacmlyoUA3Okwmqxkwgoa1+w9Re9v/GCOX63/D/CTyDkPPB 6cmblRROe5Cu8U2LPacIo7U0qbqvy9aJPDTXJuQCAgke4tpA57PvaIZnzX8WU0Ikwp+P wZcA== 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=1viOu5GL1Auv3D+RvMLd1iNczsL4mRxNizWgcflzx+Q=; b=ETrNEASUPZVrHkqNa8KSljy1b9MvQCrDET21vKjaK1iqonJzX98HmkfhVznJhA1xk+ XvMxjFkZyzwoCCXG68jik3k/7P2jeCDvZLx9BplpFsed8Z3ADWpgWrDXKclpp9wtjghq KfO/mvT8558sNvOBw7V5k7C53yjZPJmPm9bgetEkURFuv7cRh+4yk+/NhtaDCHs10ft0 XKnxOHy683LmwpMDFMUifx5GsokvIIjwu/58MImJ0FnKEXzM7Qaf0bdEIvFbVxr+eIkG a4h4hc4OxQwiLLJsPofyRSC08u2vJ1wH1v8Wqx2dEEUPckzzvSFK77rqioBeUs7SQhaV gt8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=g97Iw9a4; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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. [209.51.188.17]) by mx.google.com with ESMTPS id k23si142583ejx.130.2019.09.04.14.22.15 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 04 Sep 2019 14:22:16 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=g97Iw9a4; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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]:40084 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5cjG-00035u-77 for patch@linaro.org; Wed, 04 Sep 2019 17:22:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52949) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5c9g-0006Ls-3c for qemu-devel@nongnu.org; Wed, 04 Sep 2019 16:45:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5c9e-0006xH-Hj for qemu-devel@nongnu.org; Wed, 04 Sep 2019 16:45:27 -0400 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]:46660) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i5c9e-0006ve-9l for qemu-devel@nongnu.org; Wed, 04 Sep 2019 16:45:26 -0400 Received: by mail-pf1-x442.google.com with SMTP id q5so11663pfg.13 for ; Wed, 04 Sep 2019 13:45:26 -0700 (PDT) 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=1viOu5GL1Auv3D+RvMLd1iNczsL4mRxNizWgcflzx+Q=; b=g97Iw9a4YpDqZkxyCAAjqM0FLF7LhXGIg38+xJ9glbLWbFxnGD1TfdFfQqedu+wXJj U1M87erXHmQhHwTxR6c/CHe/dyzs81/+kBrQeKLsYcBujJp7DC/f/u7zxccrAYc9doUz 048i8exZu6MWQg2DnND2wmfj263Z+wIQ2fDUJhrjL9U5WhHJlocqsPnTAFZxgVaak3ou Wg3rB5KKGhjyalIx5ApvXr+AhCz7K5/V9HefYLvO34Ie+o0hOzbFkewtWfkPhTSjXpHL CY+YZxa10MOh5652fsbYYsaYQOXy1elOlJg9caNmNPr+BlPZWuH/V7tfp8G7q8QgYVSq hhjw== 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=1viOu5GL1Auv3D+RvMLd1iNczsL4mRxNizWgcflzx+Q=; b=ZF6MI9NAdctvTINeuofmU2XJ00gPv9oRVJV3Ovuth/HeZ1Rvgrh+qSLQZs9/2fEFCS Qx3YJjqvpKnszLQCW0YaPxj7eYv3jnQawgPP2znjw4DPYk9t0Dz4CclN1MLGreQVyzma bqrNv7bWU/INKJnliOfeK78H8PvYUKhgnq0puoPIaIrOqEnb1crDNJ9MWWJbrldZ+czx K1LciLnnk1Pe733hQHcKBCoDCdGOaAQeW4QvunMo6cEf7xModYDggSIp5xAVimg+2N3Y B9RC93+e9pbcdrZgwS7UpOq0wMomTg7uKsTinm2fh0F4KcyuP00EoW8iOJ21MmlHJ9EX rv8A== X-Gm-Message-State: APjAAAU7ifHQfCvcd6jLZK3wRjdL5G39LpmWqPbvMwzf05czn5y+rVWW s3ie816gMHMt1z+jBVx+MdkbR+e0vMc= X-Received: by 2002:aa7:9591:: with SMTP id z17mr48833868pfj.215.1567629925120; Wed, 04 Sep 2019 13:45:25 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id n66sm8104610pfn.90.2019.09.04.13.45.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2019 13:45:24 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 4 Sep 2019 13:45:07 -0700 Message-Id: <20190904204507.32457-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190904204507.32457-1-richard.henderson@linaro.org> References: <20190904204507.32457-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::442 Subject: [Qemu-devel] [PULL 13/13] target/openrisc: Update cpu "any" to v1.3 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Now that the two updates from v1.3 are implemented, update the "any" cpu to enable it. Reviewed-by: Stafford Horne Signed-off-by: Richard Henderson --- target/openrisc/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.17.1 diff --git a/target/openrisc/cpu.c b/target/openrisc/cpu.c index f96a69e278..506aec6bfb 100644 --- a/target/openrisc/cpu.c +++ b/target/openrisc/cpu.c @@ -129,7 +129,7 @@ static void openrisc_any_initfn(Object *obj) cpu->env.vr = 0x13000040; /* Obsolete VER + UVRP for new SPRs */ cpu->env.vr2 = 0; /* No version specific id */ - cpu->env.avr = 0x01010000; /* Architecture v1.1 */ + cpu->env.avr = 0x01030000; /* Architecture v1.3 */ cpu->env.upr = UPR_UP | UPR_DMP | UPR_IMP | UPR_PICP | UPR_TTP | UPR_PMP; cpu->env.cpucfgr = CPUCFGR_NSGF | CPUCFGR_OB32S | CPUCFGR_OF32S |