From patchwork Wed May 1 05:05:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 163187 Delivered-To: patch@linaro.org Received: by 2002:a92:7e86:0:0:0:0:0 with SMTP id q6csp4124351ill; Tue, 30 Apr 2019 22:12:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqx7vd6nWCAd3g3y56oYVPsIf5Wx7Bc9GH1V33J8Xhl21TtybBiDWXZ1uYeBI1Fc87CuXx9R X-Received: by 2002:a17:902:6b82:: with SMTP id p2mr17399643plk.99.1556687532908; Tue, 30 Apr 2019 22:12:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556687532; cv=none; d=google.com; s=arc-20160816; b=fuVMvZKTOHv8tUJcJevBK8ggMaxVC4wUeQ0G/iDOPDTAqbB7bU/PNG9zvfXJNSKRPT 1mWyzWPCMQWAqeD61Iqief+a78uzvAs2PsxfO84YFLuEn/luYu1ciOkqgFnd6P8Qmv4l UcATixbyLxJNgZhe2c1dpMamF2lO0xMxjsb7boU1AibvSLT9tQzsy7TUsKp60XXLM5jl 66cjcg5oucABfF9Tde1lmZrnQAMzFQS6N5aFLUNZmxW4In2hQVoBGXnxQNFQkMhW0ks7 21A8nQdg5Pz4woCnbvCvhFu1l/Bdg7wp9Z3NnH8TbZvGX0x8hgAQs11aDXDR9md0xu/F sIoQ== 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:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=C9S5vov6bUnXU5tt0bNOV17wX7MiGxVomIsm/epCn2g=; b=vgwFK9vYzhmrFLhhrngp2/Ik3bDX14ew1NSBZjkxl810Xv02fNSSkBapcIoMX8apmZ LLYC/0rUZOmvWGcU4b6GyHFRNrGZSvIb+JH0KH4IG5yLP9nSn0d8PDEa41RaXwum/dfX L8+nl3SfYyh/66/v99vzfYtktgxBxCwaTJ4KlcRo14mJr10dTd/3bSyB4T3bBNeFQgc5 VMsIaiRxI8RzwYnlizMItp5cmUmTzCI7TZzcbl1AHs1inGNvXrfqfS+InCnciMp8BQe4 uYAMUEmKGO5zchxNWKLFttPe/x7ne8Imxwm2fBVJ9mgvS9ekv21bh1jzz8fW4xIBqPxU LQGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=YVwRHHR5; 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 d37si39367550plb.401.2019.04.30.22.12.12 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 30 Apr 2019 22:12:12 -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=YVwRHHR5; 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]:36299 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hLhXN-00037A-KD for patch@linaro.org; Wed, 01 May 2019 01:12:09 -0400 Received: from eggs.gnu.org ([209.51.188.92]:38406) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hLhRd-0006bl-49 for qemu-devel@nongnu.org; Wed, 01 May 2019 01:06:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hLhRZ-0002zp-As for qemu-devel@nongnu.org; Wed, 01 May 2019 01:06:12 -0400 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]:34464) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hLhRX-0002x5-EU for qemu-devel@nongnu.org; Wed, 01 May 2019 01:06:07 -0400 Received: by mail-pf1-x42a.google.com with SMTP id b3so8156938pfd.1 for ; Tue, 30 Apr 2019 22:06:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=C9S5vov6bUnXU5tt0bNOV17wX7MiGxVomIsm/epCn2g=; b=YVwRHHR5znooT8iDc7LZpXeeD8UR/L3GxJzgqeEd06p49GDxJUoErxoGOZFiLTuSJK 97L6YIFj7WzAl/aUStBVALitKcmnbJUxAM0fMCxM7FZr9HJ/u/L87MUpWUIieK66HYoB 6tTVW6f95M/lW/yR1RQdHEKjCYv0OmMyQmoqWKyGYYCRwh2p9KtH+8XExorvjVwnd2Yz REd6sEwLbvVwEfU1x2KXeah+Q92eBOoKw8zyvzhrYEcLHNWNwk5DOWTnJit2pWtJ0zon XEWVWCmlq1JS58WA7zVtONR3JozUnh7lIGLBm/H2+391Wh2nDdD8YlO+EjtBrYhz8czd 6uuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=C9S5vov6bUnXU5tt0bNOV17wX7MiGxVomIsm/epCn2g=; b=TmugFi9joEQ6espZylEufGYFpScVhPpX3pLOj6xHgYvG3I4+KAv3ud+3TKOLSdhy8W Gzpgd3fE2KuS4nkZkMDoXgKqk5aZlDHvqvCz4rEWfWe4B2/1IDaW6fYJ1eM59UHSV6ee SOWtvg1uSo5E/YarkE1u7bX6QLBXGtODEbCka93+MFLCjdTEddqq8Gv2FpSZutrGn9ci dQqlkhy4NTjQULbgY4+hoATTiuq+M8BanoNqe5H85lVtq5JuAuanTkJlwJ1+5n/LRfcA onpfwl5GUyPxRWQIUKQ0BuT8D1+fo1n3zIK46lhdNU4dSA/cOQJDXu0sU1x+ts0WUk2e axLQ== X-Gm-Message-State: APjAAAWCjgg2evB372vjdzsNJOuVUhnxP6HlVE7QKpjI5G767Ea9WZkB zevQpcjaEjaa2ZRPMuu8X/szL3xUWEQ= X-Received: by 2002:a63:ed4e:: with SMTP id m14mr73239595pgk.182.1556687165871; Tue, 30 Apr 2019 22:06:05 -0700 (PDT) Received: from localhost.localdomain (97-113-189-189.tukw.qwest.net. [97.113.189.189]) by smtp.gmail.com with ESMTPSA id t127sm9687251pfb.106.2019.04.30.22.06.04 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Apr 2019 22:06:05 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 30 Apr 2019 22:05:25 -0700 Message-Id: <20190501050536.15580-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190501050536.15580-1-richard.henderson@linaro.org> References: <20190501050536.15580-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::42a Subject: [Qemu-devel] [PATCH v2 18/29] 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: , 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;