From nobody Sun May 19 10:14:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1673295049; cv=none; d=zohomail.com; s=zohoarc; b=gu1alLHUnrxvbw8MmZQBjZc5hW21EcanjgFEts/tIQEbKJ0x718LZm8lgOol+U3REFKz+AGGCRBUyqAQQem588pIkh4ua1N/bQzRpPKU+sA5pdlA08yJdCGoHbrX/DAzBjmD2gJTJTPKJ9nK1vz8v5wYL2DsoUHt/UK9dEOYcl4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673295049; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=tjA7kzj+I+xGEzR8kCmNODklxUgH2/KEyszqH8j+kCo=; b=JVpLkueuMg5iZWOb9DLVf9p/G32V18CEGxGsvpVfS8oYycq3eWj6eE4/l99Fbdr8E2TG7dQgFF9o0zozpqvE/e0BYfEjz/Hs5HFo033w4FogFEKgAJRW9ZcXnqnqpFTUWDXnR8KQWJ3Ijxep10iFctmuZAjcDsQgjglYhLptCJc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1673295049323873.7119177933843; Mon, 9 Jan 2023 12:10:49 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pEyRc-0002sq-Mb; Mon, 09 Jan 2023 15:08:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pEyRa-0002pw-Qw for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:31 -0500 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pEyRU-0007Nn-Ty for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:28 -0500 Received: by mail-pj1-x1036.google.com with SMTP id dw9so8510790pjb.5 for ; Mon, 09 Jan 2023 12:08:24 -0800 (PST) Received: from stoup.. ([2602:47:d48c:8101:158e:facf:7a46:ba9f]) by smtp.gmail.com with ESMTPSA id l2-20020a17090a384200b0022727d4af8dsm577574pjf.48.2023.01.09.12.08.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Jan 2023 12:08:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tjA7kzj+I+xGEzR8kCmNODklxUgH2/KEyszqH8j+kCo=; b=h1/WTjPslTdWQJBgYAKyZZyNSkGbmdQtkia2y8G3PPDmNlCxz3CdPNdOT1YYfRi29U H+tFdB2GVJqIotW10WUzmqTvsk/iOLfQAF88PlUVZrpgrUugsnMQiSG3UGrpkzq2tNRv qPQeOzxTsnqsuq7KUtlfBuVQnIGJrTEa6KNMNxtU+IcCZ9s/Lvc6oA4l9TbxzNg+rVwJ poj3BPxYoXYm2hch8jf9wJmfe4GX065/1XrmcXUuqVRRg4gkw7ZLb1mvp9fwvZT0NCmr CH+0FUaqp9InQ42kD+f/n697Oz9AWB0QZRGeBpe1S9AS+dIdLPknTw9FZFCEtQdsqRgX OZkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tjA7kzj+I+xGEzR8kCmNODklxUgH2/KEyszqH8j+kCo=; b=oJ7vBIJqsNVzu+QAOZ3d57qriDSyqEN3WGRkvJKeOPJIew5TmmspVvMXfhqdY7JvkS IZu9TWnlIyaRSbzpJZix2E5kWZZQpEc3m/gEpKruqa+csPlLQHWEWhTkoomwsAw5st1O Qi0sLj8TJkJ2CbQByAdWTbuAX9FAVIaLLpamADozOcwaDQWLZf3vcyOLid1dzbVjQsyk SpyKOdzUik/EL+CFL5/xq01p7Vg5n69lfo0oW0LQzbkzi2ETEW0a+UgZmmuVy6aq+aER a0KOJpRnh5PrxTK4fiPYIpTHnkbo9Av/Ejp4I7aEjoh6/uyFlt1EYiVF092k5ZIF23Sw b3jA== X-Gm-Message-State: AFqh2kqxtcA23j/KNE+gxrbCSu1KXRY/qASw/8pD97ZbnKMGixaMj5y7 DJ4jF+s4nsr5EycdwGnh9NApxvixSVvpJH5o X-Google-Smtp-Source: AMrXdXvsrQBzxnGPd7XGaLhVVtMF0YtfZ8L2Tt8T3/1u0bfkSdzN/44+uTSiTRR4r8bkHyu7tCWijQ== X-Received: by 2002:a17:90b:1f90:b0:219:d274:ba43 with SMTP id so16-20020a17090b1f9000b00219d274ba43mr69637637pjb.47.1673294902879; Mon, 09 Jan 2023 12:08:22 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Ilya Leoshkevich , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v3 01/27] target/s390x: Use tcg_constant_* in local contexts Date: Mon, 9 Jan 2023 12:07:53 -0800 Message-Id: <20230109200819.3916395-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230109200819.3916395-1-richard.henderson@linaro.org> References: <20230109200819.3916395-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1036; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1036.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1673295050215100001 Replace tcg_const_* with tcg_constant_* in contexts where the free to remove is nearby. Reviewed-by: Ilya Leoshkevich Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- target/s390x/tcg/translate.c | 416 +++++++++++++---------------------- 1 file changed, 149 insertions(+), 267 deletions(-) diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c index a339b277e9..f1c0e1af0d 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -171,8 +171,6 @@ static uint64_t inline_branch_miss[CC_OP_MAX]; =20 static void pc_to_link_info(TCGv_i64 out, DisasContext *s, uint64_t pc) { - TCGv_i64 tmp; - if (s->base.tb->flags & FLAG_MASK_32) { if (s->base.tb->flags & FLAG_MASK_64) { tcg_gen_movi_i64(out, pc); @@ -181,9 +179,7 @@ static void pc_to_link_info(TCGv_i64 out, DisasContext = *s, uint64_t pc) pc |=3D 0x80000000; } assert(!(s->base.tb->flags & FLAG_MASK_64)); - tmp =3D tcg_const_i64(pc); - tcg_gen_deposit_i64(out, out, tmp, 0, 32); - tcg_temp_free_i64(tmp); + tcg_gen_deposit_i64(out, out, tcg_constant_i64(pc), 0, 32); } =20 static TCGv_i64 psw_addr; @@ -348,11 +344,8 @@ static void per_branch(DisasContext *s, bool to_next) tcg_gen_movi_i64(gbea, s->base.pc_next); =20 if (s->base.tb->flags & FLAG_MASK_PER) { - TCGv_i64 next_pc =3D to_next ? tcg_const_i64(s->pc_tmp) : psw_addr; + TCGv_i64 next_pc =3D to_next ? tcg_constant_i64(s->pc_tmp) : psw_a= ddr; gen_helper_per_branch(cpu_env, gbea, next_pc); - if (to_next) { - tcg_temp_free_i64(next_pc); - } } #endif } @@ -370,9 +363,8 @@ static void per_branch_cond(DisasContext *s, TCGCond co= nd, =20 gen_set_label(lab); } else { - TCGv_i64 pc =3D tcg_const_i64(s->base.pc_next); + TCGv_i64 pc =3D tcg_constant_i64(s->base.pc_next); tcg_gen_movcond_i64(cond, gbea, arg1, arg2, gbea, pc); - tcg_temp_free_i64(pc); } #endif } @@ -426,23 +418,17 @@ static int get_mem_index(DisasContext *s) =20 static void gen_exception(int excp) { - TCGv_i32 tmp =3D tcg_const_i32(excp); - gen_helper_exception(cpu_env, tmp); - tcg_temp_free_i32(tmp); + gen_helper_exception(cpu_env, tcg_constant_i32(excp)); } =20 static void gen_program_exception(DisasContext *s, int code) { - TCGv_i32 tmp; + /* Remember what pgm exeption this was. */ + tcg_gen_st_i32(tcg_constant_i32(code), cpu_env, + offsetof(CPUS390XState, int_pgm_code)); =20 - /* Remember what pgm exception this was. */ - tmp =3D tcg_const_i32(code); - tcg_gen_st_i32(tmp, cpu_env, offsetof(CPUS390XState, int_pgm_code)); - tcg_temp_free_i32(tmp); - - tmp =3D tcg_const_i32(s->ilen); - tcg_gen_st_i32(tmp, cpu_env, offsetof(CPUS390XState, int_pgm_ilen)); - tcg_temp_free_i32(tmp); + tcg_gen_st_i32(tcg_constant_i32(s->ilen), cpu_env, + offsetof(CPUS390XState, int_pgm_ilen)); =20 /* update the psw */ update_psw_addr(s); @@ -461,9 +447,7 @@ static inline void gen_illegal_opcode(DisasContext *s) =20 static inline void gen_data_exception(uint8_t dxc) { - TCGv_i32 tmp =3D tcg_const_i32(dxc); - gen_helper_data_exception(cpu_env, tmp); - tcg_temp_free_i32(tmp); + gen_helper_data_exception(cpu_env, tcg_constant_i32(dxc)); } =20 static inline void gen_trap(DisasContext *s) @@ -584,13 +568,13 @@ static void gen_op_calc_cc(DisasContext *s) =20 switch (s->cc_op) { default: - dummy =3D tcg_const_i64(0); + dummy =3D tcg_constant_i64(0); /* FALLTHRU */ case CC_OP_ADD_64: case CC_OP_SUB_64: case CC_OP_ADD_32: case CC_OP_SUB_32: - local_cc_op =3D tcg_const_i32(s->cc_op); + local_cc_op =3D tcg_constant_i32(s->cc_op); break; case CC_OP_CONST0: case CC_OP_CONST1: @@ -660,13 +644,6 @@ static void gen_op_calc_cc(DisasContext *s) tcg_abort(); } =20 - if (local_cc_op) { - tcg_temp_free_i32(local_cc_op); - } - if (dummy) { - tcg_temp_free_i64(dummy); - } - /* We now have cc in cc_op as constant */ set_cc_static(s); } @@ -1284,9 +1261,9 @@ static DisasJumpType help_branch(DisasContext *s, Dis= asCompare *c, Most commonly we're single-stepping or some other condition that disables all use of goto_tb. Just update the PC and exit. */ =20 - TCGv_i64 next =3D tcg_const_i64(s->pc_tmp); + TCGv_i64 next =3D tcg_constant_i64(s->pc_tmp); if (is_imm) { - cdest =3D tcg_const_i64(dest); + cdest =3D tcg_constant_i64(dest); } =20 if (c->is_64) { @@ -1296,21 +1273,15 @@ static DisasJumpType help_branch(DisasContext *s, D= isasCompare *c, } else { TCGv_i32 t0 =3D tcg_temp_new_i32(); TCGv_i64 t1 =3D tcg_temp_new_i64(); - TCGv_i64 z =3D tcg_const_i64(0); + TCGv_i64 z =3D tcg_constant_i64(0); tcg_gen_setcond_i32(c->cond, t0, c->u.s32.a, c->u.s32.b); tcg_gen_extu_i32_i64(t1, t0); tcg_temp_free_i32(t0); tcg_gen_movcond_i64(TCG_COND_NE, psw_addr, t1, z, cdest, next); per_branch_cond(s, TCG_COND_NE, t1, z); tcg_temp_free_i64(t1); - tcg_temp_free_i64(z); } =20 - if (is_imm) { - tcg_temp_free_i64(cdest); - } - tcg_temp_free_i64(next); - ret =3D DISAS_PC_UPDATED; } =20 @@ -1394,10 +1365,9 @@ static DisasJumpType op_addc64(DisasContext *s, Disa= sOps *o) { compute_carry(s); =20 - TCGv_i64 zero =3D tcg_const_i64(0); + TCGv_i64 zero =3D tcg_constant_i64(0); tcg_gen_add2_i64(o->out, cc_src, o->in1, zero, cc_src, zero); tcg_gen_add2_i64(o->out, cc_src, o->out, cc_src, o->in2, zero); - tcg_temp_free_i64(zero); =20 return DISAS_NEXT; } @@ -2077,9 +2047,8 @@ static DisasJumpType op_clc(DisasContext *s, DisasOps= *o) tcg_gen_qemu_ld64(cc_dst, o->in2, get_mem_index(s)); break; default: - vl =3D tcg_const_i32(l); + vl =3D tcg_constant_i32(l); gen_helper_clc(cc_op, cpu_env, vl, o->addr1, o->in2); - tcg_temp_free_i32(vl); set_cc_static(s); return DISAS_NEXT; } @@ -2099,11 +2068,9 @@ static DisasJumpType op_clcl(DisasContext *s, DisasO= ps *o) return DISAS_NORETURN; } =20 - t1 =3D tcg_const_i32(r1); - t2 =3D tcg_const_i32(r2); + t1 =3D tcg_constant_i32(r1); + t2 =3D tcg_constant_i32(r2); gen_helper_clcl(cc_op, cpu_env, t1, t2); - tcg_temp_free_i32(t1); - tcg_temp_free_i32(t2); set_cc_static(s); return DISAS_NEXT; } @@ -2120,11 +2087,9 @@ static DisasJumpType op_clcle(DisasContext *s, Disas= Ops *o) return DISAS_NORETURN; } =20 - t1 =3D tcg_const_i32(r1); - t3 =3D tcg_const_i32(r3); + t1 =3D tcg_constant_i32(r1); + t3 =3D tcg_constant_i32(r3); gen_helper_clcle(cc_op, cpu_env, t1, o->in2, t3); - tcg_temp_free_i32(t1); - tcg_temp_free_i32(t3); set_cc_static(s); return DISAS_NEXT; } @@ -2141,24 +2106,22 @@ static DisasJumpType op_clclu(DisasContext *s, Disa= sOps *o) return DISAS_NORETURN; } =20 - t1 =3D tcg_const_i32(r1); - t3 =3D tcg_const_i32(r3); + t1 =3D tcg_constant_i32(r1); + t3 =3D tcg_constant_i32(r3); gen_helper_clclu(cc_op, cpu_env, t1, o->in2, t3); - tcg_temp_free_i32(t1); - tcg_temp_free_i32(t3); set_cc_static(s); return DISAS_NEXT; } =20 static DisasJumpType op_clm(DisasContext *s, DisasOps *o) { - TCGv_i32 m3 =3D tcg_const_i32(get_field(s, m3)); + TCGv_i32 m3 =3D tcg_constant_i32(get_field(s, m3)); TCGv_i32 t1 =3D tcg_temp_new_i32(); + tcg_gen_extrl_i64_i32(t1, o->in1); gen_helper_clm(cc_op, cpu_env, t1, m3, o->in2); set_cc_static(s); tcg_temp_free_i32(t1); - tcg_temp_free_i32(m3); return DISAS_NEXT; } =20 @@ -2217,8 +2180,8 @@ static DisasJumpType op_cdsg(DisasContext *s, DisasOp= s *o) =20 /* Note that R1:R1+1 =3D expected value and R3:R3+1 =3D new value. */ addr =3D get_address(s, 0, b2, d2); - t_r1 =3D tcg_const_i32(r1); - t_r3 =3D tcg_const_i32(r3); + t_r1 =3D tcg_constant_i32(r1); + t_r3 =3D tcg_constant_i32(r3); if (!(tb_cflags(s->base.tb) & CF_PARALLEL)) { gen_helper_cdsg(cpu_env, addr, t_r1, t_r3); } else if (HAVE_CMPXCHG128) { @@ -2228,8 +2191,6 @@ static DisasJumpType op_cdsg(DisasContext *s, DisasOp= s *o) ret =3D DISAS_NORETURN; } tcg_temp_free_i64(addr); - tcg_temp_free_i32(t_r1); - tcg_temp_free_i32(t_r3); =20 set_cc_static(s); return ret; @@ -2238,14 +2199,13 @@ static DisasJumpType op_cdsg(DisasContext *s, Disas= Ops *o) static DisasJumpType op_csst(DisasContext *s, DisasOps *o) { int r3 =3D get_field(s, r3); - TCGv_i32 t_r3 =3D tcg_const_i32(r3); + TCGv_i32 t_r3 =3D tcg_constant_i32(r3); =20 if (tb_cflags(s->base.tb) & CF_PARALLEL) { gen_helper_csst_parallel(cc_op, cpu_env, t_r3, o->addr1, o->in2); } else { gen_helper_csst(cc_op, cpu_env, t_r3, o->addr1, o->in2); } - tcg_temp_free_i32(t_r3); =20 set_cc_static(s); return DISAS_NEXT; @@ -2343,9 +2303,9 @@ static DisasJumpType op_cuXX(DisasContext *s, DisasOp= s *o) m3 =3D 0; } =20 - tr1 =3D tcg_const_i32(r1); - tr2 =3D tcg_const_i32(r2); - chk =3D tcg_const_i32(m3); + tr1 =3D tcg_constant_i32(r1); + tr2 =3D tcg_constant_i32(r2); + chk =3D tcg_constant_i32(m3); =20 switch (s->insn->data) { case 12: @@ -2370,9 +2330,6 @@ static DisasJumpType op_cuXX(DisasContext *s, DisasOp= s *o) g_assert_not_reached(); } =20 - tcg_temp_free_i32(tr1); - tcg_temp_free_i32(tr2); - tcg_temp_free_i32(chk); set_cc_static(s); return DISAS_NEXT; } @@ -2380,15 +2337,11 @@ static DisasJumpType op_cuXX(DisasContext *s, Disas= Ops *o) #ifndef CONFIG_USER_ONLY static DisasJumpType op_diag(DisasContext *s, DisasOps *o) { - TCGv_i32 r1 =3D tcg_const_i32(get_field(s, r1)); - TCGv_i32 r3 =3D tcg_const_i32(get_field(s, r3)); - TCGv_i32 func_code =3D tcg_const_i32(get_field(s, i2)); + TCGv_i32 r1 =3D tcg_constant_i32(get_field(s, r1)); + TCGv_i32 r3 =3D tcg_constant_i32(get_field(s, r3)); + TCGv_i32 func_code =3D tcg_constant_i32(get_field(s, i2)); =20 gen_helper_diag(cpu_env, r1, r3, func_code); - - tcg_temp_free_i32(func_code); - tcg_temp_free_i32(r3); - tcg_temp_free_i32(r1); return DISAS_NEXT; } #endif @@ -2494,18 +2447,13 @@ static DisasJumpType op_ex(DisasContext *s, DisasOp= s *o) update_cc_op(s); =20 if (r1 =3D=3D 0) { - v1 =3D tcg_const_i64(0); + v1 =3D tcg_constant_i64(0); } else { v1 =3D regs[r1]; } =20 - ilen =3D tcg_const_i32(s->ilen); + ilen =3D tcg_constant_i32(s->ilen); gen_helper_ex(cpu_env, ilen, v1, o->in2); - tcg_temp_free_i32(ilen); - - if (r1 =3D=3D 0) { - tcg_temp_free_i64(v1); - } =20 return DISAS_PC_CC_UPDATED; } @@ -2657,12 +2605,11 @@ static DisasJumpType op_idte(DisasContext *s, Disas= Ops *o) TCGv_i32 m4; =20 if (s390_has_feat(S390_FEAT_LOCAL_TLB_CLEARING)) { - m4 =3D tcg_const_i32(get_field(s, m4)); + m4 =3D tcg_constant_i32(get_field(s, m4)); } else { - m4 =3D tcg_const_i32(0); + m4 =3D tcg_constant_i32(0); } gen_helper_idte(cpu_env, o->in1, o->in2, m4); - tcg_temp_free_i32(m4); return DISAS_NEXT; } =20 @@ -2671,12 +2618,11 @@ static DisasJumpType op_ipte(DisasContext *s, Disas= Ops *o) TCGv_i32 m4; =20 if (s390_has_feat(S390_FEAT_LOCAL_TLB_CLEARING)) { - m4 =3D tcg_const_i32(get_field(s, m4)); + m4 =3D tcg_constant_i32(get_field(s, m4)); } else { - m4 =3D tcg_const_i32(0); + m4 =3D tcg_constant_i32(0); } gen_helper_ipte(cpu_env, o->in1, o->in2, m4); - tcg_temp_free_i32(m4); return DISAS_NEXT; } =20 @@ -2732,16 +2678,12 @@ static DisasJumpType op_msa(DisasContext *s, DisasO= ps *o) g_assert_not_reached(); }; =20 - t_r1 =3D tcg_const_i32(r1); - t_r2 =3D tcg_const_i32(r2); - t_r3 =3D tcg_const_i32(r3); - type =3D tcg_const_i32(s->insn->data); + t_r1 =3D tcg_constant_i32(r1); + t_r2 =3D tcg_constant_i32(r2); + t_r3 =3D tcg_constant_i32(r3); + type =3D tcg_constant_i32(s->insn->data); gen_helper_msa(cc_op, cpu_env, t_r1, t_r2, t_r3, type); set_cc_static(s); - tcg_temp_free_i32(t_r1); - tcg_temp_free_i32(t_r2); - tcg_temp_free_i32(t_r3); - tcg_temp_free_i32(type); return DISAS_NEXT; } =20 @@ -3002,10 +2944,9 @@ static DisasJumpType op_loc(DisasContext *s, DisasOp= s *o) tcg_gen_extu_i32_i64(t, t32); tcg_temp_free_i32(t32); =20 - z =3D tcg_const_i64(0); + z =3D tcg_constant_i64(0); tcg_gen_movcond_i64(TCG_COND_NE, o->out, t, z, o->in2, o->in1); tcg_temp_free_i64(t); - tcg_temp_free_i64(z); } =20 return DISAS_NEXT; @@ -3014,11 +2955,10 @@ static DisasJumpType op_loc(DisasContext *s, DisasO= ps *o) #ifndef CONFIG_USER_ONLY static DisasJumpType op_lctl(DisasContext *s, DisasOps *o) { - TCGv_i32 r1 =3D tcg_const_i32(get_field(s, r1)); - TCGv_i32 r3 =3D tcg_const_i32(get_field(s, r3)); + TCGv_i32 r1 =3D tcg_constant_i32(get_field(s, r1)); + TCGv_i32 r3 =3D tcg_constant_i32(get_field(s, r3)); + gen_helper_lctl(cpu_env, r1, o->in2, r3); - tcg_temp_free_i32(r1); - tcg_temp_free_i32(r3); /* Exit to main loop to reevaluate s390_cpu_exec_interrupt. */ s->exit_to_mainloop =3D true; return DISAS_TOO_MANY; @@ -3026,11 +2966,10 @@ static DisasJumpType op_lctl(DisasContext *s, Disas= Ops *o) =20 static DisasJumpType op_lctlg(DisasContext *s, DisasOps *o) { - TCGv_i32 r1 =3D tcg_const_i32(get_field(s, r1)); - TCGv_i32 r3 =3D tcg_const_i32(get_field(s, r3)); + TCGv_i32 r1 =3D tcg_constant_i32(get_field(s, r1)); + TCGv_i32 r3 =3D tcg_constant_i32(get_field(s, r3)); + gen_helper_lctlg(cpu_env, r1, o->in2, r3); - tcg_temp_free_i32(r1); - tcg_temp_free_i32(r3); /* Exit to main loop to reevaluate s390_cpu_exec_interrupt. */ s->exit_to_mainloop =3D true; return DISAS_TOO_MANY; @@ -3090,11 +3029,10 @@ static DisasJumpType op_lpswe(DisasContext *s, Disa= sOps *o) =20 static DisasJumpType op_lam(DisasContext *s, DisasOps *o) { - TCGv_i32 r1 =3D tcg_const_i32(get_field(s, r1)); - TCGv_i32 r3 =3D tcg_const_i32(get_field(s, r3)); + TCGv_i32 r1 =3D tcg_constant_i32(get_field(s, r1)); + TCGv_i32 r3 =3D tcg_constant_i32(get_field(s, r3)); + gen_helper_lam(cpu_env, r1, o->in2, r3); - tcg_temp_free_i32(r1); - tcg_temp_free_i32(r3); return DISAS_NEXT; } =20 @@ -3304,9 +3242,6 @@ static DisasJumpType op_lcbb(DisasContext *s, DisasOp= s *o) =20 static DisasJumpType op_mc(DisasContext *s, DisasOps *o) { -#if !defined(CONFIG_USER_ONLY) - TCGv_i32 i2; -#endif const uint16_t monitor_class =3D get_field(s, i2); =20 if (monitor_class & 0xff00) { @@ -3315,9 +3250,8 @@ static DisasJumpType op_mc(DisasContext *s, DisasOps = *o) } =20 #if !defined(CONFIG_USER_ONLY) - i2 =3D tcg_const_i32(monitor_class); - gen_helper_monitor_call(cpu_env, o->addr1, i2); - tcg_temp_free_i32(i2); + gen_helper_monitor_call(cpu_env, o->addr1, + tcg_constant_i32(monitor_class)); #endif /* Defaults to a NOP. */ return DISAS_NEXT; @@ -3381,9 +3315,9 @@ static DisasJumpType op_movx(DisasContext *s, DisasOp= s *o) =20 static DisasJumpType op_mvc(DisasContext *s, DisasOps *o) { - TCGv_i32 l =3D tcg_const_i32(get_field(s, l1)); + TCGv_i32 l =3D tcg_constant_i32(get_field(s, l1)); + gen_helper_mvc(cpu_env, l, o->addr1, o->in2); - tcg_temp_free_i32(l); return DISAS_NEXT; } =20 @@ -3395,9 +3329,9 @@ static DisasJumpType op_mvcrl(DisasContext *s, DisasO= ps *o) =20 static DisasJumpType op_mvcin(DisasContext *s, DisasOps *o) { - TCGv_i32 l =3D tcg_const_i32(get_field(s, l1)); + TCGv_i32 l =3D tcg_constant_i32(get_field(s, l1)); + gen_helper_mvcin(cpu_env, l, o->addr1, o->in2); - tcg_temp_free_i32(l); return DISAS_NEXT; } =20 @@ -3413,11 +3347,9 @@ static DisasJumpType op_mvcl(DisasContext *s, DisasO= ps *o) return DISAS_NORETURN; } =20 - t1 =3D tcg_const_i32(r1); - t2 =3D tcg_const_i32(r2); + t1 =3D tcg_constant_i32(r1); + t2 =3D tcg_constant_i32(r2); gen_helper_mvcl(cc_op, cpu_env, t1, t2); - tcg_temp_free_i32(t1); - tcg_temp_free_i32(t2); set_cc_static(s); return DISAS_NEXT; } @@ -3434,11 +3366,9 @@ static DisasJumpType op_mvcle(DisasContext *s, Disas= Ops *o) return DISAS_NORETURN; } =20 - t1 =3D tcg_const_i32(r1); - t3 =3D tcg_const_i32(r3); + t1 =3D tcg_constant_i32(r1); + t3 =3D tcg_constant_i32(r3); gen_helper_mvcle(cc_op, cpu_env, t1, o->in2, t3); - tcg_temp_free_i32(t1); - tcg_temp_free_i32(t3); set_cc_static(s); return DISAS_NEXT; } @@ -3455,11 +3385,9 @@ static DisasJumpType op_mvclu(DisasContext *s, Disas= Ops *o) return DISAS_NORETURN; } =20 - t1 =3D tcg_const_i32(r1); - t3 =3D tcg_const_i32(r3); + t1 =3D tcg_constant_i32(r1); + t3 =3D tcg_constant_i32(r3); gen_helper_mvclu(cc_op, cpu_env, t1, o->in2, t3); - tcg_temp_free_i32(t1); - tcg_temp_free_i32(t3); set_cc_static(s); return DISAS_NEXT; } @@ -3494,49 +3422,45 @@ static DisasJumpType op_mvcs(DisasContext *s, Disas= Ops *o) =20 static DisasJumpType op_mvn(DisasContext *s, DisasOps *o) { - TCGv_i32 l =3D tcg_const_i32(get_field(s, l1)); + TCGv_i32 l =3D tcg_constant_i32(get_field(s, l1)); + gen_helper_mvn(cpu_env, l, o->addr1, o->in2); - tcg_temp_free_i32(l); return DISAS_NEXT; } =20 static DisasJumpType op_mvo(DisasContext *s, DisasOps *o) { - TCGv_i32 l =3D tcg_const_i32(get_field(s, l1)); + TCGv_i32 l =3D tcg_constant_i32(get_field(s, l1)); + gen_helper_mvo(cpu_env, l, o->addr1, o->in2); - tcg_temp_free_i32(l); return DISAS_NEXT; } =20 static DisasJumpType op_mvpg(DisasContext *s, DisasOps *o) { - TCGv_i32 t1 =3D tcg_const_i32(get_field(s, r1)); - TCGv_i32 t2 =3D tcg_const_i32(get_field(s, r2)); + TCGv_i32 t1 =3D tcg_constant_i32(get_field(s, r1)); + TCGv_i32 t2 =3D tcg_constant_i32(get_field(s, r2)); =20 gen_helper_mvpg(cc_op, cpu_env, regs[0], t1, t2); - tcg_temp_free_i32(t1); - tcg_temp_free_i32(t2); set_cc_static(s); return DISAS_NEXT; } =20 static DisasJumpType op_mvst(DisasContext *s, DisasOps *o) { - TCGv_i32 t1 =3D tcg_const_i32(get_field(s, r1)); - TCGv_i32 t2 =3D tcg_const_i32(get_field(s, r2)); + TCGv_i32 t1 =3D tcg_constant_i32(get_field(s, r1)); + TCGv_i32 t2 =3D tcg_constant_i32(get_field(s, r2)); =20 gen_helper_mvst(cc_op, cpu_env, t1, t2); - tcg_temp_free_i32(t1); - tcg_temp_free_i32(t2); set_cc_static(s); return DISAS_NEXT; } =20 static DisasJumpType op_mvz(DisasContext *s, DisasOps *o) { - TCGv_i32 l =3D tcg_const_i32(get_field(s, l1)); + TCGv_i32 l =3D tcg_constant_i32(get_field(s, l1)); + gen_helper_mvz(cpu_env, l, o->addr1, o->in2); - tcg_temp_free_i32(l); return DISAS_NEXT; } =20 @@ -3624,13 +3548,12 @@ static DisasJumpType op_msdb(DisasContext *s, Disas= Ops *o) =20 static DisasJumpType op_nabs(DisasContext *s, DisasOps *o) { - TCGv_i64 z, n; - z =3D tcg_const_i64(0); - n =3D tcg_temp_new_i64(); + TCGv_i64 z =3D tcg_constant_i64(0); + TCGv_i64 n =3D tcg_temp_new_i64(); + tcg_gen_neg_i64(n, o->in2); tcg_gen_movcond_i64(TCG_COND_GE, o->out, o->in2, z, n, o->in2); tcg_temp_free_i64(n); - tcg_temp_free_i64(z); return DISAS_NEXT; } =20 @@ -3655,9 +3578,9 @@ static DisasJumpType op_nabsf128(DisasContext *s, Dis= asOps *o) =20 static DisasJumpType op_nc(DisasContext *s, DisasOps *o) { - TCGv_i32 l =3D tcg_const_i32(get_field(s, l1)); + TCGv_i32 l =3D tcg_constant_i32(get_field(s, l1)); + gen_helper_nc(cc_op, cpu_env, l, o->addr1, o->in2); - tcg_temp_free_i32(l); set_cc_static(s); return DISAS_NEXT; } @@ -3689,9 +3612,9 @@ static DisasJumpType op_negf128(DisasContext *s, Disa= sOps *o) =20 static DisasJumpType op_oc(DisasContext *s, DisasOps *o) { - TCGv_i32 l =3D tcg_const_i32(get_field(s, l1)); + TCGv_i32 l =3D tcg_constant_i32(get_field(s, l1)); + gen_helper_oc(cc_op, cpu_env, l, o->addr1, o->in2); - tcg_temp_free_i32(l); set_cc_static(s); return DISAS_NEXT; } @@ -3741,9 +3664,9 @@ static DisasJumpType op_oi(DisasContext *s, DisasOps = *o) =20 static DisasJumpType op_pack(DisasContext *s, DisasOps *o) { - TCGv_i32 l =3D tcg_const_i32(get_field(s, l1)); + TCGv_i32 l =3D tcg_constant_i32(get_field(s, l1)); + gen_helper_pack(cpu_env, l, o->addr1, o->in2); - tcg_temp_free_i32(l); return DISAS_NEXT; } =20 @@ -3757,9 +3680,8 @@ static DisasJumpType op_pka(DisasContext *s, DisasOps= *o) gen_program_exception(s, PGM_SPECIFICATION); return DISAS_NORETURN; } - l =3D tcg_const_i32(l2); + l =3D tcg_constant_i32(l2); gen_helper_pka(cpu_env, o->addr1, o->in2, l); - tcg_temp_free_i32(l); return DISAS_NEXT; } =20 @@ -3773,9 +3695,8 @@ static DisasJumpType op_pku(DisasContext *s, DisasOps= *o) gen_program_exception(s, PGM_SPECIFICATION); return DISAS_NORETURN; } - l =3D tcg_const_i32(l2); + l =3D tcg_constant_i32(l2); gen_helper_pku(cpu_env, o->addr1, o->in2, l); - tcg_temp_free_i32(l); return DISAS_NEXT; } =20 @@ -4022,9 +3943,8 @@ static DisasJumpType op_sam(DisasContext *s, DisasOps= *o) } s->pc_tmp &=3D mask; =20 - tsam =3D tcg_const_i64(sam); + tsam =3D tcg_constant_i64(sam); tcg_gen_deposit_i64(psw_mask, psw_mask, tsam, 31, 2); - tcg_temp_free_i64(tsam); =20 /* Always exit the TB, since we (may have) changed execution mode. */ return DISAS_TOO_MANY; @@ -4085,12 +4005,11 @@ static DisasJumpType op_servc(DisasContext *s, Disa= sOps *o) =20 static DisasJumpType op_sigp(DisasContext *s, DisasOps *o) { - TCGv_i32 r1 =3D tcg_const_i32(get_field(s, r1)); - TCGv_i32 r3 =3D tcg_const_i32(get_field(s, r3)); + TCGv_i32 r1 =3D tcg_constant_i32(get_field(s, r1)); + TCGv_i32 r3 =3D tcg_constant_i32(get_field(s, r3)); + gen_helper_sigp(cc_op, cpu_env, o->in2, r1, r3); set_cc_static(s); - tcg_temp_free_i32(r1); - tcg_temp_free_i32(r3); return DISAS_NEXT; } #endif @@ -4359,21 +4278,19 @@ static DisasJumpType op_stckc(DisasContext *s, Disa= sOps *o) =20 static DisasJumpType op_stctg(DisasContext *s, DisasOps *o) { - TCGv_i32 r1 =3D tcg_const_i32(get_field(s, r1)); - TCGv_i32 r3 =3D tcg_const_i32(get_field(s, r3)); + TCGv_i32 r1 =3D tcg_constant_i32(get_field(s, r1)); + TCGv_i32 r3 =3D tcg_constant_i32(get_field(s, r3)); + gen_helper_stctg(cpu_env, r1, o->in2, r3); - tcg_temp_free_i32(r1); - tcg_temp_free_i32(r3); return DISAS_NEXT; } =20 static DisasJumpType op_stctl(DisasContext *s, DisasOps *o) { - TCGv_i32 r1 =3D tcg_const_i32(get_field(s, r1)); - TCGv_i32 r3 =3D tcg_const_i32(get_field(s, r3)); + TCGv_i32 r1 =3D tcg_constant_i32(get_field(s, r1)); + TCGv_i32 r3 =3D tcg_constant_i32(get_field(s, r3)); + gen_helper_stctl(cpu_env, r1, o->in2, r3); - tcg_temp_free_i32(r1); - tcg_temp_free_i32(r3); return DISAS_NEXT; } =20 @@ -4600,11 +4517,10 @@ static DisasJumpType op_st64(DisasContext *s, Disas= Ops *o) =20 static DisasJumpType op_stam(DisasContext *s, DisasOps *o) { - TCGv_i32 r1 =3D tcg_const_i32(get_field(s, r1)); - TCGv_i32 r3 =3D tcg_const_i32(get_field(s, r3)); + TCGv_i32 r1 =3D tcg_constant_i32(get_field(s, r1)); + TCGv_i32 r3 =3D tcg_constant_i32(get_field(s, r3)); + gen_helper_stam(cpu_env, r1, o->in2, r3); - tcg_temp_free_i32(r1); - tcg_temp_free_i32(r3); return DISAS_NEXT; } =20 @@ -4662,7 +4578,7 @@ static DisasJumpType op_stm(DisasContext *s, DisasOps= *o) int r1 =3D get_field(s, r1); int r3 =3D get_field(s, r3); int size =3D s->insn->data; - TCGv_i64 tsize =3D tcg_const_i64(size); + TCGv_i64 tsize =3D tcg_constant_i64(size); =20 while (1) { if (size =3D=3D 8) { @@ -4677,7 +4593,6 @@ static DisasJumpType op_stm(DisasContext *s, DisasOps= *o) r1 =3D (r1 + 1) & 15; } =20 - tcg_temp_free_i64(tsize); return DISAS_NEXT; } =20 @@ -4686,8 +4601,8 @@ static DisasJumpType op_stmh(DisasContext *s, DisasOp= s *o) int r1 =3D get_field(s, r1); int r3 =3D get_field(s, r3); TCGv_i64 t =3D tcg_temp_new_i64(); - TCGv_i64 t4 =3D tcg_const_i64(4); - TCGv_i64 t32 =3D tcg_const_i64(32); + TCGv_i64 t4 =3D tcg_constant_i64(4); + TCGv_i64 t32 =3D tcg_constant_i64(32); =20 while (1) { tcg_gen_shl_i64(t, regs[r1], t32); @@ -4700,8 +4615,6 @@ static DisasJumpType op_stmh(DisasContext *s, DisasOp= s *o) } =20 tcg_temp_free_i64(t); - tcg_temp_free_i64(t4); - tcg_temp_free_i64(t32); return DISAS_NEXT; } =20 @@ -4720,26 +4633,20 @@ static DisasJumpType op_stpq(DisasContext *s, Disas= Ops *o) =20 static DisasJumpType op_srst(DisasContext *s, DisasOps *o) { - TCGv_i32 r1 =3D tcg_const_i32(get_field(s, r1)); - TCGv_i32 r2 =3D tcg_const_i32(get_field(s, r2)); + TCGv_i32 r1 =3D tcg_constant_i32(get_field(s, r1)); + TCGv_i32 r2 =3D tcg_constant_i32(get_field(s, r2)); =20 gen_helper_srst(cpu_env, r1, r2); - - tcg_temp_free_i32(r1); - tcg_temp_free_i32(r2); set_cc_static(s); return DISAS_NEXT; } =20 static DisasJumpType op_srstu(DisasContext *s, DisasOps *o) { - TCGv_i32 r1 =3D tcg_const_i32(get_field(s, r1)); - TCGv_i32 r2 =3D tcg_const_i32(get_field(s, r2)); + TCGv_i32 r1 =3D tcg_constant_i32(get_field(s, r1)); + TCGv_i32 r2 =3D tcg_constant_i32(get_field(s, r2)); =20 gen_helper_srstu(cpu_env, r1, r2); - - tcg_temp_free_i32(r1); - tcg_temp_free_i32(r2); set_cc_static(s); return DISAS_NEXT; } @@ -4797,10 +4704,9 @@ static DisasJumpType op_subb64(DisasContext *s, Disa= sOps *o) * Borrow is {0, -1}, so add to subtract; replicate the * borrow input to produce 128-bit -1 for the addition. */ - TCGv_i64 zero =3D tcg_const_i64(0); + TCGv_i64 zero =3D tcg_constant_i64(0); tcg_gen_add2_i64(o->out, cc_src, o->in1, zero, cc_src, cc_src); tcg_gen_sub2_i64(o->out, cc_src, o->out, cc_src, o->in2, zero); - tcg_temp_free_i64(zero); =20 return DISAS_NEXT; } @@ -4812,13 +4718,11 @@ static DisasJumpType op_svc(DisasContext *s, DisasO= ps *o) update_psw_addr(s); update_cc_op(s); =20 - t =3D tcg_const_i32(get_field(s, i1) & 0xff); + t =3D tcg_constant_i32(get_field(s, i1) & 0xff); tcg_gen_st_i32(t, cpu_env, offsetof(CPUS390XState, int_svc_code)); - tcg_temp_free_i32(t); =20 - t =3D tcg_const_i32(s->ilen); + t =3D tcg_constant_i32(s->ilen); tcg_gen_st_i32(t, cpu_env, offsetof(CPUS390XState, int_svc_ilen)); - tcg_temp_free_i32(t); =20 gen_exception(EXCP_SVC); return DISAS_NORETURN; @@ -4875,18 +4779,18 @@ static DisasJumpType op_tprot(DisasContext *s, Disa= sOps *o) =20 static DisasJumpType op_tp(DisasContext *s, DisasOps *o) { - TCGv_i32 l1 =3D tcg_const_i32(get_field(s, l1) + 1); + TCGv_i32 l1 =3D tcg_constant_i32(get_field(s, l1) + 1); + gen_helper_tp(cc_op, cpu_env, o->addr1, l1); - tcg_temp_free_i32(l1); set_cc_static(s); return DISAS_NEXT; } =20 static DisasJumpType op_tr(DisasContext *s, DisasOps *o) { - TCGv_i32 l =3D tcg_const_i32(get_field(s, l1)); + TCGv_i32 l =3D tcg_constant_i32(get_field(s, l1)); + gen_helper_tr(cpu_env, l, o->addr1, o->in2); - tcg_temp_free_i32(l); set_cc_static(s); return DISAS_NEXT; } @@ -4901,27 +4805,27 @@ static DisasJumpType op_tre(DisasContext *s, DisasO= ps *o) =20 static DisasJumpType op_trt(DisasContext *s, DisasOps *o) { - TCGv_i32 l =3D tcg_const_i32(get_field(s, l1)); + TCGv_i32 l =3D tcg_constant_i32(get_field(s, l1)); + gen_helper_trt(cc_op, cpu_env, l, o->addr1, o->in2); - tcg_temp_free_i32(l); set_cc_static(s); return DISAS_NEXT; } =20 static DisasJumpType op_trtr(DisasContext *s, DisasOps *o) { - TCGv_i32 l =3D tcg_const_i32(get_field(s, l1)); + TCGv_i32 l =3D tcg_constant_i32(get_field(s, l1)); + gen_helper_trtr(cc_op, cpu_env, l, o->addr1, o->in2); - tcg_temp_free_i32(l); set_cc_static(s); return DISAS_NEXT; } =20 static DisasJumpType op_trXX(DisasContext *s, DisasOps *o) { - TCGv_i32 r1 =3D tcg_const_i32(get_field(s, r1)); - TCGv_i32 r2 =3D tcg_const_i32(get_field(s, r2)); - TCGv_i32 sizes =3D tcg_const_i32(s->insn->opc & 3); + TCGv_i32 r1 =3D tcg_constant_i32(get_field(s, r1)); + TCGv_i32 r2 =3D tcg_constant_i32(get_field(s, r2)); + TCGv_i32 sizes =3D tcg_constant_i32(s->insn->opc & 3); TCGv_i32 tst =3D tcg_temp_new_i32(); int m3 =3D get_field(s, m3); =20 @@ -4940,9 +4844,6 @@ static DisasJumpType op_trXX(DisasContext *s, DisasOp= s *o) } gen_helper_trXX(cc_op, cpu_env, r1, r2, tst, sizes); =20 - tcg_temp_free_i32(r1); - tcg_temp_free_i32(r2); - tcg_temp_free_i32(sizes); tcg_temp_free_i32(tst); set_cc_static(s); return DISAS_NEXT; @@ -4950,19 +4851,19 @@ static DisasJumpType op_trXX(DisasContext *s, Disas= Ops *o) =20 static DisasJumpType op_ts(DisasContext *s, DisasOps *o) { - TCGv_i32 t1 =3D tcg_const_i32(0xff); + TCGv_i32 t1 =3D tcg_constant_i32(0xff); + tcg_gen_atomic_xchg_i32(t1, o->in2, t1, get_mem_index(s), MO_UB); tcg_gen_extract_i32(cc_op, t1, 7, 1); - tcg_temp_free_i32(t1); set_cc_static(s); return DISAS_NEXT; } =20 static DisasJumpType op_unpk(DisasContext *s, DisasOps *o) { - TCGv_i32 l =3D tcg_const_i32(get_field(s, l1)); + TCGv_i32 l =3D tcg_constant_i32(get_field(s, l1)); + gen_helper_unpk(cpu_env, l, o->addr1, o->in2); - tcg_temp_free_i32(l); return DISAS_NEXT; } =20 @@ -4976,9 +4877,8 @@ static DisasJumpType op_unpka(DisasContext *s, DisasO= ps *o) gen_program_exception(s, PGM_SPECIFICATION); return DISAS_NORETURN; } - l =3D tcg_const_i32(l1); + l =3D tcg_constant_i32(l1); gen_helper_unpka(cc_op, cpu_env, o->addr1, l, o->in2); - tcg_temp_free_i32(l); set_cc_static(s); return DISAS_NEXT; } @@ -4993,9 +4893,8 @@ static DisasJumpType op_unpku(DisasContext *s, DisasO= ps *o) gen_program_exception(s, PGM_SPECIFICATION); return DISAS_NORETURN; } - l =3D tcg_const_i32(l1); + l =3D tcg_constant_i32(l1); gen_helper_unpku(cc_op, cpu_env, o->addr1, l, o->in2); - tcg_temp_free_i32(l); set_cc_static(s); return DISAS_NEXT; } @@ -5014,7 +4913,7 @@ static DisasJumpType op_xc(DisasContext *s, DisasOps = *o) =20 /* If the addresses are identical, this is a store/memset of zero. */ if (b1 =3D=3D b2 && d1 =3D=3D d2 && (l + 1) <=3D 32) { - o->in2 =3D tcg_const_i64(0); + o->in2 =3D tcg_constant_i64(0); =20 l++; while (l >=3D 8) { @@ -5047,9 +4946,8 @@ static DisasJumpType op_xc(DisasContext *s, DisasOps = *o) =20 /* But in general we'll defer to a helper. */ o->in2 =3D get_address(s, 0, b2, d2); - t32 =3D tcg_const_i32(l); + t32 =3D tcg_constant_i32(l); gen_helper_xc(cc_op, cpu_env, t32, o->addr1, o->in2); - tcg_temp_free_i32(t32); set_cc_static(s); return DISAS_NEXT; } @@ -5114,46 +5012,39 @@ static DisasJumpType op_zero2(DisasContext *s, Disa= sOps *o) #ifndef CONFIG_USER_ONLY static DisasJumpType op_clp(DisasContext *s, DisasOps *o) { - TCGv_i32 r2 =3D tcg_const_i32(get_field(s, r2)); + TCGv_i32 r2 =3D tcg_constant_i32(get_field(s, r2)); =20 gen_helper_clp(cpu_env, r2); - tcg_temp_free_i32(r2); set_cc_static(s); return DISAS_NEXT; } =20 static DisasJumpType op_pcilg(DisasContext *s, DisasOps *o) { - TCGv_i32 r1 =3D tcg_const_i32(get_field(s, r1)); - TCGv_i32 r2 =3D tcg_const_i32(get_field(s, r2)); + TCGv_i32 r1 =3D tcg_constant_i32(get_field(s, r1)); + TCGv_i32 r2 =3D tcg_constant_i32(get_field(s, r2)); =20 gen_helper_pcilg(cpu_env, r1, r2); - tcg_temp_free_i32(r1); - tcg_temp_free_i32(r2); set_cc_static(s); return DISAS_NEXT; } =20 static DisasJumpType op_pcistg(DisasContext *s, DisasOps *o) { - TCGv_i32 r1 =3D tcg_const_i32(get_field(s, r1)); - TCGv_i32 r2 =3D tcg_const_i32(get_field(s, r2)); + TCGv_i32 r1 =3D tcg_constant_i32(get_field(s, r1)); + TCGv_i32 r2 =3D tcg_constant_i32(get_field(s, r2)); =20 gen_helper_pcistg(cpu_env, r1, r2); - tcg_temp_free_i32(r1); - tcg_temp_free_i32(r2); set_cc_static(s); return DISAS_NEXT; } =20 static DisasJumpType op_stpcifc(DisasContext *s, DisasOps *o) { - TCGv_i32 r1 =3D tcg_const_i32(get_field(s, r1)); - TCGv_i32 ar =3D tcg_const_i32(get_field(s, b2)); + TCGv_i32 r1 =3D tcg_constant_i32(get_field(s, r1)); + TCGv_i32 ar =3D tcg_constant_i32(get_field(s, b2)); =20 gen_helper_stpcifc(cpu_env, r1, o->addr1, ar); - tcg_temp_free_i32(ar); - tcg_temp_free_i32(r1); set_cc_static(s); return DISAS_NEXT; } @@ -5166,38 +5057,31 @@ static DisasJumpType op_sic(DisasContext *s, DisasO= ps *o) =20 static DisasJumpType op_rpcit(DisasContext *s, DisasOps *o) { - TCGv_i32 r1 =3D tcg_const_i32(get_field(s, r1)); - TCGv_i32 r2 =3D tcg_const_i32(get_field(s, r2)); + TCGv_i32 r1 =3D tcg_constant_i32(get_field(s, r1)); + TCGv_i32 r2 =3D tcg_constant_i32(get_field(s, r2)); =20 gen_helper_rpcit(cpu_env, r1, r2); - tcg_temp_free_i32(r1); - tcg_temp_free_i32(r2); set_cc_static(s); return DISAS_NEXT; } =20 static DisasJumpType op_pcistb(DisasContext *s, DisasOps *o) { - TCGv_i32 r1 =3D tcg_const_i32(get_field(s, r1)); - TCGv_i32 r3 =3D tcg_const_i32(get_field(s, r3)); - TCGv_i32 ar =3D tcg_const_i32(get_field(s, b2)); + TCGv_i32 r1 =3D tcg_constant_i32(get_field(s, r1)); + TCGv_i32 r3 =3D tcg_constant_i32(get_field(s, r3)); + TCGv_i32 ar =3D tcg_constant_i32(get_field(s, b2)); =20 gen_helper_pcistb(cpu_env, r1, r3, o->addr1, ar); - tcg_temp_free_i32(ar); - tcg_temp_free_i32(r1); - tcg_temp_free_i32(r3); set_cc_static(s); return DISAS_NEXT; } =20 static DisasJumpType op_mpcifc(DisasContext *s, DisasOps *o) { - TCGv_i32 r1 =3D tcg_const_i32(get_field(s, r1)); - TCGv_i32 ar =3D tcg_const_i32(get_field(s, b2)); + TCGv_i32 r1 =3D tcg_constant_i32(get_field(s, r1)); + TCGv_i32 ar =3D tcg_constant_i32(get_field(s, b2)); =20 gen_helper_mpcifc(cpu_env, r1, o->addr1, ar); - tcg_temp_free_i32(ar); - tcg_temp_free_i32(r1); set_cc_static(s); return DISAS_NEXT; } @@ -6318,16 +6202,15 @@ static const DisasInsn *extract_insn(CPUS390XState = *env, DisasContext *s) =20 if (unlikely(s->ex_value)) { /* Drop the EX data now, so that it's clear on exception paths. */ - TCGv_i64 zero =3D tcg_const_i64(0); - int i; - tcg_gen_st_i64(zero, cpu_env, offsetof(CPUS390XState, ex_value)); - tcg_temp_free_i64(zero); + tcg_gen_st_i64(tcg_constant_i64(0), cpu_env, + offsetof(CPUS390XState, ex_value)); =20 /* Extract the values saved by EXECUTE. */ insn =3D s->ex_value & 0xffffffffffff0000ull; ilen =3D s->ex_value & 0xf; - /* register insn bytes with translator so plugins work */ - for (i =3D 0; i < ilen; i++) { + + /* Register insn bytes with translator so plugins work. */ + for (int i =3D 0; i < ilen; i++) { uint8_t byte =3D extract64(insn, 56 - (i * 8), 8); translator_fake_ldb(byte, pc + i); } @@ -6452,9 +6335,8 @@ static DisasJumpType translate_one(CPUS390XState *env= , DisasContext *s) =20 #ifndef CONFIG_USER_ONLY if (s->base.tb->flags & FLAG_MASK_PER) { - TCGv_i64 addr =3D tcg_const_i64(s->base.pc_next); + TCGv_i64 addr =3D tcg_constant_i64(s->base.pc_next); gen_helper_per_ifetch(cpu_env, addr); - tcg_temp_free_i64(addr); } #endif =20 --=20 2.34.1 From nobody Sun May 19 10:14:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1673295214; cv=none; d=zohomail.com; s=zohoarc; b=K9BiBC/yq4m2X2Laff08qMMPNXWpQcVYYxkmBil6eC3oZTEAp8xXKlNTZEmAG66ASGIxsqIl82TOYPgAOJI45AChJP0r8kEsq+yYtzJ0l6dD6SGnvMAXhHqjx4e4Ot0Onu/4NmYHTSjndwOPDMBnwUql/ULpnyPOikNoJIYsU5w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673295214; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=zfVA0nj/TN3+VHB5xtnDhkO2uqdEaNgLQfY+g2hMs6Y=; b=IkeTWhY0FmTcT5Shojxj8ICTWqHYR+oAsSNEZcPUtuoVlpfUrCVPxZpgFHblglPL70xLsI0DEfwKMk6svy9M2IKR+Ui/BD5rgNRuFy1PImv3djY2uFbo//SVGVCgHxpMTjHfAbY/GkH8WsPrx14w9MamGOVw/seyYpJHIIjCDNY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1673295214286665.624888841823; Mon, 9 Jan 2023 12:13:34 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pEyRc-0002tD-RL; Mon, 09 Jan 2023 15:08:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pEyRY-0002pd-9a for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:30 -0500 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pEyRW-0007OD-0e for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:27 -0500 Received: by mail-pj1-x102b.google.com with SMTP id fz16-20020a17090b025000b002269d6c2d83so12049354pjb.0 for ; Mon, 09 Jan 2023 12:08:25 -0800 (PST) Received: from stoup.. ([2602:47:d48c:8101:158e:facf:7a46:ba9f]) by smtp.gmail.com with ESMTPSA id l2-20020a17090a384200b0022727d4af8dsm577574pjf.48.2023.01.09.12.08.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Jan 2023 12:08:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zfVA0nj/TN3+VHB5xtnDhkO2uqdEaNgLQfY+g2hMs6Y=; b=hoDmb0RyIFGZvnJeDTBZ+Y7CZKIMBjDaMxbB3TodTkUaWVGPZsguX3QgPkEXAb54pt hU+wUiuR30OMukm8XouyuIns6HTCwcGnym7OKat//ii9t41TKtHvi7Ce+oA10VTBF3BB XgnDUaDBML/qNcNe13jaTTl+Whuveclc+XSJ1x0gIZPxkyMGi3QLsv1k+v+PSHD2mSpG WnOwrsdNk0IZSuGDGeyunMLuaD7v7NIHhQoac3q35JkbGS25CI/C/1r/P0d3Cs+nOuXE 8/hdJglbP74L49heZgTs3Wy/c7pi6gWaocW/ezFD/ijWCaavsk7yCs2NZPpZ4O45QduD V/+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zfVA0nj/TN3+VHB5xtnDhkO2uqdEaNgLQfY+g2hMs6Y=; b=D7x39jMGM8Bh69vqrEhvWKrOJLy38fTRorY2BjCP5YnQRq7v9cdUUuEoijPJehc3fD TmkD7QRZ06aKwZTn+T5/eZQvqS8WzOOJ6f4GdLP1uRjaCJ93NH5C9yrPEGBqK6rcyIdM 0k3/5D0D/TeFndhSeRwuoWGgCMtg79NArJK3/hnpnkklqg5J/vNorS2/UecaUQEBrNXF +N2mZLTdJ9AEsTrb7aA0Ta4+LQ6T3DU8PS/ZJ6F3AjNm7BE4l5kpfAEYYZ8R9Q8T4G4p wy642dgLi2JXvkmPthEIJNWLg+4hsTMGBF3BYsO/7EMqDAS3lePY4OcQw5dh6FiOTFU/ +ndQ== X-Gm-Message-State: AFqh2kq8mz8JEyRAWCQAdXtpWSh2rkvLHbbHpjyJcDdvNSCZgEkOhqlo 96emM5fW1N0SnTeEK9va3Ka88Yz3OFjPCj+k X-Google-Smtp-Source: AMrXdXsgFhtXcmirE2U3wscRI1YdRyRrv7ZfKeGoAySFUpNSEqs+rkVlYE3jqBVnsKfV+TfjvCiKZA== X-Received: by 2002:a05:6a20:8ee1:b0:ac:3f3f:9fbd with SMTP id m33-20020a056a208ee100b000ac3f3f9fbdmr65009082pzk.48.1673294904103; Mon, 09 Jan 2023 12:08:24 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Ilya Leoshkevich Subject: [PATCH v3 02/27] target/s390x: Use tcg_constant_* for DisasCompare Date: Mon, 9 Jan 2023 12:07:54 -0800 Message-Id: <20230109200819.3916395-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230109200819.3916395-1-richard.henderson@linaro.org> References: <20230109200819.3916395-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102b; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1673295215003100001 The a and b fields are not modified by the consumer, and while we need not free a constant, tcg will quietly ignore such frees, so free_compare need not be changed. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Ilya Leoshkevich Signed-off-by: Richard Henderson --- target/s390x/tcg/translate.c | 44 ++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c index f1c0e1af0d..2fa052249f 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -830,7 +830,7 @@ static void disas_jcc(DisasContext *s, DisasCompare *c,= uint32_t mask) c->is_64 =3D false; c->u.s32.a =3D tcg_temp_new_i32(); tcg_gen_extrl_i64_i32(c->u.s32.a, cc_dst); - c->u.s32.b =3D tcg_const_i32(0); + c->u.s32.b =3D tcg_constant_i32(0); break; case CC_OP_LTGT_32: case CC_OP_LTUGTU_32: @@ -845,7 +845,7 @@ static void disas_jcc(DisasContext *s, DisasCompare *c,= uint32_t mask) case CC_OP_NZ: case CC_OP_FLOGR: c->u.s64.a =3D cc_dst; - c->u.s64.b =3D tcg_const_i64(0); + c->u.s64.b =3D tcg_constant_i64(0); c->g1 =3D true; break; case CC_OP_LTGT_64: @@ -859,14 +859,14 @@ static void disas_jcc(DisasContext *s, DisasCompare *= c, uint32_t mask) case CC_OP_TM_64: case CC_OP_ICM: c->u.s64.a =3D tcg_temp_new_i64(); - c->u.s64.b =3D tcg_const_i64(0); + c->u.s64.b =3D tcg_constant_i64(0); tcg_gen_and_i64(c->u.s64.a, cc_src, cc_dst); break; =20 case CC_OP_ADDU: case CC_OP_SUBU: c->is_64 =3D true; - c->u.s64.b =3D tcg_const_i64(0); + c->u.s64.b =3D tcg_constant_i64(0); c->g1 =3D true; switch (mask) { case 8 | 2: @@ -889,65 +889,65 @@ static void disas_jcc(DisasContext *s, DisasCompare *= c, uint32_t mask) switch (mask) { case 0x8 | 0x4 | 0x2: /* cc !=3D 3 */ cond =3D TCG_COND_NE; - c->u.s32.b =3D tcg_const_i32(3); + c->u.s32.b =3D tcg_constant_i32(3); break; case 0x8 | 0x4 | 0x1: /* cc !=3D 2 */ cond =3D TCG_COND_NE; - c->u.s32.b =3D tcg_const_i32(2); + c->u.s32.b =3D tcg_constant_i32(2); break; case 0x8 | 0x2 | 0x1: /* cc !=3D 1 */ cond =3D TCG_COND_NE; - c->u.s32.b =3D tcg_const_i32(1); + c->u.s32.b =3D tcg_constant_i32(1); break; case 0x8 | 0x2: /* cc =3D=3D 0 || cc =3D=3D 2 =3D> (cc & 1) =3D=3D= 0 */ cond =3D TCG_COND_EQ; c->g1 =3D false; c->u.s32.a =3D tcg_temp_new_i32(); - c->u.s32.b =3D tcg_const_i32(0); + c->u.s32.b =3D tcg_constant_i32(0); tcg_gen_andi_i32(c->u.s32.a, cc_op, 1); break; case 0x8 | 0x4: /* cc < 2 */ cond =3D TCG_COND_LTU; - c->u.s32.b =3D tcg_const_i32(2); + c->u.s32.b =3D tcg_constant_i32(2); break; case 0x8: /* cc =3D=3D 0 */ cond =3D TCG_COND_EQ; - c->u.s32.b =3D tcg_const_i32(0); + c->u.s32.b =3D tcg_constant_i32(0); break; case 0x4 | 0x2 | 0x1: /* cc !=3D 0 */ cond =3D TCG_COND_NE; - c->u.s32.b =3D tcg_const_i32(0); + c->u.s32.b =3D tcg_constant_i32(0); break; case 0x4 | 0x1: /* cc =3D=3D 1 || cc =3D=3D 3 =3D> (cc & 1) !=3D 0= */ cond =3D TCG_COND_NE; c->g1 =3D false; c->u.s32.a =3D tcg_temp_new_i32(); - c->u.s32.b =3D tcg_const_i32(0); + c->u.s32.b =3D tcg_constant_i32(0); tcg_gen_andi_i32(c->u.s32.a, cc_op, 1); break; case 0x4: /* cc =3D=3D 1 */ cond =3D TCG_COND_EQ; - c->u.s32.b =3D tcg_const_i32(1); + c->u.s32.b =3D tcg_constant_i32(1); break; case 0x2 | 0x1: /* cc > 1 */ cond =3D TCG_COND_GTU; - c->u.s32.b =3D tcg_const_i32(1); + c->u.s32.b =3D tcg_constant_i32(1); break; case 0x2: /* cc =3D=3D 2 */ cond =3D TCG_COND_EQ; - c->u.s32.b =3D tcg_const_i32(2); + c->u.s32.b =3D tcg_constant_i32(2); break; case 0x1: /* cc =3D=3D 3 */ cond =3D TCG_COND_EQ; - c->u.s32.b =3D tcg_const_i32(3); + c->u.s32.b =3D tcg_constant_i32(3); break; default: /* CC is masked by something else: (8 >> cc) & mask. */ cond =3D TCG_COND_NE; c->g1 =3D false; - c->u.s32.a =3D tcg_const_i32(8); - c->u.s32.b =3D tcg_const_i32(0); - tcg_gen_shr_i32(c->u.s32.a, c->u.s32.a, cc_op); + c->u.s32.a =3D tcg_temp_new_i32(); + c->u.s32.b =3D tcg_constant_i32(0); + tcg_gen_shr_i32(c->u.s32.a, tcg_constant_i32(8), cc_op); tcg_gen_andi_i32(c->u.s32.a, c->u.s32.a, mask); break; } @@ -1604,7 +1604,7 @@ static DisasJumpType op_bct32(DisasContext *s, DisasO= ps *o) tcg_gen_subi_i64(t, regs[r1], 1); store_reg32_i64(r1, t); c.u.s32.a =3D tcg_temp_new_i32(); - c.u.s32.b =3D tcg_const_i32(0); + c.u.s32.b =3D tcg_constant_i32(0); tcg_gen_extrl_i64_i32(c.u.s32.a, t); tcg_temp_free_i64(t); =20 @@ -1628,7 +1628,7 @@ static DisasJumpType op_bcth(DisasContext *s, DisasOp= s *o) tcg_gen_subi_i64(t, t, 1); store_reg32h_i64(r1, t); c.u.s32.a =3D tcg_temp_new_i32(); - c.u.s32.b =3D tcg_const_i32(0); + c.u.s32.b =3D tcg_constant_i32(0); tcg_gen_extrl_i64_i32(c.u.s32.a, t); tcg_temp_free_i64(t); =20 @@ -1649,7 +1649,7 @@ static DisasJumpType op_bct64(DisasContext *s, DisasO= ps *o) =20 tcg_gen_subi_i64(regs[r1], regs[r1], 1); c.u.s64.a =3D regs[r1]; - c.u.s64.b =3D tcg_const_i64(0); + c.u.s64.b =3D tcg_constant_i64(0); =20 return help_branch(s, &c, is_imm, imm, o->in2); } --=20 2.34.1 From nobody Sun May 19 10:14:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1673295170; cv=none; d=zohomail.com; s=zohoarc; b=ckqxxb3e07EgmdUexY8aIfrB+uXwq/X1gzIlKbZaUdj75tT7g7dKswJcJqpKQb32JQYscEPYG5uIInJkXVASsrtAsv0fdlK4SdSKX9ljrlh3EHyzomX3CQA0MAKpQTAyrAAb+VVE9qycSnE0YorxkacOjq8vJqMBK1/ddsSrqRI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673295170; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=q3WKZKXeAQ7VZHzrf3EHfWYZVMYgOXzqitJC4yCe2aA=; b=bcSdJqI+ECRmgDJKqOlTee/pLis0PmhIaSRnVxMsaaoxQ99avmdjs3vy06nu2K74PFMRe/bWlRejHCu71c6wkkNrjXZsZGtUFddQHQNqEoW13ckiQuiSm3uFEWnXFLZliqC7zEHfUXASoevnPR6ga7QVGP7sKydgeD3VxDMsrkc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1673295170411224.56082047505151; Mon, 9 Jan 2023 12:12:50 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pEyRf-0002uz-CW; Mon, 09 Jan 2023 15:08:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pEyRa-0002py-Ud for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:31 -0500 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pEyRX-0007PB-Dy for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:29 -0500 Received: by mail-pj1-x1034.google.com with SMTP id bj3so6725377pjb.0 for ; Mon, 09 Jan 2023 12:08:27 -0800 (PST) Received: from stoup.. ([2602:47:d48c:8101:158e:facf:7a46:ba9f]) by smtp.gmail.com with ESMTPSA id l2-20020a17090a384200b0022727d4af8dsm577574pjf.48.2023.01.09.12.08.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Jan 2023 12:08:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=q3WKZKXeAQ7VZHzrf3EHfWYZVMYgOXzqitJC4yCe2aA=; b=jOT09j4bfc3x1wmz2yZkBmPL/D4LW0KmspYq3esnmUm1KCJT/QOrxsgME+qDw++qpq x0MbGzCzbZMdCdVdKqnRrGqUz1gvGR4GbYTWIXRAbgL02867FD3JDP9c3QYMHE7XHOfz D1ioNLGvqTO7GcpiiHL8Z3hU9jXSwtn3z6zMneVqOoulRgFCBAfnY29E9cDzObRpDR5a kXv3WST29MJb5yKvL06KqNnvbDTfcujib+ETNg2fdSwlvkPQcof6IaFIEgYFo/UEh0wr xmwckZtkl8VCR/ht82d7iFdm0VucAqyDgfcL2Q/rxyr0rpM1/5Kfw0MyfBhdU//L8XdK eAxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=q3WKZKXeAQ7VZHzrf3EHfWYZVMYgOXzqitJC4yCe2aA=; b=wsIgRmDTcyGTT2kxwWI/7HZeTttQQYYi1OhE4WjtLEo8mqUqNEshF74sHskal1G+Ed POH4pm1BoIPxmrzwL/iSMJaXv0EZjRCn/5Ra8n/keWV39yc5c1rFhJw2I8XGePNzJSBi t6gx23xO/FJVt8/A20seQbcQbdE8Aiu4iX0PQhsL0dFD1m+CW2c4afcqCEEAqnDz8LJP 38hbWj5TcdkO0fXTvm8nphyMv9CCPpnxr6jobzPT+jAMoclTjUssCs1FjIhhoWYGxMRq sYCVV3kj3bMTrPucIQ1CFuNO1xXjMzlityovXghiZb947H/Zw0zF/odO6udHFYhyPUEd GxsQ== X-Gm-Message-State: AFqh2kqKFsksxSEtul2DS7Hp9JRWn5xS0L+dDzOLDxPqipnvY2zLPm6D 2tk8ruK8rrsy26FDOwRv4GaekAvqdiTTZTz/ X-Google-Smtp-Source: AMrXdXtQaZV4hW8GyEWbW52Sd768i50NHijJdYF8+AVQiYby6AYj35Si9Hf7HEoBU/HOQZfRQIn8sw== X-Received: by 2002:a17:90a:5b05:b0:225:d190:f16c with SMTP id o5-20020a17090a5b0500b00225d190f16cmr55871705pji.21.1673294905318; Mon, 09 Jan 2023 12:08:25 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Ilya Leoshkevich Subject: [PATCH v3 03/27] target/s390x: Use tcg_constant_i32 for fpinst_extract_m34 Date: Mon, 9 Jan 2023 12:07:55 -0800 Message-Id: <20230109200819.3916395-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230109200819.3916395-1-richard.henderson@linaro.org> References: <20230109200819.3916395-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1034; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1034.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1673295170825100001 Return a constant or NULL, which means the free may be removed from all callers of fpinst_extract_m34. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Ilya Leoshkevich Signed-off-by: Richard Henderson --- target/s390x/tcg/translate.c | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c index 2fa052249f..83805085a9 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -1775,7 +1775,7 @@ static TCGv_i32 fpinst_extract_m34(DisasContext *s, b= ool m3_with_fpe, return NULL; } =20 - return tcg_const_i32(deposit32(m3, 4, 4, m4)); + return tcg_constant_i32(deposit32(m3, 4, 4, m4)); } =20 static DisasJumpType op_cfeb(DisasContext *s, DisasOps *o) @@ -1786,7 +1786,6 @@ static DisasJumpType op_cfeb(DisasContext *s, DisasOp= s *o) return DISAS_NORETURN; } gen_helper_cfeb(o->out, cpu_env, o->in2, m34); - tcg_temp_free_i32(m34); set_cc_static(s); return DISAS_NEXT; } @@ -1799,7 +1798,6 @@ static DisasJumpType op_cfdb(DisasContext *s, DisasOp= s *o) return DISAS_NORETURN; } gen_helper_cfdb(o->out, cpu_env, o->in2, m34); - tcg_temp_free_i32(m34); set_cc_static(s); return DISAS_NEXT; } @@ -1812,7 +1810,6 @@ static DisasJumpType op_cfxb(DisasContext *s, DisasOp= s *o) return DISAS_NORETURN; } gen_helper_cfxb(o->out, cpu_env, o->in1, o->in2, m34); - tcg_temp_free_i32(m34); set_cc_static(s); return DISAS_NEXT; } @@ -1825,7 +1822,6 @@ static DisasJumpType op_cgeb(DisasContext *s, DisasOp= s *o) return DISAS_NORETURN; } gen_helper_cgeb(o->out, cpu_env, o->in2, m34); - tcg_temp_free_i32(m34); set_cc_static(s); return DISAS_NEXT; } @@ -1838,7 +1834,6 @@ static DisasJumpType op_cgdb(DisasContext *s, DisasOp= s *o) return DISAS_NORETURN; } gen_helper_cgdb(o->out, cpu_env, o->in2, m34); - tcg_temp_free_i32(m34); set_cc_static(s); return DISAS_NEXT; } @@ -1851,7 +1846,6 @@ static DisasJumpType op_cgxb(DisasContext *s, DisasOp= s *o) return DISAS_NORETURN; } gen_helper_cgxb(o->out, cpu_env, o->in1, o->in2, m34); - tcg_temp_free_i32(m34); set_cc_static(s); return DISAS_NEXT; } @@ -1864,7 +1858,6 @@ static DisasJumpType op_clfeb(DisasContext *s, DisasO= ps *o) return DISAS_NORETURN; } gen_helper_clfeb(o->out, cpu_env, o->in2, m34); - tcg_temp_free_i32(m34); set_cc_static(s); return DISAS_NEXT; } @@ -1877,7 +1870,6 @@ static DisasJumpType op_clfdb(DisasContext *s, DisasO= ps *o) return DISAS_NORETURN; } gen_helper_clfdb(o->out, cpu_env, o->in2, m34); - tcg_temp_free_i32(m34); set_cc_static(s); return DISAS_NEXT; } @@ -1890,7 +1882,6 @@ static DisasJumpType op_clfxb(DisasContext *s, DisasO= ps *o) return DISAS_NORETURN; } gen_helper_clfxb(o->out, cpu_env, o->in1, o->in2, m34); - tcg_temp_free_i32(m34); set_cc_static(s); return DISAS_NEXT; } @@ -1903,7 +1894,6 @@ static DisasJumpType op_clgeb(DisasContext *s, DisasO= ps *o) return DISAS_NORETURN; } gen_helper_clgeb(o->out, cpu_env, o->in2, m34); - tcg_temp_free_i32(m34); set_cc_static(s); return DISAS_NEXT; } @@ -1916,7 +1906,6 @@ static DisasJumpType op_clgdb(DisasContext *s, DisasO= ps *o) return DISAS_NORETURN; } gen_helper_clgdb(o->out, cpu_env, o->in2, m34); - tcg_temp_free_i32(m34); set_cc_static(s); return DISAS_NEXT; } @@ -1929,7 +1918,6 @@ static DisasJumpType op_clgxb(DisasContext *s, DisasO= ps *o) return DISAS_NORETURN; } gen_helper_clgxb(o->out, cpu_env, o->in1, o->in2, m34); - tcg_temp_free_i32(m34); set_cc_static(s); return DISAS_NEXT; } @@ -1942,7 +1930,6 @@ static DisasJumpType op_cegb(DisasContext *s, DisasOp= s *o) return DISAS_NORETURN; } gen_helper_cegb(o->out, cpu_env, o->in2, m34); - tcg_temp_free_i32(m34); return DISAS_NEXT; } =20 @@ -1954,7 +1941,6 @@ static DisasJumpType op_cdgb(DisasContext *s, DisasOp= s *o) return DISAS_NORETURN; } gen_helper_cdgb(o->out, cpu_env, o->in2, m34); - tcg_temp_free_i32(m34); return DISAS_NEXT; } =20 @@ -1966,7 +1952,6 @@ static DisasJumpType op_cxgb(DisasContext *s, DisasOp= s *o) return DISAS_NORETURN; } gen_helper_cxgb(o->out, cpu_env, o->in2, m34); - tcg_temp_free_i32(m34); return_low128(o->out2); return DISAS_NEXT; } @@ -1979,7 +1964,6 @@ static DisasJumpType op_celgb(DisasContext *s, DisasO= ps *o) return DISAS_NORETURN; } gen_helper_celgb(o->out, cpu_env, o->in2, m34); - tcg_temp_free_i32(m34); return DISAS_NEXT; } =20 @@ -1991,7 +1975,6 @@ static DisasJumpType op_cdlgb(DisasContext *s, DisasO= ps *o) return DISAS_NORETURN; } gen_helper_cdlgb(o->out, cpu_env, o->in2, m34); - tcg_temp_free_i32(m34); return DISAS_NEXT; } =20 @@ -2003,7 +1986,6 @@ static DisasJumpType op_cxlgb(DisasContext *s, DisasO= ps *o) return DISAS_NORETURN; } gen_helper_cxlgb(o->out, cpu_env, o->in2, m34); - tcg_temp_free_i32(m34); return_low128(o->out2); return DISAS_NEXT; } @@ -2466,7 +2448,6 @@ static DisasJumpType op_fieb(DisasContext *s, DisasOp= s *o) return DISAS_NORETURN; } gen_helper_fieb(o->out, cpu_env, o->in2, m34); - tcg_temp_free_i32(m34); return DISAS_NEXT; } =20 @@ -2478,7 +2459,6 @@ static DisasJumpType op_fidb(DisasContext *s, DisasOp= s *o) return DISAS_NORETURN; } gen_helper_fidb(o->out, cpu_env, o->in2, m34); - tcg_temp_free_i32(m34); return DISAS_NEXT; } =20 @@ -2491,7 +2471,6 @@ static DisasJumpType op_fixb(DisasContext *s, DisasOp= s *o) } gen_helper_fixb(o->out, cpu_env, o->in1, o->in2, m34); return_low128(o->out2); - tcg_temp_free_i32(m34); return DISAS_NEXT; } =20 @@ -2766,7 +2745,6 @@ static DisasJumpType op_ledb(DisasContext *s, DisasOp= s *o) return DISAS_NORETURN; } gen_helper_ledb(o->out, cpu_env, o->in2, m34); - tcg_temp_free_i32(m34); return DISAS_NEXT; } =20 @@ -2778,7 +2756,6 @@ static DisasJumpType op_ldxb(DisasContext *s, DisasOp= s *o) return DISAS_NORETURN; } gen_helper_ldxb(o->out, cpu_env, o->in1, o->in2, m34); - tcg_temp_free_i32(m34); return DISAS_NEXT; } =20 @@ -2790,7 +2767,6 @@ static DisasJumpType op_lexb(DisasContext *s, DisasOp= s *o) return DISAS_NORETURN; } gen_helper_lexb(o->out, cpu_env, o->in1, o->in2, m34); - tcg_temp_free_i32(m34); return DISAS_NEXT; } =20 --=20 2.34.1 From nobody Sun May 19 10:14:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1673295282; cv=none; d=zohomail.com; s=zohoarc; b=TlYuPb8O42x1Zmb0d0BniegHXL+Ecc/xx5w/BuXYchZTp2ffwJX32xMHYZoguljFRGGi9etKdB8+1e1wXb/dEU4OgqcUg0ylFq5OaLgSl+xqSYRS4cSAPIveI+/ZSKxDiZwc9LAh250MrIjkbvo2lx/seKggnPBMFX9gT5McZYw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673295282; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=dNtcbq+YaAISCksJEqrwoDBG8G3LKrhNUHooAhzADaw=; b=UtoSjXYDTnmOeKwortpUDd0z/PkKg9xrESjmwybxb2xZznryDxl2vqasuDs9oYbmrZsniNl4M7t/2p2v0hnjRoMx0t77LPynnQe4/lGhOo0aLIO0UYFKhVtncSZQLNWEOf5AcoqEjbzDUWi3l1WgqXb8EAAgv2BBPocn/BjE5qM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1673295282886583.0570088568802; Mon, 9 Jan 2023 12:14:42 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pEyRf-0002v5-IN; Mon, 09 Jan 2023 15:08:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pEyRc-0002tA-He for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:32 -0500 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pEyRa-0007QA-Fw for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:32 -0500 Received: by mail-pl1-x62e.google.com with SMTP id w3so10776165ply.3 for ; Mon, 09 Jan 2023 12:08:28 -0800 (PST) Received: from stoup.. ([2602:47:d48c:8101:158e:facf:7a46:ba9f]) by smtp.gmail.com with ESMTPSA id l2-20020a17090a384200b0022727d4af8dsm577574pjf.48.2023.01.09.12.08.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Jan 2023 12:08:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dNtcbq+YaAISCksJEqrwoDBG8G3LKrhNUHooAhzADaw=; b=V/3XVwUkJbP16xqoUM0RweGzEeS2omcIXi1pSPyFc63bWFvg21GT6GcDSLLvmC9OFT DMBcHvJEGFRs8iTFosXxCvWYSEGPsvmISqX8gQillImKOZ3Hxpatkd4fW6VNOFgWIUDW mXV5G1DEtSCuebmZnAyzGQiZ+3YXleaUOrK+VNi851xRSeZkxqhHeYfJ0gbnMUXoJahq ja2QXNhH8l0TtFSexUfeqV1ukXNRpa4jb9qSv66v6sPzcuiHu71fJIu5OQh1KTWetxYV 1E5G2yJIb/yK8PmR9N7uUmkEwLTjHjpoSfyvnwvaVr5ks7106SsNf2Ztolng++jkA0y3 BIuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dNtcbq+YaAISCksJEqrwoDBG8G3LKrhNUHooAhzADaw=; b=MA+XbHECR10w4MOFR6/uiGKatHqrU8JmzTz0uER4acxx80WhuSKA++8bqFFW8vbdTL nnqFpp/Cw+KakEGp4alWWkl2PQ+EztDmUpSvsjf6cQGPrWDmsdWn8MAGhlRRIiQnrkU8 lYASxoGKyZj+Ail5JX2M7oHDGd20Kp2ygpeu8s5mjAW56DQd4ePsR5OeAqnTmSdQhnYk hzXA+xOveH5rnHxtEe7Xcdy7m0LkLcBrGH9qA576CZUtS6UIkYusjzjArlC6BAcXh/Xo Owx6/D114FMB4DquKF99SouE/2+PZSsxLPj/x9WIrxxmobNJqK0J6jcTsV/KOnu7O0Oh YzVA== X-Gm-Message-State: AFqh2koyZzdUtuIsixpLJ6NqyWtwlfWveQ5DJ10QL8Oa9E29YSCtmwSK ZFAY47Fm6LuXKkKB6b1jYIniyyyxDHy9g4dx X-Google-Smtp-Source: AMrXdXsuCkhlNvq6taVDYWkLlujljTqIBYkwxL3NpAIQCFH730B/38v6FKombCtYIAGJ0gChW5cOLA== X-Received: by 2002:a17:90b:2384:b0:227:1745:3478 with SMTP id mr4-20020a17090b238400b0022717453478mr4116744pjb.30.1673294906537; Mon, 09 Jan 2023 12:08:26 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Ilya Leoshkevich Subject: [PATCH v3 04/27] target/s390x: Use tcg_constant_* in translate_vx.c.inc Date: Mon, 9 Jan 2023 12:07:56 -0800 Message-Id: <20230109200819.3916395-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230109200819.3916395-1-richard.henderson@linaro.org> References: <20230109200819.3916395-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::62e; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1673295283464100001 In most cases, this is a simple local allocate and free replaced by tcg_constant_*. In three cases, a variable temp was initialized with a constant value -- reorg to localize the constant. In gen_acc, this fixes a leak. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Ilya Leoshkevich Signed-off-by: Richard Henderson --- target/s390x/tcg/translate_vx.c.inc | 45 +++++++++++++---------------- 1 file changed, 20 insertions(+), 25 deletions(-) diff --git a/target/s390x/tcg/translate_vx.c.inc b/target/s390x/tcg/transla= te_vx.c.inc index d39ee81cd6..3fadc82e5c 100644 --- a/target/s390x/tcg/translate_vx.c.inc +++ b/target/s390x/tcg/translate_vx.c.inc @@ -319,12 +319,10 @@ static void gen_gvec128_4_i64(gen_gvec128_4_i64_fn fn= , uint8_t d, uint8_t a, static void gen_addi2_i64(TCGv_i64 dl, TCGv_i64 dh, TCGv_i64 al, TCGv_i64 = ah, uint64_t b) { - TCGv_i64 bl =3D tcg_const_i64(b); - TCGv_i64 bh =3D tcg_const_i64(0); + TCGv_i64 bl =3D tcg_constant_i64(b); + TCGv_i64 bh =3D tcg_constant_i64(0); =20 tcg_gen_add2_i64(dl, dh, al, ah, bl, bh); - tcg_temp_free_i64(bl); - tcg_temp_free_i64(bh); } =20 static DisasJumpType op_vbperm(DisasContext *s, DisasOps *o) @@ -609,9 +607,8 @@ static DisasJumpType op_vlei(DisasContext *s, DisasOps = *o) return DISAS_NORETURN; } =20 - tmp =3D tcg_const_i64((int16_t)get_field(s, i2)); + tmp =3D tcg_constant_i64((int16_t)get_field(s, i2)); write_vec_element_i64(tmp, get_field(s, v1), enr, es); - tcg_temp_free_i64(tmp); return DISAS_NEXT; } =20 @@ -1107,11 +1104,13 @@ static DisasJumpType op_vseg(DisasContext *s, Disas= Ops *o) =20 static DisasJumpType op_vst(DisasContext *s, DisasOps *o) { - TCGv_i64 tmp =3D tcg_const_i64(16); + TCGv_i64 tmp; =20 /* Probe write access before actually modifying memory */ - gen_helper_probe_write_access(cpu_env, o->addr1, tmp); + gen_helper_probe_write_access(cpu_env, o->addr1, + tcg_constant_i64(16)); =20 + tmp =3D tcg_temp_new_i64(); read_vec_element_i64(tmp, get_field(s, v1), 0, ES_64); tcg_gen_qemu_st_i64(tmp, o->addr1, get_mem_index(s), MO_TEUQ); gen_addi_and_wrap_i64(s, o->addr1, o->addr1, 8); @@ -1270,9 +1269,10 @@ static DisasJumpType op_vstm(DisasContext *s, DisasO= ps *o) } =20 /* Probe write access before actually modifying memory */ - tmp =3D tcg_const_i64((v3 - v1 + 1) * 16); - gen_helper_probe_write_access(cpu_env, o->addr1, tmp); + gen_helper_probe_write_access(cpu_env, o->addr1, + tcg_constant_i64((v3 - v1 + 1) * 16)); =20 + tmp =3D tcg_temp_new_i64(); for (;; v1++) { read_vec_element_i64(tmp, v1, 0, ES_64); tcg_gen_qemu_st_i64(tmp, o->addr1, get_mem_index(s), MO_TEUQ); @@ -1359,7 +1359,7 @@ static DisasJumpType op_va(DisasContext *s, DisasOps = *o) static void gen_acc(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b, uint8_t es) { const uint8_t msb_bit_nr =3D NUM_VEC_ELEMENT_BITS(es) - 1; - TCGv_i64 msb_mask =3D tcg_const_i64(dup_const(es, 1ull << msb_bit_nr)); + TCGv_i64 msb_mask =3D tcg_constant_i64(dup_const(es, 1ull << msb_bit_n= r)); TCGv_i64 t1 =3D tcg_temp_new_i64(); TCGv_i64 t2 =3D tcg_temp_new_i64(); TCGv_i64 t3 =3D tcg_temp_new_i64(); @@ -1416,7 +1416,7 @@ static void gen_acc2_i64(TCGv_i64 dl, TCGv_i64 dh, TC= Gv_i64 al, { TCGv_i64 th =3D tcg_temp_new_i64(); TCGv_i64 tl =3D tcg_temp_new_i64(); - TCGv_i64 zero =3D tcg_const_i64(0); + TCGv_i64 zero =3D tcg_constant_i64(0); =20 tcg_gen_add2_i64(tl, th, al, zero, bl, zero); tcg_gen_add2_i64(tl, th, th, zero, ah, zero); @@ -1425,7 +1425,6 @@ static void gen_acc2_i64(TCGv_i64 dl, TCGv_i64 dh, TC= Gv_i64 al, =20 tcg_temp_free_i64(th); tcg_temp_free_i64(tl); - tcg_temp_free_i64(zero); } =20 static DisasJumpType op_vacc(DisasContext *s, DisasOps *o) @@ -1455,15 +1454,14 @@ static void gen_ac2_i64(TCGv_i64 dl, TCGv_i64 dh, T= CGv_i64 al, TCGv_i64 ah, TCGv_i64 bl, TCGv_i64 bh, TCGv_i64 cl, TCGv_i64 ch) { TCGv_i64 tl =3D tcg_temp_new_i64(); - TCGv_i64 th =3D tcg_const_i64(0); + TCGv_i64 zero =3D tcg_constant_i64(0); =20 /* extract the carry only */ tcg_gen_extract_i64(tl, cl, 0, 1); tcg_gen_add2_i64(dl, dh, al, ah, bl, bh); - tcg_gen_add2_i64(dl, dh, dl, dh, tl, th); + tcg_gen_add2_i64(dl, dh, dl, dh, tl, zero); =20 tcg_temp_free_i64(tl); - tcg_temp_free_i64(th); } =20 static DisasJumpType op_vac(DisasContext *s, DisasOps *o) @@ -1484,7 +1482,7 @@ static void gen_accc2_i64(TCGv_i64 dl, TCGv_i64 dh, T= CGv_i64 al, TCGv_i64 ah, { TCGv_i64 tl =3D tcg_temp_new_i64(); TCGv_i64 th =3D tcg_temp_new_i64(); - TCGv_i64 zero =3D tcg_const_i64(0); + TCGv_i64 zero =3D tcg_constant_i64(0); =20 tcg_gen_andi_i64(tl, cl, 1); tcg_gen_add2_i64(tl, th, tl, zero, al, zero); @@ -1495,7 +1493,6 @@ static void gen_accc2_i64(TCGv_i64 dl, TCGv_i64 dh, T= CGv_i64 al, TCGv_i64 ah, =20 tcg_temp_free_i64(tl); tcg_temp_free_i64(th); - tcg_temp_free_i64(zero); } =20 static DisasJumpType op_vaccc(DisasContext *s, DisasOps *o) @@ -1597,14 +1594,13 @@ static void gen_avgl_i32(TCGv_i32 d, TCGv_i32 a, TC= Gv_i32 b) static void gen_avgl_i64(TCGv_i64 dl, TCGv_i64 al, TCGv_i64 bl) { TCGv_i64 dh =3D tcg_temp_new_i64(); - TCGv_i64 zero =3D tcg_const_i64(0); + TCGv_i64 zero =3D tcg_constant_i64(0); =20 tcg_gen_add2_i64(dl, dh, al, zero, bl, zero); gen_addi2_i64(dl, dh, dl, dh, 1); tcg_gen_extract2_i64(dl, dl, dh, 1); =20 tcg_temp_free_i64(dh); - tcg_temp_free_i64(zero); } =20 static DisasJumpType op_vavgl(DisasContext *s, DisasOps *o) @@ -2440,7 +2436,7 @@ static void gen_scbi2_i64(TCGv_i64 dl, TCGv_i64 dh, T= CGv_i64 al, { TCGv_i64 th =3D tcg_temp_new_i64(); TCGv_i64 tl =3D tcg_temp_new_i64(); - TCGv_i64 zero =3D tcg_const_i64(0); + TCGv_i64 zero =3D tcg_constant_i64(0); =20 tcg_gen_sub2_i64(tl, th, al, zero, bl, zero); tcg_gen_andi_i64(th, th, 1); @@ -2452,7 +2448,6 @@ static void gen_scbi2_i64(TCGv_i64 dl, TCGv_i64 dh, T= CGv_i64 al, =20 tcg_temp_free_i64(th); tcg_temp_free_i64(tl); - tcg_temp_free_i64(zero); } =20 static DisasJumpType op_vscbi(DisasContext *s, DisasOps *o) @@ -2572,11 +2567,12 @@ static DisasJumpType op_vsumq(DisasContext *s, Disa= sOps *o) return DISAS_NORETURN; } =20 - sumh =3D tcg_const_i64(0); + sumh =3D tcg_temp_new_i64(); suml =3D tcg_temp_new_i64(); - zero =3D tcg_const_i64(0); + zero =3D tcg_constant_i64(0); tmpl =3D tcg_temp_new_i64(); =20 + tcg_gen_mov_i64(sumh, zero); read_vec_element_i64(suml, get_field(s, v3), max_idx, es); for (idx =3D 0; idx <=3D max_idx; idx++) { read_vec_element_i64(tmpl, get_field(s, v2), idx, es); @@ -2587,7 +2583,6 @@ static DisasJumpType op_vsumq(DisasContext *s, DisasO= ps *o) =20 tcg_temp_free_i64(sumh); tcg_temp_free_i64(suml); - tcg_temp_free_i64(zero); tcg_temp_free_i64(tmpl); return DISAS_NEXT; } --=20 2.34.1 From nobody Sun May 19 10:14:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1673295700; cv=none; d=zohomail.com; s=zohoarc; b=J5Pf+Ox0GX2Y/4DGdr4yjrHonc0TS7a6eeNLD8BBHXhheg1P5LTObX4FLqWHIVYBuM06rNr/3cPMoZK7QqKrr+BtRdKcQRfZuUOVA9N3SekA2kXBXpmpWiiaOOnRDWlTVFI3d60V62MSz0lkhteRSJLQqxYszZuog9p6AolKhzo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673295700; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=r88aN3ONQOrYoR5TjuSp7kfzVMmJ7L52pXjl2Gd7WK4=; b=Ltr0XqM3f553ATSCWFFR9rxC7NmmKsU8HdhRFlHe/YoGTjXmy2MSHOu2dPb+TLwHpOSDB4ji8NzpEtWcmt4QzzG42hN9LAlcf9H25OvdEIPnaawXzGpZ82AF+PyArCi/eRlq3H8gb4tOeW94dhsj/1nIoTlM3m7AH2kZa3NX4tQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1673295700620581.4869953934966; Mon, 9 Jan 2023 12:21:40 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pEyRh-0002wu-8O; Mon, 09 Jan 2023 15:08:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pEyRd-0002u6-Se for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:34 -0500 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pEyRa-0007NI-TI for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:33 -0500 Received: by mail-pl1-x630.google.com with SMTP id v23so5855920plo.1 for ; Mon, 09 Jan 2023 12:08:29 -0800 (PST) Received: from stoup.. ([2602:47:d48c:8101:158e:facf:7a46:ba9f]) by smtp.gmail.com with ESMTPSA id l2-20020a17090a384200b0022727d4af8dsm577574pjf.48.2023.01.09.12.08.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Jan 2023 12:08:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=r88aN3ONQOrYoR5TjuSp7kfzVMmJ7L52pXjl2Gd7WK4=; b=xHQNKg03MFa7/NWec9s6cpOWpWb8d4oaW/AQ94/5VspkPQi+FvlDdp2JKH4vxWProL 37KHSGfLvgYulVcD+O+krpWWc8W/Din5gyU9IlFuEPV11CjqVOhA8Kbg6ZwjeRDeQByQ iJIejEQkeskmJqvT5FaQSocWbejupv8tSInlIm+cnFEmdwAvbc9kUD33mbzQytetTfDs bhzDZo0E0KVkJrMtdb7v67ps8WIHxkkc8onBCQh/i00F84FUfy/rYlbo8QCAaVJGXSdD 7ad9skwLg8Hc16ishWleblDtRIdb8H3EKwcoSl+rLNX2mn6f+eMglfikVV6iPWwIjOXJ FRRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=r88aN3ONQOrYoR5TjuSp7kfzVMmJ7L52pXjl2Gd7WK4=; b=RS9tD1URgxoTqDSeh8nXal3+072QlkY/OsYT+MSxW2Z/KL6/0AEWVh8NtZSh91iPp5 THmlwDzTT267Bt6fGbkRf1kPpWWyo7JsMYn+X1UgHAcDrQRRgsfyXZh79XAa7aBufsrG rCsUQeZMSkS0NAhoSi1xGist2povA00DB3NUOo8Ya47tsWiBo8gSTe/wpHiJC8/6U0Ao Qq9AMG0Rv6+GMqE9sQUupwQT5IDWJzQkOUNyk27bgSp+heyc8hoK8vBwlZVFW1M3O/l6 wyk60haq+AkBjyqvBoxfUjwRLQIvbRpDYYyZ6T5eDQsgwQagQGHwolSnbGt1q+Bzh13k +baQ== X-Gm-Message-State: AFqh2krEZOlS1Fl9sf/RjPmM5za6CQgH1EhMexUPIRZLHMYPduKmn0PB iB7kcR5eynR5xKocJcvROUOE5AnfU0ck2Nzl X-Google-Smtp-Source: AMrXdXvhBIltYEmKgEK1hhpIAYOfzEPi1V2pL09tlPHZVCivlXlsuW1AWEmj4XyHVWQ8bRSq9k5D/g== X-Received: by 2002:a17:90b:2684:b0:227:203d:4d70 with SMTP id pl4-20020a17090b268400b00227203d4d70mr3022358pjb.32.1673294908398; Mon, 09 Jan 2023 12:08:28 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Ilya Leoshkevich Subject: [PATCH v3 05/27] tests/tcg/s390x: Add bal.S Date: Mon, 9 Jan 2023 12:07:57 -0800 Message-Id: <20230109200819.3916395-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230109200819.3916395-1-richard.henderson@linaro.org> References: <20230109200819.3916395-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::630; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x630.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1673295701414100001 Content-Type: text/plain; charset="utf-8" From: Ilya Leoshkevich Add a small test to prevent regressions. Signed-off-by: Ilya Leoshkevich Message-Id: <20221103130011.2670186-1-iii@linux.ibm.com> Signed-off-by: Richard Henderson --- tests/tcg/s390x/Makefile.softmmu-target | 1 + tests/tcg/s390x/bal.S | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 tests/tcg/s390x/bal.S diff --git a/tests/tcg/s390x/Makefile.softmmu-target b/tests/tcg/s390x/Make= file.softmmu-target index a34fa68473..295df08491 100644 --- a/tests/tcg/s390x/Makefile.softmmu-target +++ b/tests/tcg/s390x/Makefile.softmmu-target @@ -7,3 +7,4 @@ QEMU_OPTS=3D-action panic=3Dexit-failure -kernel -Wl,--build-id=3Dnone $< -o $@ =20 TESTS +=3D unaligned-lowcore +TESTS +=3D bal diff --git a/tests/tcg/s390x/bal.S b/tests/tcg/s390x/bal.S new file mode 100644 index 0000000000..e54d8874ff --- /dev/null +++ b/tests/tcg/s390x/bal.S @@ -0,0 +1,24 @@ + .org 0x200 /* lowcore padding */ + .globl _start +_start: + lpswe start24_psw +_start24: + lgrl %r0,initial_r0 + lgrl %r1,expected_r0 + bal %r0,0f +0: + cgrjne %r0,%r1,1f + lpswe success_psw +1: + lpswe failure_psw + .align 8 +start24_psw: + .quad 0x160000000000,_start24 /* 24-bit mode, cc =3D 1, pm =3D 6 = */ +initial_r0: + .quad 0x1234567887654321 +expected_r0: + .quad 0x1234567896000000 + 0b /* ilc =3D 2, cc =3D 1, pm =3D 6 */ +success_psw: + .quad 0x2000000000000,0xfff /* see is_special_wait_psw() */ +failure_psw: + .quad 0x2000000000000,0 /* disabled wait */ --=20 2.34.1 From nobody Sun May 19 10:14:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1673295394; cv=none; d=zohomail.com; s=zohoarc; b=d/Oh1RtekByn8Qsf1oV70nK4rf96gmgqI03v4E3U3Rxot+YChP25wwQNIsSpx5eN2TtpOv6xH1nK2dhvlvxNOz6kSC9xjlAVoNmj1TXGVf1dg7yqbAv9z2mazSH/cP86m0nMunvhZ/2NEGtCIY1kBl9XRMRaZ9koHSniy+bYvx0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673295394; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=7Jm8IvT8OnM6ntzNw++ITlfcs7TcV+gT1sswHnCP9Os=; b=j67/uu3uwCNbGuqsusDESnnPekkHZTntP0RKxKHyr46KcrE0JgdHBsi9ab3IdqPBI8uXrh1Dl/vkGo3+I1ZN0u4TI+IXXgjXEAFzp76zdfZb0TllXQOZ01BrLER5URPcwC4igdr9+wX+g6IdZFXoFoF2FXMkRavKJWzjreDiDBg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1673295394107226.33613274703646; Mon, 9 Jan 2023 12:16:34 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pEyRk-00031t-1o; Mon, 09 Jan 2023 15:08:40 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pEyRd-0002uA-VA for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:34 -0500 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pEyRa-0007OD-N0 for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:33 -0500 Received: by mail-pj1-x102b.google.com with SMTP id fz16-20020a17090b025000b002269d6c2d83so12049511pjb.0 for ; Mon, 09 Jan 2023 12:08:29 -0800 (PST) Received: from stoup.. ([2602:47:d48c:8101:158e:facf:7a46:ba9f]) by smtp.gmail.com with ESMTPSA id l2-20020a17090a384200b0022727d4af8dsm577574pjf.48.2023.01.09.12.08.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Jan 2023 12:08:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7Jm8IvT8OnM6ntzNw++ITlfcs7TcV+gT1sswHnCP9Os=; b=HczyxnSG1cF3PnQGsi52Gld1no8ZC6NNK9Yta5ipxLu4TSYu0jIaqeAR+fWaoWPrBS v40cagqJBXHuzDVRqUOmm1jsAPzRqTrYIqa+VP8SsDPCW4Bc+MA5Q7mmyooEtC5YAig0 u84TXqluJVK8JoddqpZVnuQwqhA1GvSsqvc6ZlSs0CfoJMRhdtQa78cFUGwMqjjtUfUD 8Mmerl00BdedGZA0exoWCCobNOgZdYYjK8ricp+q8sdWtU+lsCbLQmDi4Br4cvn6gjCJ azJ+v/dSmhOsoN3IfWcXbbH/qDRnEnfg9uri55V4xSltLDRibh/6aWi6XjxXamT7aXxe Me8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7Jm8IvT8OnM6ntzNw++ITlfcs7TcV+gT1sswHnCP9Os=; b=BLx6ud5bHpbgHDsrPn1wqxKZazwclE5oFD0BGP7GlXO7fIB/2X6DQ9yARB3D47xM0o NYP6aMY0hQG1iH1Vaf+ng+rW71435iTgDFYccNNSvPQq6k9coy6hBp9lj6IJ8gPpkS6e F0NLNTTEM84CHxgcknHPlPQrPRrvYxHp8edB1T6mVs91gF44LXHQnJEqsOfZMEhlcauY Ji2oGVsOXY/qvtXEop5xO9NNnAlD8ZWx9wj2HJjJOdCcwxcHbiAeBVgBUpLGSTpUaCoi ekj95WEnJ0XKhD5QfsmT1v7YHlK5WzJMndN1idJG4T37AHb1s1tmIXRYrLHsTWLxCZOX TxgQ== X-Gm-Message-State: AFqh2kpxhehMBPLGW9iqdmSSBxD5pHKeHS9KXaCrOJAPgb9FxQlF2Sus EYee593oX9vlh33ZtRuPJoNNzAWkwALfoXIq X-Google-Smtp-Source: AMrXdXudnuJA8HARCOB71U3SPBxSynwAFC+zWtdst2WdUYBIKIEDiNWc67N68t2D7GLK5REcdn52hQ== X-Received: by 2002:a17:90b:19cc:b0:226:cdcf:da83 with SMTP id nm12-20020a17090b19cc00b00226cdcfda83mr15746645pjb.46.1673294909345; Mon, 09 Jan 2023 12:08:29 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Ilya Leoshkevich Subject: [PATCH v3 06/27] tests/tcg/s390x: Add sam.S Date: Mon, 9 Jan 2023 12:07:58 -0800 Message-Id: <20230109200819.3916395-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230109200819.3916395-1-richard.henderson@linaro.org> References: <20230109200819.3916395-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102b; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1673295395967100003 Content-Type: text/plain; charset="utf-8" From: Ilya Leoshkevich Add a small test to prevent regressions. Signed-off-by: Ilya Leoshkevich Message-Id: <20221129015328.55439-1-iii@linux.ibm.com> Signed-off-by: Richard Henderson --- tests/tcg/s390x/Makefile.softmmu-target | 1 + tests/tcg/s390x/sam.S | 67 +++++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 tests/tcg/s390x/sam.S diff --git a/tests/tcg/s390x/Makefile.softmmu-target b/tests/tcg/s390x/Make= file.softmmu-target index 295df08491..d6ca8d7342 100644 --- a/tests/tcg/s390x/Makefile.softmmu-target +++ b/tests/tcg/s390x/Makefile.softmmu-target @@ -8,3 +8,4 @@ QEMU_OPTS=3D-action panic=3Dexit-failure -kernel =20 TESTS +=3D unaligned-lowcore TESTS +=3D bal +TESTS +=3D sam diff --git a/tests/tcg/s390x/sam.S b/tests/tcg/s390x/sam.S new file mode 100644 index 0000000000..4cab2dd200 --- /dev/null +++ b/tests/tcg/s390x/sam.S @@ -0,0 +1,67 @@ +/* DAT on, home-space mode, 64-bit mode */ +#define DAT_PSWM 0x400c00180000000 +#define VIRTUAL_BASE 0x123456789abcd000 + + .org 0x8e +program_interruption_code: + .org 0x150 +program_old_psw: + .org 0x1d0 /* program new PSW */ + .quad 0,pgm_handler + .org 0x200 /* lowcore padding */ + + .globl _start +_start: + lctlg %c13,%c13,hasce + lpswe dat_psw +start_dat: + sam24 +sam24_suppressed: + /* sam24 should fail */ +fail: + basr %r12,%r0 + lpswe failure_psw-.(%r12) +pgm_handler: + chhsi program_interruption_code,6 /* specification exception? */ + jne fail + clc suppressed_psw(16),program_old_psw /* correct location? */ + jne fail + lpswe success_psw + + .align 8 +dat_psw: + .quad DAT_PSWM,VIRTUAL_BASE+start_dat +suppressed_psw: + .quad DAT_PSWM,VIRTUAL_BASE+sam24_suppressed +success_psw: + .quad 0x2000000000000,0xfff /* see is_special_wait_psw() */ +failure_psw: + .quad 0x2000000000000,0 /* disabled wait */ +hasce: + /* DT =3D 0b11 (region-first-table), TL =3D 3 (2k entries) */ + .quad region_first_table + (3 << 2) + 3 + .align 0x1000 +region_first_table: + .org region_first_table + ((VIRTUAL_BASE >> 53) & 0x7ff) * 8 + /* TT =3D 0b11 (region-first-table), TL =3D 3 (2k entries) */ + .quad region_second_table + (3 << 2) + 3 + .org region_first_table + 0x800 * 8 +region_second_table: + .org region_second_table + ((VIRTUAL_BASE >> 42) & 0x7ff) * 8 + /* TT =3D 0b10 (region-second-table), TL =3D 3 (2k entries) */ + .quad region_third_table + (2 << 2) + 3 + .org region_second_table + 0x800 * 8 +region_third_table: + .org region_third_table + ((VIRTUAL_BASE >> 31) & 0x7ff) * 8 + /* TT =3D 0b01 (region-third-table), TL =3D 3 (2k entries) */ + .quad segment_table + (1 << 2) + 3 + .org region_third_table + 0x800 * 8 +segment_table: + .org segment_table + ((VIRTUAL_BASE >> 20) & 0x7ff) * 8 + /* TT =3D 0b00 (segment-table) */ + .quad page_table + .org segment_table + 0x800 * 8 +page_table: + .org page_table + ((VIRTUAL_BASE >> 12) & 0xff) * 8 + .quad 0 + .org page_table + 0x100 * 8 --=20 2.34.1 From nobody Sun May 19 10:14:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1673295454; cv=none; d=zohomail.com; s=zohoarc; b=UbOh5qSIVVYeLgLk7Lls454d5zSjNcNP7EYAZBirQU+RTr4K4V9nQf26jZewazIVINVnjlUxVnL0fOSBMbFsO6l9myxRZ3qBLPZo6Czn34XtymSjQ5W7komTwcNfyOkGLXIdGO9ggCN+GkqH00+UmloBQ3IEk/v98Qu3YeEhct8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673295454; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=0zBrdaSUeRUDXCt0EzlV8qE/5LvkgTmGDIbtmZQgP5w=; b=QsAfG3lnYJkrqefx1rFX4W/vQeBGLiPyQW7PzAjonLoVgx5Sg/rKW0fUcqTUsuEXoTz3ie4yyq8XvAIRp83a1cdkMRPXxnLUHMaGr5bn3GqU4tJ4zqRBfbv1Dw33xGh/1cMtUTTQ/CKzDVaKOX+YcAMuKQwXeuWTTP8YYhliIY8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1673295454437246.00128246804957; Mon, 9 Jan 2023 12:17:34 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pEyRm-00034G-A1; Mon, 09 Jan 2023 15:08:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pEyRi-0002zY-Pb for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:38 -0500 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pEyRb-0007S7-Nd for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:38 -0500 Received: by mail-pj1-x102b.google.com with SMTP id v13-20020a17090a6b0d00b00219c3be9830so10942847pjj.4 for ; Mon, 09 Jan 2023 12:08:31 -0800 (PST) Received: from stoup.. ([2602:47:d48c:8101:158e:facf:7a46:ba9f]) by smtp.gmail.com with ESMTPSA id l2-20020a17090a384200b0022727d4af8dsm577574pjf.48.2023.01.09.12.08.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Jan 2023 12:08:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0zBrdaSUeRUDXCt0EzlV8qE/5LvkgTmGDIbtmZQgP5w=; b=bjHG9r+PJjcuB9oEPNyuuFDzSVg7c7AlNw0o11pnztnuxCwOT6VI/PuhbfIu84+lGt /mjlStYCHW4U8znrO6tZRPqH5c95x+LhEJFgV+2VBhnF1utmlhVG6ou5VJ+frphFhL60 zTxu16PYhotBC4SWWKeSApydvqvDbyhsYirzCl/K/R4nrWqxdcfW1wf8BeZG8Gb5duD6 u4MsAVk14W4VWO14bq3meSwEO4YXafGFGBunY+fyxLEcQbeHBo2Ka1M+3p4ZgeKZPEeT i9aS3cqoKoKjHNKzJqtE4iG3RShhG0/JApc0z465fLGXv2bZk9VQA58m9C9Ycg4woqTf jRqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0zBrdaSUeRUDXCt0EzlV8qE/5LvkgTmGDIbtmZQgP5w=; b=V46MgBKOQllXSZVRrDl8YAXmx3w80yBCgeXPLp+7hWSGwK/BYUs11rZZE9ghq9g37Z pdPhlEqPY44VU88GsGZew5/ubatua4lUGWGRkpRZoVZ2oYc2rL2YpUY2d3S6JE625lbc iR9+hIBAUkkBo+JpGNrX9uYl+C4/+yKbXrbagfM70k0wm6FEugs9RvZ6UBihM3uGRj5w yOfu/5aZL3cc3L0thlpgafGp8sGuLc68HPp01t7z02KVCp7UgnkslKtDRaAl/KeYE3id C3oKSWQ3qOUsDs8zxLwCmJv8gY+lVex3PYjKOBCwuMU2gmEmjyg6oh+KGmt2917Fjooh Epbg== X-Gm-Message-State: AFqh2krCRp4rLHEkNo9qrBB4ihNZq26g6p759K1wlZIsfNIBDDna93qQ /2WZfOsLESOPK8mNxbwTQ9+KmEED/MCDWvpf X-Google-Smtp-Source: AMrXdXuO0pityJ7jBu/cRPl0hGYI7zQLovYwOhEchPFiMPsFgfrcisJG8Y3zkWCvNOJFI9izvjanlA== X-Received: by 2002:a17:90a:db8a:b0:226:632c:abbd with SMTP id h10-20020a17090adb8a00b00226632cabbdmr29585822pjv.47.1673294910246; Mon, 09 Jan 2023 12:08:30 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Ilya Leoshkevich Subject: [PATCH v3 07/27] target/s390x: Change help_goto_direct to work on displacements Date: Mon, 9 Jan 2023 12:07:59 -0800 Message-Id: <20230109200819.3916395-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230109200819.3916395-1-richard.henderson@linaro.org> References: <20230109200819.3916395-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102b; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1673295456237100003 In preparation for TARGET_TB_PCREL, reduce reliance on absolute values. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Ilya Leoshkevich Signed-off-by: Richard Henderson --- target/s390x/tcg/translate.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c index 83805085a9..f13ea43ce9 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -1145,8 +1145,10 @@ struct DisasInsn { /* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */ /* Miscellaneous helpers, used by several operations. */ =20 -static DisasJumpType help_goto_direct(DisasContext *s, uint64_t dest) +static DisasJumpType help_goto_direct(DisasContext *s, int64_t disp) { + uint64_t dest =3D s->base.pc_next + disp; + if (dest =3D=3D s->pc_tmp) { per_branch(s, true); return DISAS_NEXT; @@ -1169,7 +1171,8 @@ static DisasJumpType help_branch(DisasContext *s, Dis= asCompare *c, bool is_imm, int imm, TCGv_i64 cdest) { DisasJumpType ret; - uint64_t dest =3D s->base.pc_next + (int64_t)imm * 2; + int64_t disp =3D (int64_t)imm * 2; + uint64_t dest =3D s->base.pc_next + disp; TCGLabel *lab; =20 /* Take care of the special cases first. */ @@ -1185,7 +1188,7 @@ static DisasJumpType help_branch(DisasContext *s, Dis= asCompare *c, goto egress; } if (c->cond =3D=3D TCG_COND_ALWAYS) { - ret =3D help_goto_direct(s, dest); + ret =3D help_goto_direct(s, disp); goto egress; } } else { @@ -1558,7 +1561,7 @@ static DisasJumpType op_bal(DisasContext *s, DisasOps= *o) static DisasJumpType op_basi(DisasContext *s, DisasOps *o) { pc_to_link_info(o->out, s, s->pc_tmp); - return help_goto_direct(s, s->base.pc_next + (int64_t)get_field(s, i2)= * 2); + return help_goto_direct(s, (int64_t)get_field(s, i2) * 2); } =20 static DisasJumpType op_bc(DisasContext *s, DisasOps *o) --=20 2.34.1 From nobody Sun May 19 10:14:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1673295055; cv=none; d=zohomail.com; s=zohoarc; b=cLCTymbulLbW8KteJGiH6/DoHlqKFvoKDzNtH90H+6QNSsEMHXmxgpUKt6mBSt0kkQGnRkB6TNrAQKrL+hXIpPsTTdfB7yuGY33zM7Q7eIiT4o0b5IiNMAjtPpyrBm1Yjuye32oq93GU7tL3DfYBnUCB145BE7MBm4ZrxBcfc6A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673295055; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=W+5Eh/DdcatVyopp39LTL5JN35D5TSKPLpjfcSQeFls=; b=EqC9Y/cgP1izU992D5bsUW5zzZtZphRPTmqe4buwTRTGPtbbK6YR1jk2mh/av7fG7DOMwX4A4IT2nSR4/NnhLVtzb5UrR+4jXh5FlBKDN5uK/PPtG/XN8oqkkhPeOvXX/JYcoUjQGCK2CigbR4/pYcjvULTneJPCsVN9rSShj8Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1673295055279913.9844160085458; Mon, 9 Jan 2023 12:10:55 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pEyRi-0002zK-Ml; Mon, 09 Jan 2023 15:08:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pEyRf-0002vj-Pc for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:36 -0500 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pEyRc-0007OC-BG for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:35 -0500 Received: by mail-pj1-x1031.google.com with SMTP id z4-20020a17090a170400b00226d331390cso10941269pjd.5 for ; Mon, 09 Jan 2023 12:08:31 -0800 (PST) Received: from stoup.. ([2602:47:d48c:8101:158e:facf:7a46:ba9f]) by smtp.gmail.com with ESMTPSA id l2-20020a17090a384200b0022727d4af8dsm577574pjf.48.2023.01.09.12.08.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Jan 2023 12:08:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=W+5Eh/DdcatVyopp39LTL5JN35D5TSKPLpjfcSQeFls=; b=RJclhlNiQqVvGUsqcJqG6TXE0bWOTVpmz4y89v44lJRoOnNhG2c0aDe7sWGMGTV9GN cS/VvGXZoMHIDV5Nm+8uuWrDHzp1TxoPJZfB7E5KbZNY1/2fdabnc5jG/W0NFtbFOpIK j1CU9u/V0u8iWwl5uZxGXK8hS+UzzLhzrRv7N5+CAS/PvLmC7l3yqf4j/IMuKOjmpuGB MfJQIECMq3ZQqaBQmbWaoJjftsxbvFPsn5Bo2Wu14vIpaIKi+U2+PlouJi3dz5t56QKS WcjYpIefGFI1kht7rlVNfLc6Kh60Mh5z4GUfLXgiKtu2zAun3d5m4rop1n4vy6FmJLoQ BAtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=W+5Eh/DdcatVyopp39LTL5JN35D5TSKPLpjfcSQeFls=; b=vKFUW4kjrKyyp3cSbQ8TLcJ9myaOxBB/2CV3TglWKpGONVOSWhryy2dOgfKfD80PK0 5rCEEfBPKXG8vmRChpojgMFUFUTCbPAJCFvE/kakjsQov4QRlgh+HQ48mBQrjpFErr6g gjBn9Cab4X6VAsQMe/5s5uUl2RH80ypXT+NHJBhXWeOAdJV30BcJKyUSNWACBxsbmyDW 22/RqnlmmR+nT7gaTB3cHXVDk7TL5FnVHELsl5t3e1um6UL0VB1D+KnoyvxY2mQ81XFy 25u8wWKhbm0qCHMDfYXUYBEeQMV5t46OOsuKi9h8+ztX8oMU3L+myHUOZpKhK3RSi/oT LjdQ== X-Gm-Message-State: AFqh2krwVGAZQAqqnqfBKH/8bqSyv8U/uY3TwZcdktDw1l3eeTeLcM0H +jytc1L/OUy9O+lbWYdckcCL9RuoFQfN6FSD X-Google-Smtp-Source: AMrXdXtmsYM9asiRksS8MrKjYVqb+DrHo7hb81dZji91XVmOqjEmO+vbivjJMVKXizvZDvx8wlDWcA== X-Received: by 2002:a17:90b:100e:b0:227:1e67:d58f with SMTP id gm14-20020a17090b100e00b002271e67d58fmr3203474pjb.12.1673294911050; Mon, 09 Jan 2023 12:08:31 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Ilya Leoshkevich Subject: [PATCH v3 08/27] target/s390x: Introduce gen_psw_addr_disp Date: Mon, 9 Jan 2023 12:08:00 -0800 Message-Id: <20230109200819.3916395-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230109200819.3916395-1-richard.henderson@linaro.org> References: <20230109200819.3916395-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1031; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1031.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1673295056155100001 Content-Type: text/plain; charset="utf-8" In preparation for TARGET_TB_PCREL, reduce reliance on absolute values. Reviewed-by: Ilya Leoshkevich Signed-off-by: Richard Henderson --- target/s390x/tcg/translate.c | 69 ++++++++++++++++++++++++------------ 1 file changed, 46 insertions(+), 23 deletions(-) diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c index f13ea43ce9..b41f5af988 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -169,6 +169,11 @@ static uint64_t inline_branch_hit[CC_OP_MAX]; static uint64_t inline_branch_miss[CC_OP_MAX]; #endif =20 +static void gen_psw_addr_disp(DisasContext *s, TCGv_i64 dest, int64_t disp) +{ + tcg_gen_movi_i64(dest, s->base.pc_next + disp); +} + static void pc_to_link_info(TCGv_i64 out, DisasContext *s, uint64_t pc) { if (s->base.tb->flags & FLAG_MASK_32) { @@ -334,18 +339,24 @@ static void return_low128(TCGv_i64 dest) =20 static void update_psw_addr(DisasContext *s) { - /* psw.addr */ - tcg_gen_movi_i64(psw_addr, s->base.pc_next); + gen_psw_addr_disp(s, psw_addr, 0); } =20 static void per_branch(DisasContext *s, bool to_next) { #ifndef CONFIG_USER_ONLY - tcg_gen_movi_i64(gbea, s->base.pc_next); + gen_psw_addr_disp(s, gbea, 0); =20 if (s->base.tb->flags & FLAG_MASK_PER) { - TCGv_i64 next_pc =3D to_next ? tcg_constant_i64(s->pc_tmp) : psw_a= ddr; - gen_helper_per_branch(cpu_env, gbea, next_pc); + if (to_next) { + TCGv_i64 next_pc =3D tcg_temp_new_i64(); + + gen_psw_addr_disp(s, next_pc, s->ilen); + gen_helper_per_branch(cpu_env, gbea, next_pc); + tcg_temp_free_i64(next_pc); + } else { + gen_helper_per_branch(cpu_env, gbea, psw_addr); + } } #endif } @@ -358,20 +369,23 @@ static void per_branch_cond(DisasContext *s, TCGCond = cond, TCGLabel *lab =3D gen_new_label(); tcg_gen_brcond_i64(tcg_invert_cond(cond), arg1, arg2, lab); =20 - tcg_gen_movi_i64(gbea, s->base.pc_next); + gen_psw_addr_disp(s, gbea, 0); gen_helper_per_branch(cpu_env, gbea, psw_addr); =20 gen_set_label(lab); } else { - TCGv_i64 pc =3D tcg_constant_i64(s->base.pc_next); + TCGv_i64 pc =3D tcg_temp_new_i64(); + + gen_psw_addr_disp(s, pc, 0); tcg_gen_movcond_i64(cond, gbea, arg1, arg2, gbea, pc); + tcg_temp_free_i64(pc); } #endif } =20 static void per_breaking_event(DisasContext *s) { - tcg_gen_movi_i64(gbea, s->base.pc_next); + gen_psw_addr_disp(s, gbea, 0); } =20 static void update_cc_op(DisasContext *s) @@ -1147,21 +1161,19 @@ struct DisasInsn { =20 static DisasJumpType help_goto_direct(DisasContext *s, int64_t disp) { - uint64_t dest =3D s->base.pc_next + disp; - - if (dest =3D=3D s->pc_tmp) { + if (disp =3D=3D s->ilen) { per_branch(s, true); return DISAS_NEXT; } - if (use_goto_tb(s, dest)) { + if (use_goto_tb(s, s->base.pc_next + disp)) { update_cc_op(s); per_breaking_event(s); tcg_gen_goto_tb(0); - tcg_gen_movi_i64(psw_addr, dest); + gen_psw_addr_disp(s, psw_addr, disp); tcg_gen_exit_tb(s->base.tb, 0); return DISAS_NORETURN; } else { - tcg_gen_movi_i64(psw_addr, dest); + gen_psw_addr_disp(s, psw_addr, disp); per_branch(s, false); return DISAS_PC_UPDATED; } @@ -1219,14 +1231,14 @@ static DisasJumpType help_branch(DisasContext *s, D= isasCompare *c, =20 /* Branch not taken. */ tcg_gen_goto_tb(0); - tcg_gen_movi_i64(psw_addr, s->pc_tmp); + gen_psw_addr_disp(s, psw_addr, s->ilen); tcg_gen_exit_tb(s->base.tb, 0); =20 /* Branch taken. */ gen_set_label(lab); per_breaking_event(s); tcg_gen_goto_tb(1); - tcg_gen_movi_i64(psw_addr, dest); + gen_psw_addr_disp(s, psw_addr, disp); tcg_gen_exit_tb(s->base.tb, 1); =20 ret =3D DISAS_NORETURN; @@ -1249,12 +1261,12 @@ static DisasJumpType help_branch(DisasContext *s, D= isasCompare *c, /* Branch not taken. */ update_cc_op(s); tcg_gen_goto_tb(0); - tcg_gen_movi_i64(psw_addr, s->pc_tmp); + gen_psw_addr_disp(s, psw_addr, s->ilen); tcg_gen_exit_tb(s->base.tb, 0); =20 gen_set_label(lab); if (is_imm) { - tcg_gen_movi_i64(psw_addr, dest); + gen_psw_addr_disp(s, psw_addr, disp); } per_breaking_event(s); ret =3D DISAS_PC_UPDATED; @@ -1264,9 +1276,12 @@ static DisasJumpType help_branch(DisasContext *s, Di= sasCompare *c, Most commonly we're single-stepping or some other condition that disables all use of goto_tb. Just update the PC and exit. */ =20 - TCGv_i64 next =3D tcg_constant_i64(s->pc_tmp); + TCGv_i64 next =3D tcg_temp_new_i64(); + + gen_psw_addr_disp(s, next, s->ilen); if (is_imm) { - cdest =3D tcg_constant_i64(dest); + cdest =3D tcg_temp_new_i64(); + gen_psw_addr_disp(s, cdest, disp); } =20 if (c->is_64) { @@ -1285,6 +1300,10 @@ static DisasJumpType help_branch(DisasContext *s, Di= sasCompare *c, tcg_temp_free_i64(t1); } =20 + tcg_temp_free_i64(next); + if (is_imm) { + tcg_temp_free_i64(cdest); + } ret =3D DISAS_PC_UPDATED; } =20 @@ -5829,7 +5848,8 @@ static void in2_a2(DisasContext *s, DisasOps *o) =20 static void in2_ri2(DisasContext *s, DisasOps *o) { - o->in2 =3D tcg_const_i64(s->base.pc_next + (int64_t)get_field(s, i2) *= 2); + o->in2 =3D tcg_temp_new_i64(); + gen_psw_addr_disp(s, o->in2, (int64_t)get_field(s, i2) * 2); } #define SPEC_in2_ri2 0 =20 @@ -6314,8 +6334,11 @@ static DisasJumpType translate_one(CPUS390XState *en= v, DisasContext *s) =20 #ifndef CONFIG_USER_ONLY if (s->base.tb->flags & FLAG_MASK_PER) { - TCGv_i64 addr =3D tcg_constant_i64(s->base.pc_next); + TCGv_i64 addr =3D tcg_temp_new_i64(); + + gen_psw_addr_disp(s, addr, 0); gen_helper_per_ifetch(cpu_env, addr); + tcg_temp_free_i64(addr); } #endif =20 @@ -6436,7 +6459,7 @@ static DisasJumpType translate_one(CPUS390XState *env= , DisasContext *s) if (s->base.tb->flags & FLAG_MASK_PER) { /* An exception might be triggered, save PSW if not already done. = */ if (ret =3D=3D DISAS_NEXT || ret =3D=3D DISAS_TOO_MANY) { - tcg_gen_movi_i64(psw_addr, s->pc_tmp); + gen_psw_addr_disp(s, psw_addr, s->ilen); } =20 /* Call the helper to check for a possible PER exception. */ --=20 2.34.1 From nobody Sun May 19 10:14:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1673295294; cv=none; d=zohomail.com; s=zohoarc; b=ZInJP1ZYOhRlNpweE+gbupEuCJuYb65NnlSwDSjsIA3zw80VZMHtU0nPMhWf6W7F1AeBSxSU15NDsI0MgaioPmXzIz7xaDFDD5AIfTRTW7lpXUiY8JWYsJOF2FEpdqeI5cLs48K+y+4xtGawRSM2yqJnZOZ5A80ojaBZhejGKR4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673295294; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=fuFmEK8Iwf94SJtJ1ovewqobkADHJCdvU7OnItfY0Yw=; b=KYE4THDnuCHim0bVcVihB3KrU67mqr7Kw2AaQfAtcQtirOCFRRZ0nTDPSxKT97rUu7sXgZdx1AcQXrmFpgpV8t2xMvL6CJgjbKKIyUxXeBtr6Dw364PxC9SogmuP4bGSw76F4KnerVKmcJpgrGe64JvU86uD87P6c13HU7ePUkY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1673295294128826.9914545257903; Mon, 9 Jan 2023 12:14:54 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pEyRk-00032Q-A3; Mon, 09 Jan 2023 15:08:40 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pEyRf-0002vk-Q6 for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:36 -0500 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pEyRd-0007QA-9L for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:35 -0500 Received: by mail-pl1-x62e.google.com with SMTP id w3so10776423ply.3 for ; Mon, 09 Jan 2023 12:08:32 -0800 (PST) Received: from stoup.. ([2602:47:d48c:8101:158e:facf:7a46:ba9f]) by smtp.gmail.com with ESMTPSA id l2-20020a17090a384200b0022727d4af8dsm577574pjf.48.2023.01.09.12.08.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Jan 2023 12:08:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=fuFmEK8Iwf94SJtJ1ovewqobkADHJCdvU7OnItfY0Yw=; b=hOHop+L0xydJi1wUplFj/YjpLaRujrORDC+Ljhs1ZCgFepO35+Cs4PQP7cheDS9zLt miXWhAO4CoZDFh7OWSWfL7j5E4uRxXzzpdLpvZP1W4OqCay3BFnqBZToNEjLMDotb4tS tKeB1vPq5sghW2MMYqWSrs9NMT42RVqS6mHLjucN74WjjkDYK5vnmycsRhydf13BcF6p ZvbuOL7TGzNqWl2Q3DMjWYFQEAJL44AU0bEQ6XTUt0vHUCzcIN1HVGCtTSDcIAZeMv6S 8E6AvivO6zLtEu5CWFBiHkTAxZJ15eZPVt/IxxtZBK0Um85j5qYBqFGD0vu9CByDK1v1 JGzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fuFmEK8Iwf94SJtJ1ovewqobkADHJCdvU7OnItfY0Yw=; b=brJrWTE78Y6MtBKS/3riAu5VDK1m3a6soHzTA/+Qq+zXuypmCM7LuqxQSgf3OgUPIK 9ZTcMed1Sw002La/a/PQvGqxb5K4A1N+BkhxmNQWcHgJ0ibBPhYPkiWnhuf3XNLyVJy/ 7/Wa481F4nBYwBzheJXzyU0QqykXzRQSGLnJa3HJ1dYdqMGv2KdAnYQm3CUbUi3fgwJl 6fEYhPsVbksVnD17j/a82Y6wIKt/ovJ3gA4c9Ops5GU7r2kEtEgZSNZqDFiP1TmvdIsO zPj3MgiAzSZ/DFPlZyzlEjrDIGDHuPluS2sVL7BRChGDXGt8kpO/hms6bewOcinhCEUu XhPg== X-Gm-Message-State: AFqh2koGFXl4Plb4tLsk5gqEBIkslnAvndc134XjyJRL85VtJC3o5zvm 3bvUnjXSIY5FxPHNChdbyCS/ALxQHFdjViEc X-Google-Smtp-Source: AMrXdXuNusuv3hz4l1wrqgQUTshj0AjZ22ObpzeRQkfB39kwxYILXy42jZcBQfV9Upc0FPJesDBbAw== X-Received: by 2002:a17:90b:2291:b0:226:43ba:54af with SMTP id kx17-20020a17090b229100b0022643ba54afmr34011919pjb.2.1673294912268; Mon, 09 Jan 2023 12:08:32 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Ilya Leoshkevich , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v3 09/27] target/s390x: Remove pc argument to pc_to_link_into Date: Mon, 9 Jan 2023 12:08:01 -0800 Message-Id: <20230109200819.3916395-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230109200819.3916395-1-richard.henderson@linaro.org> References: <20230109200819.3916395-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::62e; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1673295295361100001 All callers pass s->pc_tmp. Reviewed-by: Ilya Leoshkevich Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- target/s390x/tcg/translate.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c index b41f5af988..fadb87ad4a 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -174,8 +174,10 @@ static void gen_psw_addr_disp(DisasContext *s, TCGv_i6= 4 dest, int64_t disp) tcg_gen_movi_i64(dest, s->base.pc_next + disp); } =20 -static void pc_to_link_info(TCGv_i64 out, DisasContext *s, uint64_t pc) +static void pc_to_link_info(TCGv_i64 out, DisasContext *s) { + uint64_t pc =3D s->pc_tmp; + if (s->base.tb->flags & FLAG_MASK_32) { if (s->base.tb->flags & FLAG_MASK_64) { tcg_gen_movi_i64(out, pc); @@ -1534,7 +1536,7 @@ static DisasJumpType op_ni(DisasContext *s, DisasOps = *o) =20 static DisasJumpType op_bas(DisasContext *s, DisasOps *o) { - pc_to_link_info(o->out, s, s->pc_tmp); + pc_to_link_info(o->out, s); if (o->in2) { tcg_gen_mov_i64(psw_addr, o->in2); per_branch(s, false); @@ -1549,7 +1551,7 @@ static void save_link_info(DisasContext *s, DisasOps = *o) TCGv_i64 t; =20 if (s->base.tb->flags & (FLAG_MASK_32 | FLAG_MASK_64)) { - pc_to_link_info(o->out, s, s->pc_tmp); + pc_to_link_info(o->out, s); return; } gen_op_calc_cc(s); @@ -1579,7 +1581,7 @@ static DisasJumpType op_bal(DisasContext *s, DisasOps= *o) =20 static DisasJumpType op_basi(DisasContext *s, DisasOps *o) { - pc_to_link_info(o->out, s, s->pc_tmp); + pc_to_link_info(o->out, s); return help_goto_direct(s, (int64_t)get_field(s, i2) * 2); } =20 --=20 2.34.1 From nobody Sun May 19 10:14:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1673295248; cv=none; d=zohomail.com; s=zohoarc; b=EW0ZXDVa4ftyZ/v6bym7JntTUz3Xe68E9p/0P0fp/OIpOEa3jHTPD9O1dsQTjVyt/fSAD/qDbCYsTIazvz9f3h6wH0o8Ej4BCkbfDs8yvY5SmMU6ECVtZIeTLF2fYKH5SDOrS0oiiW7i2uGH8byl1U8lJGmOWn9tuFBeaw1ROV0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673295248; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=aRf7w7ZOWvevd8ePH3+KPSTGXAG+AAapDCGBGEQxlrc=; b=W4NX9Z8dxS0Ebsqt/4860GJPbuTl5/PhWDFeNIaHlrGTjQthuk2aD/ZI7ztl6BQUhemK4ktfjHa6G+Uq+qbgeq8H2krf9pqc2Hr57Yc5wooUUYlEXIvA9ySB9FF3EoQOMOfhHYTOFTrCSENHaPfD4PNeNtmEdWO37+0O6rpbBns= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 167329524830122.550137317655526; Mon, 9 Jan 2023 12:14:08 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pEyRi-0002yz-GB; Mon, 09 Jan 2023 15:08:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pEyRg-0002we-L4 for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:36 -0500 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pEyRe-0007Ub-R6 for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:36 -0500 Received: by mail-pl1-x62b.google.com with SMTP id c6so10776674pls.4 for ; Mon, 09 Jan 2023 12:08:34 -0800 (PST) Received: from stoup.. ([2602:47:d48c:8101:158e:facf:7a46:ba9f]) by smtp.gmail.com with ESMTPSA id l2-20020a17090a384200b0022727d4af8dsm577574pjf.48.2023.01.09.12.08.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Jan 2023 12:08:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=aRf7w7ZOWvevd8ePH3+KPSTGXAG+AAapDCGBGEQxlrc=; b=xoiuMtacu9k4LjMvi3YLdD8bBA0wLlJKFxO/nkEG2CacRpPbaMOTVh0eo+g20nNGn1 o3eCKj9siNiq37NfnYyvKJzWEHV8ztTCsqb2U0OAKPqZm4LJBULNu7J5hXzchmZgS/AL oJPP+BENtGu1wQeX75Ha0c8kx8LcSBuhxBF1zpwsAXsA6iCTnzWu3W4LC2FVE7N4LxyQ hmhju9Int6/71GaP5O6HcAkd/tz/kPArfyFhvBBaL0UXWcmblFgDDZjBBusKkI0Ccm6h hgcebP4YR53mLFul1/rg8xgKIHGwHGjDGSG/hetVLE3oBGaI2QB+pScHA9b7SWIV3oV4 fcOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aRf7w7ZOWvevd8ePH3+KPSTGXAG+AAapDCGBGEQxlrc=; b=Vb3q4PMTeCyISou2d9BNQvQdfagW7f0kKqqbixTLIeKIgb2JWJygxHiNxtbAY7G6wT N06LQYPDoqLXnnv8b6X3Tu0FMD6mR01f6fgdj40BwHuHV+aOmauojpWGWWXYMVNWt6P1 BgbR//C4LKCnW4i5Rfox/camSx3/IDu9Zg1JjbRpnP9DJvV/0MVYt8lnydSyzyBrKeM+ XLQKt96XUds0QoTcNlRymqImS5XHq7ViIPqYE0D2eFo3XZkx0FDFuAueXRobEcV7EmyU 1jUgitVxZwpDF2cQS6fOMmRCld05AjslftvBIBC32CfF5wLwO+GkRM6/OyGjhrStuJhN 8eYQ== X-Gm-Message-State: AFqh2koCtcgumtPuN8yXPB2KXm0Hdvs+Sr7h8PNwIOjpFd8DWk+4BuTm 8OTIVZkjGjkfjfAF7MyvxZhHVwTvbOmhjqV3 X-Google-Smtp-Source: AMrXdXsntYDblkbVoLm9CrZpYJ0nI6L6vhb0qKTPUIWCgiZYFBjMsL6K/TzFjCqzmnPP69+Ou0U3mQ== X-Received: by 2002:a17:90a:5889:b0:226:79:41dd with SMTP id j9-20020a17090a588900b00226007941ddmr48209394pji.0.1673294913099; Mon, 09 Jan 2023 12:08:33 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Ilya Leoshkevich Subject: [PATCH v3 10/27] target/s390x: Use gen_psw_addr_disp in pc_to_link_info Date: Mon, 9 Jan 2023 12:08:02 -0800 Message-Id: <20230109200819.3916395-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230109200819.3916395-1-richard.henderson@linaro.org> References: <20230109200819.3916395-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::62b; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1673295249199100001 Content-Type: text/plain; charset="utf-8" This is slightly more complicated than a straight displacement for 31 and 24-bit modes. Dont bother with a cant-happen assert. Reviewed-by: Ilya Leoshkevich Signed-off-by: Richard Henderson --- target/s390x/tcg/translate.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c index fadb87ad4a..05a11df00e 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -176,17 +176,20 @@ static void gen_psw_addr_disp(DisasContext *s, TCGv_i= 64 dest, int64_t disp) =20 static void pc_to_link_info(TCGv_i64 out, DisasContext *s) { - uint64_t pc =3D s->pc_tmp; + TCGv_i64 tmp; =20 - if (s->base.tb->flags & FLAG_MASK_32) { - if (s->base.tb->flags & FLAG_MASK_64) { - tcg_gen_movi_i64(out, pc); - return; - } - pc |=3D 0x80000000; + if (s->base.tb->flags & FLAG_MASK_64) { + gen_psw_addr_disp(s, out, s->ilen); + return; } - assert(!(s->base.tb->flags & FLAG_MASK_64)); - tcg_gen_deposit_i64(out, out, tcg_constant_i64(pc), 0, 32); + + tmp =3D tcg_temp_new_i64(); + gen_psw_addr_disp(s, tmp, s->ilen); + if (s->base.tb->flags & FLAG_MASK_32) { + tcg_gen_ori_i64(tmp, tmp, 0x80000000); + } + tcg_gen_deposit_i64(out, out, tmp, 0, 32); + tcg_temp_free_i64(tmp); } =20 static TCGv_i64 psw_addr; --=20 2.34.1 From nobody Sun May 19 10:14:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1673295294; cv=none; d=zohomail.com; s=zohoarc; b=FGY+SFUPgqfp9Ot+nH4F8Aaoa2YCvaQj8ZoF/LECjBJHexYjVaLE0TPo2830QyIILTLtpCo70BNwicGtfQFofZJ/SFBsPz/aFl5YgzK6NHttYTjHslEt4N2uHNMfYoS3aakfij53m8GIMXfOEPBRD1c0uZ7EJwf5xPbU3kDdMjw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673295294; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=rzW2RGRVBHiiLOC7jWYoqfyrR/GmVs5nUcJKMJ/tfDc=; b=WJGmrdc4wYMVfrrC5utF/QZK/aT1NHfD/lgzPyXA9sd7HPOiJCrN9EDZoEgwsMoA6GVVVwOGeHDRbfe0WebntGbGrKpB66gZo20XZee4n35k4uxdtds7f5H1bRCHB7+v2Un2ZBg7QKIp8euFNuEYS85TcLJSZqhH9qaFv+30sNk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1673295294041600.8535420799155; Mon, 9 Jan 2023 12:14:54 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pEyRj-00030i-Dq; Mon, 09 Jan 2023 15:08:39 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pEyRh-0002xd-J3 for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:37 -0500 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pEyRg-0007VR-22 for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:37 -0500 Received: by mail-pj1-x102d.google.com with SMTP id o8-20020a17090a9f8800b00223de0364beso13959791pjp.4 for ; Mon, 09 Jan 2023 12:08:35 -0800 (PST) Received: from stoup.. ([2602:47:d48c:8101:158e:facf:7a46:ba9f]) by smtp.gmail.com with ESMTPSA id l2-20020a17090a384200b0022727d4af8dsm577574pjf.48.2023.01.09.12.08.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Jan 2023 12:08:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rzW2RGRVBHiiLOC7jWYoqfyrR/GmVs5nUcJKMJ/tfDc=; b=nVRKJ0QDgC9RmCKG1F19fKOj7SNsHPPdFve+fwrjiK7PWFZJVop6d2eiy34K2PEBdg KY1b/JRVboTU0x0Vgt1D1NhHPug19nrjjGKsZIT1L6xetnptyCKiVWFKCflInHPcv4v5 smBFyWdJ4MGQKPxI2BxtDGElGf0zGGqtVEf+O7ehWA6MViy+RjGygkQVx/Znb7rTEePe JdF6jP6i3hv0HYdk6FkdmmWF1RR3Yx8FdLL+pciKoPeqEGTxG6Pxoc+LLjZGMhDzvi4B 2YQumVHK/yHTxIZd+H9AsANkBv84NFvrhNBqADco+KHRmBgEOALlMLhrAgCCj3Ze8yJg QiMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rzW2RGRVBHiiLOC7jWYoqfyrR/GmVs5nUcJKMJ/tfDc=; b=NijRxmVk3Ho2oURsm/f00K4alI9rf2EIDWYNTibXiLEUw+azl0MRb7H+pmvXAF1nlb VEi60e1GhKOtOw/VSslzlyqMLPlpe3s4P+IsbgJe0QInwgcOZA8sY4lSBzC/zBSQ375+ ojEhY8mjXs0R/x8Lr492tMpuFs21lZBrfDT5Atz12T6sqKJVA5ku4r36raS0w7PHV7J5 Ao7JjR1aAWdGlNH7L3L1hlvzMbKNZ5Ve8niR79ja1y8DfmgQw1aF9qhicY4C6Q4Vtvn7 CvCzLJxoJI3zu4ef2SafPBsZXgHapd5reMgiGNRx80h4Og8D/pjyZkux/Tf4Mpr9+9Iv 8i9w== X-Gm-Message-State: AFqh2krVLip+r14yc31Nplbj07lT0yf1XMI4JVTS1HO6h3Vkgro1Nrnw HlPE4FyZKgMFjRAdxePMyKFeEOgjxpx6xRfG X-Google-Smtp-Source: AMrXdXtqjajNvHmBi/+xL1yZ6wSu+PmBLFPiQkzxO0D7PWWIr9OEZoyW5eXTYP4Nu8BMYZS5g8/Wgg== X-Received: by 2002:a17:90a:fe89:b0:226:e59a:f869 with SMTP id co9-20020a17090afe8900b00226e59af869mr12647242pjb.43.1673294914116; Mon, 09 Jan 2023 12:08:34 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Ilya Leoshkevich , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v3 11/27] target/s390x: Use gen_psw_addr_disp in save_link_info Date: Mon, 9 Jan 2023 12:08:03 -0800 Message-Id: <20230109200819.3916395-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230109200819.3916395-1-richard.henderson@linaro.org> References: <20230109200819.3916395-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102d; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1673295295434100003 Trivial but non-mechanical conversion away from pc_tmp. Reviewed-by: Ilya Leoshkevich Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- target/s390x/tcg/translate.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c index 05a11df00e..001cfa9162 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -1558,9 +1558,11 @@ static void save_link_info(DisasContext *s, DisasOps= *o) return; } gen_op_calc_cc(s); - tcg_gen_andi_i64(o->out, o->out, 0xffffffff00000000ull); - tcg_gen_ori_i64(o->out, o->out, ((s->ilen / 2) << 30) | s->pc_tmp); t =3D tcg_temp_new_i64(); + tcg_gen_andi_i64(o->out, o->out, 0xffffffff00000000ull); + gen_psw_addr_disp(s, t, s->ilen); + tcg_gen_or_i64(o->out, o->out, t); + tcg_gen_ori_i64(o->out, o->out, (s->ilen / 2) << 30); tcg_gen_shri_i64(t, psw_mask, 16); tcg_gen_andi_i64(t, t, 0x0f000000); tcg_gen_or_i64(o->out, o->out, t); --=20 2.34.1 From nobody Sun May 19 10:14:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1673295049; cv=none; d=zohomail.com; s=zohoarc; b=WnURFBzdcG4AhuWbY1IEt29nbq9w7wA5nBYMS4EokbLxux6KW7JRRIju5y5vhqDeH1g28pShfWzfBs1F4QASBfrH1ZH75eCeTenPI1mkBlpCX9HnJ8eGb/lWxKquMoYh73vyWeoa/1msKdqG7k0pZREpEa0s0XSnG0uop/d/BX0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673295049; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=LQBI7dFc7kEPaCFgnTuGOTxG1+cWJVCWRSLqHnmhHaM=; b=aB3F6j/dqgBlAY+Q6K388FSjlSZWz+zzC1AGCF+/bggv3nyq/8ChTsExMnSvMBJVG58d2iWw+9hICXXM/fX83Cm+XoVZKE31fLEq07KgOonX4h2p3RCz83hqqXc/Lld4aDS15LEd2JojVB4B03wZ9xQ0mpdmAvEMGQ/IjdJf+E4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1673295049907744.6247890498535; Mon, 9 Jan 2023 12:10:49 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pEyRk-00032R-I3; Mon, 09 Jan 2023 15:08:40 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pEyRi-0002zG-GQ for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:38 -0500 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pEyRg-0007Pp-Nq for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:38 -0500 Received: by mail-pl1-x62d.google.com with SMTP id s8so2451504plk.5 for ; Mon, 09 Jan 2023 12:08:36 -0800 (PST) Received: from stoup.. ([2602:47:d48c:8101:158e:facf:7a46:ba9f]) by smtp.gmail.com with ESMTPSA id l2-20020a17090a384200b0022727d4af8dsm577574pjf.48.2023.01.09.12.08.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Jan 2023 12:08:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LQBI7dFc7kEPaCFgnTuGOTxG1+cWJVCWRSLqHnmhHaM=; b=mSgoQdZAGFPyHy/K1k3k5fZJihneAhKlsarSudgxWO6hg2cRUw9DTBLQxDkpfJdud2 iEEpwHG+STLd8nLgHY6/TEBTJkHYN3u6p4tCISQI+duMsbu07IdVbCQW6jgmI5WeOpmc igRoGvB7H3EnZM8o4AuuIbZAnimGlOzzraGZacrhEDt1hdCLozsME3Y910WE+79pKL5B 52mac1qI3rF4sZ7KJTwBgoadfTktwd7E4d133XPh7mS84yAWhpfrYkKKOPzDBCeal5t3 tTKOTHy+rMS03oPD9rdU9eE0J2Irov+5FxxZN193bwYtY8HGb0gkXTvbEeBjdsbraM5b DHrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LQBI7dFc7kEPaCFgnTuGOTxG1+cWJVCWRSLqHnmhHaM=; b=yhQRaManlRQY5e7jBGQjEkAjP9dmNL428xk9u/PV33rj0+qoKohlB6F4bezhS7+Suh 4TyyL28UIoQQ8eYIFWm7kZlFL55I3meoECyLbd1lG/hzrV0JA9dmiKNVTCnNzWaHotrv 3g+n+FNN69h0x+n7Lyu+v/It1vU5RrbbxxVcw4m6Q9y2EgADTSygkKkjda+lz0C35iXy eFsZWtffayqrtWLKlM/D/7F/x/Aiz4f7wj7utSV1YfyMqTwTG6J5TYNSXmHXxt2C4uRg CyOJAi1665MybBHtfeePg+IZcMsEJG2BE100sCg/NvDuu+NAHo+2Czmr+NUPX8pVP4eF BQKQ== X-Gm-Message-State: AFqh2kof7omV8M9mLZVmdargaevp0Sm+jNIg3INS5kmiUh2toCBrgNVF 2Cgev+vVnQx2eDUVDKBH4/K4LGn8UbUF6ss9 X-Google-Smtp-Source: AMrXdXs2ayp510MHkXdbm1cyZP7+tSQteH7W8cOI4otKk/+YCpjPXaKdux+LCyLTNDu3f5bwlTY6Rw== X-Received: by 2002:a17:90b:4004:b0:226:c966:28a3 with SMTP id ie4-20020a17090b400400b00226c96628a3mr17091896pjb.25.1673294915498; Mon, 09 Jan 2023 12:08:35 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Ilya Leoshkevich Subject: [PATCH v3 12/27] target/s390x: Use gen_psw_addr_disp in op_sam Date: Mon, 9 Jan 2023 12:08:04 -0800 Message-Id: <20230109200819.3916395-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230109200819.3916395-1-richard.henderson@linaro.org> References: <20230109200819.3916395-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::62d; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1673295052239100005 Content-Type: text/plain; charset="utf-8" Complicated because we may now require a runtime jump. Reviewed-by: Ilya Leoshkevich Signed-off-by: Richard Henderson --- target/s390x/tcg/translate.c | 40 +++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c index 001cfa9162..624bd18735 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -3924,7 +3924,7 @@ static DisasJumpType op_sacf(DisasContext *s, DisasOp= s *o) static DisasJumpType op_sam(DisasContext *s, DisasOps *o) { int sam =3D s->insn->data; - TCGv_i64 tsam; + TCGLabel *fault =3D NULL; uint64_t mask; =20 switch (sam) { @@ -3939,20 +3939,36 @@ static DisasJumpType op_sam(DisasContext *s, DisasO= ps *o) break; } =20 - /* Bizarre but true, we check the address of the current insn for the - specification exception, not the next to be executed. Thus the PoO - documents that Bad Things Happen two bytes before the end. */ - if (s->base.pc_next & ~mask) { - gen_program_exception(s, PGM_SPECIFICATION); - return DISAS_NORETURN; - } - s->pc_tmp &=3D mask; + /* + * Bizarre but true, we check the address of the current insn for the + * specification exception, not the next to be executed. Thus the PoO + * documents that Bad Things Happen two bytes before the end. + */ + if (mask !=3D -1) { + TCGv_i64 t =3D tcg_temp_new_i64(); + fault =3D gen_new_label(); =20 - tsam =3D tcg_constant_i64(sam); - tcg_gen_deposit_i64(psw_mask, psw_mask, tsam, 31, 2); + gen_psw_addr_disp(s, t, 0); + tcg_gen_andi_i64(t, t, ~mask); + tcg_gen_brcondi_i64(TCG_COND_NE, t, 0, fault); + tcg_temp_free_i64(t); + } + + update_cc_op(s); + + tcg_gen_deposit_i64(psw_mask, psw_mask, tcg_constant_i64(sam), 31, 2); + + gen_psw_addr_disp(s, psw_addr, s->ilen); + tcg_gen_andi_i64(psw_addr, psw_addr, mask); =20 /* Always exit the TB, since we (may have) changed execution mode. */ - return DISAS_TOO_MANY; + tcg_gen_lookup_and_goto_ptr(); + + if (mask !=3D -1) { + gen_set_label(fault); + gen_program_exception(s, PGM_SPECIFICATION); + } + return DISAS_NORETURN; } =20 static DisasJumpType op_sar(DisasContext *s, DisasOps *o) --=20 2.34.1 From nobody Sun May 19 10:14:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1673295620; cv=none; d=zohomail.com; s=zohoarc; b=Q9uYjLT0Hxb17gC/UbKCy/Npa/bh8Nu5Sc56k3NafzmafYGV7lEZzMcszsSQpLHBDpRpkWuybRfEe8fbaVVJKpKwzHbRU48Vt00E5dvXQC8E65+532QendZj0JJ6kUP9Jp0R+lEzbmtnj9nSdt+2ZeLYV3/wfFF8d4UlcFoQLRQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673295620; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=7YAEntzWlG5+v74Y9jfKjHpqon5dqwdjfhEi1TOWUto=; b=QgV70dyAkrP6FTMgLUdpWHIqguUu24OUqLB2Z1ywV65Z9+lpjjA9T5N6Yk4++Oa6uQtp8v8IsCz0X8sO37PDtgBuRUKX0Tp3esads3VDsloaFDlQzqzLqr5X27RwYcxBDYMj7fnGU94sxl7bkhfPtiAM9bPZl6+nqjDA8E/lpuY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1673295620793430.79251852000516; Mon, 9 Jan 2023 12:20:20 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pEyRm-00033r-2L; Mon, 09 Jan 2023 15:08:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pEyRj-00030n-H1 for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:39 -0500 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pEyRh-0007Qd-V6 for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:39 -0500 Received: by mail-pj1-x102a.google.com with SMTP id z4-20020a17090a170400b00226d331390cso10941589pjd.5 for ; Mon, 09 Jan 2023 12:08:37 -0800 (PST) Received: from stoup.. ([2602:47:d48c:8101:158e:facf:7a46:ba9f]) by smtp.gmail.com with ESMTPSA id l2-20020a17090a384200b0022727d4af8dsm577574pjf.48.2023.01.09.12.08.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Jan 2023 12:08:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7YAEntzWlG5+v74Y9jfKjHpqon5dqwdjfhEi1TOWUto=; b=Hc8QJAl0XuY1kmL0UhytuX31XJZkWQDjTvPB1O8s5e2E5H8Hmnx/W7a/xKMU4mr7kn k7jnHi3SLB4OKHlVJQJF1T1ILN5OcJB1o+uiuptwiUBDKIXtn3IcRqLsEPE3MqYHOF30 eDlCACbY6fiTfqqki4IMJWM2cd5NjBVGXANWWos2WBelzl1dC8+xtNjC8BuYuEgfQFfp 1CFFkm2VpIAeCHw+3z0fBaJAmMntgW6Ko5KzCCYvkRYr1aXdVGemDXDGjSWl06tflo1c bbtvv8QanM9nwRa4cnJVR4P9tQKmLxJqFX8l8jZXHVAQd5yDng6awodeMhEUUTvDf+lo Mw9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7YAEntzWlG5+v74Y9jfKjHpqon5dqwdjfhEi1TOWUto=; b=VV7Y+i4uV88HVEN7maOSKq5qKh7m8nnRe9gUvRfF4dqMycBNsoFS56YEmZVER0KwLK D4BvAsmAS55fEaEFk57cpqRq7L3eFsaahKkOkBLlzKW0y5DAUqS1w+Tv4r6UqmniQUAf lEbG/JBc7org1agQDlAmTJBKWLDx8n3AVmxU3g98ARPv8cclaAdDlLidC0wG7Z+t33q+ R3D1XagF8tmn2MnKSl0A3OVUnOWu5JOHmXyK0A1avY3GiwDZ00OsF2GOZ/jy+Ow6fBdD 1+L2v6nKIC7OuHTUcTKta/ZiBT0TXSb2baojsVUFUlczpeTmtz1Uq/4hbnxuvU++kuRW 0Xzw== X-Gm-Message-State: AFqh2kodGJ5DKOAl/SYdDy+sKfNM3Z2Psvse+rO/spgmbs0s+o4VLYgn vuy+HTEbWD6QgcenHwWRYEWP96yqI7eVhAyg X-Google-Smtp-Source: AMrXdXsSzpP/+p4+vOmiQWaZ1MOmbap7JOOrBAYACdp+dYdtvbsm3wUGmB939Ms9eVbt5gHKcElQew== X-Received: by 2002:a17:90a:9c15:b0:227:94f:9036 with SMTP id h21-20020a17090a9c1500b00227094f9036mr5756808pjp.22.1673294916600; Mon, 09 Jan 2023 12:08:36 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Ilya Leoshkevich Subject: [PATCH v3 13/27] target/s390x: Use ilen instead in branches Date: Mon, 9 Jan 2023 12:08:05 -0800 Message-Id: <20230109200819.3916395-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230109200819.3916395-1-richard.henderson@linaro.org> References: <20230109200819.3916395-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102a; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1673295621294100001 Remove the remaining uses of pc_tmp, and remove the variable. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Ilya Leoshkevich Signed-off-by: Richard Henderson --- target/s390x/tcg/translate.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c index 624bd18735..449e854c82 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -141,12 +141,6 @@ struct DisasContext { TCGOp *insn_start; DisasFields fields; uint64_t ex_value; - /* - * During translate_one(), pc_tmp is used to determine the instruction - * to be executed after base.pc_next - e.g. next sequential instruction - * or a branch target. - */ - uint64_t pc_tmp; uint32_t ilen; enum cc_op cc_op; bool exit_to_mainloop; @@ -1198,7 +1192,7 @@ static DisasJumpType help_branch(DisasContext *s, Dis= asCompare *c, goto egress; } if (is_imm) { - if (dest =3D=3D s->pc_tmp) { + if (disp =3D=3D s->ilen) { /* Branch to next. */ per_branch(s, true); ret =3D DISAS_NEXT; @@ -1222,7 +1216,7 @@ static DisasJumpType help_branch(DisasContext *s, Dis= asCompare *c, } } =20 - if (use_goto_tb(s, s->pc_tmp)) { + if (use_goto_tb(s, s->base.pc_next + s->ilen)) { if (is_imm && use_goto_tb(s, dest)) { /* Both exits can use goto_tb. */ update_cc_op(s); @@ -6255,7 +6249,6 @@ static const DisasInsn *extract_insn(CPUS390XState *e= nv, DisasContext *s) g_assert_not_reached(); } } - s->pc_tmp =3D s->base.pc_next + ilen; s->ilen =3D ilen; =20 /* We can't actually determine the insn format until we've looked up @@ -6492,7 +6485,7 @@ static DisasJumpType translate_one(CPUS390XState *env= , DisasContext *s) =20 out: /* Advance to the next instruction. */ - s->base.pc_next =3D s->pc_tmp; + s->base.pc_next +=3D s->ilen; return ret; } =20 --=20 2.34.1 From nobody Sun May 19 10:14:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1673295040; cv=none; d=zohomail.com; s=zohoarc; b=kmwaDeFTvst6gvxK5C1gNHQymy4Us4Pml/jnkW0bWY0bvKf5ZERqnYt71mEZaBT8KRSCOrJVken7d+qbNBLXWjHd6I8DKIPaiR/MkKiij+s/P3BjTJxvzhesHc4W+k7OfvHwPGw66F6X1YJH/Te5JzwaiMDKxBmt9jXS2HZ3Ctk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673295040; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=3kEe5fNGYkVr+4UJdUprtIi1urVwj9zZaNxQZb+ASkI=; b=kwE9ONNQFE2ivZVRiszCPfey/cNY3naf/8pkmghspbdhlgPk1rqy8r9CdZ+wO1UjzB95iKmTs5yGjYjICBt24eupg+SMu8bnA+pKVGlTlIdZjE9yd01FI/J2DxlENMZ7mQA7GDn600GxNcx6vj9snf5oMYgFmJhVB1NwWLgqc2k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1673295040246383.6819984144629; Mon, 9 Jan 2023 12:10:40 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pEyRo-00037X-8g; Mon, 09 Jan 2023 15:08:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pEyRl-00032Y-3a for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:41 -0500 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pEyRj-0007Xk-GW for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:40 -0500 Received: by mail-pl1-x62e.google.com with SMTP id y1so10782570plb.2 for ; Mon, 09 Jan 2023 12:08:39 -0800 (PST) Received: from stoup.. ([2602:47:d48c:8101:158e:facf:7a46:ba9f]) by smtp.gmail.com with ESMTPSA id l2-20020a17090a384200b0022727d4af8dsm577574pjf.48.2023.01.09.12.08.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Jan 2023 12:08:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3kEe5fNGYkVr+4UJdUprtIi1urVwj9zZaNxQZb+ASkI=; b=vGdj34OuogiNh7FheRmpKpNUEM83HCrm3Nqbs9IfiZWnHBcYefwfakoB8k4aSACdGX Kl00fT2J0cqGl75vN5/8Frc9YCZf2TobFjNv7yBN+wvPSaGf/rBitRx6pShufFXouyU1 naX1f1Li3DrYvQhjX7WDLP652gA/BZS8ijFyTZ8BWnA5+Z7yZomW5I0yLNzm+Fht1+4B rxX1o7tpTwnOL95lUQpjl2t67nVZG4H0NQoAh/xtpfsoZKdfFR8OEhxGd7ulV6WIqHm3 eFhyQekzDGU5m0mbIX7gm1bNbF42dkI+zVnNTRLtgdqQl8SmbH/pR4l8HFIMWFpw2qHw 6tCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3kEe5fNGYkVr+4UJdUprtIi1urVwj9zZaNxQZb+ASkI=; b=nDMIowv6Y65pW8KQi/3kOMCIU1Lawf6us51DueTV3U78m/1sOS37h7U+hUeRv8nTaS PfPEs+XxEnq29zI6wjg9M1gEO9LweZGWQ3VH7eCVQQ4/cLUrf5W09euN2tJ3fO0zo29A bE3tBRBqtxT39XvVDjx29R2zX7kbsTuwT0upKQX1Q+3REH6cwwwQc73VdPKRqlo3mzYT xUJRuKEK0smVw1+HmektaLIYlA65Jg8j7/yOz9faF0dSh7EUhDDfpGXCU7/U8BeEdAEs PZf+tj4VqGEjJpp+PgqzVQRblgipYGtR95WaG/zh77nnt24Nco7qDQ5dD4lbPuIfSUN5 YTrw== X-Gm-Message-State: AFqh2krQV1snZG/T/wtlhUbwHaqFsivXMgS64WEIndqzjr5zbZ2nUJgp 0mYze5fquske9WCbkEsSPMVjgoLVmToIGH41 X-Google-Smtp-Source: AMrXdXuRABT4pB+/vNas7Sq+bhcyV26P/70rHm5/F4UhGXPpLMxcxWfi1edxnrwwEXvxF50zOK1zVw== X-Received: by 2002:a17:90a:f10d:b0:219:705c:7193 with SMTP id cc13-20020a17090af10d00b00219705c7193mr68856648pjb.11.1673294917805; Mon, 09 Jan 2023 12:08:37 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Ilya Leoshkevich Subject: [PATCH v3 14/27] target/s390x: Assert masking of psw.addr in cpu_get_tb_cpu_state Date: Mon, 9 Jan 2023 12:08:06 -0800 Message-Id: <20230109200819.3916395-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230109200819.3916395-1-richard.henderson@linaro.org> References: <20230109200819.3916395-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::62e; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1673295042080100003 Content-Type: text/plain; charset="utf-8" When changing modes via SAM, we raise a specification exception if the new PC is out of range. The masking in s390x_tr_init_disas_context was too late to be correct, but may be removed. Add a debugging assert in cpu_get_tb_cpu_state. Reviewed-by: Ilya Leoshkevich Signed-off-by: Richard Henderson --- target/s390x/cpu.h | 20 ++++++++++++++------ target/s390x/tcg/translate.c | 6 +----- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h index 7d6d01325b..c7eeebfc53 100644 --- a/target/s390x/cpu.h +++ b/target/s390x/cpu.h @@ -379,17 +379,25 @@ static inline int cpu_mmu_index(CPUS390XState *env, b= ool ifetch) } =20 static inline void cpu_get_tb_cpu_state(CPUS390XState* env, target_ulong *= pc, - target_ulong *cs_base, uint32_t *f= lags) + target_ulong *cs_base, uint32_t *p= flags) { - *pc =3D env->psw.addr; - *cs_base =3D env->ex_value; - *flags =3D (env->psw.mask >> FLAG_MASK_PSW_SHIFT) & FLAG_MASK_PSW; + int flags =3D (env->psw.mask >> FLAG_MASK_PSW_SHIFT) & FLAG_MASK_PSW; if (env->cregs[0] & CR0_AFP) { - *flags |=3D FLAG_MASK_AFP; + flags |=3D FLAG_MASK_AFP; } if (env->cregs[0] & CR0_VECTOR) { - *flags |=3D FLAG_MASK_VECTOR; + flags |=3D FLAG_MASK_VECTOR; } + *pflags =3D flags; + *cs_base =3D env->ex_value; + *pc =3D env->psw.addr; +#ifdef CONFIG_DEBUG_TCG + if (!(flags & FLAG_MASK_32)) { + assert(*pc <=3D 0xffffff); + } else if (!(flags & FLAG_MASK_64)) { + assert(*pc <=3D 0x7fffffff); + } +#endif } =20 /* PER bits from control register 9 */ diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c index 449e854c82..de2d8edb47 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -6493,11 +6493,7 @@ static void s390x_tr_init_disas_context(DisasContext= Base *dcbase, CPUState *cs) { DisasContext *dc =3D container_of(dcbase, DisasContext, base); =20 - /* 31-bit mode */ - if (!(dc->base.tb->flags & FLAG_MASK_64)) { - dc->base.pc_first &=3D 0x7fffffff; - dc->base.pc_next =3D dc->base.pc_first; - } + /* Note cpu_get_tb_cpu_state asserts PC is masked for the mode. */ =20 dc->cc_op =3D CC_OP_DYNAMIC; dc->ex_value =3D dc->base.tb->cs_base; --=20 2.34.1 From nobody Sun May 19 10:14:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1673295767; cv=none; d=zohomail.com; s=zohoarc; b=BWSfdMrEHfk9E9j4a3qml3iwjY/wbhNvnZ1uUgUOfbRrz8DtkqvYTJ4yCKZsHFBLcAppB7OSqtJkDJyjv3KNnLoQF65RGQ1QzaNBzxsfkB1IDENVGcNIj0zKoqhI2q09dLgg2neYWAbBVGBFtdkCpvPVFdXkmYRe5t9dqQI2+dc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673295767; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=LthcmYqoGylcnimKyPE4SUZ0KHnZX+uAbIpucCo0mYE=; b=NBpbEL8EpQ+chysmBDwQ4Y/H5KWSQoJj8y7iMyNTo9GB8geYYkk3p0UBeeIxLVMHvY3NAFIZeQIkd/vds+EiVYgmMh4tQVJWeK2bAzb3m9zwTqIU09kWRy0GkYdqG+TPW0iCFoiggZw7f5PheIMJMj8kONLoJtIHKqfac9xp2ZE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1673295767953436.28264937706; Mon, 9 Jan 2023 12:22:47 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pEyRq-0003CC-6G; Mon, 09 Jan 2023 15:08:46 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pEyRm-000346-3e for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:42 -0500 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pEyRk-0007Yi-GQ for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:41 -0500 Received: by mail-pj1-x1030.google.com with SMTP id o1-20020a17090a678100b00219cf69e5f0so13994204pjj.2 for ; Mon, 09 Jan 2023 12:08:40 -0800 (PST) Received: from stoup.. ([2602:47:d48c:8101:158e:facf:7a46:ba9f]) by smtp.gmail.com with ESMTPSA id l2-20020a17090a384200b0022727d4af8dsm577574pjf.48.2023.01.09.12.08.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Jan 2023 12:08:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LthcmYqoGylcnimKyPE4SUZ0KHnZX+uAbIpucCo0mYE=; b=HnDKjEAbDGsmyrHt3Gsu7ysr5yTMHLwT6t87tt7Atm6lIsMQZrHV0l1qVe5l3TVwbR +fuQDRtoP9ewLiThFtkItitugHGUyzo7csghfAsUO3gsUgtVUEGtqVB9Q2u2h6mHX4xu rtx9eizzSS3YWuWPQlEuSOo26u8xhZgi5P2XjVUgaX/xfFhJm5RPhLleqG+2vqFrD6RK fYbHU2eRIAOu63SB/TQkvVJkFdDmRSWRDUz7lFFaBv93SvitYLUd9dC1Q0f20QmCRVfC KlGbVlZM/WoxLiJMDiXy5kTTz5OKyKvEOdr2I3lgcyQenCVu1j8HoplPoSAfBDLYp/rl SMSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LthcmYqoGylcnimKyPE4SUZ0KHnZX+uAbIpucCo0mYE=; b=KUl1hl598SoFKSXJgB3UB/Wy8EJhw7JSGljV1l/n78YCyghxndlfmM9dvcfvSQBzDF RPvCHYCWq2gS/RkX8fBSpAeGDQct2712Yoha5tah9Vi6AIG/o6pkBq8Ai36DKZKtLcoF UahyMlcw2OQNt7BkqtDPhlun1D4cTGDYCHqUvdUHNgNzsOVWvp34UUSLhu6QYE/pvjRY JSOaaWtv64PSNYdUZQvJSFAQMfslG5z5OYCtWzYQ0jlgauFCT37yD/4Rn3D71fv7N0tQ /pw/TJM5YXMZWurvxUE7fdSA0ZEqo3k8H3zz5WWud6TudtZ/KbGCvKhiCBFUF8xwWJjj VUZA== X-Gm-Message-State: AFqh2koRIFeN/aZe6RTZkh003ps6TJNFB/nmp7LI6VIVSfZ0Df+fdeVj fuuByAqHRVUv9a1KXSNpDy9docabBJD9KWNL X-Google-Smtp-Source: AMrXdXvxYmgQ0IximkTQFlb6v9mO2z4BUoR4Jn/9JnHRRl3I7GXAl7tdEdSqPcobcZOQ4lpczadC8Q== X-Received: by 2002:a17:90b:19cc:b0:226:cdcf:da83 with SMTP id nm12-20020a17090b19cc00b00226cdcfda83mr15747043pjb.46.1673294918825; Mon, 09 Jan 2023 12:08:38 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Ilya Leoshkevich Subject: [PATCH v3 15/27] target/s390x: Add disp argument to update_psw_addr Date: Mon, 9 Jan 2023 12:08:07 -0800 Message-Id: <20230109200819.3916395-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230109200819.3916395-1-richard.henderson@linaro.org> References: <20230109200819.3916395-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1030; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1030.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1673295769408100003 Rename to update_psw_addr_disp at the same time. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Ilya Leoshkevich Signed-off-by: Richard Henderson --- target/s390x/tcg/translate.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c index de2d8edb47..56e1259dc6 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -336,9 +336,9 @@ static void return_low128(TCGv_i64 dest) tcg_gen_ld_i64(dest, cpu_env, offsetof(CPUS390XState, retxl)); } =20 -static void update_psw_addr(DisasContext *s) +static void update_psw_addr_disp(DisasContext *s, int64_t disp) { - gen_psw_addr_disp(s, psw_addr, 0); + gen_psw_addr_disp(s, psw_addr, disp); } =20 static void per_branch(DisasContext *s, bool to_next) @@ -444,7 +444,7 @@ static void gen_program_exception(DisasContext *s, int = code) offsetof(CPUS390XState, int_pgm_ilen)); =20 /* update the psw */ - update_psw_addr(s); + update_psw_addr_disp(s, 0); =20 /* Save off cc. */ update_cc_op(s); @@ -1168,11 +1168,11 @@ static DisasJumpType help_goto_direct(DisasContext = *s, int64_t disp) update_cc_op(s); per_breaking_event(s); tcg_gen_goto_tb(0); - gen_psw_addr_disp(s, psw_addr, disp); + update_psw_addr_disp(s, disp); tcg_gen_exit_tb(s->base.tb, 0); return DISAS_NORETURN; } else { - gen_psw_addr_disp(s, psw_addr, disp); + update_psw_addr_disp(s, disp); per_branch(s, false); return DISAS_PC_UPDATED; } @@ -2448,7 +2448,7 @@ static DisasJumpType op_ex(DisasContext *s, DisasOps = *o) return DISAS_NORETURN; } =20 - update_psw_addr(s); + update_psw_addr_disp(s, 0); update_cc_op(s); =20 if (r1 =3D=3D 0) { @@ -3175,7 +3175,7 @@ static DisasJumpType op_lpd(DisasContext *s, DisasOps= *o) =20 /* In a parallel context, stop the world and single step. */ if (tb_cflags(s->base.tb) & CF_PARALLEL) { - update_psw_addr(s); + update_psw_addr_disp(s, 0); update_cc_op(s); gen_exception(EXCP_ATOMIC); return DISAS_NORETURN; @@ -4492,7 +4492,7 @@ static DisasJumpType op_stura(DisasContext *s, DisasO= ps *o) tcg_gen_qemu_st_tl(o->in1, o->in2, MMU_REAL_IDX, s->insn->data); =20 if (s->base.tb->flags & FLAG_MASK_PER) { - update_psw_addr(s); + update_psw_addr_disp(s, 0); gen_helper_per_store_real(cpu_env); } return DISAS_NEXT; @@ -4730,7 +4730,7 @@ static DisasJumpType op_svc(DisasContext *s, DisasOps= *o) { TCGv_i32 t; =20 - update_psw_addr(s); + update_psw_addr_disp(s, 0); update_cc_op(s); =20 t =3D tcg_constant_i32(get_field(s, i1) & 0xff); @@ -6475,7 +6475,7 @@ static DisasJumpType translate_one(CPUS390XState *env= , DisasContext *s) if (s->base.tb->flags & FLAG_MASK_PER) { /* An exception might be triggered, save PSW if not already done. = */ if (ret =3D=3D DISAS_NEXT || ret =3D=3D DISAS_TOO_MANY) { - gen_psw_addr_disp(s, psw_addr, s->ilen); + update_psw_addr_disp(s, s->ilen); } =20 /* Call the helper to check for a possible PER exception. */ @@ -6544,7 +6544,7 @@ static void s390x_tr_tb_stop(DisasContextBase *dcbase= , CPUState *cs) case DISAS_NORETURN: break; case DISAS_TOO_MANY: - update_psw_addr(dc); + update_psw_addr_disp(dc, 0); /* FALLTHRU */ case DISAS_PC_UPDATED: /* Next TB starts off with CC_OP_DYNAMIC, so make sure the --=20 2.34.1 From nobody Sun May 19 10:14:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1673295663; cv=none; d=zohomail.com; s=zohoarc; b=FKSo7dumQCF+4aQAnWLzuvTTF16Znp7uVJ6YYEIoc6V6f9ic2vOvqTOvu79zR6iqklqWfC9UJmbXbAlFDINh2zzZ8hn5HrsMLNysIWh80NLeb86cCMZmPMr6W1cGoaJ8MOE6C9pbn5wOG55IGhnna7zNcM+bbDdRJ5E3gwJP9ug= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673295663; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=tP7Xom2Zt041mpQlzbnt0w/L44IFCyA/KWlistDO3Do=; b=S6LiIJyICIBtSFGgu+ctzzHSqSoM80Vj08xOV8AnrndQk11OLYDxasD/uHEWHayOizmr/ohKH3/JeBCLCvVge9MfZR08Pbz3nByPBnXZxSdW6qvlBhvplVtDaFsZLmjxDVf6eBaY2srtWUENZyIXkfgV9WpN7xg7Fn91Wg4FYIk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1673295663516171.60683127213838; Mon, 9 Jan 2023 12:21:03 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pEyRp-00038Z-3a; Mon, 09 Jan 2023 15:08:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pEyRm-00035x-Sd for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:42 -0500 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pEyRl-0007Z3-Fj for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:42 -0500 Received: by mail-pj1-x1032.google.com with SMTP id w4-20020a17090ac98400b002186f5d7a4cso14033461pjt.0 for ; Mon, 09 Jan 2023 12:08:41 -0800 (PST) Received: from stoup.. ([2602:47:d48c:8101:158e:facf:7a46:ba9f]) by smtp.gmail.com with ESMTPSA id l2-20020a17090a384200b0022727d4af8dsm577574pjf.48.2023.01.09.12.08.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Jan 2023 12:08:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tP7Xom2Zt041mpQlzbnt0w/L44IFCyA/KWlistDO3Do=; b=mByDq8hwLU3Om3nGJt25BUZN6UySoAtTpuy7mrshYYd6K0DgW06OWnw6hz45jx1qak 3JEWxlpIz/+aN25vHtk/DBB8FN5mmdnjvgVI+jL6vzflVpdwE452E69MwYWT4Gc+JaVh 0sT052tArgDTzyUCix1UNffFQoNkyHOhXMNzKs+QZ+Ym94de96S2LYNKGiFrTiVJC5qk BNHR1DRMH0k7vXbipLMnkrqgVwVwul7goqQTDldGlQNG63615Imivj605gDudWqMxOCt SwZZHQI1sqdD6fIzgSHuaTkT7TCuukyTRznjVAvwXUwm9F6sZUG7M+CamZMS4VwPofEW zn7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tP7Xom2Zt041mpQlzbnt0w/L44IFCyA/KWlistDO3Do=; b=R8dhLWGz9d9xXAoZLjdJ8IdHy5J/RoOCiPOV6uO1ELe+5oZsV5UpmOHwnhTX/eug6R jcDWfdHFLACc1/Bp1TrFAq+UtqSyRKbNOlPXM9NvFCPlKegljVjJAS4buBoqytkfMfy2 tiIrQaflRLZGBP8qQLYpxv2SYOkiS1vTng/s91qDH+rScnm4X8J+wmnyn5z+IzUmfAgE 60wlJ4rHUMeT/+JXWE4OZEXOgT31aDzXf+XXVJXQjl6zfKHLU72JntQKfj82fdME45Jv LvZN94nlSeRbCX91i1PlJfmHGnFhrUyBZryjcogoyDSf9KFs0CyLdeA1qsOYg2UwR6H+ kW5g== X-Gm-Message-State: AFqh2ko3OYfftZN+oet3ZV2gW8r7HS/FRa8igIIRQRvdMebZLTPW90IX zA1e7ehuwETAm7ztu6bUCDJ7P9/9T1ZVSfY9 X-Google-Smtp-Source: AMrXdXtxE1GDDgw3JOyCNBb5ZiGw/o0ekKW+Y9i9nHRI98IzPiYNCdAtK0br4u/6/Az204ha/hH1bw== X-Received: by 2002:a17:90a:7605:b0:227:22d1:5947 with SMTP id s5-20020a17090a760500b0022722d15947mr2399460pjk.45.1673294919748; Mon, 09 Jan 2023 12:08:39 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Ilya Leoshkevich Subject: [PATCH v3 16/27] target/s390x: Don't set gbea for user-only Date: Mon, 9 Jan 2023 12:08:08 -0800 Message-Id: <20230109200819.3916395-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230109200819.3916395-1-richard.henderson@linaro.org> References: <20230109200819.3916395-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1032; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1032.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1673295665322100003 Content-Type: text/plain; charset="utf-8" The rest of the per_* functions have this ifdef; this one seemed to be missing. Reviewed-by: Ilya Leoshkevich Signed-off-by: Richard Henderson --- target/s390x/tcg/translate.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c index 56e1259dc6..b84b0062ca 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -384,7 +384,9 @@ static void per_branch_cond(DisasContext *s, TCGCond co= nd, =20 static void per_breaking_event(DisasContext *s) { +#ifndef CONFIG_USER_ONLY gen_psw_addr_disp(s, gbea, 0); +#endif } =20 static void update_cc_op(DisasContext *s) --=20 2.34.1 From nobody Sun May 19 10:14:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1673295560; cv=none; d=zohomail.com; s=zohoarc; b=ReDN+oyYTMN8foz6Rwq5U54/RAqTpOq5MUAqk+OPmiw/s/0w3MbqJNFKIaHvL+jY+HpDzDi+SuXUBN3lo5qBa4gABb/a+22Ssvu790P3/nUVq+8LBxl24oPxAVpNyYh7HpRXS90DYVFzweCPiUqKSjA0nat0Sq03fGgJp/JMdik= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673295560; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=pQ4eU68d6z+rZoABNFvXkHrbyWgsMN7s71IQ0UJs6N0=; b=j0+Js1/QBk4rZf7cVDn1IV8FdDkYO8oprlea80Bdf4kEQ45pdiXKU0OWQKz2KnvHhQ8/4CQubsSxcCstWS/0jdnrZ+/vM6cir67FCZIAmFIM+X9uY5lBOsIKpm/kRwr4WpURnux5GMNOeT0iBpBHUz90mAskYQVVu5ECZt7FzIc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1673295560054761.3924416828937; Mon, 9 Jan 2023 12:19:20 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pEyRp-0003Bi-SP; Mon, 09 Jan 2023 15:08:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pEyRn-00036l-Il for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:43 -0500 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pEyRm-0007OD-1J for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:43 -0500 Received: by mail-pj1-x102b.google.com with SMTP id fz16-20020a17090b025000b002269d6c2d83so12049851pjb.0 for ; Mon, 09 Jan 2023 12:08:41 -0800 (PST) Received: from stoup.. ([2602:47:d48c:8101:158e:facf:7a46:ba9f]) by smtp.gmail.com with ESMTPSA id l2-20020a17090a384200b0022727d4af8dsm577574pjf.48.2023.01.09.12.08.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Jan 2023 12:08:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pQ4eU68d6z+rZoABNFvXkHrbyWgsMN7s71IQ0UJs6N0=; b=wLW+rxir/D7rTySQYb6fSnngxAqvxxbqzNKy6X7/WJlOhXZlSJSHFNCo8zOS1HNznB Ey9PcgAkA3GwkP6iXqCVdJXc0NW0fhsgou1FDvcl2B+D6nmPzEPQhQ4pI7J/+ZH/UO4M flpR9CKsk82L6KJvYgbbtOiaLJVbYUwXmXxLcpSo5mQKnZNteHoIIDJU1Gic6/Z6UkB2 GT45tgq9dKlmvMjl1MPNG3CH+ohuHD9Jxe9LBQNi1x9/uhgnOiXHraGW6vs6QQyQVth3 kpXdO3Jky/7mAgpCdy0Lx3zHXpH+n7Y3/InjLB4xPb+T3KlAfpPlgHCCwNd8LvneY2MU vWbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pQ4eU68d6z+rZoABNFvXkHrbyWgsMN7s71IQ0UJs6N0=; b=czVn2Dbq9QjMDOfSE1GXXIF1O5zVTkMKIZhP+HEQU5NlhBjHWUOeqabjRmXvfq1V4s zPwHXsg2A5Ch9a4Y3SGmvu1jrajpFLto3hugvCJNnP6wDpccEpUEHAOdyCMeBySF5jmf RaVltr8Y/5Y3D69Fo3Lfr5ByU4JDuUqngPtELKU5pR1J5ojzly0xuyTzqdoQobrp1nHG 6Cm7DATPKKIxJU8Lv5flsdJ3YnSIaJ250ZyCR4nl93A43wdw4mJs2hqbiyPxdpuHK0Nj cBcMSf+5xzsqAciJ1wGHoTF50B9dGK6W3+kRiN2IL27AKohXkY7QseVLfR/9PDK5Vacu Lt1Q== X-Gm-Message-State: AFqh2ko57ahdchafq2ZGdyO7/oe5VZrHHribibOdD9HGvSZyPmtjUmzL tR9wIJUPrMj+oVoBjNca1OPKWMZcoupt/d/s X-Google-Smtp-Source: AMrXdXsAnT1QsDw8Wvilx+YXr2YVYQOb+s4FNKkGbykzZCv6qnApD25Iju8XIhV7vJUgPNNfMGjLCg== X-Received: by 2002:a17:90a:b011:b0:226:8fc5:b55 with SMTP id x17-20020a17090ab01100b002268fc50b55mr24062859pjq.33.1673294920745; Mon, 09 Jan 2023 12:08:40 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Ilya Leoshkevich Subject: [PATCH v3 17/27] target/s390x: Introduce per_enabled Date: Mon, 9 Jan 2023 12:08:09 -0800 Message-Id: <20230109200819.3916395-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230109200819.3916395-1-richard.henderson@linaro.org> References: <20230109200819.3916395-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102b; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1673295560722100005 Content-Type: text/plain; charset="utf-8" Hoist the test of FLAG_MASK_PER to a helper. Reviewed-by: Ilya Leoshkevich Signed-off-by: Richard Henderson --- target/s390x/tcg/translate.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c index b84b0062ca..b02b76dfad 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -341,12 +341,21 @@ static void update_psw_addr_disp(DisasContext *s, int= 64_t disp) gen_psw_addr_disp(s, psw_addr, disp); } =20 +static inline bool per_enabled(DisasContext *s) +{ +#ifdef CONFIG_USER_ONLY + return false; +#else + return unlikely(s->base.tb->flags & FLAG_MASK_PER); +#endif +} + static void per_branch(DisasContext *s, bool to_next) { #ifndef CONFIG_USER_ONLY gen_psw_addr_disp(s, gbea, 0); =20 - if (s->base.tb->flags & FLAG_MASK_PER) { + if (per_enabled(s)) { if (to_next) { TCGv_i64 next_pc =3D tcg_temp_new_i64(); =20 @@ -364,7 +373,7 @@ static void per_branch_cond(DisasContext *s, TCGCond co= nd, TCGv_i64 arg1, TCGv_i64 arg2) { #ifndef CONFIG_USER_ONLY - if (s->base.tb->flags & FLAG_MASK_PER) { + if (per_enabled(s)) { TCGLabel *lab =3D gen_new_label(); tcg_gen_brcond_i64(tcg_invert_cond(cond), arg1, arg2, lab); =20 @@ -665,7 +674,7 @@ static void gen_op_calc_cc(DisasContext *s) =20 static bool use_goto_tb(DisasContext *s, uint64_t dest) { - if (unlikely(s->base.tb->flags & FLAG_MASK_PER)) { + if (per_enabled(s)) { return false; } return translator_use_goto_tb(&s->base, dest); @@ -4493,7 +4502,7 @@ static DisasJumpType op_stura(DisasContext *s, DisasO= ps *o) { tcg_gen_qemu_st_tl(o->in1, o->in2, MMU_REAL_IDX, s->insn->data); =20 - if (s->base.tb->flags & FLAG_MASK_PER) { + if (per_enabled(s)) { update_psw_addr_disp(s, 0); gen_helper_per_store_real(cpu_env); } @@ -6351,7 +6360,7 @@ static DisasJumpType translate_one(CPUS390XState *env= , DisasContext *s) } =20 #ifndef CONFIG_USER_ONLY - if (s->base.tb->flags & FLAG_MASK_PER) { + if (per_enabled(s)) { TCGv_i64 addr =3D tcg_temp_new_i64(); =20 gen_psw_addr_disp(s, addr, 0); @@ -6474,7 +6483,7 @@ static DisasJumpType translate_one(CPUS390XState *env= , DisasContext *s) } =20 #ifndef CONFIG_USER_ONLY - if (s->base.tb->flags & FLAG_MASK_PER) { + if (per_enabled(s)) { /* An exception might be triggered, save PSW if not already done. = */ if (ret =3D=3D DISAS_NEXT || ret =3D=3D DISAS_TOO_MANY) { update_psw_addr_disp(s, s->ilen); @@ -6499,7 +6508,7 @@ static void s390x_tr_init_disas_context(DisasContextB= ase *dcbase, CPUState *cs) =20 dc->cc_op =3D CC_OP_DYNAMIC; dc->ex_value =3D dc->base.tb->cs_base; - dc->exit_to_mainloop =3D (dc->base.tb->flags & FLAG_MASK_PER) || dc->e= x_value; + dc->exit_to_mainloop =3D per_enabled(dc) || dc->ex_value; } =20 static void s390x_tr_tb_start(DisasContextBase *db, CPUState *cs) --=20 2.34.1 From nobody Sun May 19 10:14:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1673295557; cv=none; d=zohomail.com; s=zohoarc; b=QUlkzvXmR+acms3UCy+gEgFLxfshYeRs6HF7MFshstVva3OdgFEhxAY5VxXiTsk4FVb6OOytOJafvo6baCEmEsP1ZfTPoYBYM9uvJ9PaKVFoqWLTruvGHQxF3aNBHvzpKCvvFFi8zqyv1MFIM1RyW3rR3KUyhz7L6ftQSe6Y0c4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673295557; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=huHLV3sTv30gudJNWzDsqVS9kBrPAjakiU9Bz/DYeo4=; b=Hfad9kCS+vv8skksSCPzMnksEJsecfiTS9Xdf0RT28KW4VVHodBeabkmUvg6pVfBzoBlMSeG1Uq1Cp9P4pyndfoF+zTgcfegmwNxm3GVc1U3UAf02FmiKwHpSHjoDqIXMGh6A7E+N6szWEvngVXS7ioA70BoRXmve1ubKNhfU9A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1673295557793921.2415061393091; Mon, 9 Jan 2023 12:19:17 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pEyRq-0003DB-NP; Mon, 09 Jan 2023 15:08:46 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pEyRo-000381-Di for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:44 -0500 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pEyRn-0007NI-1R for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:44 -0500 Received: by mail-pl1-x630.google.com with SMTP id v23so5856616plo.1 for ; Mon, 09 Jan 2023 12:08:42 -0800 (PST) Received: from stoup.. ([2602:47:d48c:8101:158e:facf:7a46:ba9f]) by smtp.gmail.com with ESMTPSA id l2-20020a17090a384200b0022727d4af8dsm577574pjf.48.2023.01.09.12.08.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Jan 2023 12:08:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=huHLV3sTv30gudJNWzDsqVS9kBrPAjakiU9Bz/DYeo4=; b=D+H7sClqc79NZxVexdPNSAtImOp975ABRLcUdV297Kn6175KJAq7tp/7MTn1q/8ZcG kiBFKNxqphbgAgeSc9ogLs443zVqT4ixSLyFo4uYbiYpn32OTyuZrKkWBwaifs8B7zXB nfcVz3xZNagu1o0ulVr7QqNtxJpRpi9WfRXPMKImzqXmFFPpwo3sO7TsuK0ZeYDGPCOp qesRSSDPdB2mKLXhpj7qL6FqYQNd5JQ1eoGzqBJzQJJy9QgixYsbftP1OSMcb/PEX+Ik Mg/3QKoaAgqTjThmFf5SgU09sTQ6j3AeWGAcoyoXwcElLz3bKcZYiya8Q8I65D7EfETD 3M5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=huHLV3sTv30gudJNWzDsqVS9kBrPAjakiU9Bz/DYeo4=; b=iNCCfEOdQqSS3OdceM0BqJ/q5QpHqN+w0k1BrtQyQPctHKFOqUgPQuGVRe0O1BUfSX yiA+jM7iIX/D1hOrzwnHlDZV1PdbYvNn5Jxk4c4/AUQ+p00pC1GJxtCGqLsdV7Cqz9ND eb5SbL0+gB0NxdCq3Y68C05NARJUi8vIiQvniautcA+YXsNSDPTIhEtwtqbTHS020qmm Fn8RpZE7oYTfXpMEAOkzdqjzGXab2NjTSJT+WAMcF/ukjvq09bwvbMZoSqVqkr+j8BlT ZVyJiEAh5kx9ioo10si9rOPAed2ZX4T1tH2FfQ2Ib2hrc4tc1dowMjXLlO4xjBrg9KMl p8bg== X-Gm-Message-State: AFqh2kr/GBXLbGKaE4l9z+PQEIrqHsGASBnfdaQw6rorgPBaoWd4nqoJ Ly+EleqYX0YXEY2CtZMrgsdqAnuD5rA9COjb X-Google-Smtp-Source: AMrXdXuXJpO4ytMrYk/8Azc161E35GQWHhkh7cwB78S26s8iNkdzuN39GPC/A3+qvK14Lp7fB6iC3g== X-Received: by 2002:a17:90a:fa43:b0:226:c6fa:9843 with SMTP id dt3-20020a17090afa4300b00226c6fa9843mr17069935pjb.1.1673294921966; Mon, 09 Jan 2023 12:08:41 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Ilya Leoshkevich Subject: [PATCH v3 18/27] target/s390x: Disable conditional branch-to-next for PER Date: Mon, 9 Jan 2023 12:08:10 -0800 Message-Id: <20230109200819.3916395-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230109200819.3916395-1-richard.henderson@linaro.org> References: <20230109200819.3916395-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::630; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x630.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1673295558698100001 Content-Type: text/plain; charset="utf-8" For PER, we require a conditional call to helper_per_branch for the conditional branch. Fold the remaining optimization into a call to helper_goto_direct, which will take care of the remaining gbea adjustment. Reviewed-by: Ilya Leoshkevich Signed-off-by: Richard Henderson --- target/s390x/tcg/translate.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c index b02b76dfad..bbe39dd083 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -1203,13 +1203,12 @@ static DisasJumpType help_branch(DisasContext *s, D= isasCompare *c, goto egress; } if (is_imm) { - if (disp =3D=3D s->ilen) { - /* Branch to next. */ - per_branch(s, true); - ret =3D DISAS_NEXT; - goto egress; - } - if (c->cond =3D=3D TCG_COND_ALWAYS) { + /* + * Do not optimize a conditional branch if PER enabled, because we + * still need a conditional call to helper_per_branch. + */ + if (c->cond =3D=3D TCG_COND_ALWAYS + || (disp =3D=3D s->ilen && !per_enabled(s))) { ret =3D help_goto_direct(s, disp); goto egress; } --=20 2.34.1 From nobody Sun May 19 10:14:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1673295725; cv=none; d=zohomail.com; s=zohoarc; b=CD7l+AkrfKt+yPGSKq7YRfea5e5Qc91Ocp/SfJYvHlGZzQrKkfRxrSLfHi/59v36oQm5xrL6COqUmgHqewJAHKjqlEbUMnhaq4JDaKHV8sj5LdStOh1DMOubG0kNPXWHKde6Tsp98SgvLLmFTkuElu3yjdRihqVZYFTw4Gy0dA4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673295725; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=rOafY3nfVG5SzehtqB5mgOADFoO+3I8xljC1PBVfEGM=; b=QE11eZdK8ZrcFpxb381wI36mKekPeertW6WJHNZwwPcKtYS28Y6/l9uZmAIgtYYK1ahL0/hLtou/KLBrRE6QJKxwX2Xd5K6615Y+JXuNi4GfrDw5Oav6ny3C8spHfYgjaI5fxE8/KJr6HxN6/0hAc82DGxv8Kk1CzJkaHqCZqTQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1673295725528362.99779172091553; Mon, 9 Jan 2023 12:22:05 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pEyRr-0003FE-HN; Mon, 09 Jan 2023 15:08:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pEyRp-0003B9-FV for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:45 -0500 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pEyRn-0007Nu-RI for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:45 -0500 Received: by mail-pj1-x1035.google.com with SMTP id o13so6437785pjg.2 for ; Mon, 09 Jan 2023 12:08:43 -0800 (PST) Received: from stoup.. ([2602:47:d48c:8101:158e:facf:7a46:ba9f]) by smtp.gmail.com with ESMTPSA id l2-20020a17090a384200b0022727d4af8dsm577574pjf.48.2023.01.09.12.08.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Jan 2023 12:08:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rOafY3nfVG5SzehtqB5mgOADFoO+3I8xljC1PBVfEGM=; b=X/WHElWW0z5JUcfQA9eS+iXba3b/lEZyjEvW2KxB5jH5WewlaSR9vQEif3ppXktJSQ YNvcEL+annpH5TqL50XO5zvGekbpljq96T2NKvkWLaMTmOUFWMThVfU/clBEEt2oFc1D LddLAiUWCCuuTPq8lXTpBpXpsNGYcVn0+lV/DUGtmkRl9I6l3UbYAsbKyXK0U8CGFxNh ck5FGpc1MVySH4fNdJTKattMMBPi7m7p6xSVTr7DreE5N/cnReRLp/CNNi9ptywHaNBC gn76+/BwQFq+4rwupCowP49JcYu1Jn1ltwIfPx6XOzv52WkepVwmCmB4JHPvqDgWPI77 /vJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rOafY3nfVG5SzehtqB5mgOADFoO+3I8xljC1PBVfEGM=; b=sINPn6wrNiA8nSfIaxfIlEAUeNqUH5O7vzLwcgqPRHATOdBw4ojEmsSGkwMl2mAblk HaQG1r+CFt2pUK/jtdWU91E2udvHblEieW7VVDbDldZBOMcqTYmQc3csuzttWiLw48cN JujbWasyjacB7RsXy4cSpu6kH4IDVvFPDjHZG17uUVcs00U+h9nS4oDBv44iFjh3XRSP 3AoWQaXQX0MiGHcZCFApGtvHWY71q0wImLAiP+PLkfM7a2ut7EyDw4g1U8N49Nl8alHy XZWdG04ZfyTJKey0+ho1pe3321oZzxZ0Ayb2wX6EXaRywH5hePs2yDiTp6X8rUJ9yDFN AUbA== X-Gm-Message-State: AFqh2kogwNiZ5g48SCKXr6A1S6NTPGpDQZFAREhPFEgnI3GZUnaIV82R KcwvYKbpz2MSfGjpJJ2FM2UVDrTSl5jGD6x/ X-Google-Smtp-Source: AMrXdXtWZpLmZOVYfU2Hk78+D1PwQ6FbfuSi60lTXC9fSzitXHzc65JuGaZdp/XfVIob5NgZFrkcKQ== X-Received: by 2002:a17:90a:2e17:b0:227:7f5:9fdb with SMTP id q23-20020a17090a2e1700b0022707f59fdbmr5987951pjd.23.1673294922962; Mon, 09 Jan 2023 12:08:42 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Ilya Leoshkevich Subject: [PATCH v3 19/27] target/s390x: Introduce help_goto_indirect Date: Mon, 9 Jan 2023 12:08:11 -0800 Message-Id: <20230109200819.3916395-20-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230109200819.3916395-1-richard.henderson@linaro.org> References: <20230109200819.3916395-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1035; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1035.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1673295726940100003 Add a small helper to handle unconditional indirect jumps. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Ilya Leoshkevich Signed-off-by: Richard Henderson --- target/s390x/tcg/translate.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c index bbe39dd083..dd3bd9531b 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -1189,6 +1189,13 @@ static DisasJumpType help_goto_direct(DisasContext *= s, int64_t disp) } } =20 +static DisasJumpType help_goto_indirect(DisasContext *s, TCGv_i64 dest) +{ + tcg_gen_mov_i64(psw_addr, dest); + per_branch(s, false); + return DISAS_PC_UPDATED; +} + static DisasJumpType help_branch(DisasContext *s, DisasCompare *c, bool is_imm, int imm, TCGv_i64 cdest) { @@ -1219,9 +1226,7 @@ static DisasJumpType help_branch(DisasContext *s, Dis= asCompare *c, goto egress; } if (c->cond =3D=3D TCG_COND_ALWAYS) { - tcg_gen_mov_i64(psw_addr, cdest); - per_branch(s, false); - ret =3D DISAS_PC_UPDATED; + ret =3D help_goto_indirect(s, cdest); goto egress; } } @@ -1545,9 +1550,7 @@ static DisasJumpType op_bas(DisasContext *s, DisasOps= *o) { pc_to_link_info(o->out, s); if (o->in2) { - tcg_gen_mov_i64(psw_addr, o->in2); - per_branch(s, false); - return DISAS_PC_UPDATED; + return help_goto_indirect(s, o->in2); } else { return DISAS_NEXT; } @@ -1580,9 +1583,7 @@ static DisasJumpType op_bal(DisasContext *s, DisasOps= *o) { save_link_info(s, o); if (o->in2) { - tcg_gen_mov_i64(psw_addr, o->in2); - per_branch(s, false); - return DISAS_PC_UPDATED; + return help_goto_indirect(s, o->in2); } else { return DISAS_NEXT; } --=20 2.34.1 From nobody Sun May 19 10:14:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1673295938; cv=none; d=zohomail.com; s=zohoarc; b=lMBAyld6J5orHKFM6Ob4Y67EBHLrcBYRPYSscWUvLO6qf2fJdKU+/hSyMfggNcb9+zydofuEHSTBd5crES8hfY5X9MlP+dlhtEcH80e8bnZZcGCNjN6Yi/DUYAstnLSsAnspY9H7X/0l17T6Ko2Bq6LP2iA7FLXw2ZueX+iWD20= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673295938; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Y50Lp3m9kvjNtC3mDiVU9iejxX6y2luF3bPL5MUhbdU=; b=FXP6qIZPPcsDxaAa2ikDDoJvkEUI/A5JiANGWKMdLD6iTM4gwIFHxe3mtXHVMFlqnIRYZmzFtUUIrw8ah6R7KEoWTKazqiwZf9KI/i9gFPRdLqkpezTmDzogF5tXRTaSsLtQC9gKnwln2eArUDbuDY6LoGb9EgC5XCkNEHXZwtk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1673295938549330.1961414208324; Mon, 9 Jan 2023 12:25:38 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pEyRu-0003KX-8x; Mon, 09 Jan 2023 15:08:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pEyRq-0003D0-Ft for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:46 -0500 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pEyRo-0007NH-RS for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:46 -0500 Received: by mail-pl1-x636.google.com with SMTP id jn22so10737032plb.13 for ; Mon, 09 Jan 2023 12:08:44 -0800 (PST) Received: from stoup.. ([2602:47:d48c:8101:158e:facf:7a46:ba9f]) by smtp.gmail.com with ESMTPSA id l2-20020a17090a384200b0022727d4af8dsm577574pjf.48.2023.01.09.12.08.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Jan 2023 12:08:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Y50Lp3m9kvjNtC3mDiVU9iejxX6y2luF3bPL5MUhbdU=; b=ltRRooQv5yEuV+slonl/WThJ6As1kH+qXAG8GW8nrGo/8fQOab3HSPslZjBnUR1Ajg 3dE7zeGj+ZX/uF7UmMVmx+1tVT+VLQas/6pSd7YuvjtkUVYUk5f3PJzvUrMB5STXOBlU /QXuc1N46LSiRPeirNz/u3HpJlD7hjI7o6HXFfZ8RV3HHfTXG1gjWp467MskjwSMRDmo I5XZ5AsYIcLQk/MDJT2b6Zu+WOmo0/gaN6Ip8uXrTFaZLL2F11y0VVpCOOpTr6TqZD92 JxrxLHT916q8sin7Zq8lGb+r3mSNgIMU8B0AMI75/U8l93u6QvN9NtdnWNmKb/EuXHYb 5ZmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Y50Lp3m9kvjNtC3mDiVU9iejxX6y2luF3bPL5MUhbdU=; b=dr0k746v9gm+5gaRiGDhdqk7Kdq3O3nAe7zwJYp+ghTiWGaFrNAHkJIhLRLPxKppTw 2CYczDp/qzHh4UkBgGa3tDVBR7HVak9BrdcCkilM2QwkU2bfPNVj5IQbnPZBE/zlhQ24 lUfNI/VN27qx/sbJgzzX7stq9TjKDSQc23WqEIz+0rqCYf0/lmr/i+dwOpU4CqSA+La8 nNf48G0FH0geRaLmWKPX7Grr4BiT/eIcU958yEzmOlE9Bm49BI9QjqiPdI2uBKvg0GoV oqXGVqGbVQ6pCczEyQ+Y9wMKjNiLC/QLSLtyvKAtpCWMK1zjiQ8H8N3duaYiC8WrmYL0 IgSA== X-Gm-Message-State: AFqh2koeia7yBTgE3bkeu1pFAoofH03gDZzMaPIJs5HpzhuBDv5LzF8F 3uGXrjWYjTMyDvOL/6v7O3a02UPvOwEe/SgL X-Google-Smtp-Source: AMrXdXvd12USsB7Px4ZJdfxfDR3aGZjM95T9+UuThJgiDrziPT8wqaC7yXaQJYAJ47hlVUy4gDAUEQ== X-Received: by 2002:a17:90a:fe89:b0:226:e59a:f869 with SMTP id co9-20020a17090afe8900b00226e59af869mr12647703pjb.43.1673294923928; Mon, 09 Jan 2023 12:08:43 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Ilya Leoshkevich Subject: [PATCH v3 20/27] target/s390x: Split per_branch Date: Mon, 9 Jan 2023 12:08:12 -0800 Message-Id: <20230109200819.3916395-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230109200819.3916395-1-richard.henderson@linaro.org> References: <20230109200819.3916395-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::636; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x636.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1673295940269100003 Content-Type: text/plain; charset="utf-8" Split into per_branch_dest and per_branch_disp, which can be used for direct and indirect. In preperation for TARGET_TB_PCREL, call per_branch_* before indirect branches. Reviewed-by: Ilya Leoshkevich Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- target/s390x/tcg/translate.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c index dd3bd9531b..e3855f6e09 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -350,21 +350,25 @@ static inline bool per_enabled(DisasContext *s) #endif } =20 -static void per_branch(DisasContext *s, bool to_next) +static void per_branch_dest(DisasContext *s, TCGv_i64 dest) { #ifndef CONFIG_USER_ONLY gen_psw_addr_disp(s, gbea, 0); - if (per_enabled(s)) { - if (to_next) { - TCGv_i64 next_pc =3D tcg_temp_new_i64(); + gen_helper_per_branch(cpu_env, gbea, dest); + } +#endif +} =20 - gen_psw_addr_disp(s, next_pc, s->ilen); - gen_helper_per_branch(cpu_env, gbea, next_pc); - tcg_temp_free_i64(next_pc); - } else { - gen_helper_per_branch(cpu_env, gbea, psw_addr); - } +static void per_branch_disp(DisasContext *s, int64_t disp) +{ +#ifndef CONFIG_USER_ONLY + gen_psw_addr_disp(s, gbea, 0); + if (per_enabled(s)) { + TCGv_i64 dest =3D tcg_temp_new_i64(); + gen_psw_addr_disp(s, dest, disp); + gen_helper_per_branch(cpu_env, gbea, dest); + tcg_temp_free_i64(dest); } #endif } @@ -1172,7 +1176,7 @@ struct DisasInsn { static DisasJumpType help_goto_direct(DisasContext *s, int64_t disp) { if (disp =3D=3D s->ilen) { - per_branch(s, true); + per_branch_disp(s, disp); return DISAS_NEXT; } if (use_goto_tb(s, s->base.pc_next + disp)) { @@ -1184,7 +1188,7 @@ static DisasJumpType help_goto_direct(DisasContext *s= , int64_t disp) return DISAS_NORETURN; } else { update_psw_addr_disp(s, disp); - per_branch(s, false); + per_branch_dest(s, psw_addr); return DISAS_PC_UPDATED; } } @@ -1192,7 +1196,7 @@ static DisasJumpType help_goto_direct(DisasContext *s= , int64_t disp) static DisasJumpType help_goto_indirect(DisasContext *s, TCGv_i64 dest) { tcg_gen_mov_i64(psw_addr, dest); - per_branch(s, false); + per_branch_dest(s, psw_addr); return DISAS_PC_UPDATED; } =20 --=20 2.34.1 From nobody Sun May 19 10:14:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1673295362; cv=none; d=zohomail.com; s=zohoarc; b=IO+KyLQjjcOV/77gUEvy2wEu794j7ZISsPRCqYzBSUT38P1TNRUvMkGioGBwOX7kOghar0P0ZykXcVx0vMenzzGKAnYWVU7m0Q1UqqoodwGQCRIoJGorvwL7UPqM1JYp3BtMiCntVu430EvNbeAVzJ85nxUom8NlN3vgB/K7eas= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673295362; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=M5QVDR5p8K9NnSXHNw0nEbXh8IznLvlZ3YQDGipeghY=; b=Dix5O/YC1AGy3u7v9zLeaUWXqKHa3A/JbBWY7vlu6iMprQwW6JaWTwFxARRTicOEVgalgwDkPd8SRsjs4lf87wK1dMkoPo8hJ3kZrgg7wKuNKww2S5BUGKvFqqX3lXbTTASweDC+LdutNjLGLQDUJJsj048ui5vCZaEcPLjsU/Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1673295362583149.4536171050587; Mon, 9 Jan 2023 12:16:02 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pEyRt-0003JU-BE; Mon, 09 Jan 2023 15:08:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pEyRr-0003GC-Rz for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:47 -0500 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pEyRp-0007Z6-UO for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:47 -0500 Received: by mail-pl1-x62c.google.com with SMTP id d15so10764841pls.6 for ; Mon, 09 Jan 2023 12:08:45 -0800 (PST) Received: from stoup.. ([2602:47:d48c:8101:158e:facf:7a46:ba9f]) by smtp.gmail.com with ESMTPSA id l2-20020a17090a384200b0022727d4af8dsm577574pjf.48.2023.01.09.12.08.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Jan 2023 12:08:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=M5QVDR5p8K9NnSXHNw0nEbXh8IznLvlZ3YQDGipeghY=; b=wZSBkM82RsEeHCKB8IQdckG6GETiJcROTMDra/qu3c7VsXLw5mWfutyzMXVqtkeWUb iq3DkCMZxupmWXRXJ7OvBVX0lPwc3EV+ywFnSa/FKwfQdxtEyvULbF1FjVUwmYQR598+ mzCIWB4aW5AKTfPMnhlNdZl8MOCZ1q865EQdaU/Ox/MLLgoRD1r0WRR+AmfJHMt79rlH b3a6QtCn6AHcviE6Xc9d6wD+LCJ6EYH+gFedTbjdTpNADM2OccYsY8D8g4vXYlQUPxwa jOlVulIlO7LewSy1fxWi+L9L2fGrZwlmQQyGLrEAGEb5DRsCfLiylMlNGyXt8Z2lSGW7 Xl4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=M5QVDR5p8K9NnSXHNw0nEbXh8IznLvlZ3YQDGipeghY=; b=heevSonFzRydahohdqGeD0DgeXvc50SVrDDDUeSRnKbCWVyCGvJ6/bQxhHaUnTInvF oAKSswfMzVEVESuxIzhIN80kqW36jU/dOYcgzrAy+ryYlMxz2epEhipE9fMxbV94Q8Zv etxEgJ8tKQsLsr1WOnShkf7Q8UEltTCrsOHxUe+w9duw148uNA46lO20BD2vMGU/9yq8 BiMzQ/rEyxOzUfPam7kH9WW49r0IOP9KFGGRqVlUwHI1/1Vdz6FdQ9voJ6Vk1upF0VQ8 2dhcFxFG0JfZW09gDctG3xiWN46DufIjiSOxbZ9wY8+hxI9O5XMXYQOZgjDEg906UqgW XFCQ== X-Gm-Message-State: AFqh2kq7Uzfs1D9D+tuhV+usnnS54rbtXplrdFG0EKonUEGeiEw0Uy/z kYmGEzdHk/wpIC+EJINOPQ5C4yGQZjgTUso1 X-Google-Smtp-Source: AMrXdXv/RzG7hUSK1aLncxjHMH44QoIA7Y5K0KpymS2qDq0Bzn2LB+uq1baL0e/D2FBMuLTOU+pm7g== X-Received: by 2002:a05:6a20:3d17:b0:a4:efdd:a9b9 with SMTP id y23-20020a056a203d1700b000a4efdda9b9mr95105914pzi.44.1673294925006; Mon, 09 Jan 2023 12:08:45 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Ilya Leoshkevich Subject: [PATCH v3 21/27] target/s390x: Simplify help_branch Date: Mon, 9 Jan 2023 12:08:13 -0800 Message-Id: <20230109200819.3916395-22-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230109200819.3916395-1-richard.henderson@linaro.org> References: <20230109200819.3916395-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::62c; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1673295363866100001 Content-Type: text/plain; charset="utf-8" Always use a tcg branch, instead of movcond. The movcond was not a bad idea before PER was added, but since then we have either 2 or 3 actions to perform on each leg of the branch, and multiple movcond is inefficient. Reorder the taken branch to be fallthrough of the tcg branch. This will be helpful later with TARGET_TB_PCREL. Reviewed-by: Ilya Leoshkevich Signed-off-by: Richard Henderson --- target/s390x/tcg/translate.c | 154 ++++++++++------------------------- 1 file changed, 44 insertions(+), 110 deletions(-) diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c index e3855f6e09..aca2d214bb 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -373,28 +373,6 @@ static void per_branch_disp(DisasContext *s, int64_t d= isp) #endif } =20 -static void per_branch_cond(DisasContext *s, TCGCond cond, - TCGv_i64 arg1, TCGv_i64 arg2) -{ -#ifndef CONFIG_USER_ONLY - if (per_enabled(s)) { - TCGLabel *lab =3D gen_new_label(); - tcg_gen_brcond_i64(tcg_invert_cond(cond), arg1, arg2, lab); - - gen_psw_addr_disp(s, gbea, 0); - gen_helper_per_branch(cpu_env, gbea, psw_addr); - - gen_set_label(lab); - } else { - TCGv_i64 pc =3D tcg_temp_new_i64(); - - gen_psw_addr_disp(s, pc, 0); - tcg_gen_movcond_i64(cond, gbea, arg1, arg2, gbea, pc); - tcg_temp_free_i64(pc); - } -#endif -} - static void per_breaking_event(DisasContext *s) { #ifndef CONFIG_USER_ONLY @@ -1205,7 +1183,6 @@ static DisasJumpType help_branch(DisasContext *s, Dis= asCompare *c, { DisasJumpType ret; int64_t disp =3D (int64_t)imm * 2; - uint64_t dest =3D s->base.pc_next + disp; TCGLabel *lab; =20 /* Take care of the special cases first. */ @@ -1235,96 +1212,53 @@ static DisasJumpType help_branch(DisasContext *s, D= isasCompare *c, } } =20 - if (use_goto_tb(s, s->base.pc_next + s->ilen)) { - if (is_imm && use_goto_tb(s, dest)) { - /* Both exits can use goto_tb. */ - update_cc_op(s); + update_cc_op(s); =20 - lab =3D gen_new_label(); - if (c->is_64) { - tcg_gen_brcond_i64(c->cond, c->u.s64.a, c->u.s64.b, lab); - } else { - tcg_gen_brcond_i32(c->cond, c->u.s32.a, c->u.s32.b, lab); - } - - /* Branch not taken. */ - tcg_gen_goto_tb(0); - gen_psw_addr_disp(s, psw_addr, s->ilen); - tcg_gen_exit_tb(s->base.tb, 0); - - /* Branch taken. */ - gen_set_label(lab); - per_breaking_event(s); - tcg_gen_goto_tb(1); - gen_psw_addr_disp(s, psw_addr, disp); - tcg_gen_exit_tb(s->base.tb, 1); - - ret =3D DISAS_NORETURN; - } else { - /* Fallthru can use goto_tb, but taken branch cannot. */ - /* Store taken branch destination before the brcond. This - avoids having to allocate a new local temp to hold it. - We'll overwrite this in the not taken case anyway. */ - if (!is_imm) { - tcg_gen_mov_i64(psw_addr, cdest); - } - - lab =3D gen_new_label(); - if (c->is_64) { - tcg_gen_brcond_i64(c->cond, c->u.s64.a, c->u.s64.b, lab); - } else { - tcg_gen_brcond_i32(c->cond, c->u.s32.a, c->u.s32.b, lab); - } - - /* Branch not taken. */ - update_cc_op(s); - tcg_gen_goto_tb(0); - gen_psw_addr_disp(s, psw_addr, s->ilen); - tcg_gen_exit_tb(s->base.tb, 0); - - gen_set_label(lab); - if (is_imm) { - gen_psw_addr_disp(s, psw_addr, disp); - } - per_breaking_event(s); - ret =3D DISAS_PC_UPDATED; - } - } else { - /* Fallthru cannot use goto_tb. This by itself is vanishingly rar= e. - Most commonly we're single-stepping or some other condition that - disables all use of goto_tb. Just update the PC and exit. */ - - TCGv_i64 next =3D tcg_temp_new_i64(); - - gen_psw_addr_disp(s, next, s->ilen); - if (is_imm) { - cdest =3D tcg_temp_new_i64(); - gen_psw_addr_disp(s, cdest, disp); - } - - if (c->is_64) { - tcg_gen_movcond_i64(c->cond, psw_addr, c->u.s64.a, c->u.s64.b, - cdest, next); - per_branch_cond(s, c->cond, c->u.s64.a, c->u.s64.b); - } else { - TCGv_i32 t0 =3D tcg_temp_new_i32(); - TCGv_i64 t1 =3D tcg_temp_new_i64(); - TCGv_i64 z =3D tcg_constant_i64(0); - tcg_gen_setcond_i32(c->cond, t0, c->u.s32.a, c->u.s32.b); - tcg_gen_extu_i32_i64(t1, t0); - tcg_temp_free_i32(t0); - tcg_gen_movcond_i64(TCG_COND_NE, psw_addr, t1, z, cdest, next); - per_branch_cond(s, TCG_COND_NE, t1, z); - tcg_temp_free_i64(t1); - } - - tcg_temp_free_i64(next); - if (is_imm) { - tcg_temp_free_i64(cdest); - } - ret =3D DISAS_PC_UPDATED; + /* + * Store taken branch destination before the brcond. This + * avoids having to allocate a new local temp to hold it. + * We'll overwrite this in the not taken case anyway. + */ + if (!is_imm) { + tcg_gen_mov_i64(psw_addr, cdest); } =20 + lab =3D gen_new_label(); + if (c->is_64) { + tcg_gen_brcond_i64(tcg_invert_cond(c->cond), + c->u.s64.a, c->u.s64.b, lab); + } else { + tcg_gen_brcond_i32(tcg_invert_cond(c->cond), + c->u.s32.a, c->u.s32.b, lab); + } + + /* Branch taken. */ + if (is_imm) { + gen_psw_addr_disp(s, psw_addr, disp); + } + per_branch_dest(s, psw_addr); + + if (is_imm && use_goto_tb(s, s->base.pc_next + disp)) { + tcg_gen_goto_tb(0); + tcg_gen_exit_tb(s->base.tb, 0); + } else { + tcg_gen_lookup_and_goto_ptr(); + } + + gen_set_label(lab); + + /* Branch not taken. */ + if (use_goto_tb(s, s->base.pc_next + s->ilen)) { + tcg_gen_goto_tb(1); + gen_psw_addr_disp(s, psw_addr, s->ilen); + tcg_gen_exit_tb(s->base.tb, 1); + } else { + gen_psw_addr_disp(s, psw_addr, s->ilen); + tcg_gen_lookup_and_goto_ptr(); + } + + ret =3D DISAS_NORETURN; + egress: free_compare(c); return ret; --=20 2.34.1 From nobody Sun May 19 10:14:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1673295142; cv=none; d=zohomail.com; s=zohoarc; b=ZjgL9l9Kxmm5Hd0HHBzbIFUB6/XaKmNwIXBI8sFNIiz1zqAqOOeG6nZA8QYbkG4c5U86sSMFtUfAZFxOobzuCYwbKGcjZQTbbMIl7z6Iov1Kdorv5FawQfhwnoECehVO5QXpVaId8PAdwngv1j+MM3nQgxlj9v9iTrCNS9uqr+4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673295142; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=+SI0XUmUuaGz6hJl5x1dC7kSwvxrktFEO3C5LNkUTlA=; b=LbmYEmmtlazRFEiuTXDSAFwDgaBsfX1QK1ztdWO23jOor+EtXA7TCvgv58Jb39AMSw0kGV85MSIJmGALB+2B6VqkrYAsQGeiWJtam1tn+d6UHmXLaQEx0n0kuqJW4XECE2cokejkt//dM22AXQ1/vyaaAaqVcttz0GBwdfp7V5w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16732951424755.155230852380214; Mon, 9 Jan 2023 12:12:22 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pEyRv-0003LJ-0m; Mon, 09 Jan 2023 15:08:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pEyRt-0003Jg-DM for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:49 -0500 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pEyRr-0007dI-RK for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:49 -0500 Received: by mail-pl1-x634.google.com with SMTP id d15so10764904pls.6 for ; Mon, 09 Jan 2023 12:08:47 -0800 (PST) Received: from stoup.. ([2602:47:d48c:8101:158e:facf:7a46:ba9f]) by smtp.gmail.com with ESMTPSA id l2-20020a17090a384200b0022727d4af8dsm577574pjf.48.2023.01.09.12.08.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Jan 2023 12:08:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+SI0XUmUuaGz6hJl5x1dC7kSwvxrktFEO3C5LNkUTlA=; b=dRdUGTRlCxPXUAuczo3KgTRzA0OgMnJN9v+fJd06wlnnSCdPeH3IAPFVaDuuHDt5VU R2MYADF2Uh09fLWreHR6ZKalBSIC3sxK2XHt/eB/ns2xcibsscoTAb1kPW3drgWAs9PI fpzFlAV4ghQ6pW3IRBEUA2XEwLCd2JEUKtewB7oYin57k6+WVvfkiQOKeErCBG8fS2el VL5Jr/HOqvzvwLu38LqIULrTHJ8m3hYK4Ljw2Rp/Gn+ADwLIxDPldo2zm+MEkad+8U9r xHHA7RcRXAhA1K5sy0TuiodrIpxhyUxPfiX4t5/yCNnkPfJ1dWWKy0/9Ll1B9B81O212 bbBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+SI0XUmUuaGz6hJl5x1dC7kSwvxrktFEO3C5LNkUTlA=; b=g3lJ3HCSYjOFIk/nJ9RDYlNYmJ9rX93pGMUjDBqkVrOFmAEOIAn8Y4TcnSbhO/Cjip lhZtCcwB3Pjy3YVaJlHLoOzvRez/QlMG+rje5s6mRYyHYCmOfiSepV2M05ZpFw9VDbVG IxR0L6vHBZsIZx+T3fOA4fGmvkIBjlnu7arO+vyjwFbcAZVJDEyWqQosLxLk+CIckIn1 qi2BhIoAhTP3jbIiyV8Gbzu5B7tjVvBtIxRG/RPUxd8I4WunHqIape3bxo4wHkk1pfX1 3SUqElnko5WlwN34RCQKYnTtR3A+GYITiSQt1U1hlhSLHAM3F2InIASfueHcQ61Cs0L+ Gurg== X-Gm-Message-State: AFqh2kqjA6bj0vbFGeIe2Kja079qtCUmFk3199fSfYaReGRBvT1gjaQX xii1yPWrXkyLz87wpXZCOSXHwlqlQAVjumkp X-Google-Smtp-Source: AMrXdXsXvnKpgXOZ1zEfslDZCQQ98wd0uIIZBRjVMeTMRyV0QI3J7mSxmLFM6Y+jXqGGeAr+xAFf5w== X-Received: by 2002:a17:90a:630a:b0:225:c317:137c with SMTP id e10-20020a17090a630a00b00225c317137cmr60939706pjj.36.1673294925904; Mon, 09 Jan 2023 12:08:45 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Ilya Leoshkevich Subject: [PATCH v3 22/27] target/s390x: Split per_breaking_event from per_branch_* Date: Mon, 9 Jan 2023 12:08:14 -0800 Message-Id: <20230109200819.3916395-23-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230109200819.3916395-1-richard.henderson@linaro.org> References: <20230109200819.3916395-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::634; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x634.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1673295142754100001 Content-Type: text/plain; charset="utf-8" This allows us to update gbea before other updates to psw_addr, which will be important for TARGET_TB_PCREL. Reviewed-by: Ilya Leoshkevich Signed-off-by: Richard Henderson --- target/s390x/tcg/translate.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c index aca2d214bb..3b7591790d 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -353,7 +353,6 @@ static inline bool per_enabled(DisasContext *s) static void per_branch_dest(DisasContext *s, TCGv_i64 dest) { #ifndef CONFIG_USER_ONLY - gen_psw_addr_disp(s, gbea, 0); if (per_enabled(s)) { gen_helper_per_branch(cpu_env, gbea, dest); } @@ -363,7 +362,6 @@ static void per_branch_dest(DisasContext *s, TCGv_i64 d= est) static void per_branch_disp(DisasContext *s, int64_t disp) { #ifndef CONFIG_USER_ONLY - gen_psw_addr_disp(s, gbea, 0); if (per_enabled(s)) { TCGv_i64 dest =3D tcg_temp_new_i64(); gen_psw_addr_disp(s, dest, disp); @@ -1153,13 +1151,14 @@ struct DisasInsn { =20 static DisasJumpType help_goto_direct(DisasContext *s, int64_t disp) { + per_breaking_event(s); + if (disp =3D=3D s->ilen) { per_branch_disp(s, disp); return DISAS_NEXT; } if (use_goto_tb(s, s->base.pc_next + disp)) { update_cc_op(s); - per_breaking_event(s); tcg_gen_goto_tb(0); update_psw_addr_disp(s, disp); tcg_gen_exit_tb(s->base.tb, 0); @@ -1173,6 +1172,7 @@ static DisasJumpType help_goto_direct(DisasContext *s= , int64_t disp) =20 static DisasJumpType help_goto_indirect(DisasContext *s, TCGv_i64 dest) { + per_breaking_event(s); tcg_gen_mov_i64(psw_addr, dest); per_branch_dest(s, psw_addr); return DISAS_PC_UPDATED; @@ -1233,6 +1233,7 @@ static DisasJumpType help_branch(DisasContext *s, Dis= asCompare *c, } =20 /* Branch taken. */ + per_breaking_event(s); if (is_imm) { gen_psw_addr_disp(s, psw_addr, disp); } --=20 2.34.1 From nobody Sun May 19 10:14:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1673295709; cv=none; d=zohomail.com; s=zohoarc; b=FHtBJo9xmwWlZ9LuTmo9RuCfBrXBEZWBPjNSDA6AvgCBVhakOVH0m5sEEJsff2eodDpRFuIeO5SWNJuSIUKIXJxf7YJU3EgZenojuZp9xPhir2xCHL/ii6hWbeXwWrV4NmMMZFpPX1PnFw/w+VRA96EQWsVTLT5ye/npXvD/Lqk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673295709; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=bgQOHiO8qTwsgUx9kJDYlFOqQZeKGAhI8ggOyt7Pfe4=; b=acWi8BB75SnNQEYctlREzWRvzWEFd3Gh+0sEVOvVzOYTMt6gKUuScsFdCIx3IY2qUPHMwTnSTrJF72hQWRLfik4JVHPKJXmQdqinf/neT692iRUdG9FsPVlpGjs3VjL9rt00eMO0fGcg/jc6j31zxxlgSQE1DS4MbkNPiRHki9M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1673295709880368.50179831456717; Mon, 9 Jan 2023 12:21:49 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pEyRw-0003Ly-Ha; Mon, 09 Jan 2023 15:08:52 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pEyRu-0003KV-Cz for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:50 -0500 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pEyRs-0007Nn-Ah for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:49 -0500 Received: by mail-pj1-x1036.google.com with SMTP id dw9so8511990pjb.5 for ; Mon, 09 Jan 2023 12:08:47 -0800 (PST) Received: from stoup.. ([2602:47:d48c:8101:158e:facf:7a46:ba9f]) by smtp.gmail.com with ESMTPSA id l2-20020a17090a384200b0022727d4af8dsm577574pjf.48.2023.01.09.12.08.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Jan 2023 12:08:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bgQOHiO8qTwsgUx9kJDYlFOqQZeKGAhI8ggOyt7Pfe4=; b=odaz2PCyxp6C8xixvGh8SkRqDEy2tCgzTQgw61zcwKrgiH528N1riDhhSLDS+Xq5CI 9VbeTUGkn3oN+Zj3UbU7Vvx7BtwTLnbFq0/Js/R38Whet1Qvb7Gkz6E18BRnHBrj3seW KXKOicXDZkt7JEzD/SUY/576Zo87HS5CpMGOzgmU1jz9mr7I/OQ+q7lhZa6KcNebId61 WLwalf/qFNIiMk+GP/3ABUBH6K2+TJNcFj2sbkBT/Zw5WMo0iJcb9fB7ViBp6MNE//F5 REawlbXyQsvKpbCTVON1ITFUPYOG/FLtJO+s07lZfiU36lpXxW8q/We5/7mrjHCZB2vB 4cWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bgQOHiO8qTwsgUx9kJDYlFOqQZeKGAhI8ggOyt7Pfe4=; b=H7cmKg9nF57vwDKrGsUyrBH6VNBliJDSX8BjsibzypbxPsaVerY7wlPKuixVL4JNhR KR68LQorEfkFBW20XK8Y7RGfXfGKOLh29weCgciQvHtFLNc5zuE2+oJPrDLRPkqq2Lnc FINmjdcmguxVo4QMb46qIPOPunnFFN1+QAJRVXan6c00u5Q0CRpxXZkkMjWvn96tOqgd CBaRBbBc+xTH/WCFJI/r0uyi7Mu75mR9E9Z4dI8Lm3U5uvJqKVmvz+412XDyvU4U/2M+ GsTLS4kIuHCc+SwDXlmeGV7zBm3IXI+oG7mrfeXryEAdWUA11rO6JlJTPc8CFntNE80g v3AQ== X-Gm-Message-State: AFqh2kqX5hUCVA4QexCBP1o5Y2RhAR9UR0VwJPxP7pk8ZQYOeh1S4dH6 iRCaYhcJvey0fs8Y1bEg+31c2nY9n09pCeWE X-Google-Smtp-Source: AMrXdXuDNpeouKAWKzOZAPLkYC+uS4lfvJoSFPqSRdZn/fEcEGQzUQUKN/ZacWDfxTLhl4qYR4MsOw== X-Received: by 2002:a17:90b:b11:b0:226:482:760f with SMTP id bf17-20020a17090b0b1100b002260482760fmr46026809pjb.10.1673294926992; Mon, 09 Jan 2023 12:08:46 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Ilya Leoshkevich Subject: [PATCH v3 23/27] target/s390x: Remove PER check from use_goto_tb Date: Mon, 9 Jan 2023 12:08:15 -0800 Message-Id: <20230109200819.3916395-24-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230109200819.3916395-1-richard.henderson@linaro.org> References: <20230109200819.3916395-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1036; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1036.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1673295711542100003 Content-Type: text/plain; charset="utf-8" While it is common for the PC update to happen in the shadow of a goto_tb, it is not required to be there. By moving it before the goto_tb, we can also place the call to helper_per_branch there, and then afterward chain to the next tb. Reviewed-by: Ilya Leoshkevich Signed-off-by: Richard Henderson --- target/s390x/tcg/translate.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c index 3b7591790d..3d9a79af42 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -654,9 +654,6 @@ static void gen_op_calc_cc(DisasContext *s) =20 static bool use_goto_tb(DisasContext *s, uint64_t dest) { - if (per_enabled(s)) { - return false; - } return translator_use_goto_tb(&s->base, dest); } =20 @@ -1157,15 +1154,16 @@ static DisasJumpType help_goto_direct(DisasContext = *s, int64_t disp) per_branch_disp(s, disp); return DISAS_NEXT; } + + update_psw_addr_disp(s, disp); + per_branch_dest(s, psw_addr); + if (use_goto_tb(s, s->base.pc_next + disp)) { update_cc_op(s); tcg_gen_goto_tb(0); - update_psw_addr_disp(s, disp); tcg_gen_exit_tb(s->base.tb, 0); return DISAS_NORETURN; } else { - update_psw_addr_disp(s, disp); - per_branch_dest(s, psw_addr); return DISAS_PC_UPDATED; } } --=20 2.34.1 From nobody Sun May 19 10:14:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1673295642; cv=none; d=zohomail.com; s=zohoarc; b=SO6gO9Qrp9kpJvgHaQ/VCs8j8dR43xJO1p8PhTwIiV3cZ8djXmGkeS/uRn+Z/LWAEoMw7PCYV3rvn70H4Z9bi2CXEh8QCmr9ZmLGmH7k8DSh4PVGLkb7i3hzmAW7HUv45DoRxRR0uzUIc0XbK+ueNTZBTzxmizft7YSV9M6P/w0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673295642; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=qoDF/rY8HtyNlykYqkZFXY86Nrt61o0/K7nWThd7Dr8=; b=B9sXwdrtWkfaT8k+nYIqPm2dgpwo9VA9UPUPlJQQCQ8Eu5MRnPWVBnc/OqVF8aI078OdL6RB7Sm8GyZXyqpVedJwnd0o9O8jYPme1g8h4+hjbNz0e6hkq7sqyu6H5JuagRkjJqdm6/l/j+hQbfvpsUNIyHQkV7hnoQjOFnAKu8Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1673295642006805.8653642931266; Mon, 9 Jan 2023 12:20:42 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pEyRv-0003Lb-RU; Mon, 09 Jan 2023 15:08:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pEyRu-0003Ko-I7 for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:50 -0500 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pEyRs-0007Yi-Sm for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:50 -0500 Received: by mail-pj1-x1030.google.com with SMTP id o1-20020a17090a678100b00219cf69e5f0so13994700pjj.2 for ; Mon, 09 Jan 2023 12:08:48 -0800 (PST) Received: from stoup.. ([2602:47:d48c:8101:158e:facf:7a46:ba9f]) by smtp.gmail.com with ESMTPSA id l2-20020a17090a384200b0022727d4af8dsm577574pjf.48.2023.01.09.12.08.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Jan 2023 12:08:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qoDF/rY8HtyNlykYqkZFXY86Nrt61o0/K7nWThd7Dr8=; b=C55XT/Y8pcqTS9wJxPULL0JkLdEKLwdtO7ffSpOz8+67bzCfu25VFz7xovjoLLPE8F KraNpNs/qV0kAlaSKTN+inChsSFrNfkvnMJlRetxxzdhO5NxYVVNqnk4ZZxwwXu6LJzW XLnikOCG/RRiGeRgzcG1YdUoDJumPQGUYJfEqPdt/zrmay9ZLOifTMGrk8bhFdQ1CTDR KGzsZZlVWrHNalLg3EPgriciEtA4Vc5KOL8AuYen4CJhyBiEvK37YHMCwm/s7Br2Pyzs AL9BVtIz/lZ5ZaOsPAuTskxRuCzYewTeTp/xa7T6bBCesS/P7GjRitn4J5w8/75AXDuv Xmwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qoDF/rY8HtyNlykYqkZFXY86Nrt61o0/K7nWThd7Dr8=; b=E3+IiBQHAj29taewJ4RzUucmkczwEDv/RLZ4n22VYUf7vo0SRcmpJmdeA6quUGhVuv BtkGc6n1P8JkuRQqJkbywKrV2IM4jk+vqrhk7Opt2TzWsLifpMLPwZ3lcdDwRHQ72ciW yR0WklchuVeKDh6yLo95s5a3DbGrC1xWtKAtZ7AXKa5WTRSIPZWniUYU60vf+qHhyZ42 8jC2/5lA3eqOPYYi1rO1u+p4LGEP37czVMzqQF8I0WcRoAKDD5sY3bxejIP9msG67KV1 EBM2mLbqIURhMleEtBgdzwnuA4jGxjUzMfig7PWm84E/YDzJPc1sv9LtNE5KOVLWG2TW hFeg== X-Gm-Message-State: AFqh2koqAgnu3ZSG3QRZHoTFHcqhLmCDt04uuJIQQNoUpMgyCODR6iU3 p83n9wJ8Uu46orf2T1AJV8SBOQFAeUbZN2QE X-Google-Smtp-Source: AMrXdXucUQJkRWBa2G0aQi9Unc8coCQcIiL2f1k5geenKb0uxeMpYmgzjlX+QYfsVI6iUZMyUKJo+A== X-Received: by 2002:a17:90a:7849:b0:226:3a7c:f248 with SMTP id y9-20020a17090a784900b002263a7cf248mr42388845pjl.24.1673294928131; Mon, 09 Jan 2023 12:08:48 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Ilya Leoshkevich Subject: [PATCH v3 24/27] target/s390x: Fix successful-branch PER events Date: Mon, 9 Jan 2023 12:08:16 -0800 Message-Id: <20230109200819.3916395-25-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230109200819.3916395-1-richard.henderson@linaro.org> References: <20230109200819.3916395-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1030; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1030.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1673295643100100001 Content-Type: text/plain; charset="utf-8" From: Ilya Leoshkevich The branching code sets per_perc_atmid, but afterwards it does goto_tb/exit_tb, so per_check_exception() added by translate_one() is not reached. Fix by raising PER exception in per_branch(). Signed-off-by: Ilya Leoshkevich Message-Id: <20221130174610.434590-1-iii@linux.ibm.com> Signed-off-by: Richard Henderson --- target/s390x/tcg/misc_helper.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/s390x/tcg/misc_helper.c b/target/s390x/tcg/misc_helper.c index 576157b1f3..e5015daf07 100644 --- a/target/s390x/tcg/misc_helper.c +++ b/target/s390x/tcg/misc_helper.c @@ -618,6 +618,7 @@ void HELPER(per_branch)(CPUS390XState *env, uint64_t fr= om, uint64_t to) || get_per_in_range(env, to)) { env->per_address =3D from; env->per_perc_atmid =3D PER_CODE_EVENT_BRANCH | get_per_atmid(= env); + tcg_s390_program_interrupt(env, PGM_PER, GETPC()); } } } --=20 2.34.1 From nobody Sun May 19 10:14:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1673295538; cv=none; d=zohomail.com; s=zohoarc; b=BzRgtWbAqiMsWDULXqetbr+rTA1F1JS6kc1/pajMBxPRCKX6ijHuxEr/NdMkuZu7m5cAhIMXHOmi7WDRh0Wo8n6GJLBhK1e5GfqyrksLzykjWV2gDnsHzAWE8n66x/Sr65hUzsbWG04k9ve4P2kqele4fBO+6N1h8Kizt+XpwBg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673295538; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=6a8SyY9eZgzz8AJukTfXtGKf9OCDu+smgkxjoQH9ksA=; b=TFSlZI5AU8iKMqVoKljiZ28Ju3VuMVdTrtkX2EzrmylWso2CCxnRPew214jV1Ij6n7zaeRY3q5+kLKuPhcwkt+BafBJL4I16Sx9dmHqE++et5OGTiPvcYB9dEBRzFjjwJBAtXC4FVw/NWgbWKoh7guFJc1/jyJePulFQVe/o97Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1673295537992225.6265041281231; Mon, 9 Jan 2023 12:18:57 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pEyRy-0003ND-4J; Mon, 09 Jan 2023 15:08:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pEyRv-0003Lc-QY for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:51 -0500 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pEyRu-0007dI-0z for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:51 -0500 Received: by mail-pl1-x634.google.com with SMTP id d15so10765064pls.6 for ; Mon, 09 Jan 2023 12:08:49 -0800 (PST) Received: from stoup.. ([2602:47:d48c:8101:158e:facf:7a46:ba9f]) by smtp.gmail.com with ESMTPSA id l2-20020a17090a384200b0022727d4af8dsm577574pjf.48.2023.01.09.12.08.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Jan 2023 12:08:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6a8SyY9eZgzz8AJukTfXtGKf9OCDu+smgkxjoQH9ksA=; b=CKutZpt7GvKGaNE9Cacl+mzJmQuG9z7hV6gNd93dFUJhjFoENkM1nnZvj2t4D1dNEX yu0NbyIQk8x3jRcLURk6S0eUyP6xtNbHfardxHxZ8r8BYKieVp0p4Moy4rJD9tHzMgIB ik1kT0RB4wz5Cd6KMvQT7oqBYk7ZvUkcOF0vqVzlQ45qu5DQGpaG5i0kWCW9qBBwKRT9 glfjukXWn1qbSSLSVLtli/NraA7tSyzx8LI/pSQrk8HiHpy7Xb9hb7J8OS2iiyW8REiX gukRM5zUaWNpEBc72nwETHzVwtLLL2m0pyXIeSMDhdx1qXFKE4wfn0LCzneedBVI9WWE sO5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6a8SyY9eZgzz8AJukTfXtGKf9OCDu+smgkxjoQH9ksA=; b=gKkFUPYXVeg/QKFT8/JTK/196xvnCMtQIP3VYYMuWBVyEGAoN2B18rQKc4KfXELEBE Dylg+NV6jCoQzPNpD4k2C4lt8+dm1579s45icq05x66HQoDEvwRYzXebsMqYFQAuGOsS 3DsH6/ainOG8V0XpFMn4FEjIHJKbr/gFUgwpFORMae15/16Ccr93VAt6Jy7PYhILMLg0 +fq8XDciq5vkJe7RcHIz/R17yHUaJEZfMpwY8fnUICIa90KhNPn8gvlMJiLtlwBIHuJ1 dvjhfKDrb3ObnGh/hcuHWDr/HvmieZ68Po1UuLrejTznLrj62mlgK+7nRHoo+sd60WBb w1Zw== X-Gm-Message-State: AFqh2kpb/U61XIZG9lSDkZUlTeK9B5cw36zC8Z4lUcRgTU5IrgjaPoul v5Ojb8pXR1TErcEOQsy1hC1ev4nWJJcZNi7q X-Google-Smtp-Source: AMrXdXtAEOMO1PyyaCznZIgpBzofXYYZgh0XUI5NoxjgaFjz6NmcoIFshgAxmkRSsu1GFB/iMEzVog== X-Received: by 2002:a17:90b:2645:b0:226:f523:28c5 with SMTP id pa5-20020a17090b264500b00226f52328c5mr8803915pjb.22.1673294928995; Mon, 09 Jan 2023 12:08:48 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Ilya Leoshkevich Subject: [PATCH v3 25/27] tests/tcg/s390x: Add per.S Date: Mon, 9 Jan 2023 12:08:17 -0800 Message-Id: <20230109200819.3916395-26-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230109200819.3916395-1-richard.henderson@linaro.org> References: <20230109200819.3916395-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::634; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x634.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1673295538824100001 Content-Type: text/plain; charset="utf-8" From: Ilya Leoshkevich Add a small test to avoid regressions. Signed-off-by: Ilya Leoshkevich Message-Id: <20221130174610.434590-2-iii@linux.ibm.com> Signed-off-by: Richard Henderson --- tests/tcg/s390x/Makefile.softmmu-target | 1 + tests/tcg/s390x/per.S | 55 +++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 tests/tcg/s390x/per.S diff --git a/tests/tcg/s390x/Makefile.softmmu-target b/tests/tcg/s390x/Make= file.softmmu-target index d6ca8d7342..7ee69e78d8 100644 --- a/tests/tcg/s390x/Makefile.softmmu-target +++ b/tests/tcg/s390x/Makefile.softmmu-target @@ -9,3 +9,4 @@ QEMU_OPTS=3D-action panic=3Dexit-failure -kernel TESTS +=3D unaligned-lowcore TESTS +=3D bal TESTS +=3D sam +TESTS +=3D per diff --git a/tests/tcg/s390x/per.S b/tests/tcg/s390x/per.S new file mode 100644 index 0000000000..02f8422c44 --- /dev/null +++ b/tests/tcg/s390x/per.S @@ -0,0 +1,55 @@ +#define N_ITERATIONS 10 + + .org 0x8d +ilc: + .org 0x8e +program_interruption_code: + .org 0x96 +per_code: + .org 0x150 +program_old_psw: + .org 0x1d0 /* program new PSW */ + .quad 0,pgm_handler + .org 0x200 /* lowcore padding */ + + .globl _start +_start: + lpswe per_on_psw +start_per: + lghi %r0,N_ITERATIONS + xgr %r1,%r1 + lctlg %c9,%c11,per_on_regs +loop: + brct %r0,loop + lctlg %c9,%c11,per_off_regs + cgijne %r1,N_ITERATIONS-1,fail /* expected number of events? */ + lpswe success_psw +fail: + lpswe failure_psw + +pgm_handler: + chhsi program_interruption_code,0x80 /* PER event? */ + jne fail + cli per_code,0x80 /* successful-branching event? */ + jne fail + la %r1,1(%r1) /* increment event counter */ + mvc return_psw(8),program_old_psw + lg %r3,program_old_psw+8 + llgc %r2,ilc + sgr %r3,%r2 /* rewind PSW */ + stg %r3,return_psw+8 + lpswe return_psw + + .align 8 +per_on_psw: + .quad 0x4000000000000000,start_per +per_on_regs: + .quad 0x80000000,0,-1 /* successful-branching everywhere = */ +per_off_regs: + .quad 0,0,0 +return_psw: + .quad 0,0 +success_psw: + .quad 0x2000000000000,0xfff /* see is_special_wait_psw() */ +failure_psw: + .quad 0x2000000000000,0 /* disabled wait */ --=20 2.34.1 From nobody Sun May 19 10:14:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1673295473; cv=none; d=zohomail.com; s=zohoarc; b=Sfj7Qip75yf8Icaz/KTlLgNSlvvJfHQYmr2iVYklnji41J+tXX/Eh3qOcpCu5vVXUzGqCc81JMrZEe5Xrqz9XPMnWqlgA7Id5D9RiRmkZuhIAt1lNv+8xrRFq26afZWDeubY80vGac1gHhZjP8c095BQTU+iAI/Z+w6yIkg0KY8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673295473; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=hj+kl1Rsv/DprYRzUBEWVOIFytk4nYZYRE9FcH6D9mQ=; b=AZkvcePvUupQudyKDTTY/3JK9tXao0Gg2B1q86eNwQp+tKizO4HlZmP09apBqsZuT7i2OwVDiltSNE89soxu+tjRmD/hDoOVE+OUg3wwtyf/jlmL/cAjH2dB3/+WsjQmyt1QKxwNUSVvz/+3jtxw/yDKYeHAT7NuAlnndce1JLo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1673295473692525.0191394757186; Mon, 9 Jan 2023 12:17:53 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pEyRy-0003NW-FZ; Mon, 09 Jan 2023 15:08:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pEyRw-0003MX-Uo for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:52 -0500 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pEyRv-0007fP-El for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:52 -0500 Received: by mail-pj1-x102c.google.com with SMTP id v23so9937082pju.3 for ; Mon, 09 Jan 2023 12:08:50 -0800 (PST) Received: from stoup.. ([2602:47:d48c:8101:158e:facf:7a46:ba9f]) by smtp.gmail.com with ESMTPSA id l2-20020a17090a384200b0022727d4af8dsm577574pjf.48.2023.01.09.12.08.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Jan 2023 12:08:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hj+kl1Rsv/DprYRzUBEWVOIFytk4nYZYRE9FcH6D9mQ=; b=RmfEhc/66yF/ZbUvH7CiltLFfFe6sij8sHIMJO6FfeH7lfGqIAPrEorMS3qytaPUqB d7/bD9T43ps/mIysn4feKmc6KdJMRhjFVwjmM6cVXCscex8w2TY/eCfu0hDju/u9fxEe XrTgjsfNmTevDOhyCvPgOYSO0K04+9gpD9324hnTzVsLt1/Ia2KMXsbMNeBKsU4G517/ mZ7Jab3DeK42rhEdhbfblNNlpBHZtM0n8Ch7sfgfi7iYb/voUTCN7bDGKVSzgU7oJb7S KfgyRkgQAnFOnsLvNzt7GXtH28P1hF1LBabFPdd7apNlbJHw5X95VFsWl2NfPBdKLtYA G9xQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hj+kl1Rsv/DprYRzUBEWVOIFytk4nYZYRE9FcH6D9mQ=; b=ev0MQB8tp13z5dBWxnyXUpFZZMFKUHFM2auXib423DmmqoVWKHU6unn8c4/XCZ5+IE i7KMFD0GybtSseajmIJZnhpLnzcRJRq2a378H6Sfex7iegQICCjqHRMeeoiM0T2ByXZ/ jfnAy3QKK3MsUMO1mwP9NhRTZqeVpPwIvY0OudQ0nXNC55yBy+wK2RYzM9zNwo56/1vu U1YIdBfA0ZZX5ZSdN4Y3PLIa/7cn1VeKIYPdC3dE+aJZ0BYb7EfOEtx+uAAx47NHqjWd lBitFdAznq+w8bMOTsZdRLH6yjqhAnwVYlLB2XWgZ2x2f1f90i4jwSjKXRpPTON+YuIC zcIQ== X-Gm-Message-State: AFqh2kppLR8hPeqHHu0EM4oow0+jv9sGh5QhI2CzwVlGsgRNrmf8c4fU dCPZ49gh9q3oDUmZIzyJJa8S251cLWuZG4/A X-Google-Smtp-Source: AMrXdXtjuD4GDu8IBrKSh8bSEirRW9qO7lUb8e1ptl7SQMWx+gKLwfJVBeBiJCdSl11eRb+j7/5pLw== X-Received: by 2002:a17:90b:2747:b0:21a:1b9b:139e with SMTP id qi7-20020a17090b274700b0021a1b9b139emr68702342pjb.8.1673294929907; Mon, 09 Jan 2023 12:08:49 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Ilya Leoshkevich Subject: [PATCH v3 26/27] target/s390x: Pass original r2 register to BCR Date: Mon, 9 Jan 2023 12:08:18 -0800 Message-Id: <20230109200819.3916395-27-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230109200819.3916395-1-richard.henderson@linaro.org> References: <20230109200819.3916395-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102c; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1673295474413100001 Content-Type: text/plain; charset="utf-8" We do not modify any general-purpose registers in BCR, which means that we may be able to avoid saving the value across a branch. Reviewed-by: Ilya Leoshkevich Signed-off-by: Richard Henderson --- target/s390x/tcg/insn-data.h.inc | 2 +- target/s390x/tcg/translate.c | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/target/s390x/tcg/insn-data.h.inc b/target/s390x/tcg/insn-data.= h.inc index 79c6ab509a..a03a19e9b9 100644 --- a/target/s390x/tcg/insn-data.h.inc +++ b/target/s390x/tcg/insn-data.h.inc @@ -121,7 +121,7 @@ /* BRANCH INDIRECT ON CONDITION */ C(0xe347, BIC, RXY_b, MIE2,0, m2_64w, 0, 0, bc, 0) /* BRANCH ON CONDITION */ - C(0x0700, BCR, RR_b, Z, 0, r2_nz, 0, 0, bc, 0) + C(0x0700, BCR, RR_b, Z, 0, r2_o_nz, 0, 0, bc, 0) C(0x4700, BC, RX_b, Z, 0, a2, 0, 0, bc, 0) /* BRANCH RELATIVE ON CONDITION */ C(0xa704, BRC, RI_c, Z, 0, 0, 0, 0, bc, 0) diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c index 3d9a79af42..afed4e2981 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -5706,6 +5706,16 @@ static void in2_r2_nz(DisasContext *s, DisasOps *o) } #define SPEC_in2_r2_nz 0 =20 +static void in2_r2_o_nz(DisasContext *s, DisasOps *o) +{ + int r2 =3D get_field(s, r2); + if (r2 !=3D 0) { + o->in2 =3D regs[r2]; + o->g_in2 =3D true; + } +} +#define SPEC_in2_r2_o_nz 0 + static void in2_r2_8s(DisasContext *s, DisasOps *o) { o->in2 =3D tcg_temp_new_i64(); --=20 2.34.1 From nobody Sun May 19 10:14:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1673294988; cv=none; d=zohomail.com; s=zohoarc; b=GGWp5FGhPDK+8WcmbxrrHC4xTSpHWaSaQMxlcobk0m7IEMLEcE68/3tc2vPoWtBfgzfyHDUtYd+J95FYwT0mGK3ijAxrUT2hK1knph6NhdNEMEiH27cgMBA4xAc9d/YT4oZbd4dcUopZJ4S/DLoRodbUj/B+PTNhDFLeojw1BqM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673294988; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=XA3AgmTJV6twi3UhuBbD+P3p6iyT4YFKtf10vXvXuoA=; b=HC8e3l+xoe6Ll+vO6ZgUy9P38BM5MmQncaVmDR5/4HMzuBCzsnqaojhOs3Y4FndUgvPq23167e4BHOeWjnvWrej0jNJUJVoq3BeFnRvukqTDZAmE9KCjh4/0CEKygLluD8OiZ39XS/Be0MHEc6dYBTl41msLBSUp7eHI+HRYnvQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1673294988735292.8041221668959; Mon, 9 Jan 2023 12:09:48 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pEyRz-0003O0-7p; Mon, 09 Jan 2023 15:08:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pEyRx-0003Mx-Le for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:53 -0500 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pEyRv-0007Xk-ND for qemu-devel@nongnu.org; Mon, 09 Jan 2023 15:08:53 -0500 Received: by mail-pl1-x62e.google.com with SMTP id y1so10783262plb.2 for ; Mon, 09 Jan 2023 12:08:51 -0800 (PST) Received: from stoup.. ([2602:47:d48c:8101:158e:facf:7a46:ba9f]) by smtp.gmail.com with ESMTPSA id l2-20020a17090a384200b0022727d4af8dsm577574pjf.48.2023.01.09.12.08.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Jan 2023 12:08:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XA3AgmTJV6twi3UhuBbD+P3p6iyT4YFKtf10vXvXuoA=; b=Bu1k6uOG8wU0Zt+ABdGzlgPfPQAWfkLnloPxp+xg0xHkab9RiML2BiuETgg1pvHwKF USOfhZ+YSeF1SNpnT8u498HiMGY0txa2+LhfLm+x55M6MMNty7T2KUAbJFz7UAJ92s6H MF6dWonrA36uu80o23uVi6mLM3a/xSi/TrUGw4htmEW/yizp5fz1/LI0ZWvhemL7aH46 4hOtANVDtn37/M+Mj1p63H5cDWnEaeihRI0QvSOjJzLJqk2RuSpJSvlVMq3lMVVMOS+P 7RGDvthn6MqQI1wJcDHZUiCuKnoGpW0Kf2gTE9mpGB4T72yH6Cr+c+5d2hYuCakdWmKv /3Jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XA3AgmTJV6twi3UhuBbD+P3p6iyT4YFKtf10vXvXuoA=; b=0QwFRmT7A+eVErU2cHYnMGvlMgk8teIBVTO+Mz1tIS9bl3oOm+GZqHQovFqLMyN0aP rKThYUFNoaqG16+RLf+bKIVaHDFJxhY69X13eSpkogLfaHzdvQbE6/4jLzp/mtybFEQ4 UgS2t5LamGCH4ffuDcIY11WaJLr1o+R5kHY+lLORGRbitALwwsbSZF21VLVJqAYq49KV 7KVX++dHPhrkbT7/skPQ8bCmuNvtu49yYMsfJ4gDAoMPEdzevfvZo18dX8EsKNd3ESq7 RBhyJq5SFmf1WKtBYR+zKhhZgSSm+HmM62B0bQnp7XOS3+Q+7OanHyEQWYSAZ8cleorg cKng== X-Gm-Message-State: AFqh2koINtuVkpga8bI3i7gcDLPkFmnZ2hPRu85LqYznw/KADUWMtu3C bbe4Psq9IaD/4w8ANuLjfwaKB9f5uhX6kuVj X-Google-Smtp-Source: AMrXdXuav440RoZWuJHB9gQV7JilrxhWiBfDmd2fKIef/J3pr5gtYbL9DobY075EHhw/KbJ4AQLeuA== X-Received: by 2002:a17:90a:b10b:b0:225:cc25:802f with SMTP id z11-20020a17090ab10b00b00225cc25802fmr58368419pjq.28.1673294930811; Mon, 09 Jan 2023 12:08:50 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Ilya Leoshkevich Subject: [PATCH v3 27/27] target/s390x: Enable TARGET_TB_PCREL Date: Mon, 9 Jan 2023 12:08:19 -0800 Message-Id: <20230109200819.3916395-28-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230109200819.3916395-1-richard.henderson@linaro.org> References: <20230109200819.3916395-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::62e; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1673294989744100001 Content-Type: text/plain; charset="utf-8" Reviewed-by: Ilya Leoshkevich Signed-off-by: Richard Henderson --- target/s390x/cpu-param.h | 4 ++ target/s390x/cpu.c | 12 +++++ target/s390x/tcg/translate.c | 86 +++++++++++++++++++++++------------- 3 files changed, 71 insertions(+), 31 deletions(-) diff --git a/target/s390x/cpu-param.h b/target/s390x/cpu-param.h index bf951a002e..52bb95de57 100644 --- a/target/s390x/cpu-param.h +++ b/target/s390x/cpu-param.h @@ -14,4 +14,8 @@ #define TARGET_VIRT_ADDR_SPACE_BITS 64 #define NB_MMU_MODES 4 =20 +#ifndef CONFIG_USER_ONLY +# define TARGET_TB_PCREL 1 +#endif + #endif diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index b10a8541ff..933ff06395 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -37,6 +37,7 @@ #ifndef CONFIG_USER_ONLY #include "sysemu/reset.h" #endif +#include "exec/exec-all.h" =20 #define CR0_RESET 0xE0UL #define CR14_RESET 0xC2000000UL; @@ -83,6 +84,16 @@ uint64_t s390_cpu_get_psw_mask(CPUS390XState *env) return r; } =20 +static void s390_cpu_synchronize_from_tb(CPUState *cs, + const TranslationBlock *tb) +{ + /* The program counter is always up to date with TARGET_TB_PCREL. */ + if (!TARGET_TB_PCREL) { + S390CPU *cpu =3D S390_CPU(cs); + cpu->env.psw.addr =3D tb_pc(tb); + } +} + static void s390_cpu_set_pc(CPUState *cs, vaddr value) { S390CPU *cpu =3D S390_CPU(cs); @@ -274,6 +285,7 @@ static void s390_cpu_reset_full(DeviceState *dev) =20 static const struct TCGCPUOps s390_tcg_ops =3D { .initialize =3D s390x_translate_init, + .synchronize_from_tb =3D s390_cpu_synchronize_from_tb, .restore_state_to_opc =3D s390x_restore_state_to_opc, =20 #ifdef CONFIG_USER_ONLY diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c index afed4e2981..704db55cd4 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -139,6 +139,7 @@ struct DisasContext { DisasContextBase base; const DisasInsn *insn; TCGOp *insn_start; + target_ulong pc_save; DisasFields fields; uint64_t ex_value; uint32_t ilen; @@ -163,29 +164,6 @@ static uint64_t inline_branch_hit[CC_OP_MAX]; static uint64_t inline_branch_miss[CC_OP_MAX]; #endif =20 -static void gen_psw_addr_disp(DisasContext *s, TCGv_i64 dest, int64_t disp) -{ - tcg_gen_movi_i64(dest, s->base.pc_next + disp); -} - -static void pc_to_link_info(TCGv_i64 out, DisasContext *s) -{ - TCGv_i64 tmp; - - if (s->base.tb->flags & FLAG_MASK_64) { - gen_psw_addr_disp(s, out, s->ilen); - return; - } - - tmp =3D tcg_temp_new_i64(); - gen_psw_addr_disp(s, tmp, s->ilen); - if (s->base.tb->flags & FLAG_MASK_32) { - tcg_gen_ori_i64(tmp, tmp, 0x80000000); - } - tcg_gen_deposit_i64(out, out, tmp, 0, 32); - tcg_temp_free_i64(tmp); -} - static TCGv_i64 psw_addr; static TCGv_i64 psw_mask; static TCGv_i64 gbea; @@ -336,9 +314,39 @@ static void return_low128(TCGv_i64 dest) tcg_gen_ld_i64(dest, cpu_env, offsetof(CPUS390XState, retxl)); } =20 +static void gen_psw_addr_disp(DisasContext *s, TCGv_i64 dest, int64_t disp) +{ + assert(s->pc_save !=3D -1); + if (TARGET_TB_PCREL) { + disp +=3D s->base.pc_next - s->pc_save; + tcg_gen_addi_i64(dest, psw_addr, disp); + } else { + tcg_gen_movi_i64(dest, s->base.pc_next + disp); + } +} + +static void pc_to_link_info(TCGv_i64 out, DisasContext *s) +{ + TCGv_i64 tmp; + + if (s->base.tb->flags & FLAG_MASK_64) { + gen_psw_addr_disp(s, out, s->ilen); + return; + } + + tmp =3D tcg_temp_new_i64(); + gen_psw_addr_disp(s, tmp, s->ilen); + if (s->base.tb->flags & FLAG_MASK_32) { + tcg_gen_ori_i64(tmp, tmp, 0x80000000); + } + tcg_gen_deposit_i64(out, out, tmp, 0, 32); + tcg_temp_free_i64(tmp); +} + static void update_psw_addr_disp(DisasContext *s, int64_t disp) { gen_psw_addr_disp(s, psw_addr, disp); + s->pc_save =3D s->base.pc_next + disp; } =20 static inline bool per_enabled(DisasContext *s) @@ -1172,6 +1180,7 @@ static DisasJumpType help_goto_indirect(DisasContext = *s, TCGv_i64 dest) { per_breaking_event(s); tcg_gen_mov_i64(psw_addr, dest); + s->pc_save =3D -1; per_branch_dest(s, psw_addr); return DISAS_PC_UPDATED; } @@ -1181,6 +1190,7 @@ static DisasJumpType help_branch(DisasContext *s, Dis= asCompare *c, { DisasJumpType ret; int64_t disp =3D (int64_t)imm * 2; + TCGv_i64 cdest_save =3D NULL; TCGLabel *lab; =20 /* Take care of the special cases first. */ @@ -1213,12 +1223,12 @@ static DisasJumpType help_branch(DisasContext *s, D= isasCompare *c, update_cc_op(s); =20 /* - * Store taken branch destination before the brcond. This - * avoids having to allocate a new local temp to hold it. - * We'll overwrite this in the not taken case anyway. + * Save taken branch destination across the brcond if required. */ if (!is_imm) { - tcg_gen_mov_i64(psw_addr, cdest); + cdest_save =3D tcg_temp_local_new_i64(); + tcg_gen_mov_i64(cdest_save, cdest); + cdest =3D cdest_save; } =20 lab =3D gen_new_label(); @@ -1234,6 +1244,11 @@ static DisasJumpType help_branch(DisasContext *s, Di= sasCompare *c, per_breaking_event(s); if (is_imm) { gen_psw_addr_disp(s, psw_addr, disp); + } else { + tcg_gen_mov_i64(psw_addr, cdest); + } + if (cdest_save) { + tcg_temp_free_i64(cdest_save); } per_branch_dest(s, psw_addr); =20 @@ -1247,15 +1262,15 @@ static DisasJumpType help_branch(DisasContext *s, D= isasCompare *c, gen_set_label(lab); =20 /* Branch not taken. */ + gen_psw_addr_disp(s, psw_addr, s->ilen); if (use_goto_tb(s, s->base.pc_next + s->ilen)) { tcg_gen_goto_tb(1); - gen_psw_addr_disp(s, psw_addr, s->ilen); tcg_gen_exit_tb(s->base.tb, 1); } else { - gen_psw_addr_disp(s, psw_addr, s->ilen); tcg_gen_lookup_and_goto_ptr(); } =20 + s->pc_save =3D -1; ret =3D DISAS_NORETURN; =20 egress: @@ -6453,6 +6468,7 @@ static void s390x_tr_init_disas_context(DisasContextB= ase *dcbase, CPUState *cs) =20 /* Note cpu_get_tb_cpu_state asserts PC is masked for the mode. */ =20 + dc->pc_save =3D dc->base.pc_first; dc->cc_op =3D CC_OP_DYNAMIC; dc->ex_value =3D dc->base.tb->cs_base; dc->exit_to_mainloop =3D per_enabled(dc) || dc->ex_value; @@ -6465,9 +6481,13 @@ static void s390x_tr_tb_start(DisasContextBase *db, = CPUState *cs) static void s390x_tr_insn_start(DisasContextBase *dcbase, CPUState *cs) { DisasContext *dc =3D container_of(dcbase, DisasContext, base); + target_ulong pc_arg =3D dc->base.pc_next; =20 + if (TARGET_TB_PCREL) { + pc_arg &=3D ~TARGET_PAGE_MASK; + } /* Delay the set of ilen until we've read the insn. */ - tcg_gen_insn_start(dc->base.pc_next, dc->cc_op, 0); + tcg_gen_insn_start(pc_arg, dc->cc_op, 0); dc->insn_start =3D tcg_last_op(); } =20 @@ -6561,7 +6581,11 @@ void s390x_restore_state_to_opc(CPUState *cs, CPUS390XState *env =3D &cpu->env; int cc_op =3D data[1]; =20 - env->psw.addr =3D data[0]; + if (TARGET_TB_PCREL) { + env->psw.addr =3D (env->psw.addr & TARGET_PAGE_MASK) | data[0]; + } else { + env->psw.addr =3D data[0]; + } =20 /* Update the CC opcode if it is not already up-to-date. */ if ((cc_op !=3D CC_OP_DYNAMIC) && (cc_op !=3D CC_OP_STATIC)) { --=20 2.34.1