From patchwork Sat Apr 20 07:34:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 162580 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp312865jan; Sat, 20 Apr 2019 00:59:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqypIcwiEYiHI9trPw1RMtSEOwVhe1RcLjgswH4Q0h71ndrxtFKRGv6iW10t6fJLA4JS7gQC X-Received: by 2002:adf:f051:: with SMTP id t17mr5477776wro.73.1555747159012; Sat, 20 Apr 2019 00:59:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555747159; cv=none; d=google.com; s=arc-20160816; b=otAGAXaSN1aMrPcgEh03yMdWIiqsoPEPe2AS+DWfk33WvAzilJ6a837EgLM6immqlH R/haaSvMkXtwOpe8itcT3mE7m3ZJa8Dl3meQMdeo0/y9ksdOCuQZkv395315mHH+m/69 eezIxaEcdfXun/xPcQ7bq7ce6jL8KXJJS0joP5t69QfXqibjL5PGRWN4tEwYpy871/DI CQrbWlUx6Ie47PRpaS3Sv1gGKl5GBV8qBiKaA+avlFkVBrMopgCkRWg49G4Po2GKun42 yyDZBMhBaUGVl2PV/OSwZJ4CaGawpktkJY8O6X3dS2xHmcZw9EyPePKMDu4h32eU2YC3 8/Wg== 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=R0QqxrQEMqfALEw2bMQE+5E2LW+Mhp5XpDv3PusuZQk=; b=l4Fny5bNxBakQUL819BPg57E+HrM7q+1w7b37NwSRn+KTG3ersqQsrovllb9/3xjwH b98yaexI7p4U/hpSHLjQHQ5Ok5WQFGz6c0H3AJdNdtejw2BjEW7ZZ6wxwZdPHlVNO2jk GqzjtBdyRo6c1DlYkASyeHqGhGzojigy7fNGNqEFMo6rJ6s8eQjfHY1SKa2w5Gk0xYuP 4dk15KHdFzznRqpBzL/umO18ebC+RxUqhYmg8MFJTVwSMB5+mqvjxRlPhutTjy8m1SnZ 7tOKTovjmdhLAVW9JZa+pSurTVk3elTrGTD996UAhHVidOF9omkwUxVERM4mMnUj5OuC xgGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=qBKKszkz; 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 s6si2671426wrr.251.2019.04.20.00.59.18 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 20 Apr 2019 00:59:19 -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=qBKKszkz; 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]:38396 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hHku6-00044W-1M for patch@linaro.org; Sat, 20 Apr 2019 03:59:18 -0400 Received: from eggs.gnu.org ([209.51.188.92]:40566) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hHkXY-00012q-IL for qemu-devel@nongnu.org; Sat, 20 Apr 2019 03:36:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hHkXW-0000nG-FA for qemu-devel@nongnu.org; Sat, 20 Apr 2019 03:36:00 -0400 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]:36978) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hHkXW-0000Px-7j for qemu-devel@nongnu.org; Sat, 20 Apr 2019 03:35:58 -0400 Received: by mail-pl1-x62c.google.com with SMTP id w23so3539961ply.4 for ; Sat, 20 Apr 2019 00:35:43 -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=R0QqxrQEMqfALEw2bMQE+5E2LW+Mhp5XpDv3PusuZQk=; b=qBKKszkzqmZLSpPi+dn+VAqtu/jNi1nmj6cL11ZW3BvZKYBebX6Op4paK4F2zm/0wv TH1CNck2bfDHz+B4beP3mczruHihNlVE6sQz0XRN3oFnhVcTm5V0zMl4HA1rsD4O+9RJ 8qEIbV5wIx2pZgzJ5N3rzcjm4Q5bAC9VjshX6FN5M9jnAg3qLBRWoeWkZ8CUuEfn5gL1 xF2vAhdn1VshTdNbVCd05D8ZAPydL37RCDy1W4ZFbNCPanzPorUyKV22V0UktDt+4+f7 oaxx2gSD1wV+Y3ROQlmghyZTQmaxGX3RYuaOskKUben/qcNPcyOqomBRtVXKuT3jNUjW vvyA== 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=R0QqxrQEMqfALEw2bMQE+5E2LW+Mhp5XpDv3PusuZQk=; b=PvS/Ho4yemB2SaA5BosgV17tfsBOscSafIx0sSQ03nM4Y4RkYKUm32nxeUNybeXVkp cOudvT/1t//yNftMKcMmdixTtR+KhMeKHNR9syBkj9/PXZrBsIUbA7+jUJYa9pCdTnWu ZLSSG8e2Os/nGX9OvP8LggcaBOg9R4Q7U5g3gfzOSHkW9F/POLKYwdHTv2H3T3rPKtoP 1znJdJxupMMocQF19altjXI78l3+wHTsX1ObHp+AczRPckRaPVgt9OP5wS9NVj8Bzww6 3ZaiAT0HwJNOMmdBrXq8W3zeQWMbxzx4uwW0Hgjlle2ugNCrmAhagk6yEj3Jl+covSAj hBVQ== X-Gm-Message-State: APjAAAV2CfZMt3CUkpJLPRarEgIUKeZevYKH897lLSGJI/XJ0ABEbKXT FFnrYqomY4oOwHgVVdHxP8gt2AKRx14= X-Received: by 2002:a17:902:2aa6:: with SMTP id j35mr2390510plb.236.1555745742505; Sat, 20 Apr 2019 00:35:42 -0700 (PDT) Received: from localhost.localdomain (rrcs-66-91-136-155.west.biz.rr.com. [66.91.136.155]) by smtp.gmail.com with ESMTPSA id z22sm7025492pgv.23.2019.04.20.00.35.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 20 Apr 2019 00:35:41 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 19 Apr 2019 21:34:40 -1000 Message-Id: <20190420073442.7488-37-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190420073442.7488-1-richard.henderson@linaro.org> References: <20190420073442.7488-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::62c Subject: [Qemu-devel] [PATCH 36/38] tcg: Expand vector minmax using cmp+cmpsel 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: david@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- tcg/tcg-op-gvec.c | 8 ++++++++ tcg/tcg-op-vec.c | 19 +++++++++++++++---- 2 files changed, 23 insertions(+), 4 deletions(-) -- 2.17.1 diff --git a/tcg/tcg-op-gvec.c b/tcg/tcg-op-gvec.c index e7029d26f4..dddb00719a 100644 --- a/tcg/tcg-op-gvec.c +++ b/tcg/tcg-op-gvec.c @@ -99,6 +99,14 @@ static bool tcg_can_emit_vecop_list(const TCGOpcode *list, case INDEX_op_cmpsel_vec: /* Fallback expansion uses only required logial ops. */ continue; + case INDEX_op_smin_vec: + case INDEX_op_smax_vec: + case INDEX_op_umin_vec: + case INDEX_op_umax_vec: + if (tcg_can_emit_vec_op(INDEX_op_cmp_vec, type, vece)) { + continue; + } + break; default: break; } diff --git a/tcg/tcg-op-vec.c b/tcg/tcg-op-vec.c index 5868a51270..43abeb0674 100644 --- a/tcg/tcg-op-vec.c +++ b/tcg/tcg-op-vec.c @@ -520,24 +520,35 @@ void tcg_gen_ussub_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b) do_op3_nofail(vece, r, a, b, INDEX_op_ussub_vec); } +static void do_minmax(unsigned vece, TCGv_vec r, TCGv_vec a, + TCGv_vec b, TCGOpcode opc, TCGCond cond) +{ + if (!do_op3(vece, r, a, b, opc)) { + TCGv_vec t = tcg_temp_new_vec_matching(r); + tcg_gen_cmp_vec(cond, vece, t, a, b); + tcg_gen_cmpsel_vec(vece, r, t, a, b); + tcg_temp_free_vec(t); + } +} + void tcg_gen_smin_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b) { - do_op3_nofail(vece, r, a, b, INDEX_op_smin_vec); + do_minmax(vece, r, a, b, INDEX_op_smin_vec, TCG_COND_GT); } void tcg_gen_umin_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b) { - do_op3_nofail(vece, r, a, b, INDEX_op_umin_vec); + do_minmax(vece, r, a, b, INDEX_op_umin_vec, TCG_COND_LTU); } void tcg_gen_smax_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b) { - do_op3_nofail(vece, r, a, b, INDEX_op_smax_vec); + do_minmax(vece, r, a, b, INDEX_op_smax_vec, TCG_COND_GT); } void tcg_gen_umax_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b) { - do_op3_nofail(vece, r, a, b, INDEX_op_umax_vec); + do_minmax(vece, r, a, b, INDEX_op_umax_vec, TCG_COND_GTU); } void tcg_gen_shlv_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b)