From patchwork Wed May 1 05:05:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 163183 Delivered-To: patch@linaro.org Received: by 2002:a92:7e86:0:0:0:0:0 with SMTP id q6csp4124069ill; Tue, 30 Apr 2019 22:11:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqxPmwbhmY5yFlopnp+IpraBatAP1BvqN7wXC1xt+pHDE3A/iZrEzefiotENZjNsz55zpRtr X-Received: by 2002:adf:f309:: with SMTP id i9mr46010670wro.258.1556687503634; Tue, 30 Apr 2019 22:11:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556687503; cv=none; d=google.com; s=arc-20160816; b=cLqRDbLWMg0Qx9R1vhNF40imwEjIbheJoYhwSCmspkY0pwlZL+8rAiSdkWLKj/jtWS t9iBV67Eazy+pQYq7Emj+9bNt55y24en3z9xVz2gx1ffS5cfqr/0d3RETQcHJKap2YtE AdNbIfbuf0CMunxvw/21b3kzeAMZCFi0NzoUD8hKJifc7Q+AGojYKevPdPefTbyLlOo/ fK62gL5t6Y7No0hC16DuwAqoo1vAO25tiUwYpESVVmlNgCz/aMNU2p19IdOu+crexfn4 fahWGN8ns8i8z6zRyRjtfAg4aQ8qK0FIL4PtRbieDTByC141CqH+mxOuo3RX15n67q5x cI2A== 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=Abtf7ymAcKqk+MfIJ4hNEtC4LePCgm1dY3zGf9JwmC8=; b=vNjBRHO7rkO0osY08BYKX63nF6n02iypm/Htkoe2vS3SDkzLwMzYGHUvohitTBekrJ hh0yrkuDcrgIiOFsOOQsnilVVYNBj3M9lbFHi/4z9d8Px59L6CA7vQYlv9zpVNlV6KrX YWAASJWOZhgPQW+L0Ayru3EtB4hrEiUoODbQrZBRssKAB4zyhtlcRvvJr90kklXbekVB /pka5H7bpO3bXDEfA8m0g4AS+R2Pr6Bx7eWSBBHCOjpIXgi8wDmLy5KBnutAbHgbHOdH 7L2f33nepfMwhN8kcx+rmtPhcDTCv/4RNFIbaJ2cnuqm4lUBAJ1NRYDl1KJORXARIrDI jeTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=YGWQ3kPc; 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 n14si12472061wre.118.2019.04.30.22.11.43 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 30 Apr 2019 22:11:43 -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=YGWQ3kPc; 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]:36295 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hLhWw-00032I-Ep for patch@linaro.org; Wed, 01 May 2019 01:11:42 -0400 Received: from eggs.gnu.org ([209.51.188.92]:38380) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hLhRZ-0006YK-BT for qemu-devel@nongnu.org; Wed, 01 May 2019 01:06:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hLhRV-0002ws-SE for qemu-devel@nongnu.org; Wed, 01 May 2019 01:06:09 -0400 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]:39578) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hLhRV-0002vy-JS for qemu-devel@nongnu.org; Wed, 01 May 2019 01:06:05 -0400 Received: by mail-pf1-x442.google.com with SMTP id z26so4260165pfg.6 for ; Tue, 30 Apr 2019 22:06:04 -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=Abtf7ymAcKqk+MfIJ4hNEtC4LePCgm1dY3zGf9JwmC8=; b=YGWQ3kPcRbB0RlOCGvzsguHvm5L1Q6I/PbfATDCENzuNEaUczoe7Tua1aWllbOFd2c 9AywBqLFeOaxhppcyULRKbkiODOe3md/sjG8GJd3q6N3/uQp7CnABqGK+9c0wNEONuft bCGbJrP/HDw5w6N+Z/xnjeS72F1GDbKZ5LXgEI4tThm1QEGwNlJIPJKQ9ZtHntRrsN++ zwM0jI8rOfSxzecY4xjz7b2GrJlju9VuB5INIpmf5ceBKZCCZG1Zs8vi+NsOMsZtlyl1 t0pOV7MBa0UG9VRML9rdoqdJX31SVkO/zQ0/0Y2r/8mN1VsiLlWSLas0IeKgQ7SQBFA7 A4Lw== 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=Abtf7ymAcKqk+MfIJ4hNEtC4LePCgm1dY3zGf9JwmC8=; b=ZISXSmxmDC+W6fglYyCpDGzfB5gUbeS9duLFc8zO5skPkNd/30F/5XSAo5yevtCRxs S1k7kLyczPBO30IWwhHdhc4DIYuQymp+cF1K1t0MuK6+jaL8XZNYhW55wan/LEAH4Uxd dvX0wgqAcuPpFBGUsx6ngmXIqcws4waI31uI/KQLjZqTxnqHtTBDE8zMmVEeuAsS7xXh Ur8DfY9KegXLjFj4+WD+vLETDdHg1LpD25T1tZSfL57sa3wxloaBwGRDrTnt2VDM0ofy TiFhCLeILvzC8VFy2UbZOv69iU+bpbUqy2DUjAao552Cay0NonC5OOCg0obLAEa0KIqt 2fZg== X-Gm-Message-State: APjAAAWutN3KokLUNAw5WBIdA+ULTfNbswz64If7Gm4yBKYVymCK8YJm NtbtakdJO4+CECt/cLh685mtIwbwEGw= X-Received: by 2002:a63:6804:: with SMTP id d4mr72200013pgc.240.1556687163380; Tue, 30 Apr 2019 22:06:03 -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.02 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Apr 2019 22:06:02 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 30 Apr 2019 22:05:23 -0700 Message-Id: <20190501050536.15580-17-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::442 Subject: [Qemu-devel] [PATCH v2 16/29] tcg/aarch64: Support vector variable 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/aarch64/tcg-target.h | 2 +- tcg/aarch64/tcg-target.opc.h | 2 ++ tcg/aarch64/tcg-target.inc.c | 42 ++++++++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+), 1 deletion(-) -- 2.17.1 Reviewed-by: Alex Bennée diff --git a/tcg/aarch64/tcg-target.h b/tcg/aarch64/tcg-target.h index ce2bb1f90b..f5640a229b 100644 --- a/tcg/aarch64/tcg-target.h +++ b/tcg/aarch64/tcg-target.h @@ -134,7 +134,7 @@ typedef enum { #define TCG_TARGET_HAS_neg_vec 1 #define TCG_TARGET_HAS_shi_vec 1 #define TCG_TARGET_HAS_shs_vec 0 -#define TCG_TARGET_HAS_shv_vec 0 +#define TCG_TARGET_HAS_shv_vec 1 #define TCG_TARGET_HAS_cmp_vec 1 #define TCG_TARGET_HAS_mul_vec 1 #define TCG_TARGET_HAS_sat_vec 1 diff --git a/tcg/aarch64/tcg-target.opc.h b/tcg/aarch64/tcg-target.opc.h index 4816a6c3d4..59e1d3f7f7 100644 --- a/tcg/aarch64/tcg-target.opc.h +++ b/tcg/aarch64/tcg-target.opc.h @@ -1,3 +1,5 @@ /* 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. */ + +DEF(aa64_sshl_vec, 1, 2, 0, IMPLVEC) diff --git a/tcg/aarch64/tcg-target.inc.c b/tcg/aarch64/tcg-target.inc.c index 16381f5175..61c2dbbff2 100644 --- a/tcg/aarch64/tcg-target.inc.c +++ b/tcg/aarch64/tcg-target.inc.c @@ -538,12 +538,14 @@ typedef enum { I3616_CMEQ = 0x2e208c00, I3616_SMAX = 0x0e206400, I3616_SMIN = 0x0e206c00, + I3616_SSHL = 0x0e204400, I3616_SQADD = 0x0e200c00, I3616_SQSUB = 0x0e202c00, I3616_UMAX = 0x2e206400, I3616_UMIN = 0x2e206c00, I3616_UQADD = 0x2e200c00, I3616_UQSUB = 0x2e202c00, + I3616_USHL = 0x2e204400, /* AdvSIMD two-reg misc. */ I3617_CMGT0 = 0x0e208800, @@ -2258,6 +2260,12 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, case INDEX_op_sari_vec: tcg_out_insn(s, 3614, SSHR, is_q, a0, a1, (16 << vece) - a2); break; + case INDEX_op_shlv_vec: + tcg_out_insn(s, 3616, USHL, is_q, vece, a0, a1, a2); + break; + case INDEX_op_aa64_sshl_vec: + tcg_out_insn(s, 3616, SSHL, is_q, vece, a0, a1, a2); + break; case INDEX_op_cmp_vec: { TCGCond cond = args[3]; @@ -2325,7 +2333,11 @@ int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece) case INDEX_op_smin_vec: case INDEX_op_umax_vec: case INDEX_op_umin_vec: + case INDEX_op_shlv_vec: return 1; + case INDEX_op_shrv_vec: + case INDEX_op_sarv_vec: + return -1; case INDEX_op_mul_vec: return vece < MO_64; @@ -2337,6 +2349,32 @@ int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece) void tcg_expand_vec_op(TCGOpcode opc, TCGType type, unsigned vece, TCGArg a0, ...) { + va_list va; + TCGv_vec v0, v1, v2, t1; + + va_start(va, a0); + v0 = temp_tcgv_vec(arg_temp(a0)); + v1 = temp_tcgv_vec(arg_temp(va_arg(va, TCGArg))); + v2 = temp_tcgv_vec(arg_temp(va_arg(va, TCGArg))); + + switch (opc) { + case INDEX_op_shrv_vec: + case INDEX_op_sarv_vec: + /* Right shifts are negative left shifts for AArch64. */ + t1 = tcg_temp_new_vec(type); + tcg_gen_neg_vec(vece, t1, v2); + opc = (opc == INDEX_op_shrv_vec + ? INDEX_op_shlv_vec : INDEX_op_aa64_sshl_vec); + vec_gen_3(opc, type, vece, tcgv_vec_arg(v0), + tcgv_vec_arg(v1), tcgv_vec_arg(t1)); + tcg_temp_free_vec(t1); + break; + + default: + g_assert_not_reached(); + } + + va_end(va); } static const TCGTargetOpDef *tcg_target_op_def(TCGOpcode op) @@ -2518,6 +2556,10 @@ static const TCGTargetOpDef *tcg_target_op_def(TCGOpcode op) case INDEX_op_smin_vec: case INDEX_op_umax_vec: case INDEX_op_umin_vec: + case INDEX_op_shlv_vec: + case INDEX_op_shrv_vec: + case INDEX_op_sarv_vec: + case INDEX_op_aa64_sshl_vec: return &w_w_w; case INDEX_op_not_vec: case INDEX_op_neg_vec: