From patchwork Sat May 4 05:52:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 163353 Delivered-To: patch@linaro.org Received: by 2002:a92:7e86:0:0:0:0:0 with SMTP id q6csp248800ill; Fri, 3 May 2019 23:02:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqzwYqPHSgG3kAsMGPnkBOu+grfNeKSjPYiA+NxJlPBUGuU9NU5fJu7KWEhGjNTiXMJF6DlY X-Received: by 2002:a5d:6a04:: with SMTP id m4mr8819061wru.84.1556949757014; Fri, 03 May 2019 23:02:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556949757; cv=none; d=google.com; s=arc-20160816; b=DrDS5lHpos6MwuoCq5XYqZmRgh/zjps/YJYaESndjjp9QG81lfnFalrg0pmu7ORfEZ DEQsg/p1dQhQgPQ+J68OBrI0dw8twe1oC22TCoYvYnUIVfL6QEkny/F/D/zlBGAOHltr cpAX3ev6LmRzK3hMqvWC6VBkdcaAiJilniJZXgYVSZpZLtxiZhebgV6wDzfOHfJ+n2DA 6Pef7pwSeNn5yBhFzCSNEcjcmcx/z47oMV9jkP76tRQcasmT1rlp3AJG6efdRgE750sY jirr9VyfvRczts1S7dUxJwChhPtZQt6NDiD8qL24oLvT1Ssz5nytZpFBbTFwuLtXsUt+ njbQ== 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; bh=C9S5vov6bUnXU5tt0bNOV17wX7MiGxVomIsm/epCn2g=; b=y8AC60Iw6SnB4hshk9PLCeDEeCyj290AkwdflhUQvMc+AqApnDqNvMapsl8Ie51Jdc mDJR12G3zGiCWTD9nGpobiCPzs5CJToL+0HdmIfJtlLsGyp9w/biZEFMBV27vLIQz2sx mccGqV1gL/+95ZhsxUHkt/EFCkCfHfqRVOSv7wjAOjkLbTQCqXc4zIb5WAgbMAWKp7iG gN5Vmbg2K4lhoMB7pehUMSkQhVUqi2z3ZK21unu5c9a1tM0A7FGuAxPCq2+eWEqIhJm0 41dBYuUtgiGhxavFmQmTnqoa+KVbMIGYiUmU6uXsSrzIbZyI5EaZeI74HWCZUXs+phO0 Vp0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=UN8b35af; 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=fail (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 c8si3002664wrx.364.2019.05.03.23.02.36 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 03 May 2019 23:02:37 -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=fail header.i=@linaro.org header.s=google header.b=UN8b35af; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1]:51735 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hMnkq-0006aI-26 for patch@linaro.org; Sat, 04 May 2019 02:02:36 -0400 Received: from eggs.gnu.org ([209.51.188.92]:41930) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hMnbz-0007wJ-Hf for qemu-devel@nongnu.org; Sat, 04 May 2019 01:53:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hMnby-0004NF-DO for qemu-devel@nongnu.org; Sat, 04 May 2019 01:53:27 -0400 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]:33671) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hMnby-0004N0-79 for qemu-devel@nongnu.org; Sat, 04 May 2019 01:53:26 -0400 Received: by mail-pl1-x633.google.com with SMTP id y3so3740368plp.0 for ; Fri, 03 May 2019 22:53:26 -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=C9S5vov6bUnXU5tt0bNOV17wX7MiGxVomIsm/epCn2g=; b=UN8b35afLcCW4+U6WFWYWS6mnrnER2Q22JrnKlEtNVtCwMbVIm46AVxMB8WuIijfxC x952hvpGs4LGsHnMys6JnFqOUpYgXNA1+lSwxsnBli1b4ue1bR4w7r2fPQHTo7W9vvKL s2sDIFkmIuNJd11pjayIFaNez91Q4Sl5Hhf7BWMHoxjka0aeZxres+xH9bBrXjhGj+IT A4k26ordQRG8H5w+guzILuFbBGgzvneSQc1DjefJfDjdkNub7jhVDiyDdkQAp6mhgN+2 QgEwLe5WQm2PHgZTdaP1lnpXAvZ2RMQWr5GgtvyB7JlAj6kxyVX8nadMcM4CzQ+5dKWu rZGQ== 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=C9S5vov6bUnXU5tt0bNOV17wX7MiGxVomIsm/epCn2g=; b=VI/x9EQjl+fBZlSlD4GOWQBHhFESGp5AvdJkJIZ2eSfTFo8INl9Mu8SS118Paf+Xmu BXK5dLMX6eIOnlrIARPU+wbWu0jYVX3NDEYOT1nluqfVR0rqZFgh8un8fkHzsaiGXYPD tPxwg86i0XlkirgNjUQC9iEJcaynUV5woc8QD8P4W6g/PLZrmDJ5ms1nvEAbC/iFfnPl Pngj2KurS9qZmB9voh7PFjkQEucxJRQ80W54qHk4ijiiiusYYP4L2gh++YkfZA+ZqaPs HjziuDTXKrWTpvtXm3lzgZk8MRUr7iIyQSXcqg9JQBhFzUV6h3AcoX00hFaUOcPvdP1w d7Wg== X-Gm-Message-State: APjAAAXYLR2f4rN5IA9+RCRgy2XnHu2nT6Ygl15vvxEYzLgyb1BeiWH5 hoX5lMOSWAT9128j+aPs2tEJTo4JLTU= X-Received: by 2002:a17:902:8bca:: with SMTP id r10mr16274860plo.67.1556949204966; Fri, 03 May 2019 22:53:24 -0700 (PDT) Received: from localhost.localdomain (97-113-189-189.tukw.qwest.net. [97.113.189.189]) by smtp.gmail.com with ESMTPSA id 15sm6680423pfo.117.2019.05.03.22.53.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 May 2019 22:53:24 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 3 May 2019 22:52:48 -0700 Message-Id: <20190504055300.18426-20-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190504055300.18426-1-richard.henderson@linaro.org> References: <20190504055300.18426-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::633 Subject: [Qemu-devel] [PATCH v3 19/31] tcg/i386: Support vector scalar shift opcodes 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: alex.bennee@linaro.org, david@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- tcg/i386/tcg-target.h | 2 +- tcg/i386/tcg-target.inc.c | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/tcg/i386/tcg-target.h b/tcg/i386/tcg-target.h index b240633455..618aa520d2 100644 --- a/tcg/i386/tcg-target.h +++ b/tcg/i386/tcg-target.h @@ -183,7 +183,7 @@ extern bool have_avx2; #define TCG_TARGET_HAS_not_vec 0 #define TCG_TARGET_HAS_neg_vec 0 #define TCG_TARGET_HAS_shi_vec 1 -#define TCG_TARGET_HAS_shs_vec 0 +#define TCG_TARGET_HAS_shs_vec 1 #define TCG_TARGET_HAS_shv_vec have_avx2 #define TCG_TARGET_HAS_cmp_vec 1 #define TCG_TARGET_HAS_mul_vec 1 diff --git a/tcg/i386/tcg-target.inc.c b/tcg/i386/tcg-target.inc.c index c9448b6d84..0ba1587da4 100644 --- a/tcg/i386/tcg-target.inc.c +++ b/tcg/i386/tcg-target.inc.c @@ -420,6 +420,14 @@ static inline int tcg_target_const_match(tcg_target_long val, TCGType type, #define OPC_PSHIFTW_Ib (0x71 | P_EXT | P_DATA16) /* /2 /6 /4 */ #define OPC_PSHIFTD_Ib (0x72 | P_EXT | P_DATA16) /* /2 /6 /4 */ #define OPC_PSHIFTQ_Ib (0x73 | P_EXT | P_DATA16) /* /2 /6 /4 */ +#define OPC_PSLLW (0xf1 | P_EXT | P_DATA16) +#define OPC_PSLLD (0xf2 | P_EXT | P_DATA16) +#define OPC_PSLLQ (0xf3 | P_EXT | P_DATA16) +#define OPC_PSRAW (0xe1 | P_EXT | P_DATA16) +#define OPC_PSRAD (0xe2 | P_EXT | P_DATA16) +#define OPC_PSRLW (0xd1 | P_EXT | P_DATA16) +#define OPC_PSRLD (0xd2 | P_EXT | P_DATA16) +#define OPC_PSRLQ (0xd3 | P_EXT | P_DATA16) #define OPC_PSUBB (0xf8 | P_EXT | P_DATA16) #define OPC_PSUBW (0xf9 | P_EXT | P_DATA16) #define OPC_PSUBD (0xfa | P_EXT | P_DATA16) @@ -2724,6 +2732,15 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, /* TODO: AVX512 adds support for MO_16, MO_64. */ OPC_UD2, OPC_UD2, OPC_VPSRAVD, OPC_UD2 }; + static int const shls_insn[4] = { + OPC_UD2, OPC_PSLLW, OPC_PSLLD, OPC_PSLLQ + }; + static int const shrs_insn[4] = { + OPC_UD2, OPC_PSRLW, OPC_PSRLD, OPC_PSRLQ + }; + static int const sars_insn[4] = { + OPC_UD2, OPC_PSRAW, OPC_PSRAD, OPC_UD2 + }; TCGType type = vecl + TCG_TYPE_V64; int insn, sub; @@ -2785,6 +2802,15 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, case INDEX_op_sarv_vec: insn = sarv_insn[vece]; goto gen_simd; + case INDEX_op_shls_vec: + insn = shls_insn[vece]; + goto gen_simd; + case INDEX_op_shrs_vec: + insn = shrs_insn[vece]; + goto gen_simd; + case INDEX_op_sars_vec: + insn = sars_insn[vece]; + goto gen_simd; case INDEX_op_x86_punpckl_vec: insn = punpckl_insn[vece]; goto gen_simd; @@ -3165,6 +3191,9 @@ static const TCGTargetOpDef *tcg_target_op_def(TCGOpcode op) case INDEX_op_shlv_vec: case INDEX_op_shrv_vec: case INDEX_op_sarv_vec: + case INDEX_op_shls_vec: + case INDEX_op_shrs_vec: + case INDEX_op_sars_vec: case INDEX_op_cmp_vec: case INDEX_op_x86_shufps_vec: case INDEX_op_x86_blend_vec: @@ -3222,6 +3251,12 @@ int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece) } return 1; + case INDEX_op_shls_vec: + case INDEX_op_shrs_vec: + return vece >= MO_16; + case INDEX_op_sars_vec: + return vece >= MO_16 && vece <= MO_32; + case INDEX_op_shlv_vec: case INDEX_op_shrv_vec: return have_avx2 && vece >= MO_32;