From patchwork Wed Oct 25 07:26:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737852 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp150501wrq; Wed, 25 Oct 2023 00:33:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG3McFs7Y7Ge87W7xUt9o3k7hnvmC8qpexYw9mS6XK3KnI1YwVZSDH5+iYaEjQdzcsC9B9j X-Received: by 2002:a05:620a:4095:b0:777:5d4:bb4 with SMTP id f21-20020a05620a409500b0077705d40bb4mr16852246qko.3.1698219191456; Wed, 25 Oct 2023 00:33:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698219191; cv=none; d=google.com; s=arc-20160816; b=PRNamkWl5k7CAo3PNXJ7hZDGjEM+7KpacSDC/jZHpRM3sJ/FKnt9aFK5Hj8d5FSJew E5/d59EyILQwZHkEMIzCMYVCY7p2E7kSw5/ESlL6Y8TNolz8EAs72sWXSAhV1lxdTwyx W1IrOzlB459E8C+BWxLpSDmnf+3RheZg26HoqdV3gTuyjn2wKN+sXmPY3Cdcxbb8ltyz 0EbrLfRzVWAEx0PCooptIMIOpdKrxRbzuJvnmPXAqp/+wTHJEI+8+gmC3h6qKBHaxuVW ZoaRuqeTZZFXZTV2d6tV8LOU5W6IbM11oxhZfKBM9Z4ux+/0NYUl0jsidY5YKSB1H4xp acBg== 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=pWAF8Yy1Ybd5ENfcMHYAo9tgOERLXXMk37OKNqP6zdk=; fh=ycigHkwOPieh2u5PmcA89sNk/qPD1ZkdDlL8Mchfvw8=; b=BIMftrX9ZIob788C3jybQ1lUp1Cqb5550izFjHCRV0s++2LUyTJHvPvW1TsUktzope eF8jntyyfwC5ox0dMXD6tn25CUat1j/BiqTD3w4rQLelfL+VvPtrxmROQIYfnReOnBov GM7Fg1nGAex5HF/9eeEgU6QmG5E/M1o27SyjNwMuhqNL9nhFZUjHzROgCtwjQktcqKz8 5eNfwf9agwQ0qat7y2EFLg+ubwoTHzVgGpxZduAzUSgAJuu8F3Qyc6PLxhqL9tZl8cTd hUpsRmYe1OTbd3Zx5zo61rmWUeEtNjzim1GXfSq8IEjldTCyAjfdbnVfZOW20yihrjJD aQaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=V7PmbJKV; 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 p8-20020a05620a22a800b0077435815875si7605729qkh.49.2023.10.25.00.33.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 00:33:11 -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=V7PmbJKV; 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 1qvYIZ-0000Fa-AM; Wed, 25 Oct 2023 03:27:27 -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 1qvYIV-0000Ce-AW for qemu-devel@nongnu.org; Wed, 25 Oct 2023 03:27:23 -0400 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvYIT-0004gR-KG for qemu-devel@nongnu.org; Wed, 25 Oct 2023 03:27:23 -0400 Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1c9e95aa02dso4679515ad.0 for ; Wed, 25 Oct 2023 00:27:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698218840; x=1698823640; 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=pWAF8Yy1Ybd5ENfcMHYAo9tgOERLXXMk37OKNqP6zdk=; b=V7PmbJKVLyms9G9LcOmCQUMsrEABiIiLbVToQHZZ1SJq1e0J3acNcvU+GSY65rmqxF ayFiM7rGetLNasdYQMGcMQz6SWL5/pO080lLBiEjqdxlDA8rQwXC/QIP9spX6fWGGJnh vQXfkC0EjTWLZW+2Xi+XrR0dBWoWprVb9PqDaNMQUvUz7B8PRxWNgdWK0yR5VRav+oiy ZNeVEY/RCVqdY2B2gT8DDCExUFXooMQMB7J6z2IBT5UWVNLgco4+MmDGbzjtOXEmOYal Cz+8NhEAsBJH3W/IDKfnFotkw9848Nj7V1CtKyS2XodVG0FTTIsh1u3MSr6m9hc+vsfn FTJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698218840; x=1698823640; 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=pWAF8Yy1Ybd5ENfcMHYAo9tgOERLXXMk37OKNqP6zdk=; b=htASKIHyzmQNUV8BCJWPeDW6zm7AJwrqjQOiTP251peA3Y4OP/Y65Wg21KiaiFwz4X bdceteY+ELBY9jUM4KElb+kzkjdR+yubli3MazGbPxuQHiPLXRNtLarC14XBI+LRIMrq 0Ypqr5tlm1TtzlIbVk66RfjGIhd2/6mjx0i4umwLpnw91QekaUZRzHn2NifTE2pIjm1H IBeb2CB9rfQ8Udpc07qLeO5vfPrVwSS1y1vHwRw8Xdq9Zg045o9sVi8txbXQQObFtX5H MkhUmm4VFdakAd/7GU/oc3JNgk4CW+jySlOQ/CgpoununRkRa0jipTjCWGbY9MtAvZzC j+Ww== X-Gm-Message-State: AOJu0YyG/Cd0NiEZdXnnDVNTe6zdHQZk90VBaquUrw8AEd2eMRWurlNz 7R8WPD5UqudYqADbpTPNL9lRlaR6jAC65cgpKJw= X-Received: by 2002:a17:903:32c1:b0:1c7:5776:a30f with SMTP id i1-20020a17090332c100b001c75776a30fmr18012824plr.12.1698218840276; Wed, 25 Oct 2023 00:27:20 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id ji5-20020a170903324500b001b06c106844sm8578661plb.151.2023.10.25.00.27.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 00:27:19 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: philmd@linaro.org Subject: [PATCH 12/29] tcg/i386: Add rexw argument to tcg_out_testi Date: Wed, 25 Oct 2023 00:26:50 -0700 Message-Id: <20231025072707.833943-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231025072707.833943-1-richard.henderson@linaro.org> References: <20231025072707.833943-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62a; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62a.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Move up above tcg_out_cmp, where it will be used. Signed-off-by: Richard Henderson --- tcg/i386/tcg-target.c.inc | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc index 6e8af1fcf6..f4f456a2c0 100644 --- a/tcg/i386/tcg-target.c.inc +++ b/tcg/i386/tcg-target.c.inc @@ -1418,6 +1418,19 @@ static void tcg_out_jxx(TCGContext *s, int opc, TCGLabel *l, bool small) } } +/* Test register R vs immediate bits I, setting Z flag for EQ/NE. */ +static void __attribute__((unused)) +tcg_out_testi(TCGContext *s, TCGReg r, uint32_t i, int rexw) +{ + if (i <= 0xff && (TCG_TARGET_REG_BITS == 64 || r < 4)) { + tcg_out_modrm(s, OPC_GRP3_Eb | P_REXB_RM, EXT3_TESTi, r); + tcg_out8(s, i); + } else { + tcg_out_modrm(s, OPC_GRP3_Ev + rexw, EXT3_TESTi, r); + tcg_out32(s, i); + } +} + static int tcg_out_cmp(TCGContext *s, TCGCond cond, TCGArg arg1, TCGArg arg2, int const_arg2, int rexw) { @@ -1796,23 +1809,6 @@ static void tcg_out_nopn(TCGContext *s, int n) tcg_out8(s, 0x90); } -/* Test register R vs immediate bits I, setting Z flag for EQ/NE. */ -static void __attribute__((unused)) -tcg_out_testi(TCGContext *s, TCGReg r, uint32_t i) -{ - /* - * This is used for testing alignment, so we can usually use testb. - * For i686, we have to use testl for %esi/%edi. - */ - if (i <= 0xff && (TCG_TARGET_REG_BITS == 64 || r < 4)) { - tcg_out_modrm(s, OPC_GRP3_Eb | P_REXB_RM, EXT3_TESTi, r); - tcg_out8(s, i); - } else { - tcg_out_modrm(s, OPC_GRP3_Ev, EXT3_TESTi, r); - tcg_out32(s, i); - } -} - typedef struct { TCGReg base; int index; @@ -2080,7 +2076,7 @@ static TCGLabelQemuLdst *prepare_host_addr(TCGContext *s, HostAddress *h, ldst->addrlo_reg = addrlo; ldst->addrhi_reg = addrhi; - tcg_out_testi(s, addrlo, a_mask); + tcg_out_testi(s, addrlo, a_mask, false); /* jne slow_path */ tcg_out_opc(s, OPC_JCC_long + JCC_JNE, 0, 0, 0); ldst->label_ptr[0] = s->code_ptr; @@ -2229,7 +2225,7 @@ static void tcg_out_qemu_ld_direct(TCGContext *s, TCGReg datalo, TCGReg datahi, TCGLabel *l1 = gen_new_label(); TCGLabel *l2 = gen_new_label(); - tcg_out_testi(s, h.base, 15); + tcg_out_testi(s, h.base, 15, false); tcg_out_jxx(s, JCC_JNE, l1, true); tcg_out_vex_modrm_sib_offset(s, OPC_MOVDQA_VxWx + h.seg, @@ -2357,7 +2353,7 @@ static void tcg_out_qemu_st_direct(TCGContext *s, TCGReg datalo, TCGReg datahi, TCGLabel *l1 = gen_new_label(); TCGLabel *l2 = gen_new_label(); - tcg_out_testi(s, h.base, 15); + tcg_out_testi(s, h.base, 15, false); tcg_out_jxx(s, JCC_JNE, l1, true); tcg_out_vex_modrm_sib_offset(s, OPC_MOVDQA_WxVx + h.seg,