From nobody Thu Nov 14 07:08:22 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=1704926851; cv=none; d=zohomail.com; s=zohoarc; b=OMxYXekhYxdYbRV6d4ukgJanB1SiRNPTPwk7AVWZxqnrbd1TOSBQMDUIC6+/GmcNgEUDHm8IInAwQlzlrl43Vrma08O7GR8Zs9iuKYpSy6hO5IhBFYHXrFrTrFYna2oLIsY5g3HECyHkG39IGUVX67TuuRNpX3ElCXJAtoSSMX0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1704926851; h=Content-Transfer-Encoding:Cc:Cc: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; bh=m/PSbURQMO52LKiUV65FsmYmXzuvt6ozdqSCCbVOxK8=; b=DoihVPMkizrDCX4wMihfzTPz5HB7SfPe3Mbcj5bC509TDJghkR0z86FLWhT0Z7cw7vMcJ4k+hAMs+ytsrjtBzkpu/7UPoBoSS8S3ZdQwlEhg9O/N0m9GzIE8jtSP/6zyAlpoqZa3ldeRv4azXihBbOcRNFa6BT8gifJxL2Srb9A= 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 1704926851889341.56637540461986; Wed, 10 Jan 2024 14:47:31 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rNhLS-0008MY-6S; Wed, 10 Jan 2024 17:46: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 1rNhL9-0006sy-99 for qemu-devel@nongnu.org; Wed, 10 Jan 2024 17:46:29 -0500 Received: from mail-qt1-x832.google.com ([2607:f8b0:4864:20::832]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rNhL6-0003QE-PB for qemu-devel@nongnu.org; Wed, 10 Jan 2024 17:46:26 -0500 Received: by mail-qt1-x832.google.com with SMTP id d75a77b69052e-429be9fe952so2186491cf.0 for ; Wed, 10 Jan 2024 14:46:23 -0800 (PST) Received: from stoup.. ([172.58.27.160]) by smtp.gmail.com with ESMTPSA id ks23-20020ac86217000000b0042987f6874bsm2092281qtb.92.2024.01.10.14.46.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 14:46:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704926782; x=1705531582; darn=nongnu.org; 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=m/PSbURQMO52LKiUV65FsmYmXzuvt6ozdqSCCbVOxK8=; b=C065TA8G0eeCEUZ49nPcOFNJjI6v78hrxOZ5nnrqUpXf23RARp6YlKJaSjDMUxF0jB ZUnU1EpPeupJi75H3IzP11qrb0IylxRyru93qGDnMcmqLPFPKfKSUNTJVCvhxcAv1QFL jvBTyNVMyVw0MiJpaI6jXtVV4iL85t4odQVjlQd+fM4hvyNQgYAqdBhTi49LgNsU8icI LlCdqkXFTiJVwFLDpCSVz2miOsIe71TUq1Pxs010eCfF9Ewab8Z6xIZeUjRlDsHa5g/i DbgZUUfB6uMP+Bx0QTDa28jA+wd2BhjVTPIjAXgIv6sxdYCvoyZO4bePehvQSiKHPB3i /zYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704926782; x=1705531582; 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=m/PSbURQMO52LKiUV65FsmYmXzuvt6ozdqSCCbVOxK8=; b=iZhHSbM/8DsDfsUkiXBOBf7VkC5Ii/j3ZcqDExGQpoA2JUCuV1ACQsM0uTGKsae8wH dJadzQq+jQJx1g3aPFfhEjK02PIeZm0Q3v4+nmw6c/08X6ACXAKsUWSLe/qAD34Q0QtB 8KIm7V0nqqVT30UBUnboJfC8E6JcsABz+0YcERYaSHz2TIUy17pCFzZxnePY/ap0vG3M +lPajihs5mi9Jf94T3yEq5JDQsxChMhWyELe0Myx7yGcLtE5m6tj2FWAQ42TzxBtLY70 vU0ydk/mudpV5y2WyR9pj4Y8AfgayefHC2Xa5TN+dlvAJe1w1SGtl6aDRu50DBe6GV81 c1mg== X-Gm-Message-State: AOJu0YxHgA86hWCrYV0OhVfm9Bzjrp0F+rtQol0bT5nhFhNlVM+ksXcb pRl3HfMe6gr/s2wVfkf74y94AdZVsMpAoHxbQkVPhBCktaMGHVup X-Google-Smtp-Source: AGHT+IHretxsBkephltom39482kwwl4p8XHZsm9+T/lF3wVAmeq+wFvFTYJaawrWzut0zomBpzE2sw== X-Received: by 2002:ac8:4e4e:0:b0:429:bccc:31ca with SMTP id e14-20020ac84e4e000000b00429bccc31camr265106qtw.46.1704926782170; Wed, 10 Jan 2024 14:46:22 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: philmd@linaro.org, pbonzini@redhat.com Subject: [PATCH v3 26/38] tcg/i386: Use TEST r,r to test 8/16/32 bits Date: Thu, 11 Jan 2024 09:43:56 +1100 Message-Id: <20240110224408.10444-27-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240110224408.10444-1-richard.henderson@linaro.org> References: <20240110224408.10444-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::832; envelope-from=richard.henderson@linaro.org; helo=mail-qt1-x832.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1704926853365100017 Content-Type: text/plain; charset="utf-8" From: Paolo Bonzini Just like when testing against the sign bits, TEST r,r can be used when the immediate is 0xff, 0xff00, 0xffff, 0xffffffff. Signed-off-by: Paolo Bonzini Reviewed-by: Richard Henderson Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- tcg/i386/tcg-target.c.inc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc index 0b8c60d021..c6ba498623 100644 --- a/tcg/i386/tcg-target.c.inc +++ b/tcg/i386/tcg-target.c.inc @@ -1501,6 +1501,10 @@ static int tcg_out_cmp(TCGContext *s, TCGCond cond, = TCGArg arg1, tcg_out_modrm(s, OPC_TESTB | P_REXB_R, arg1, arg1); return js; } + if (arg2 =3D=3D 0xff) { + tcg_out_modrm(s, OPC_TESTB | P_REXB_R, arg1, arg1); + return jz; + } tcg_out_modrm(s, OPC_GRP3_Eb | P_REXB_RM, EXT3_TESTi, arg1); tcg_out8(s, arg2); return jz; @@ -1511,11 +1515,24 @@ static int tcg_out_cmp(TCGContext *s, TCGCond cond,= TCGArg arg1, tcg_out_modrm(s, OPC_TESTB, arg1 + 4, arg1 + 4); return js; } + if (arg2 =3D=3D 0xff00) { + tcg_out_modrm(s, OPC_TESTB, arg1 + 4, arg1 + 4); + return jz; + } tcg_out_modrm(s, OPC_GRP3_Eb, EXT3_TESTi, arg1 + 4); tcg_out8(s, arg2 >> 8); return jz; } =20 + if (arg2 =3D=3D 0xffff) { + tcg_out_modrm(s, OPC_TESTL | P_DATA16, arg1, arg1); + return jz; + } + if (arg2 =3D=3D 0xffffffffu) { + tcg_out_modrm(s, OPC_TESTL, arg1, arg1); + return jz; + } + if (is_power_of_2(rexw ? arg2 : (uint32_t)arg2)) { int jc =3D (cond =3D=3D TCG_COND_TSTNE ? JCC_JB : JCC_JAE); int sh =3D ctz64(arg2); --=20 2.34.1