From patchwork Sun Oct 13 22:25:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 176095 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp3791606ill; Sun, 13 Oct 2019 15:40:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqxaCem2l7PjAwPPMCKQ/FtfCsiEZwpGRnMK/TudmNlrS6+W5wow8rx4Y2vKDL1q1FMZoSnO X-Received: by 2002:a17:907:366:: with SMTP id rs6mr25708375ejb.232.1571006411420; Sun, 13 Oct 2019 15:40:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571006411; cv=none; d=google.com; s=arc-20160816; b=lBa+4TdUB+EcSp39fdlka8ZVDKgGy+DnogjJPo6q4hDSBZewl/Q6TG4c0EV1eX3hqq bvf78qGqyuhpINBg1sFCONrKOyrDsM+zP+1iU83hRVRIPaCiF0mNRfveH124zWdz7qiM 8jCLtuB56EwFm9SgF/EQUWWpR83AgZDPgJRHVw2jJRUjlgBgrboIOWrGABpp1qt+5BcT gtsL8TObC1anoMEyzugo23ymmpWM7GYAYOTXEfqEkd9hUxfLnXWrTKflzMtckLr6ePhB UhDisnqqpBrDQuOdse095m0Pcg5z91Wu5m/SzZL8Vy8gnLWFqHSOHi88JCGNCIcmdbf8 9Srw== 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:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=5ZDmbwz7v2egeojt/Bhecjq76qk07ezt/13exaG5QJI=; b=C84+9fpuS2o63Vu2qfheGMnZA+ttiYZo9MbLfr8onjzG+zMc3JA9L9kzulYqRVbwDc Tyxj7ybWzim6msZaqtiGVbIkOxM38jH67taBtdlc7mpIFXixMz46Zp/34CsC3oFvCtph hdWHOonk1dKrtigWHtI3V7xmGzfN37gheFJqQotMQNGxbJZcQAF1JXAsVm12iWZWwh5I gZ2GiQ5r5Ylcdz37A/DRRhZ0eWbhLh0wgegFFCHR+3+QW7GDSb3XXfUnr9CHK/vKMK9Z HxTadZNbbgpW2x8LZq9BTOx87WfYLetjrdTnDBaCMGM7Ej2mY9WIv/N+ZQfZJZNMdHtw 2r6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Orl5U+SO; 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=pass (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 e12si11965943edb.262.2019.10.13.15.40.11 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 13 Oct 2019 15:40:11 -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=pass header.i=@linaro.org header.s=google header.b=Orl5U+SO; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:43262 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iJmX4-0004QS-4O for patch@linaro.org; Sun, 13 Oct 2019 18:40:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51241) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iJmJP-0006lj-16 for qemu-devel@nongnu.org; Sun, 13 Oct 2019 18:26:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iJmJM-0000tP-8x for qemu-devel@nongnu.org; Sun, 13 Oct 2019 18:26:02 -0400 Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]:42464) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iJmJM-0000tC-2S for qemu-devel@nongnu.org; Sun, 13 Oct 2019 18:26:00 -0400 Received: by mail-pg1-x52d.google.com with SMTP id f14so3817977pgi.9 for ; Sun, 13 Oct 2019 15:26:00 -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=5ZDmbwz7v2egeojt/Bhecjq76qk07ezt/13exaG5QJI=; b=Orl5U+SOcF0h8ZUzIsugmGwxryPFjloJuDDAFeQw/GgTI797hHWQ8gygIbNoJUhLYw obzvhLX/N/wEO5ZM5DP2uMuQQitTE56fri7arWrZgU4K8oolD2UG/A2oRkOnopJcFt91 Z/vGy9s9MgqMSoVwFy1pKoxXA1IhUEqnVGP/aNlgeBpfqqeK6lggok+NG711I+vslBXX 3hrUqDxG6ynSPV8OU7W3IuCHDP6QxrjaOypheJymjFWe6SNOd4tRD/boWg8yu3IhIxZ+ sukhK7FvR/lCDxhB0+cAGDRTHxZuWXRtmVRIdtgfkFEbFa4G/nAiBYow2n2nyYATFkDt 99Og== 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=5ZDmbwz7v2egeojt/Bhecjq76qk07ezt/13exaG5QJI=; b=QcVQq1R4s8V7XGD6UxTXVTVT4GTUyI/RuF73vWQloIf5vBvpKA4zH4dHvFpe4T7N7C V68I4ojdrsho3Lii07e/FXtnCaJ2uTvEfhlatuaULvoR+a/A5pIiKeryncwpN1F910jI 5M7lbErNufDtg1lxJdO38Uh2ZlpSQdwjRJuHPQM06lVBAt3trpUWnQKmdvpsa8fiiNIv TtoFsugbUKC4F1R+53I1yRfmEGkQxsrHD4Tyfn5XBu6Y8np4E5CL5l6z1PbkGi9qV13z 0TObUBZp0A63ReGPGhIMNQcmTNJosGj1ocgv0k++g854RnfYmobLrM5mbOUH4Wp8Q2dj JE/A== X-Gm-Message-State: APjAAAXUEnxoqfJJ6wXZaXBiMFLgmLFL2xsnv30gRJ3Kb20Zl+upgLhX 02kCnIEu1ebEF0cRuL1iTtrpStE8V1U= X-Received: by 2002:a63:d754:: with SMTP id w20mr11166502pgi.156.1571005558708; Sun, 13 Oct 2019 15:25:58 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id d76sm15940571pfd.185.2019.10.13.15.25.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Oct 2019 15:25:57 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 09/23] tcg/ppc: Add support for vector maximum/minimum Date: Sun, 13 Oct 2019 15:25:30 -0700 Message-Id: <20191013222544.3679-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191013222544.3679-1-richard.henderson@linaro.org> References: <20191013222544.3679-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::52d X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, Aleksandar Markovic Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Add support for vector maximum/minimum using Altivec instructions VMAXSB, VMAXSH, VMAXSW, VMAXUB, VMAXUH, VMAXUW, and VMINSB, VMINSH, VMINSW, VMINUB, VMINUH, VMINUW. Signed-off-by: Richard Henderson Signed-off-by: Aleksandar Markovic --- tcg/ppc/tcg-target.h | 2 +- tcg/ppc/tcg-target.inc.c | 40 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 40 insertions(+), 2 deletions(-) -- 2.17.1 diff --git a/tcg/ppc/tcg-target.h b/tcg/ppc/tcg-target.h index a0e59a5074..13699f1b63 100644 --- a/tcg/ppc/tcg-target.h +++ b/tcg/ppc/tcg-target.h @@ -164,7 +164,7 @@ extern bool have_altivec; #define TCG_TARGET_HAS_cmp_vec 1 #define TCG_TARGET_HAS_mul_vec 0 #define TCG_TARGET_HAS_sat_vec 0 -#define TCG_TARGET_HAS_minmax_vec 0 +#define TCG_TARGET_HAS_minmax_vec 1 #define TCG_TARGET_HAS_bitsel_vec 0 #define TCG_TARGET_HAS_cmpsel_vec 0 diff --git a/tcg/ppc/tcg-target.inc.c b/tcg/ppc/tcg-target.inc.c index 1a8d7dc925..6879be6f80 100644 --- a/tcg/ppc/tcg-target.inc.c +++ b/tcg/ppc/tcg-target.inc.c @@ -471,6 +471,19 @@ static int tcg_target_const_match(tcg_target_long val, TCGType type, #define STVX XO31(231) #define STVEWX XO31(199) +#define VMAXSB VX4(258) +#define VMAXSH VX4(322) +#define VMAXSW VX4(386) +#define VMAXUB VX4(2) +#define VMAXUH VX4(66) +#define VMAXUW VX4(130) +#define VMINSB VX4(770) +#define VMINSH VX4(834) +#define VMINSW VX4(898) +#define VMINUB VX4(514) +#define VMINUH VX4(578) +#define VMINUW VX4(642) + #define VCMPEQUB VX4(6) #define VCMPEQUH VX4(70) #define VCMPEQUW VX4(134) @@ -2817,6 +2830,11 @@ int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece) case INDEX_op_andc_vec: case INDEX_op_not_vec: return 1; + case INDEX_op_smax_vec: + case INDEX_op_smin_vec: + case INDEX_op_umax_vec: + case INDEX_op_umin_vec: + return vece <= MO_32; case INDEX_op_cmp_vec: return vece <= MO_32 ? -1 : 0; default: @@ -2914,7 +2932,11 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, static const uint32_t eq_op[4] = { VCMPEQUB, VCMPEQUH, VCMPEQUW, 0 }, gts_op[4] = { VCMPGTSB, VCMPGTSH, VCMPGTSW, 0 }, - gtu_op[4] = { VCMPGTUB, VCMPGTUH, VCMPGTUW, 0 }; + gtu_op[4] = { VCMPGTUB, VCMPGTUH, VCMPGTUW, 0 }, + umin_op[4] = { VMINUB, VMINUH, VMINUW, 0 }, + smin_op[4] = { VMINSB, VMINSH, VMINSW, 0 }, + umax_op[4] = { VMAXUB, VMAXUH, VMAXUW, 0 }, + smax_op[4] = { VMAXSB, VMAXSH, VMAXSW, 0 }; TCGType type = vecl + TCG_TYPE_V64; TCGArg a0 = args[0], a1 = args[1], a2 = args[2]; @@ -2931,6 +2953,18 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, tcg_out_dupm_vec(s, type, vece, a0, a1, a2); return; + case INDEX_op_smin_vec: + insn = smin_op[vece]; + break; + case INDEX_op_umin_vec: + insn = umin_op[vece]; + break; + case INDEX_op_smax_vec: + insn = smax_op[vece]; + break; + case INDEX_op_umax_vec: + insn = umax_op[vece]; + break; case INDEX_op_and_vec: insn = VAND; break; @@ -3223,6 +3257,10 @@ static const TCGTargetOpDef *tcg_target_op_def(TCGOpcode op) case INDEX_op_andc_vec: case INDEX_op_orc_vec: case INDEX_op_cmp_vec: + case INDEX_op_smax_vec: + case INDEX_op_smin_vec: + case INDEX_op_umax_vec: + case INDEX_op_umin_vec: return &v_v_v; case INDEX_op_not_vec: case INDEX_op_dup_vec: