From patchwork Wed May 22 22:28:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 164902 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp1411124ili; Wed, 22 May 2019 15:29:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqxI7tIel+8RpH52UGWdsYvE7jA73RbVfi5RPExj/M6YsSw9LCRCx3lVjSUw2INzMYjbBR64 X-Received: by 2002:a17:906:f1d8:: with SMTP id gx24mr11374363ejb.239.1558564144661; Wed, 22 May 2019 15:29:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558564144; cv=none; d=google.com; s=arc-20160816; b=qDsOlHDZkJZT6bOGMY7s93OnHqgRpOCGcSOETdZAiF8lIeOIy5s4wsL1ZUYwg8EYkA 5aSUUYtCEpa5PAgUDm/9N8sjpntZU/rYDTvnrwyE/fTX1bcW1TyzQAOJM3QY0xvaeCES WTnb/us6WI1Zch72v9X4fmT/LyWjGmnhGpbR0J+HyEya7IhaFzzwD5gPrLfEPSsrxAMg YqU3wL7dC1Oz/uaKIZNLTVbMyZM6M6mEvhxNZzn8Y7+w6RAowGfTvIZXcx6J+80bI7i7 qZkv3C2Fmhco16MDtwK825yvMDbF5Ps126jbwfCZ1JNGij2N23na3Bt7Ld9FEpESluAY 9tEw== 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=Dp2wE06ppFvr7SDc7+wjEouETDXh/6Jd86FUlkd8ziE=; b=Wzn+xquWLQ9Qo9ExgUflJnOKGPidCyYJo09/QlWHEtfrcFS0XjchdMFUebC9vdWXE6 n0EdWQtn0oekO6GQ1ynjf/Cwuh+R7wTSl7MxV1JRHFEVOcqfsVzAep6wONDEYVG577rn jXQJrdiBT6RYtahcp7Jc4C20NGdFWGy6nZvKY2dI4ScWxv5yPI1RDzis2guXToLlsuWX vf4P7fsL+MIuke4KtD+TCHRwtuBAaUhoVdieGycKWkbYkC5rjJo9Jk7RkyRGu/1vvOhL QcnIQ+roRRWgOnD5JB5qGTRVCec1c6UfSFVonUkyaTZ+9l2G9NHaLL02VE4+0M6cAiew ebQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=fIPiLh6h; 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 ec17si2062768ejb.96.2019.05.22.15.29.04 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 22 May 2019 15:29:04 -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=fIPiLh6h; 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]:52494 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTZjL-00033T-GP for patch@linaro.org; Wed, 22 May 2019 18:29:03 -0400 Received: from eggs.gnu.org ([209.51.188.92]:49786) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTZiv-00031a-PO for qemu-devel@nongnu.org; Wed, 22 May 2019 18:28:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hTZir-0007M9-W2 for qemu-devel@nongnu.org; Wed, 22 May 2019 18:28:35 -0400 Received: from mail-yb1-xb43.google.com ([2607:f8b0:4864:20::b43]:40183) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hTZiq-0007Kd-1q for qemu-devel@nongnu.org; Wed, 22 May 2019 18:28:33 -0400 Received: by mail-yb1-xb43.google.com with SMTP id g62so1490373ybg.7 for ; Wed, 22 May 2019 15:28:31 -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=Dp2wE06ppFvr7SDc7+wjEouETDXh/6Jd86FUlkd8ziE=; b=fIPiLh6hCxAuH1koRb0SzwwUI/pJky6k/oG7kQyC5n9CWGBZUBZTj3hLS0kkJH0+k+ 2QcPfGDNmec2gxWbNmyh7eyH59U8RwF+zAgPeQGT3eeWLEmVtLv43AswahPT1SPBLrwz GwA7mrBbYxS2Mh0QY0rtsvvXIxC+OeJJCixj/DigvJSeiX35XdpbT+UKYaPk4GWD7Rtf XEV6aVqkYfHPZsdnaq9Y+0wg4r3ytR4zirCq2esL1KY7n0LoD1G066kCHLm1UBw537wg 4rwr98apdk3ekolWwq7wZvSQ3FKKpNqNoKkXmeQvGm7PdhZJpBALhcLyhZvPaf0qUxC7 bmhg== 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=Dp2wE06ppFvr7SDc7+wjEouETDXh/6Jd86FUlkd8ziE=; b=qUY4CvIoVCJAi7fXLB5UmYvEZYP70zz6XWcoR9re07eH25Vr194B7LWa3fCzb33SS/ fGc2N/bNvNbVMcx/snFW7rUHG7vKJ58B9tjVCryn77R01EL5ykxS97Lz9drLsx07owqh q7yQlhJwfUsIAhzWQP4IoywBCUAoMH/hX+Y0c+MTyo9kWi2QLTbXDCx2XO10Qj3aMTAw QnTgOknUxXeEAOJdTKTxoGTdAm9bmuj99sv7Uu0YFB283ZhADSkRY/tpfP95i4SgGvxj WVWUPVjgi5S8TZhRxgT1QVzvDC+kM/eoYDpmCrMrV+MC2k31HbXWP8TebYVSQNkF8YG8 0vRQ== X-Gm-Message-State: APjAAAUHuHEh6fosFysyq53+Y9z13jyp9hTn9+L9PYMiwYplUAGzdv20 vwv/VaSAo7vDNfqlNPxJPKBCmz/g0gI= X-Received: by 2002:a25:ce8a:: with SMTP id x132mr11836887ybe.239.1558564110477; Wed, 22 May 2019 15:28:30 -0700 (PDT) Received: from localhost.localdomain ([71.46.56.17]) by smtp.gmail.com with ESMTPSA id q11sm2276453ywg.7.2019.05.22.15.28.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 May 2019 15:28:29 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 22 May 2019 18:28:11 -0400 Message-Id: <20190522222821.23850-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190522222821.23850-1-richard.henderson@linaro.org> References: <20190522222821.23850-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::b43 Subject: [Qemu-devel] [PULL 06/16] 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: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Provide a generic fallback for the min/max operations. Signed-off-by: Richard Henderson --- tcg/tcg-op-vec.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) -- 2.17.1 diff --git a/tcg/tcg-op-vec.c b/tcg/tcg-op-vec.c index 004a34935b..501d9630a2 100644 --- a/tcg/tcg-op-vec.c +++ b/tcg/tcg-op-vec.c @@ -120,6 +120,10 @@ bool tcg_can_emit_vecop_list(const TCGOpcode *list, } break; case INDEX_op_cmpsel_vec: + 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; } @@ -632,24 +636,32 @@ 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)) { + tcg_gen_cmpsel_vec(cond, vece, r, a, b, a, b); + } +} + 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_LT); } 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)