From patchwork Sat Jun 29 13:00:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 168167 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp739993ilk; Sat, 29 Jun 2019 06:18:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqz7j690zi+lrwqRxEyhNXS6kAh1PtjJk256vTkPOrTJo4bdwgcWmC348jFAf8A3zfI/QZNr X-Received: by 2002:a05:6402:2cb:: with SMTP id b11mr17519225edx.281.1561814290497; Sat, 29 Jun 2019 06:18:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561814290; cv=none; d=google.com; s=arc-20160816; b=fS+fJBijgQ9P0i82ftYnjJsglQiU1fyqVsmnWUXfrwJl2RzZ4KOYmj1IZhB77aD7pT 7ZmOoQufWKl1r41GbPJYZGbhcn791mG0ShWwK158vjkxEuPfcUTUv6iA1B42fjWh1j6E HRlYksF+69LV1z23MkvN7fCP4wigiK36guLOxKxtebjzoEHae0LeRudkwT6+vMvWMpAc yZEpWT3MBD8pP3Jkzdu+Nnr/XN75kjr8uv9JczjznoZRpE1C5liBAoT0askGmr8P8/rx zquEa/VJttlpLpMm8w+w34IbxiyA33bNuLh134mt04hq4Ne2hOjRnxK/s6WYpS3k2bo2 PYVw== 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=8c5PWY3kLWS20dN1HlPj3Yx2DCSMVh04T/gD6RTE3Dk=; b=tmXBClYuxmb5UjlzjjrHEcUC7oJ14Nryg7PPHLgsE8iZKbXIGNthqPw6A3obWMIOxw jzncYoGu2cWOQabCpiPMFX/OdUJrCizqZE+W0WgtuwSc6lWeXCu0yyCQCV7G6bGku6PA vVyYvhSIHeV/Gt3SHujzM2gnlNnemZ9wmz5HP+ppDVF4P6MRVJ72/Nw+lYNml5pErCps NYYMOH0/jgfQ5SoeDuSY+9EVV9uHAPjfcE0DTmUJJmkEieAnbo+/wPZei7aKs1qg0GSJ 6gmTKEOLAhlg/jSfi6GGCpxZtMIHsedCNMtVXpI/PPRjNoek+S9p5tbGuyOBKvw76sfH sW8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=puWa1sT5; 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 v9si4781119edm.56.2019.06.29.06.18.10 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 29 Jun 2019 06:18:10 -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=puWa1sT5; 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 ([::1]:39609 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hhDF3-00067Y-Gc for patch@linaro.org; Sat, 29 Jun 2019 09:18:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41294) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hhCyC-0007zS-3h for qemu-devel@nongnu.org; Sat, 29 Jun 2019 09:00:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hhCy9-0003d5-9u for qemu-devel@nongnu.org; Sat, 29 Jun 2019 09:00:43 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]:34310) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hhCy8-0003Ly-ND for qemu-devel@nongnu.org; Sat, 29 Jun 2019 09:00:40 -0400 Received: by mail-wm1-x330.google.com with SMTP id w9so11100919wmd.1 for ; Sat, 29 Jun 2019 06:00:26 -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=8c5PWY3kLWS20dN1HlPj3Yx2DCSMVh04T/gD6RTE3Dk=; b=puWa1sT5b2YYTerF5BXKmUC7LsmrdDQajpPA1R3JeWaare6MsGo4mx9ATWIMDIlVbu AhPmav82cEtS+1bC8Bxh2KsEnOReTw40Pt0m4lLVPflYs51WpP6CN3NJrhpyUSEEWzdo R9u9vTF4CxcMn0/50Of93UyBquc5bHBrVSvp9BBlE0qfM264f4NCmL30pqJTjUne0zlW LTDdIIw5mEGiaPvSR9D8kSoDqJPy/soPnP/6pRtxQHQSmhZQOYn8mbXHvtRr1An/S97S Nxoo+TBsMSCt2F6VvlrCI2S5MxpqQJoIvBzMMWwZ+ykLltwi4s2iedgfmeyOaBFYFpGt DekQ== 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=8c5PWY3kLWS20dN1HlPj3Yx2DCSMVh04T/gD6RTE3Dk=; b=hl/U1Z3r5D5/NxiWRY1fkrLcEVwHF1TK3j0hvHSdzxoEv18dFauvAxn3lXKfHhzVak JN2fG7AFwyv/CP9xv0cOCoeJx12wkadqDV3Mt5ZN3nCDCvekvTPVbTdZJVSe7Edljkc0 MqW/a80X60Duo8lTE6BkB3eU22goA1buy4NKRaHROk2AMjJtFMQyNDL4gWFJF2W44G8I X2DgizpY3dpD0AZKEdkEIvCNtcyK4hgiZEhQMBw+cRn0DULM2VzOIjzy3uzZD95oDPI3 A+p2HNHzifqRRkGVTUL00TJEnSVOKtmBNpItSvxT2BhQ6Z6eVD/pVIAUet2DLc6pWmsH a5VQ== X-Gm-Message-State: APjAAAX3sZgl5TWz3WTjn6Sk1z0eO1EM+wl1/AYwp2rtXofkkHnmI9xq xgua+RMDDsH+SfdTw89uf5VastuA0l2bmQ== X-Received: by 2002:a1c:7408:: with SMTP id p8mr10151054wmc.161.1561813225100; Sat, 29 Jun 2019 06:00:25 -0700 (PDT) Received: from localhost.localdomain (93-34-153-63.ip50.fastwebnet.it. [93.34.153.63]) by smtp.gmail.com with ESMTPSA id d10sm4937676wro.18.2019.06.29.06.00.24 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sat, 29 Jun 2019 06:00:24 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sat, 29 Jun 2019 15:00:07 +0200 Message-Id: <20190629130017.2973-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190629130017.2973-1-richard.henderson@linaro.org> References: <20190629130017.2973-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::330 Subject: [Qemu-devel] [PATCH v6 06/16] tcg/ppc: Add support for vector maximum/minimum 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: mark.cave-ayland@ilande.co.uk, amarkovic@wavecomp.com, hsp.cat7@gmail.com 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 b66a808259..a86ed57303 100644 --- a/tcg/ppc/tcg-target.h +++ b/tcg/ppc/tcg-target.h @@ -156,7 +156,7 @@ extern bool have_isa_3_00; #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 87c418ebf4..9c5630dc8a 100644 --- a/tcg/ppc/tcg-target.inc.c +++ b/tcg/ppc/tcg-target.inc.c @@ -474,6 +474,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) @@ -2820,6 +2833,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: @@ -2917,7 +2935,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]; @@ -2934,6 +2956,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; @@ -3226,6 +3260,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: