From patchwork Tue Nov 21 21:25:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 119425 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp5827044qgn; Tue, 21 Nov 2017 13:45:27 -0800 (PST) X-Google-Smtp-Source: AGs4zMZvHvAUJkN1PPwMAgadyEe+zV1E4Pe3EYLfgPso7LXvFB1K9nzeOiodYoaFheBrexIvrwi+ X-Received: by 10.129.159.72 with SMTP id w69mr12005768ywg.491.1511300727952; Tue, 21 Nov 2017 13:45:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511300727; cv=none; d=google.com; s=arc-20160816; b=BSHMHb9nvpUKsFZHX7LuUeovuK3fQVLOVSQ6mvrMai/GSDAOyx8a0BSrwB3NKwhEGa HgA1TmAq8v9BQJ17CoK1prGQ6qe5Zn27zwko+P0L/d9homOK1ObuiNU2HQtI762goGyT U+Wto9DSe+u9n4DZhidFBUPazoSkipxNx745iVV+0Yahme2sw7BUsMJjjl+ge6BYEJLd 1/I7quwXX2In1WCJEuCKYSvxAAZpnFG7xKrKSeR3f0wCttDqaxbpUM/ZdcwKo5jh27ZE sbF4FG41OK87qmsU0K16+humvVF6e9wUMUgy4/mL8X7pCmXDRGDxHD8QX+3j9vovFBgk i+yA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:arc-authentication-results; bh=9nX13rkW5BnudPsgCBbM6M5Hq1UugkSHhy4B6et7qLw=; b=M9b08w+9NlbqThB+Yi3ShtCVvY26G9mIWJP+Zjn7vmSr9wku9//4mBqSuAtycrgbzA 8EDPq9LK9fR4tWzRd/hVv6OC8UIcBDx0ua3f6tb/TzHtsXZtQd4w549kb0U2hm4ZiWkb YIKxnRnqIbNPBWbyTw6N18OrC82nZJhsolpiYMiTz4/cV1b/L39Cd4r/IPMRDSb/rq4T wXZZIMJp0/sTGl7Ya3hrkqojiQn/E2XCohQ3SgLZoIxMieAul7OlZnyLS49HWFk587Hr TST5xOfyH2C5ZSP3yy+QlnzzEQK1VgT7UtAeyzainoGL4O7E4huW0MIhS4GVbR0IEfF3 I3Jg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=HNj226uM; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id u1si2984905ybd.714.2017.11.21.13.45.27 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 21 Nov 2017 13:45:27 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=HNj226uM; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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]:36665 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eHGMB-0002j4-BM for patch@linaro.org; Tue, 21 Nov 2017 16:45:27 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54157) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eHG5L-0004b3-PQ for qemu-devel@nongnu.org; Tue, 21 Nov 2017 16:28:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eHG5K-0007oS-F6 for qemu-devel@nongnu.org; Tue, 21 Nov 2017 16:28:03 -0500 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:37620) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eHG5K-0007oA-6B for qemu-devel@nongnu.org; Tue, 21 Nov 2017 16:28:02 -0500 Received: by mail-wm0-x242.google.com with SMTP id v186so6270134wma.2 for ; Tue, 21 Nov 2017 13:28:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=9nX13rkW5BnudPsgCBbM6M5Hq1UugkSHhy4B6et7qLw=; b=HNj226uMcsK0W7dq9aBFFE0Av0CKkTxXMK9SDbMADir4WMtQcERgfj+Xo+Xm5tbSzq gDlPqtP77AzIF7JqqD3sXn3I7kzZWQk+t+ohBV/zb9Y/eU0kzSgGmddAskdq2pi18HpI dqqdvH4hKrxl0kITSxB7wQhP4P90qnynYzf7g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=9nX13rkW5BnudPsgCBbM6M5Hq1UugkSHhy4B6et7qLw=; b=tLiPZBqYKxKKpzkYWm+s9FfLjHKIYLc9StNv4lUPPM6kZg6CXYMs8kQ7mtz+PLZoHJ LoHvDvAhPwc3zaM5fi1ImrcGwTwwsajGk+geVf3x7p1t/4yxiRzvSDEdHIqbaZszWZy/ 7U/ddgTlxf1xiFGmFGeK7t4o3f3cwZhiRXCDP2BjpJS68DnX7DJpXCRNgH+5jymexyQu 7RgMmziVqPfXD4IAuTS/sLTcOAK06k64dWDTlU4bAuKNzYziy43OFm/GlFlpoe24GtPx G1iUfJr5XZ1avWUnEnMC8jEePsgXje0DMPoPDHgkGmRDrgsjYiDTSQKc+VBA3L6BQtRU Sh3A== X-Gm-Message-State: AJaThX4ZtU1gB9W191u73xUunPrjE56LwMRB25Fonc2SBsPck+uIUJ25 FZFran+qXXBZKffKs60Exnt/ggEXY8w= X-Received: by 10.28.125.85 with SMTP id y82mr2440412wmc.25.1511299680955; Tue, 21 Nov 2017 13:28:00 -0800 (PST) Received: from cloudburst.twiddle.net (70.red-37-158-60.dynamicip.rima-tde.net. [37.158.60.70]) by smtp.gmail.com with ESMTPSA id e124sm706517wmg.34.2017.11.21.13.27.59 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Nov 2017 13:27:59 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 21 Nov 2017 22:25:27 +0100 Message-Id: <20171121212534.5177-20-richard.henderson@linaro.org> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171121212534.5177-1-richard.henderson@linaro.org> References: <20171121212534.5177-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::242 Subject: [Qemu-devel] [PATCH v6 19/26] target/arm: Use vector infrastructure for aa64 compares 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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- target/arm/translate-a64.c | 96 ++++++++++++++++++++++++++++++---------------- 1 file changed, 62 insertions(+), 34 deletions(-) -- 2.13.6 diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index c47faa5633..1ea7e37b03 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -7115,6 +7115,28 @@ static void disas_simd_scalar_three_reg_diff(DisasContext *s, uint32_t insn) } } +/* CMTST : test is "if (X & Y != 0)". */ +static void gen_cmtst_i32(TCGv_i32 d, TCGv_i32 a, TCGv_i32 b) +{ + tcg_gen_and_i32(d, a, b); + tcg_gen_setcondi_i32(TCG_COND_NE, d, d, 0); + tcg_gen_neg_i32(d, d); +} + +static void gen_cmtst_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b) +{ + tcg_gen_and_i64(d, a, b); + tcg_gen_setcondi_i64(TCG_COND_NE, d, d, 0); + tcg_gen_neg_i64(d, d); +} + +static void gen_cmtst_vec(unsigned vece, TCGv_vec d, TCGv_vec a, TCGv_vec b) +{ + tcg_gen_and_vec(vece, d, a, b); + tcg_gen_dupi_vec(vece, a, 0); + tcg_gen_cmp_vec(TCG_COND_NE, vece, d, d, a); +} + static void handle_3same_64(DisasContext *s, int opcode, bool u, TCGv_i64 tcg_rd, TCGv_i64 tcg_rn, TCGv_i64 tcg_rm) { @@ -7158,10 +7180,7 @@ static void handle_3same_64(DisasContext *s, int opcode, bool u, cond = TCG_COND_EQ; goto do_cmop; } - /* CMTST : test is "if (X & Y != 0)". */ - tcg_gen_and_i64(tcg_rd, tcg_rn, tcg_rm); - tcg_gen_setcondi_i64(TCG_COND_NE, tcg_rd, tcg_rd, 0); - tcg_gen_neg_i64(tcg_rd, tcg_rd); + gen_cmtst_i64(tcg_rd, tcg_rn, tcg_rm); break; case 0x8: /* SSHL, USHL */ if (u) { @@ -9684,6 +9703,7 @@ static void disas_simd_3same_int(DisasContext *s, uint32_t insn) int rd = extract32(insn, 0, 5); int pass; GVecGen3Fn *gvec_op; + TCGCond cond; switch (opcode) { case 0x13: /* MUL, PMUL */ @@ -9731,6 +9751,44 @@ static void disas_simd_3same_int(DisasContext *s, uint32_t insn) vec_full_reg_offset(s, rm), is_q ? 16 : 8, vec_full_reg_size(s)); return; + case 0x11: + if (u) { /* CMEQ */ + cond = TCG_COND_EQ; + goto do_gvec_cmp; + } else { /* CMTST */ + static const GVecGen3 cmtst_op[4] = { + { .fni4 = gen_helper_neon_tst_u8, + .fniv = gen_cmtst_vec, + .vece = MO_8 }, + { .fni4 = gen_helper_neon_tst_u16, + .fniv = gen_cmtst_vec, + .vece = MO_16 }, + { .fni4 = gen_cmtst_i32, + .fniv = gen_cmtst_vec, + .vece = MO_32 }, + { .fni8 = gen_cmtst_i64, + .fniv = gen_cmtst_vec, + .prefer_i64 = TCG_TARGET_REG_BITS == 64, + .vece = MO_64 }, + }; + tcg_gen_gvec_3(vec_full_reg_offset(s, rd), + vec_full_reg_offset(s, rn), + vec_full_reg_offset(s, rm), + is_q ? 16 : 8, vec_full_reg_size(s), + &cmtst_op[size]); + } + return; + case 0x06: /* CMGT, CMHI */ + cond = u ? TCG_COND_GTU : TCG_COND_GT; + goto do_gvec_cmp; + case 0x07: /* CMGE, CMHS */ + cond = u ? TCG_COND_GEU : TCG_COND_GE; + do_gvec_cmp: + tcg_gen_gvec_cmp(cond, size, vec_full_reg_offset(s, rd), + vec_full_reg_offset(s, rn), + vec_full_reg_offset(s, rm), + is_q ? 16 : 8, vec_full_reg_size(s)); + return; } if (size == 3) { @@ -9813,26 +9871,6 @@ static void disas_simd_3same_int(DisasContext *s, uint32_t insn) genenvfn = fns[size][u]; break; } - case 0x6: /* CMGT, CMHI */ - { - static NeonGenTwoOpFn * const fns[3][2] = { - { gen_helper_neon_cgt_s8, gen_helper_neon_cgt_u8 }, - { gen_helper_neon_cgt_s16, gen_helper_neon_cgt_u16 }, - { gen_helper_neon_cgt_s32, gen_helper_neon_cgt_u32 }, - }; - genfn = fns[size][u]; - break; - } - case 0x7: /* CMGE, CMHS */ - { - static NeonGenTwoOpFn * const fns[3][2] = { - { gen_helper_neon_cge_s8, gen_helper_neon_cge_u8 }, - { gen_helper_neon_cge_s16, gen_helper_neon_cge_u16 }, - { gen_helper_neon_cge_s32, gen_helper_neon_cge_u32 }, - }; - genfn = fns[size][u]; - break; - } case 0x8: /* SSHL, USHL */ { static NeonGenTwoOpFn * const fns[3][2] = { @@ -9905,16 +9943,6 @@ static void disas_simd_3same_int(DisasContext *s, uint32_t insn) genfn = fns[size][u]; break; } - case 0x11: /* CMTST, CMEQ */ - { - static NeonGenTwoOpFn * const fns[3][2] = { - { gen_helper_neon_tst_u8, gen_helper_neon_ceq_u8 }, - { gen_helper_neon_tst_u16, gen_helper_neon_ceq_u16 }, - { gen_helper_neon_tst_u32, gen_helper_neon_ceq_u32 }, - }; - genfn = fns[size][u]; - break; - } case 0x13: /* MUL, PMUL */ if (u) { /* PMUL */