From patchwork Sun Oct 13 22:25:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 176086 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp3787007ill; Sun, 13 Oct 2019 15:33:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqxX/XDP5HJq3ef5+1hLH7Aa8d2Bs+rERdjP5fyW/TbOF9GUA70tPEerKkBvRdR34r23N5oy X-Received: by 2002:aed:24e9:: with SMTP id u38mr29416060qtc.30.1571006007484; Sun, 13 Oct 2019 15:33:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571006007; cv=none; d=google.com; s=arc-20160816; b=XVpP3o0KwNM7Os7ErraO7XZPKpmHynkiXMLVQ72VBdsM05J53GFJDBRig4hpq2QSPS WuL45inFTso4lPu72/9pPaMWUU7XzBodWLaRBTlzBBtLTzzNyCLmr1K0H4U9vu9xkX3q UOk+0elG7GBdS9q+2z7A77HjENQeUTkO7f7wQ3RwikZIstHO/zgof5YvteyhSaMNKE8c oEeCngrDgmGVHcULKFG3nXs/rbGgVgplh5souscxE6Fj6hNQrgZ/zqQLLEJABC0mXVfX 8UoaIgUDTiPDOPnf6PYSUqFRpMCjdmXFSoRbwQ5gdPoBF8bXcChR0zuCtZouENtEzA3t AcWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=KJht3k8cNEabdOtAXgVHE9ekZLuMtQn0jx2AnG8ofpM=; b=Hd9CCYxYOmuVBNbyITq1xZrHoXDxD5GrVH1TSlxnu6s86JlvfFpDAp/GK8GqPtXks9 eZlj2keOyo5PtCrD8ibE1+YvBKOItfcONDestfBi3bQEUBoj2RPiswtVgkfMWAkoSCQi GLq4+btI7FeqIxivO+zakDbg9jD1JiM99tIh6cl6vAnywxeYUwBNyUcgSw1xx2/nFCAK 1sMf53c2FZlUytvbHDV35QXjFXHgofuwxu1Lvi75hsn3UbkhsyD+VAFlmuMHajRObElT nojLz9+Rruxo27z6ZemVtKEi0RxhlQxdVh1II0Cbd7vW0L2iNNp2vv939OeuluRsvxC7 MujQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="QLp/FKO4"; 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 e17si15338664qvq.49.2019.10.13.15.33.27 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 13 Oct 2019 15:33:27 -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="QLp/FKO4"; 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]:43158 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iJmQY-0005R8-UY for patch@linaro.org; Sun, 13 Oct 2019 18:33:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51197) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iJmJJ-0006g8-NQ for qemu-devel@nongnu.org; Sun, 13 Oct 2019 18:25:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iJmJI-0000rU-CP for qemu-devel@nongnu.org; Sun, 13 Oct 2019 18:25:57 -0400 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]:41783) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iJmJI-0000rA-7H for qemu-devel@nongnu.org; Sun, 13 Oct 2019 18:25:56 -0400 Received: by mail-pg1-x542.google.com with SMTP id t3so8924514pga.8 for ; Sun, 13 Oct 2019 15:25:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=KJht3k8cNEabdOtAXgVHE9ekZLuMtQn0jx2AnG8ofpM=; b=QLp/FKO4M0qA4ADBqrRPJCQ/lN5iGSKIKF+VV3HuLOZQ+uzDkyPrgnuWEV8rK+bvQy sEVd4DlkgNSPibeACTWrAfLjhI+DvCOq8Vjg7nQW1E3pFsQdTmnOYUl69mlAVqOwHO/Z hUjorcnQDLxV/fHdt6YN4dD9I9DYOe726/1tXcoETs3CbMFMG5akXsizjGvLMECeF7le yuVqA50QrVdC6BvQiZHQaH3xQS1ZVIPZ4PHcAeDC2ML0yEC9ERi1gP/NkTc2dHUh8O1/ 0/KaM6Mb7hY31PAlUMx1maSjQOQ1maxmoFwaXrrT0q8CQyBM7IA1TJ5abENb4RSdZgYZ rnMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=KJht3k8cNEabdOtAXgVHE9ekZLuMtQn0jx2AnG8ofpM=; b=VUftQbQk19m8xmBmrR2W25s2lXer2O2uoapPZgZtshUaunZnYiLoIQZ7y+KVZUgFTk 35CD9y56Mk0vZbkRdxhTKL8gNCBq76nq/9kNEmJJcdyA7R0j/rNiL0kLM8uEdlNkQRXf CFDzt2TdQEqk8UqH/OxZ7azvEwUeeTrAPiCT/DDI7tOKxepJFveKxHYAaO+TWwRSafs7 WspVjo6KDKX01msuYZwHu2uAOYl/0HAthq/to0NFM9pWBr2GWNo6C5pOwDv0znbr51EI ELjVE6HGFvRrQ7RLvjU05bfoZ5GJGP1p0gVi9o8UuVLX2hlNTTi+xZrXHP12uEJyGNCN jO2Q== X-Gm-Message-State: APjAAAWQgqZgih7HsfOa3VVIJUjdbc9xH9jpCiIHOVnF0O5y0+QOXF+3 NDcDu1kAmFQvbpWndY1dWdzWozL9vco= X-Received: by 2002:a63:9751:: with SMTP id d17mr10324393pgo.427.1571005554792; Sun, 13 Oct 2019 15:25:54 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id d76sm15940571pfd.185.2019.10.13.15.25.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Oct 2019 15:25:54 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 06/23] tcg/ppc: Replace HAVE_ISEL macro with a variable Date: Sun, 13 Oct 2019 15:25:27 -0700 Message-Id: <20191013222544.3679-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191013222544.3679-1-richard.henderson@linaro.org> References: <20191013222544.3679-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::542 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Previously we've been hard-coding knowledge that Power7 has ISEL, but it was an optional instruction before that. Use the AT_HWCAP2 bit, when present, to properly determine support. Reviewed-by: Aleksandar Markovic Signed-off-by: Richard Henderson --- tcg/ppc/tcg-target.inc.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) -- 2.17.1 diff --git a/tcg/ppc/tcg-target.inc.c b/tcg/ppc/tcg-target.inc.c index 7cb0002c14..db28ae7eb1 100644 --- a/tcg/ppc/tcg-target.inc.c +++ b/tcg/ppc/tcg-target.inc.c @@ -65,8 +65,7 @@ static tcg_insn_unit *tb_ret_addr; TCGPowerISA have_isa; - -#define HAVE_ISEL have_isa_2_06 +static bool have_isel; #ifndef CONFIG_SOFTMMU #define TCG_GUEST_BASE_REG 30 @@ -1100,7 +1099,7 @@ static void tcg_out_setcond(TCGContext *s, TCGType type, TCGCond cond, /* If we have ISEL, we can implement everything with 3 or 4 insns. All other cases below are also at least 3 insns, so speed up the code generator by not considering them and always using ISEL. */ - if (HAVE_ISEL) { + if (have_isel) { int isel, tab; tcg_out_cmp(s, cond, arg1, arg2, const_arg2, 7, type); @@ -1203,7 +1202,7 @@ static void tcg_out_movcond(TCGContext *s, TCGType type, TCGCond cond, tcg_out_cmp(s, cond, c1, c2, const_c2, 7, type); - if (HAVE_ISEL) { + if (have_isel) { int isel = tcg_to_isel[cond]; /* Swap the V operands if the operation indicates inversion. */ @@ -1247,7 +1246,7 @@ static void tcg_out_cntxz(TCGContext *s, TCGType type, uint32_t opc, } else { tcg_out_cmp(s, TCG_COND_EQ, a1, 0, 1, 7, type); /* Note that the only other valid constant for a2 is 0. */ - if (HAVE_ISEL) { + if (have_isel) { tcg_out32(s, opc | RA(TCG_REG_R0) | RS(a1)); tcg_out32(s, tcg_to_isel[TCG_COND_EQ] | TAB(a0, a2, TCG_REG_R0)); } else if (!const_a2 && a0 == a2) { @@ -2795,6 +2794,14 @@ static void tcg_target_init(TCGContext *s) } #endif +#ifdef PPC_FEATURE2_HAS_ISEL + /* Prefer explicit instruction from the kernel. */ + have_isel = (hwcap2 & PPC_FEATURE2_HAS_ISEL) != 0; +#else + /* Fall back to knowing Power7 (2.06) has ISEL. */ + have_isel = have_isa_2_06; +#endif + tcg_target_available_regs[TCG_TYPE_I32] = 0xffffffff; tcg_target_available_regs[TCG_TYPE_I64] = 0xffffffff;