From patchwork Sat May 4 05:52:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 163366 Delivered-To: patch@linaro.org Received: by 2002:a92:7e86:0:0:0:0:0 with SMTP id q6csp253539ill; Fri, 3 May 2019 23:08:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqxG79ffyni/z5i3e3WG+U5Ye4D1df7dE0zZG5IolNCLC1h/nbvU5xTMv+J3ASBfEuN4WTfM X-Received: by 2002:adf:b646:: with SMTP id i6mr9818044wre.12.1556950083231; Fri, 03 May 2019 23:08:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556950083; cv=none; d=google.com; s=arc-20160816; b=CrO/OjHVjwvqs65TyUbeTivM9/zpsK7Akjk42wO1NWBJPa+M/E+CMtLGCMOaCMW3aW oAhhNkzbApwhp3qmtl6rAhf0ltK5es+gymaaCFXCOM5YknCkJ7cp4wLA/ZipKHWlddfB aCMeXtY2Na0etGJF//h0wi+KADBhjtBfClDmie9ErDulZz2B10WguaBITlxIRpwt/PRr Dq0U0Ux0lihqpK1asDV+vheV5QdZ4/oLb8nyCOVFcM6uOj3jpMqfpK9Au6MPYlq47eTi D6DPnzCw8633iktX7qA1KUJqXlXWwyIUDAxxxbeLqs7J8zuVGFiLxeOdMB9LmuJJuEHt P30w== 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=4RamRVLS6CpSQqwq41FPx2oK0CgrkzF+uLuaNa5g2S4=; b=x3CPKWBx3aj5ZsmHmO45cQcvEJGewZ9devM+46E/HP9xHSBrcfOMSFFDSZoDRxoJdK 3F6mHVQoYBzc3+V5/3cMU6uGjVDDLWgeA0LtQ3sa3McxW/yCqFemReIyLGv6whbneN5j ZJeq186xZm9l0edN6Pj2zhuJoQplxbWzoIN8NBrbW87YEmlok6f2hG1/ETwXw78C/tJb 8om18HHXz03JhjpkKeZycJDW/I6uILoyZovOH459xrzVJeVexlFltcmJ/r8d74OLZW6A Trtpj+srsvYBw0ZnFVEh1NqE8UGB8L63ypGI67k+4olqh5qSp0A18zJh5OW7Tqnuv2Nj yeOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=mxDjQCt3; 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 f3si2689066wme.155.2019.05.03.23.08.03 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 03 May 2019 23:08:03 -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=mxDjQCt3; 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]:51810 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hMnq6-0002oR-4f for patch@linaro.org; Sat, 04 May 2019 02:08:02 -0400 Received: from eggs.gnu.org ([209.51.188.92]:41977) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hMnc3-00081I-E8 for qemu-devel@nongnu.org; Sat, 04 May 2019 01:53:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hMnc2-0004R2-De for qemu-devel@nongnu.org; Sat, 04 May 2019 01:53:31 -0400 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]:45108) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hMnc2-0004P3-6z for qemu-devel@nongnu.org; Sat, 04 May 2019 01:53:30 -0400 Received: by mail-pf1-x435.google.com with SMTP id e24so3956563pfi.12 for ; Fri, 03 May 2019 22:53:30 -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=4RamRVLS6CpSQqwq41FPx2oK0CgrkzF+uLuaNa5g2S4=; b=mxDjQCt37mE5J5Cvzs64RuNxY5zDhXZ3MIuN5y3PUi5nR5boLTrL0qW6YrH++IjGvZ QkuAUtbaqGMRK/31fbornlNW91M5vFI9+5a1nznsE1jF9Va6XFa17EpPNvqA6/lv/BvX VQmC1Ifc88lMAtucCyMS80eIz5Qya5EE/Ybvk2zX+xH24fLj02avXdmuehwEjJ0bzwNe /l5U2jKA+KX2uAuw0Yw88kpD/DcFbIYKusEnkqUE+ZZEEA06O5hxz0jDs+T+SObhhqRs b+aG3Bs+aJMPlrdb2uTY/JX3PWQBgoCurlOgmbPnGwh9U6nkfUOKc3rtiY/oM/nmqiBS XCSw== 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=4RamRVLS6CpSQqwq41FPx2oK0CgrkzF+uLuaNa5g2S4=; b=d/1pGY3JnA9UjyMRGzFUPA6IivZVsc1DAiYsOFfvQ2Ri0WFw0XOf9HnoUP7ywYJKvq rfKxbMxqXJwcAHp3KvPz5z/m8EXGkWI0LUVOL7B2KyJo4R9owEvw4TQzfSuweOuYo5nl 3RZw06hVFXZuwCkAFMzSvJ3kT3lZlcnjXm1Gx3LZJyb9PJj6G2xIuOd6q2pvS8cgOclE 8FKaJxByD2R9PlSL4B+80Ok1llhRligNcsA/fVE9/NPPoC/46h3g+bLVILnp2i0NJT+b i5JDl5Jyy0X8wAtk7KfhOrJKAw+fa69TsrXqwAHDqmkgzjB8+XCiWqb/z2FQ0L0oUnH8 HzYg== X-Gm-Message-State: APjAAAX4JGLbnb/zgEU3MSRiQDQmUfhcp2komIq1XLsOgp+R/P+ZAN4H VSdX00Bsfe3PbS6cTZFHw0I4Jydv7RQ= X-Received: by 2002:a63:6849:: with SMTP id d70mr15670892pgc.21.1556949208817; Fri, 03 May 2019 22:53:28 -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.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 May 2019 22:53:28 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 3 May 2019 22:52:51 -0700 Message-Id: <20190504055300.18426-23-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::435 Subject: [Qemu-devel] [PATCH v3 22/31] 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: , 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 | 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;