From patchwork Mon Dec 18 17:17:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 122245 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3103321qgn; Mon, 18 Dec 2017 09:22:13 -0800 (PST) X-Google-Smtp-Source: ACJfBosckWap6w0MsyRhPPJUFRy3IdOmb45vBbHywQkVBJSKcivRKBnS5Iv1eD3lerfFV8fLrtxd X-Received: by 10.129.169.194 with SMTP id g185mr391453ywh.420.1513617733913; Mon, 18 Dec 2017 09:22:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513617733; cv=none; d=google.com; s=arc-20160816; b=Kw/Uq6MgkOyMYgEl+G8GOcx8X9UGhoNtwFTpxsLUtivmtQRNyzTcQ4wMDcnrcXtwUL PEq5grhqkwe98R21h0I/gr1OSuoIvj9FmIF3ec1VhwXbJK4rTOgjouNqiKug/ow5yvCY 9TM06GapIwOoMoUkHGR8bCKVB7UvB6Q4joqHBcVMFPPpCo4iBvacEcPwdRQcWR7E4sLt DT+nbfTuAWCXDr4U8qkcpLsaYh1SH9BPse58UwechXtMRJIf5ONtglY08j08pRRGZ6pt TjDD/Mn0/vs6wC48wHCBO/uLLi0Is9LS+AzOoS/EnbXtwcGJy/byR4f9wVT8xejrzy6r 5ojw== 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:subject:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=/GgjKGXHrQaYbQicWKE6S3D9Cp7sWgPEK7F5sH0PF2I=; b=NqSVaYmDEGbNK2TXpe0sYWOZfgwTWqBDu1A1CcF4RDhlYrL6w52Y6JYvU312Jl5BOk /TSPoAlyFB8hGtQhyVLMG231vZUO1JEeKTqrF9v1HVHXMvcZ9UohnZOKPtzK8MK5RDLC UVehJqE+en/Eyf9+hbvMbXvlFxrIAplzYZgJEsMfKORHO441QMmk8tbR8MZc0gkzqwGe oLhR3NBj7jH9hcA+ZOar1QruxiKWR6XDdHWdWW32lEULeiVGEyjg2eOUtSXkAfPONGeE tugfzgYTMpmCObKbYPakwtes/lltRLK52KkEWBcRsAw4XdcQy6CxNe/Hl26DWSBU4sYS LHiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=F9ah4O3A; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id t84si2527310ywf.135.2017.12.18.09.22.13 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 18 Dec 2017 09:22:13 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=F9ah4O3A; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:58455 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQz7F-0003Iq-C8 for patch@linaro.org; Mon, 18 Dec 2017 12:22:13 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37034) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQz3V-0000OC-U3 for qemu-devel@nongnu.org; Mon, 18 Dec 2017 12:18:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eQz3Q-00010q-Es for qemu-devel@nongnu.org; Mon, 18 Dec 2017 12:18:21 -0500 Received: from mail-pl0-x244.google.com ([2607:f8b0:400e:c01::244]:44969) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eQz3Q-0000zg-6v for qemu-devel@nongnu.org; Mon, 18 Dec 2017 12:18:16 -0500 Received: by mail-pl0-x244.google.com with SMTP id n13so5193364plp.11 for ; Mon, 18 Dec 2017 09:18:16 -0800 (PST) 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=/GgjKGXHrQaYbQicWKE6S3D9Cp7sWgPEK7F5sH0PF2I=; b=F9ah4O3Ao1lelNyK93Wqnilt4YwczA3AoRXE0J9fhFspvfFKaRe885lT7/jcCd5P/i +jKykItG7vi6XKO5fLsHUI9Mx6OP8BcAezSubIfDGbraZAOFq3nwAKTaNa9MNnU2Uqj/ b6HWJsHa+Lm0m9uKrH73qcBPGAfQWNaSx726s= 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=/GgjKGXHrQaYbQicWKE6S3D9Cp7sWgPEK7F5sH0PF2I=; b=tawFjgkmiJL+ARAPQNAIWovmTT1Qlvw+89OJySATXTfZRho9PFPG0GAY7RoJnfbBEa rf1/afFjPtSIUVauf8oJyHKLXY4q8WC8Z2Ehzy5rr6NECW+Ly6tsUW864ePY2oy3ARHE 7cIXll+3n5q3NyOXdImydgKROuGHdy4gXTBWwKErKA/Rvx3t7HG8OPOnOMtNvQwpBkmS SoXp8ntQ/QDQ4WjjBMkX13yJXjYq7eJY9Fjdq3LBmTfI7o5PpPrQvVGUR9+0WmA/A7mW G5DuZYoG/lIvDK84butzLODDcD0rUCDM0wMZLOe2uvqcUqy7HVireOrHqaxiZznYrGzN JZyA== X-Gm-Message-State: AKGB3mIjQ1gW6REAdD6llu1kC5SXGWHWRNP4PT08WJTu+J/G2QwVlEt7 udQUB1EZSsbZrxhAqqCLDy6ZLxqodzk= X-Received: by 10.84.252.148 with SMTP id y20mr384437pll.245.1513617494881; Mon, 18 Dec 2017 09:18:14 -0800 (PST) Received: from cloudburst.twiddle.net (174-21-7-63.tukw.qwest.net. [174.21.7.63]) by smtp.gmail.com with ESMTPSA id y19sm21050272pgv.19.2017.12.18.09.18.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Dec 2017 09:18:13 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 18 Dec 2017 09:17:41 -0800 Message-Id: <20171218171758.16964-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171218171758.16964-1-richard.henderson@linaro.org> References: <20171218171758.16964-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::244 Subject: [Qemu-devel] [PATCH v7 09/26] tcg: Add tcg_expand_vec_op and tcg-target.opc.h X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 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" These will be useful in the next few patches adding shifts, permutes, and multiplication. Signed-off-by: Richard Henderson --- tcg/i386/tcg-target.opc.h | 3 +++ tcg/tcg-opc.h | 6 ++++++ tcg/tcg.h | 15 +++++++++++++++ tcg/i386/tcg-target.inc.c | 21 +++++++++++++++++++++ tcg/tcg.c | 13 ++++++++++--- 5 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 tcg/i386/tcg-target.opc.h -- 2.14.3 diff --git a/tcg/i386/tcg-target.opc.h b/tcg/i386/tcg-target.opc.h new file mode 100644 index 0000000000..4816a6c3d4 --- /dev/null +++ b/tcg/i386/tcg-target.opc.h @@ -0,0 +1,3 @@ +/* Target-specific opcodes for host vector expansion. These will be + emitted by tcg_expand_vec_op. For those familiar with GCC internals, + consider these to be UNSPEC with names. */ diff --git a/tcg/tcg-opc.h b/tcg/tcg-opc.h index 4e62eda14b..b4e16cfbc3 100644 --- a/tcg/tcg-opc.h +++ b/tcg/tcg-opc.h @@ -229,6 +229,12 @@ DEF(andc_vec, 1, 2, 0, IMPLVEC | IMPL(TCG_TARGET_HAS_andc_vec)) DEF(orc_vec, 1, 2, 0, IMPLVEC | IMPL(TCG_TARGET_HAS_orc_vec)) DEF(not_vec, 1, 1, 0, IMPLVEC | IMPL(TCG_TARGET_HAS_not_vec)) +DEF(last_generic, 0, 0, 0, TCG_OPF_NOT_PRESENT) + +#if TCG_TARGET_MAYBE_vec +#include "tcg-target.opc.h" +#endif + #undef TLADDR_ARGS #undef DATA64_ARGS #undef IMPL diff --git a/tcg/tcg.h b/tcg/tcg.h index dce483b0ee..0e9d79bdd4 100644 --- a/tcg/tcg.h +++ b/tcg/tcg.h @@ -1207,6 +1207,21 @@ uintptr_t tcg_qemu_tb_exec(CPUArchState *env, uint8_t *tb_ptr); void tcg_register_jit(void *buf, size_t buf_size); +#if TCG_TARGET_MAYBE_vec +/* Return zero if the tuple (opc, type, vece) is unsupportable; + return > 0 if it is directly supportable; + return < 0 if we must call tcg_expand_vec_op. */ +int tcg_can_emit_vec_op(TCGOpcode, TCGType, unsigned); +#else +static inline int tcg_can_emit_vec_op(TCGOpcode o, TCGType t, unsigned ve) +{ + return 0; +} +#endif + +/* Expand the tuple (opc, type, vece) on the given arguments. */ +void tcg_expand_vec_op(TCGOpcode, TCGType, unsigned, TCGArg, ...); + /* * Memory helpers that will be used by TCG generated code. */ diff --git a/tcg/i386/tcg-target.inc.c b/tcg/i386/tcg-target.inc.c index e9a4d92598..062cf16607 100644 --- a/tcg/i386/tcg-target.inc.c +++ b/tcg/i386/tcg-target.inc.c @@ -2942,6 +2942,27 @@ static const TCGTargetOpDef *tcg_target_op_def(TCGOpcode op) return NULL; } +int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece) +{ + switch (opc) { + case INDEX_op_add_vec: + case INDEX_op_sub_vec: + case INDEX_op_and_vec: + case INDEX_op_or_vec: + case INDEX_op_xor_vec: + case INDEX_op_andc_vec: + return true; + + default: + return false; + } +} + +void tcg_expand_vec_op(TCGOpcode opc, TCGType type, unsigned vece, + TCGArg a0, ...) +{ +} + static const int tcg_target_callee_save_regs[] = { #if TCG_TARGET_REG_BITS == 64 TCG_REG_RBP, diff --git a/tcg/tcg.c b/tcg/tcg.c index 16b8faf66f..b4f8938fb0 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -1404,10 +1404,10 @@ bool tcg_op_supported(TCGOpcode op) case INDEX_op_orc_vec: return have_vec && TCG_TARGET_HAS_orc_vec; - case NB_OPS: - break; + default: + tcg_debug_assert(op > INDEX_op_last_generic && op < NB_OPS); + return true; } - g_assert_not_reached(); } /* Note: we convert the 64 bit args to 32 bit and do some alignment @@ -3737,3 +3737,10 @@ void tcg_register_jit(void *buf, size_t buf_size) { } #endif /* ELF_HOST_MACHINE */ + +#if !TCG_TARGET_MAYBE_vec +void tcg_expand_vec_op(TCGOpcode o, TCGType t, unsigned e, TCGArg a0, ...) +{ + g_assert_not_reached(); +} +#endif