From patchwork Wed May 1 05:05:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 163198 Delivered-To: patch@linaro.org Received: by 2002:a92:7e86:0:0:0:0:0 with SMTP id q6csp4131179ill; Tue, 30 Apr 2019 22:22:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqywc66Xsqw/jnjPUmmC19CO1SjNO5LMR7sCkBZ9mFX3O62vpheafUyduNpFQbaMVnASHwY8 X-Received: by 2002:adf:f2c5:: with SMTP id d5mr29118722wrp.293.1556688127855; Tue, 30 Apr 2019 22:22:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556688127; cv=none; d=google.com; s=arc-20160816; b=py2UT3e9SaFfR14dkTyTu8kDTIsuxux9IT99S9CGoGtYAJ17pSID+Rfx2Knvp8mWR3 FIlCg0zZQO54WbDLgWbgrjjhJ0GO5pPb1ofktwIueXj/og+yza6YpowJi7asA5X+Ta5F esPRKf6hVk4Hjkis7YwgR2vVr6r31WyGf3Bp/NdIvBhO4dCi6WVx+i21tPv/I4bzTD7S 6uNuKrLmo7SuEw63BBYpEPWB1Y7GVV21DFKLmE995fGq+HOplFY8Iv3RU0pbCzm9BXUr z7V+TQTigAb0KS3TbOrxRsYleUEY2gdVYd+KPCoghXYFI+ByIL6ViqsKPQWE5UwVmT9y ilAQ== 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=4RamRVLS6CpSQqwq41FPx2oK0CgrkzF+uLuaNa5g2S4=; b=xTVsezv92T/xOA4tPwJCrXnpiAiCgM1AzaK3NgvZ6JCcHYseryyJXlJrTIARrHqBHE sekzwyg6bw1u/j7+nUyHH013wDpjdvQMwgO5V2Hjl9AHnuarFRcnkp5UqjHJldqHMN95 6tScBAXFFvgjndX24HdtRXxb0jFAHU/eu2kV62EOPpFK0/uhBNupYSzGcp3Wus27WXTq Ph6m7ibOphdgxy1wzzh7JkqG/b4Cj+4Henl2Ryfj/OmoKKUViY8+dgE1ggc5qqHyfVtu IWfhsRwvR0vLb52G+l4BWh0DGu5M3qDCcOEeh6Dbrc3oYcLJPLjIeN/EUAaS4DBWuVi2 gvKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=YUlVOOhk; 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 f12si13205974wrx.51.2019.04.30.22.22.07 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 30 Apr 2019 22:22:07 -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=YUlVOOhk; 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]:36445 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hLhh0-0002ua-OO for patch@linaro.org; Wed, 01 May 2019 01:22:06 -0400 Received: from eggs.gnu.org ([209.51.188.92]:38456) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hLhRi-0006hz-VZ for qemu-devel@nongnu.org; Wed, 01 May 2019 01:06:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hLhRf-00032a-0l for qemu-devel@nongnu.org; Wed, 01 May 2019 01:06:18 -0400 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]:45877) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hLhRd-00030S-ON for qemu-devel@nongnu.org; Wed, 01 May 2019 01:06:14 -0400 Received: by mail-pg1-x531.google.com with SMTP id i21so4414956pgi.12 for ; Tue, 30 Apr 2019 22:06:10 -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=4RamRVLS6CpSQqwq41FPx2oK0CgrkzF+uLuaNa5g2S4=; b=YUlVOOhkSv5Iesn+A6SKAXAjPktYNIihrdUvP8bn15JIkTc+4kc2bUBv/8Zkh/ZEMt gtUSVzN8mBA2XkUiSkIOe39jcbMzr2Ja9BTAXL7Wubrg0QSYE2Kel2rVXh0XOnzPzREf /reDZFBEsiPnRh1YAzmISLr6qERR2CxVozh35uAoZNS8vPUGJg0GOFLywfL5B8a6cbF8 kjM0iSn+9jH90ovt5dgeYVXg8Mn3o/eQZB+ch/ednBIHeqFfblKBE05aC7y6vdhLclWw fi11aoPrXanaCILjPAPwB/L8DlQryyMA6qfWJnA5O6wKLLSJj0nAJeR45NVtjj3gB4tQ 8bCA== 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=4RamRVLS6CpSQqwq41FPx2oK0CgrkzF+uLuaNa5g2S4=; b=i4GbG5kaiaO2TzUuxcgFkXeHXXz8JsAIOB9fQIvjV5bcH6Fsbp5iwpu5I9PUOcbcae 4KYSuNwEqrbLgLhbrRjqlgg6iKS2lRQRfNDiCKvmcrCjeUO6cbMqq8SZ5P35EfjefH7/ WZmVuzblts4cWQicphPZ0VPEkB7VyJfebi/OSXsvf7zyVchrcb82VFE7NRQZNkNMlQCe qJvWsafEfclTpgFSIKaahObr4DeYUsi05Yt/lKvRLN0cigtHxcV9GxNkeRbG26zS6krg 9FilyZ/L4vq+s5WElE08A/FP7HcFKeNY3UJmZ/jycULbLeObRYvsDLHN8NCRMqSG8P7c CBUQ== X-Gm-Message-State: APjAAAUpdjYk695HZX4Fq0QwwtnXeMpa+za4EiA/QnMAl9OlpoL94Jif koTTJGm2VvZJ3kOHSS3w+Ysk7SHiptM= X-Received: by 2002:a63:564f:: with SMTP id g15mr18298405pgm.258.1556687169716; Tue, 30 Apr 2019 22:06:09 -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.08 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Apr 2019 22:06:08 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 30 Apr 2019 22:05:28 -0700 Message-Id: <20190501050536.15580-22-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::531 Subject: [Qemu-devel] [PATCH v2 21/29] tcg/i386: Support vector absolute value 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 | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/tcg/i386/tcg-target.h b/tcg/i386/tcg-target.h index 7445f05885..66f16fbe3c 100644 --- a/tcg/i386/tcg-target.h +++ b/tcg/i386/tcg-target.h @@ -182,7 +182,7 @@ extern bool have_avx2; #define TCG_TARGET_HAS_orc_vec 0 #define TCG_TARGET_HAS_not_vec 0 #define TCG_TARGET_HAS_neg_vec 0 -#define TCG_TARGET_HAS_abs_vec 0 +#define TCG_TARGET_HAS_abs_vec 1 #define TCG_TARGET_HAS_shi_vec 1 #define TCG_TARGET_HAS_shs_vec 1 #define TCG_TARGET_HAS_shv_vec have_avx2 diff --git a/tcg/i386/tcg-target.inc.c b/tcg/i386/tcg-target.inc.c index 0ba1587da4..aafd01cb49 100644 --- a/tcg/i386/tcg-target.inc.c +++ b/tcg/i386/tcg-target.inc.c @@ -369,6 +369,9 @@ static inline int tcg_target_const_match(tcg_target_long val, TCGType type, #define OPC_MOVSLQ (0x63 | P_REXW) #define OPC_MOVZBL (0xb6 | P_EXT) #define OPC_MOVZWL (0xb7 | P_EXT) +#define OPC_PABSB (0x1c | P_EXT38 | P_DATA16) +#define OPC_PABSW (0x1d | P_EXT38 | P_DATA16) +#define OPC_PABSD (0x1e | P_EXT38 | P_DATA16) #define OPC_PACKSSDW (0x6b | P_EXT | P_DATA16) #define OPC_PACKSSWB (0x63 | P_EXT | P_DATA16) #define OPC_PACKUSDW (0x2b | P_EXT38 | P_DATA16) @@ -2741,6 +2744,10 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, static int const sars_insn[4] = { OPC_UD2, OPC_PSRAW, OPC_PSRAD, OPC_UD2 }; + static int const abs_insn[4] = { + /* TODO: AVX512 adds support for MO_64. */ + OPC_PABSB, OPC_PABSW, OPC_PABSD, OPC_UD2 + }; TCGType type = vecl + TCG_TYPE_V64; int insn, sub; @@ -2829,6 +2836,11 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, insn = OPC_PUNPCKLDQ; goto gen_simd; #endif + case INDEX_op_abs_vec: + insn = abs_insn[vece]; + a2 = a1; + a1 = 0; + goto gen_simd; gen_simd: tcg_debug_assert(insn != OPC_UD2); if (type == TCG_TYPE_V256) { @@ -3206,6 +3218,7 @@ static const TCGTargetOpDef *tcg_target_op_def(TCGOpcode op) case INDEX_op_dup2_vec: #endif return &x_x_x; + case INDEX_op_abs_vec: case INDEX_op_dup_vec: case INDEX_op_shli_vec: case INDEX_op_shri_vec: @@ -3283,6 +3296,8 @@ int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece) case INDEX_op_umin_vec: case INDEX_op_umax_vec: return vece <= MO_32 ? 1 : -1; + case INDEX_op_abs_vec: + return vece <= MO_32; default: return 0;