From patchwork Wed Jan 10 22:43:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 761476 Delivered-To: patch@linaro.org Received: by 2002:a5d:6e02:0:b0:337:62d3:c6d5 with SMTP id h2csp2112678wrz; Wed, 10 Jan 2024 14:47:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IH22VAavOTRfzcJ54va7gOZWQjJWos9zbEG0PszbtASEFoXXLA2xD/A32050j0EZQnq/zpQ X-Received: by 2002:a05:622a:181:b0:421:c349:73f6 with SMTP id s1-20020a05622a018100b00421c34973f6mr244815qtw.22.1704926847683; Wed, 10 Jan 2024 14:47:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704926847; cv=none; d=google.com; s=arc-20160816; b=VvMlz1vSvWBpIcMkK3dxtmqgbXGzc5rz6EVLoIMtxftqkPOrCrFxwKBeHTBkpksXkG q0CGYqvCFaDKhk/yU5GvQm20S87Si2SHpOu7bYIR4Yee7gZm/9HqKTA+xU9woHnuxASN ykq7YfmxbQ3XW/8XsRKuV9Kf9y3X5c4T6h3FkNwGqiG1lODZFGBZK3FijStWpRz93S+l Yp76uoaX7c/NvbTWAmlrLTAyZoDVYlMTrAeg5gLdeWxnGfYMLIaDvyN9RuEWN6bcOf/h ZKNkSZYTQbwZ/vftp2VDlHRvHRnmdEog74sLRsTR7lUXPc1nASVkP7FsrloO5oC/H6dw JBLA== 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:cc:to :from:dkim-signature; bh=hIn73/7L0/UvLzTpfBg1BsspTF3e93L6IUnQvuIa2EY=; fh=GbSB792CRg76qyQfASHmg380JBauy2gTuYi49sbOwBU=; b=c5y05vg+GhyrdpUmwjSoMn3TdBXpZ+aUBBxre+W/PfXyo8VxinVsMPhnjshoZpxFmd p9g+ZJ7aqKftof0celN6+4TpGvU5RlR1cjmPopZhAvzH8TbrZ1/E2vQalfRHh3KgVTM1 EQaYlJYm2UA2t4A1DAYBPIFXFCAvBUlvl7J+QgWkGxckqzuWENMtMi3LEFF4vOtlsG6L 2gKeiP41JV8eeRvQqNaDfiP+NCV7snDZwJ00Vg6vW21kjrOsnHwuqM0pcRrWjdusVlS7 2H/R8LxAZ6kH6tVf7jks933rIhezAoSMNXi42HB+XVTh64n+echDy8IOaKWnAw8LpBnc GW3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Xp+KOfok; 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 s38-20020a05622a1aa600b004298a439055si4698299qtc.566.2024.01.10.14.47.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 10 Jan 2024 14:47:27 -0800 (PST) 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=Xp+KOfok; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rNhLL-0007Mh-0h; Wed, 10 Jan 2024 17:46: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 1rNhKu-0006Oz-LV for qemu-devel@nongnu.org; Wed, 10 Jan 2024 17:46:16 -0500 Received: from mail-qt1-x82f.google.com ([2607:f8b0:4864:20::82f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rNhKr-0003Fa-Pv for qemu-devel@nongnu.org; Wed, 10 Jan 2024 17:46:12 -0500 Received: by mail-qt1-x82f.google.com with SMTP id d75a77b69052e-4299e43a712so15455071cf.1 for ; Wed, 10 Jan 2024 14:46:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704926768; x=1705531568; 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=hIn73/7L0/UvLzTpfBg1BsspTF3e93L6IUnQvuIa2EY=; b=Xp+KOfokdo8TOxX9F5RBZY7ktjN79N37LrQ3L9G7qUBVsFhwzhEkbOEXMxMc4WMTDE PjGQ46s2yNnv5EiFMc7I2cCxp49akRj4nzt3mBMoFuogtZg+fme6SkDVaNWGoPKiCpEn bxIb6KZ+UZPNh5caQQtGUvQ3KJzZC/nkq6ZWtKfHS3aSEg4qrYTtPtmfo8I322s/aK5I 4x1K12C41gE1zoc95moICDU6E3eS5FgBCGcdJCbm47A/YuraG7GVAunm3950cvSLP6i9 QO7cTDnytI2Hqid1Xem9RavqM6dGKmzJJcLBVxHC+Mf1zWgL1mCAvrLzQlt7YXRAAnfW qGNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704926768; x=1705531568; 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=hIn73/7L0/UvLzTpfBg1BsspTF3e93L6IUnQvuIa2EY=; b=iD3h8oAX9oXn0JJChYGEpeLto6fO7+TPdIQ4OB63QxUHUjqCxI/uZQV2KbH7HSNYkA inMVvlnMNHxfIgv8st+30s+v1+qFwIXGyiZtKf/8kzAcd/bTRZFwDxp3wLh2YDeqJERG Vn2mKIbf9AsVhNw+JAIFiIgO7pp0W9a4AbDRN2zsKkql1o8JJln7NpH/FREqGZqVyXSA KwzEk2W3JzHetT+xjVNW0c2I7divw/rx0oeAR7rXSy8UgR4wGRovHX36NHISz9tn3myd EsYXt0vGcWREcKvRYcXIsG7+5C7vEGQU6pBtQncMCmdb/gocyEvw1OcLydq+F19yAQta Ty8g== X-Gm-Message-State: AOJu0YzoZjYAsfO0QpsgwNOXw4Mc3qrNTKCX+ZPgE8vjCJ9xKjDwhDjr NuoiRZlWffYS3V4zxX+4GJ09pc5uPDVBpvsw2TVOnD/PUeojCqe4 X-Received: by 2002:ac8:7f01:0:b0:429:bbf2:14bd with SMTP id f1-20020ac87f01000000b00429bbf214bdmr308764qtk.102.1704926768272; Wed, 10 Jan 2024 14:46:08 -0800 (PST) Received: from stoup.. ([172.58.27.160]) by smtp.gmail.com with ESMTPSA id ks23-20020ac86217000000b0042987f6874bsm2092281qtb.92.2024.01.10.14.46.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 14:46:07 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: philmd@linaro.org, pbonzini@redhat.com Subject: [PATCH v3 22/38] tcg/i386: Pass x86 condition codes to tcg_out_cmov Date: Thu, 11 Jan 2024 09:43:52 +1100 Message-Id: <20240110224408.10444-23-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 Received-SPF: pass client-ip=2607:f8b0:4864:20::82f; envelope-from=richard.henderson@linaro.org; helo=mail-qt1-x82f.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-bounces+patch=linaro.org@nongnu.org Hoist the tcg_cond_to_jcc index outside the function. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- tcg/i386/tcg-target.c.inc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc index accaaa2660..2d6100a8f4 100644 --- a/tcg/i386/tcg-target.c.inc +++ b/tcg/i386/tcg-target.c.inc @@ -1699,14 +1699,14 @@ static void tcg_out_setcond2(TCGContext *s, const TCGArg *args, } #endif -static void tcg_out_cmov(TCGContext *s, TCGCond cond, int rexw, +static void tcg_out_cmov(TCGContext *s, int jcc, int rexw, TCGReg dest, TCGReg v1) { if (have_cmov) { - tcg_out_modrm(s, OPC_CMOVCC | tcg_cond_to_jcc[cond] | rexw, dest, v1); + tcg_out_modrm(s, OPC_CMOVCC | jcc | rexw, dest, v1); } else { TCGLabel *over = gen_new_label(); - tcg_out_jxx(s, tcg_cond_to_jcc[tcg_invert_cond(cond)], over, 1); + tcg_out_jxx(s, jcc ^ 1, over, 1); tcg_out_mov(s, TCG_TYPE_I32, dest, v1); tcg_out_label(s, over); } @@ -1717,7 +1717,7 @@ static void tcg_out_movcond(TCGContext *s, int rexw, TCGCond cond, TCGReg v1) { tcg_out_cmp(s, c1, c2, const_c2, rexw); - tcg_out_cmov(s, cond, rexw, dest, v1); + tcg_out_cmov(s, tcg_cond_to_jcc[cond], rexw, dest, v1); } static void tcg_out_ctz(TCGContext *s, int rexw, TCGReg dest, TCGReg arg1, @@ -1729,12 +1729,12 @@ static void tcg_out_ctz(TCGContext *s, int rexw, TCGReg dest, TCGReg arg1, tcg_debug_assert(arg2 == (rexw ? 64 : 32)); } else { tcg_debug_assert(dest != arg2); - tcg_out_cmov(s, TCG_COND_LTU, rexw, dest, arg2); + tcg_out_cmov(s, JCC_JB, rexw, dest, arg2); } } else { tcg_debug_assert(dest != arg2); tcg_out_modrm(s, OPC_BSF + rexw, dest, arg1); - tcg_out_cmov(s, TCG_COND_EQ, rexw, dest, arg2); + tcg_out_cmov(s, JCC_JE, rexw, dest, arg2); } } @@ -1747,7 +1747,7 @@ static void tcg_out_clz(TCGContext *s, int rexw, TCGReg dest, TCGReg arg1, tcg_debug_assert(arg2 == (rexw ? 64 : 32)); } else { tcg_debug_assert(dest != arg2); - tcg_out_cmov(s, TCG_COND_LTU, rexw, dest, arg2); + tcg_out_cmov(s, JCC_JB, rexw, dest, arg2); } } else { tcg_debug_assert(!const_a2); @@ -1760,7 +1760,7 @@ static void tcg_out_clz(TCGContext *s, int rexw, TCGReg dest, TCGReg arg1, /* Since we have destroyed the flags from BSR, we have to re-test. */ tcg_out_cmp(s, arg1, 0, 1, rexw); - tcg_out_cmov(s, TCG_COND_EQ, rexw, dest, arg2); + tcg_out_cmov(s, JCC_JE, rexw, dest, arg2); } }