From patchwork Mon Aug 22 23:33:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 599248 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:4388:0:0:0:0 with SMTP id w8csp2044130mae; Mon, 22 Aug 2022 16:58:41 -0700 (PDT) X-Google-Smtp-Source: AA6agR5nhamNf/c/XX8ksew1+GJ8OFHeiVNhZrMvV15KxaNbcHASKHyHpvzaRRQkNeHD0d3nBGWA X-Received: by 2002:a05:620a:908:b0:6bb:c0b6:a919 with SMTP id v8-20020a05620a090800b006bbc0b6a919mr13130927qkv.169.1661212721660; Mon, 22 Aug 2022 16:58:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661212721; cv=none; d=google.com; s=arc-20160816; b=eVanucKTxEaSgMMttQ/cMVg84RU3sJV0U6kAj6Ld3J+XkHtHQhvehdoa/es9naqetW 30BazPrQsnNg31Taw/3t6gsMUZbHOC93h5yUWrzH+oIg4sIgNGC4wXgRdJBalxPdjtjM E+TagpVR2hg3vqUgtfY+5ohYp52+Q+cAV5Hd9DdCGt7L4XPTjokOylN6WFxbi+aT0Est gM+W3oj/0eXha8b+LfANsJJQrz0OMtNKCFgXjsLucTEo9HDP2U7k70SbojmUxvf24NKo k68j2rO9oe23TkPLyCPC87XjfNchxt6IeqJFY8cDvujvpob+uSNy6brmiySuzo/bn37o 77HA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=3g0L0mSk6Sn1c+VmjW7Vt89UONp5whGx/8SFykv65y4=; b=RQhbmJ2TqQGq+ShoT6tEmvCoR1Ixk3SlpzXT4ab+lgF0RjKj1FDvhndg+w/ag3e9J+ OpwbyTg8TipVSATHrMr56MQaqcOcjnVrtvvd6En2OqRrW5hO5AlhggL7d/rzQr5eHw6p GAV7OGihfqyJ/PiB2ImIVWo9/SvsLaM5s3K8bMVWzBz7pgrSiemXxqEqKpe7FyciYZii pq3s92Syj20yvzZei6wnB62T1prtgLyx+z5UkSBZ8I0elHRpBh7P/0kuFC+yfxadoKSe V+svQGt0HPckJ/WSHY9xPzH5JUb6/k3ExbnTVVu9MR9ziNfi6UJ0ThLW6/YOT5YI2Kwm R7cQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ytmCgEYr; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id t12-20020ac8530c000000b003445dcb3b9esi5202363qtn.328.2022.08.22.16.58.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Aug 2022 16:58:41 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ytmCgEYr; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:50270 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQHJZ-0002cU-8N for patch@linaro.org; Mon, 22 Aug 2022 19:58:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58810) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQGvY-0006AA-3X for qemu-devel@nongnu.org; Mon, 22 Aug 2022 19:33:55 -0400 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]:40530) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQGvW-0007HL-7b for qemu-devel@nongnu.org; Mon, 22 Aug 2022 19:33:51 -0400 Received: by mail-pl1-x62c.google.com with SMTP id x23so11300852pll.7 for ; Mon, 22 Aug 2022 16:33:40 -0700 (PDT) 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:to:from:from:to:cc; bh=3g0L0mSk6Sn1c+VmjW7Vt89UONp5whGx/8SFykv65y4=; b=ytmCgEYrUlOrJjclEE2deiT6I5G4AFjJoGJbtk7D5B1tHrz1RewQDIyW0apx2yXUu6 HLjBVN2hzJLDQ1cRMKhSW/zU1MBw0+noq0CTWJADS5VMcKJGt5ZKGzn/Cj8V1CPd7EYi Ww3UcDqwkd7Ycb1UB6bQbC+lrhaCpY062+IGGRBdp4lG0w/Q7Wv9/hzpJUSgAmcdhl2n Ko3GRE8ptfpHdahGGLzyxDxRM6A7DLqSeFxh4pvdTXj0W08Tzd0L9WkRmQqDRwXSoW3N yPNi5XbMNkseAPBeT9F5gDjUJMt7G4yyxfT0oQyFJhlGWRhRuQdFnx80J1hHM6SsH48X llrA== 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:to:from:x-gm-message-state:from:to:cc; bh=3g0L0mSk6Sn1c+VmjW7Vt89UONp5whGx/8SFykv65y4=; b=nm+qYtQPeJkanu3c1j7g0SKAZ9nQTLIjiH+Ezk3AcZi3zhKIYEgsUw/pMJ6GzspLpQ qz2E0952eEgpUtNgeBhEYzpzicBvAPKjDAdZ+BrI+9Rb0G2uV182Bp0dFytRfWN19HZK h95E6LU/cihWldRgp7TUYIm3N04r/4GkI4n7AV7XgXL+YiyVwV5MUizT7WxRsHueeghu Xog7RfDZbGK6d6BWK5f+uuoN2Bxsc8HeOYdxDuezWYLhss2RHhjgSNaz9Ka2eubq7qpJ B7Z6bubxfz1bOfsTMWGe/ssCKCZaRcAFl3Pg78SAfW2KB3ERo2Hz79lHuPjqVEuSCvN4 DucQ== X-Gm-Message-State: ACgBeo1b1VXcS2oHxU6O7pFnImnXl+76zG9yFXJ+7vHrtlJm/FATgTON byn8EckbC4V6PnfuMiAFXR1wsKmThIavKw== X-Received: by 2002:a17:902:6b42:b0:172:ed37:bc55 with SMTP id g2-20020a1709026b4200b00172ed37bc55mr6363456plt.33.1661211219837; Mon, 22 Aug 2022 16:33:39 -0700 (PDT) Received: from stoup.. ([2602:47:d49d:ec01:c3f1:b74f:5edd:63af]) by smtp.gmail.com with ESMTPSA id 82-20020a621555000000b0053655af14easm5133124pfv.45.2022.08.22.16.33.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Aug 2022 16:33:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 15/22] target/i386: Use DISAS_TOO_MANY to exit after gen_io_start Date: Mon, 22 Aug 2022 16:33:11 -0700 Message-Id: <20220822233318.1728621-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220822233318.1728621-1-richard.henderson@linaro.org> References: <20220822233318.1728621-1-richard.henderson@linaro.org> MIME-Version: 1.0 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, T_SCC_BODY_TEXT_LINE=-0.01 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We can set is_jmp early, using only one if, and let that be overwritten by gen_repz_* etc. Signed-off-by: Richard Henderson --- target/i386/tcg/translate.c | 42 +++++++++---------------------------- 1 file changed, 10 insertions(+), 32 deletions(-) diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index 47d6cd2fce..cacd52c50f 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -5492,14 +5492,12 @@ static bool disas_insn(DisasContext *s, CPUState *cpu) } if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) { gen_io_start(); + s->base.is_jmp = DISAS_TOO_MANY; } gen_helper_rdrand(s->T0, cpu_env); rm = (modrm & 7) | REX_B(s); gen_op_mov_reg_v(s, dflag, rm, s->T0); set_cc_op(s, CC_OP_EFLAGS); - if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) { - gen_jmp(s, s->pc - s->cs_base); - } break; default: @@ -6545,15 +6543,12 @@ static bool disas_insn(DisasContext *s, CPUState *cpu) } if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) { gen_io_start(); + s->base.is_jmp = DISAS_TOO_MANY; } if (prefixes & (PREFIX_REPZ | PREFIX_REPNZ)) { gen_repz_ins(s, ot); - /* jump generated by gen_repz_ins */ } else { gen_ins(s, ot); - if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) { - gen_jmp(s, s->pc - s->cs_base); - } } break; case 0x6e: /* outsS */ @@ -6566,15 +6561,12 @@ static bool disas_insn(DisasContext *s, CPUState *cpu) } if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) { gen_io_start(); + s->base.is_jmp = DISAS_TOO_MANY; } if (prefixes & (PREFIX_REPZ | PREFIX_REPNZ)) { gen_repz_outs(s, ot); - /* jump generated by gen_repz_outs */ } else { gen_outs(s, ot); - if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) { - gen_jmp(s, s->pc - s->cs_base); - } } break; @@ -6591,13 +6583,11 @@ static bool disas_insn(DisasContext *s, CPUState *cpu) } if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) { gen_io_start(); + s->base.is_jmp = DISAS_TOO_MANY; } gen_helper_in_func(ot, s->T1, s->tmp2_i32); gen_op_mov_reg_v(s, ot, R_EAX, s->T1); gen_bpt_io(s, s->tmp2_i32, ot); - if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) { - gen_jmp(s, s->pc - s->cs_base); - } break; case 0xe6: case 0xe7: @@ -6609,14 +6599,12 @@ static bool disas_insn(DisasContext *s, CPUState *cpu) } if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) { gen_io_start(); + s->base.is_jmp = DISAS_TOO_MANY; } gen_op_mov_v_reg(s, ot, s->T1, R_EAX); tcg_gen_trunc_tl_i32(s->tmp3_i32, s->T1); gen_helper_out_func(ot, s->tmp2_i32, s->tmp3_i32); gen_bpt_io(s, s->tmp2_i32, ot); - if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) { - gen_jmp(s, s->pc - s->cs_base); - } break; case 0xec: case 0xed: @@ -6628,13 +6616,11 @@ static bool disas_insn(DisasContext *s, CPUState *cpu) } if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) { gen_io_start(); + s->base.is_jmp = DISAS_TOO_MANY; } gen_helper_in_func(ot, s->T1, s->tmp2_i32); gen_op_mov_reg_v(s, ot, R_EAX, s->T1); gen_bpt_io(s, s->tmp2_i32, ot); - if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) { - gen_jmp(s, s->pc - s->cs_base); - } break; case 0xee: case 0xef: @@ -6646,14 +6632,12 @@ static bool disas_insn(DisasContext *s, CPUState *cpu) } if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) { gen_io_start(); + s->base.is_jmp = DISAS_TOO_MANY; } gen_op_mov_v_reg(s, ot, s->T1, R_EAX); tcg_gen_trunc_tl_i32(s->tmp3_i32, s->T1); gen_helper_out_func(ot, s->tmp2_i32, s->tmp3_i32); gen_bpt_io(s, s->tmp2_i32, ot); - if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) { - gen_jmp(s, s->pc - s->cs_base); - } break; /************************/ @@ -7319,11 +7303,9 @@ static bool disas_insn(DisasContext *s, CPUState *cpu) gen_update_eip_cur(s); if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) { gen_io_start(); + s->base.is_jmp = DISAS_TOO_MANY; } gen_helper_rdtsc(cpu_env); - if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) { - gen_jmp(s, s->pc - s->cs_base); - } break; case 0x133: /* rdpmc */ gen_update_cc_op(s); @@ -7780,11 +7762,9 @@ static bool disas_insn(DisasContext *s, CPUState *cpu) gen_update_eip_cur(s); if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) { gen_io_start(); + s->base.is_jmp = DISAS_TOO_MANY; } gen_helper_rdtscp(cpu_env); - if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) { - gen_jmp(s, s->pc - s->cs_base); - } break; default: @@ -8148,6 +8128,7 @@ static bool disas_insn(DisasContext *s, CPUState *cpu) if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) { gen_io_start(); + s->base.is_jmp = DISAS_TOO_MANY; } if (b & 2) { gen_svm_check_intercept(s, SVM_EXIT_WRITE_CR0 + reg); @@ -8158,9 +8139,6 @@ static bool disas_insn(DisasContext *s, CPUState *cpu) gen_svm_check_intercept(s, SVM_EXIT_READ_CR0 + reg); gen_helper_read_crN(s->T0, cpu_env, tcg_constant_i32(reg)); gen_op_mov_reg_v(s, ot, rm, s->T0); - if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) { - gen_jmp(s, s->pc - s->cs_base); - } } break;