From patchwork Sat May 4 05:52:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 163371 Delivered-To: patch@linaro.org Received: by 2002:a92:7e86:0:0:0:0:0 with SMTP id q6csp257202ill; Fri, 3 May 2019 23:12:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqy8lFAj0b+pFI769vBg+pSzrnEzNK8sGaSqyIByTL30g0ilVuCr4j5p/SHmCACHVykAfgtG X-Received: by 2002:ac2:558d:: with SMTP id v13mr2246307lfg.76.1556950362166; Fri, 03 May 2019 23:12:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556950362; cv=none; d=google.com; s=arc-20160816; b=SswJW6lmevxovjNAGaqKF/xQPtZZlAvE/5QbpvlG8hMqM9yHRJjPbc1Ar49eW5Asl+ X6W0WzwO0y+EdUZhhvTAkDk1uB8m3R/iL8DxW4lRJew1Y9wroybi7ghk3rhYZjJpnNqW Cvu91ezYbbyMl1Lu9OBplAPGCIXlbViYG9VgENJYKgZx5uDFG0HaE8gAlrjBxnU1R8ta tr+eni6/Bzflt0QWkY8ezt7//sWONht1ve1LyfZdD58htDsGlwforKL2TX9Idsi6KxH8 1vjopNtM8DPD+m+/1rdLMWIKYP+UfmSSkbthKcH1rFHozqlkPZpNvoChXj9RrNyIVhBP pyNQ== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=prTUAzbPvH5wKS0jiTGzjhMb0GdRc5cNbrE395D55Ho=; b=fQfiMcrMA9+C29nW8erH4wiwyABprc0d2zelpOzGebcSvUAAIt9m32e4N3PSb4dEHX tbIwMsWXAksA455XNw84/m/o5ritd/KnM7Vtg1cR2cPWUdMh9bLMdjgVUFRbeO4nE5sr PZovOljyHZtqW0r6aMxpCtj5HSA2PO5GBlk7Wx3n37/MrjRSJK1tysa7AGv26xQD80Ay X6dZp1ef+rFQIg8KZC1ipk2fAVh2XadsjY285405DGzSUEUVewcSb/hrniOQ2akg8uv+ P7LhJlXRBk0PX1f3B3HW6SjCHgXltzd2AjU0ZsuL+J94G/jYSJUDjM+R/il8DwUo04mt AH4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=ZLU4bjck; 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 o25si2837447ljj.59.2019.05.03.23.12.41 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 03 May 2019 23:12:42 -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=ZLU4bjck; 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]:51882 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hMnua-0007um-Fg for patch@linaro.org; Sat, 04 May 2019 02:12:40 -0400 Received: from eggs.gnu.org ([209.51.188.92]:41894) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hMnbx-0007tk-8W for qemu-devel@nongnu.org; Sat, 04 May 2019 01:53:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hMnbw-0004Ll-2K for qemu-devel@nongnu.org; Sat, 04 May 2019 01:53:25 -0400 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]:44766) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hMnbv-0004LP-SX for qemu-devel@nongnu.org; Sat, 04 May 2019 01:53:24 -0400 Received: by mail-pl1-x642.google.com with SMTP id l2so3719837plt.11 for ; Fri, 03 May 2019 22:53:23 -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 :mime-version:content-transfer-encoding; bh=prTUAzbPvH5wKS0jiTGzjhMb0GdRc5cNbrE395D55Ho=; b=ZLU4bjckbQeC31yKp3kZ8VboXHVOeg91xZNS7IyIckWkh/3tU3LgfQhYL/6EAdzwuh DZcdHvt3fGCWRyskTvAU32szKgFwF7PYdn0zOn15cKtSyAxadEeSV17zwG8Cstk1AY8L dAqLX22o6qrfyrsYX6nbbkueHai07+TDEXUQUfmQCJyBQXeGcuBugyggPqxoJi6oMZw0 dFO9H/skJ27qoorh01A6w1Tp3Adkza8lYkvC1LRHrj3ZjnTXUy8xgDBfJnjaSjgKG8qg lis+pkRXQMS8mGbhd+S1Q6UCKsRlyOe0xi6NMmhwqH+L7rxNdgT/d3N80TA1zHcFhH0r QNsA== 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:mime-version:content-transfer-encoding; bh=prTUAzbPvH5wKS0jiTGzjhMb0GdRc5cNbrE395D55Ho=; b=aq8jddUQOzOoWL3clSRBKAk2dkG5Z2f3c+7xNcPZuyzZWJNyK+PcDzcC5ywe2qzqZx 2p13wF9HOmYhvLsAQVzTK1Z1t8wVH2V0YN6yLfDngCJsE9YrtcQ6Ggt7kuvCEMiOYme9 2nGm8SleNO/Yk92UtMaJiNOe3+2a/X9U2+gPd+hFy/er+SZDE9Mc7BbGq7C5UTM4ocrx yPFvZkTLYx8R8213ApYxMvE11ZRx4V8em0PFvXrmjHxELiSZHdFdRE+eQhopTzdTMEYm xHMJ9ZJeFSTAs63z57dqbZ8ow1TnkBEEDunzKigUO8HapU0ThbGuRF2KW5DdlpA4jlb7 scPQ== X-Gm-Message-State: APjAAAVeK412XuFKEl4dHFXPnfh4RG4K4H1DTT5LtP0SIqkVY2dEY8XK pfKfpaF4LKwIuqUtdSmis39YtrntFRY= X-Received: by 2002:a17:902:9884:: with SMTP id s4mr16702915plp.179.1556949202675; Fri, 03 May 2019 22:53:22 -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.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 May 2019 22:53:22 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 3 May 2019 22:52:46 -0700 Message-Id: <20190504055300.18426-18-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> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::642 Subject: [Qemu-devel] [PATCH v3 17/31] 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: , Cc: alex.bennee@linaro.org, david@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Alex Bennée 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 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 15ab35adf7..7d842cad47 100644 --- a/tcg/aarch64/tcg-target.inc.c +++ b/tcg/aarch64/tcg-target.inc.c @@ -536,12 +536,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, @@ -2256,6 +2258,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]; @@ -2323,7 +2331,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; @@ -2335,6 +2347,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) @@ -2516,6 +2554,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: