From nobody Mon Nov 25 04:41:27 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1717836162; cv=none; d=zohomail.com; s=zohoarc; b=l2r82Z+ug41iAxGjhTCFEjQfAw/9ILRF/UCnkKJ+/BrYqWKaZXmlW0dO+NjPWZ2QbxAJwg5nEql0rihwq1LBA/6Sl1s6LWXevn+QwKWmW7nWB/ke2p1x7DffRinr2gF0bojPTLVDyu1dnGhSPIqV/bL207cViTHEvCG6QhYy9j0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1717836162; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=e54zIwB4ZotLZ75Nya5oaHP5znOGdXyOL0dXOi/s3BY=; b=RlZV/6iZ/ZvJ/2lAdS0pxYL1IkIgpArUWao/Cq0Wl1XKCxcoUPeq73vgbH/wL7V9MTCiLwHEtSTAVE1psQGFSBWe5cU7tRmVb7QPPfoL+db5qobEkBuGLNU8E5jTo419lLr+h3ateCFZbFS+oHULgPA3EbVXpa7LiKPTdAdTrnQ= 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 1717836162035257.2790533079756; Sat, 8 Jun 2024 01:42:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sFreY-0003lX-SX; Sat, 08 Jun 2024 04:42:22 -0400 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 1sFreX-0003iI-QW for qemu-devel@nongnu.org; Sat, 08 Jun 2024 04:42:21 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sFreW-0001Vi-2U for qemu-devel@nongnu.org; Sat, 08 Jun 2024 04:42:21 -0400 Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-618-pJgg61V4PwCiUZPLE0re_w-1; Sat, 08 Jun 2024 04:42:14 -0400 Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-57c6979daf7so180439a12.1 for ; Sat, 08 Jun 2024 01:42:14 -0700 (PDT) Received: from avogadro.local ([151.81.115.112]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-57aae0ffbf8sm3981249a12.39.2024.06.08.01.42.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Jun 2024 01:42:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1717836139; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=e54zIwB4ZotLZ75Nya5oaHP5znOGdXyOL0dXOi/s3BY=; b=OAfe4r1d29QgFMGiFzaMpID9OL+ls99iC+kcjt28N76YWbHKi1aBOsaPzzKgbU3BttkHee KRr4886po6JUxB6fHr81zds5/27CEbfPHTpr6g+4L/H0trSAPXNIIBrZCjwXqb1CSYKziL DBO+/81052tqn5OluF62R3fT6sXcY7g= X-MC-Unique: pJgg61V4PwCiUZPLE0re_w-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717836132; x=1718440932; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=e54zIwB4ZotLZ75Nya5oaHP5znOGdXyOL0dXOi/s3BY=; b=tfaK6V4Rl4iV+gAgGasN7GqAHAYMP5/XpcslD5/4AyQqc+1Lz0E+ueRYfwgld2r2mp 11HnKfN5Grzn5sXdnMc0OfTyFAtllf4bsJ2cWMPH86Yfxnb9Jjxvcur6W455OQrbYE9v pmH8rZqKgTjB6GVp6JB/smgTMFF+8SVEeTyBh4GJqY/9WCmRdrJLw/ckXuRRs/q9d7CJ 4v1aMleSajKNnCp4E0IyHhiDxmGDOyosS31o8VtTyhkqFrOykDdxA6zRqSqc1Y0je9Uq GpdjYa4MMX644n1bfjZZp2bbU1a8dm8bifvlG+Hs7wThd9RW7tLLKaAri6LCipGze9DN sTGQ== X-Gm-Message-State: AOJu0YxflcqbS2cnomy/2ctvbLlAv3w0dBeQ862RlJ/nN2H0pdiWtQUk RSvaXRsss9BKGPiSmk+oa1HxUbk0/BadI0M9i/1m/k6TR+yDyxGxkN72FO+hYslkGcLdt/UYPCF pUPdP4jFR6GMwD3PtcLSta9cCap+7Yl7TJN1NuglUEBCqWRKvE4gBNFb8h143TZWfOrNwyLJGyz c4bBe1pa47O35uCyeV5bayi3qonN8oQxuvvWaw X-Received: by 2002:a50:cd56:0:b0:57a:31c6:69cf with SMTP id 4fb4d7f45d1cf-57c50990d57mr2461490a12.28.1717836132329; Sat, 08 Jun 2024 01:42:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFoEa/m+uBJrPOHWW9ztTd/5V4IWDSpV3aUNNXUADrJAueF/31IVE3psJdy5ZIldLel4XBZHw== X-Received: by 2002:a50:cd56:0:b0:57a:31c6:69cf with SMTP id 4fb4d7f45d1cf-57c50990d57mr2461481a12.28.1717836131850; Sat, 08 Jun 2024 01:42:11 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 16/25] target/i386: adapt gen_shift_count for SHLD/SHRD Date: Sat, 8 Jun 2024 10:41:04 +0200 Message-ID: <20240608084113.2770363-17-pbonzini@redhat.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240608084113.2770363-1-pbonzini@redhat.com> References: <20240608084113.2770363-1-pbonzini@redhat.com> 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=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1717836164145100003 Content-Type: text/plain; charset="utf-8" SHLD/SHRD can have 3 register operands - s->T0, s->T1 and either 1 or CL - and therefore decode->op[2] is taken by the low part of the register being shifted. Pass X86_OP_* to gen_shift_count from its current callers and hardcode cpu_regs[R_ECX] as the shift count. Signed-off-by: Paolo Bonzini Reviewed-by: Richard Henderson --- target/i386/tcg/emit.c.inc | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/target/i386/tcg/emit.c.inc b/target/i386/tcg/emit.c.inc index 41398e5130c..2e73b41cd3e 100644 --- a/target/i386/tcg/emit.c.inc +++ b/target/i386/tcg/emit.c.inc @@ -2998,16 +2998,16 @@ static void gen_PUSHF(DisasContext *s, X86DecodedIn= sn *decode) } =20 static MemOp gen_shift_count(DisasContext *s, X86DecodedInsn *decode, - bool *can_be_zero, TCGv *count) + bool *can_be_zero, TCGv *count, int unit) { MemOp ot =3D decode->op[0].ot; int mask =3D (ot <=3D MO_32 ? 0x1f : 0x3f); =20 *can_be_zero =3D false; - switch (decode->op[2].unit) { + switch (unit) { case X86_OP_INT: *count =3D tcg_temp_new(); - tcg_gen_andi_tl(*count, s->T1, mask); + tcg_gen_andi_tl(*count, cpu_regs[R_ECX], mask); *can_be_zero =3D true; break; =20 @@ -3192,7 +3192,7 @@ static void gen_RCL(DisasContext *s, X86DecodedInsn *= decode) bool have_1bit_cin, can_be_zero; TCGv count; TCGLabel *zero_label =3D NULL; - MemOp ot =3D gen_shift_count(s, decode, &can_be_zero, &count); + MemOp ot =3D gen_shift_count(s, decode, &can_be_zero, &count, decode->= op[2].unit); TCGv low, high, low_count; =20 if (!count) { @@ -3244,7 +3244,7 @@ static void gen_RCR(DisasContext *s, X86DecodedInsn *= decode) bool have_1bit_cin, can_be_zero; TCGv count; TCGLabel *zero_label =3D NULL; - MemOp ot =3D gen_shift_count(s, decode, &can_be_zero, &count); + MemOp ot =3D gen_shift_count(s, decode, &can_be_zero, &count, decode->= op[2].unit); TCGv low, high, high_count; =20 if (!count) { @@ -3422,7 +3422,7 @@ static void gen_ROL(DisasContext *s, X86DecodedInsn *= decode) { bool can_be_zero; TCGv count; - MemOp ot =3D gen_shift_count(s, decode, &can_be_zero, &count); + MemOp ot =3D gen_shift_count(s, decode, &can_be_zero, &count, decode->= op[2].unit); TCGv_i32 temp32, count32; TCGv old =3D tcg_temp_new(); =20 @@ -3450,7 +3450,7 @@ static void gen_ROR(DisasContext *s, X86DecodedInsn *= decode) { bool can_be_zero; TCGv count; - MemOp ot =3D gen_shift_count(s, decode, &can_be_zero, &count); + MemOp ot =3D gen_shift_count(s, decode, &can_be_zero, &count, decode->= op[2].unit); TCGv_i32 temp32, count32; TCGv old =3D tcg_temp_new(); =20 @@ -3562,7 +3562,7 @@ static void gen_SAR(DisasContext *s, X86DecodedInsn *= decode) { bool can_be_zero; TCGv count; - MemOp ot =3D gen_shift_count(s, decode, &can_be_zero, &count); + MemOp ot =3D gen_shift_count(s, decode, &can_be_zero, &count, decode->= op[2].unit); =20 if (!count) { return; @@ -3690,7 +3690,7 @@ static void gen_SHL(DisasContext *s, X86DecodedInsn *= decode) { bool can_be_zero; TCGv count; - MemOp ot =3D gen_shift_count(s, decode, &can_be_zero, &count); + MemOp ot =3D gen_shift_count(s, decode, &can_be_zero, &count, decode->= op[2].unit); =20 if (!count) { return; @@ -3722,7 +3722,7 @@ static void gen_SHR(DisasContext *s, X86DecodedInsn *= decode) { bool can_be_zero; TCGv count; - MemOp ot =3D gen_shift_count(s, decode, &can_be_zero, &count); + MemOp ot =3D gen_shift_count(s, decode, &can_be_zero, &count, decode->= op[2].unit); =20 if (!count) { return; --=20 2.45.1