From patchwork Wed Feb 7 22:55:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 127226 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp936298ljc; Wed, 7 Feb 2018 15:10:49 -0800 (PST) X-Google-Smtp-Source: AH8x226BqktBelP/9IpBP4uH7SKx8TM21nFGRilpZFL0U2ANWCacmUa6UgUCYNOHdjwXyDvaOq/k X-Received: by 10.129.75.70 with SMTP id y67mr5014628ywa.441.1518045049314; Wed, 07 Feb 2018 15:10:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518045049; cv=none; d=google.com; s=arc-20160816; b=vNHkBc4ft8wFLE7jyTssKE8JJSBuuzVbE2HQGudan5xgL5aSsY1b1CLfh4sYmz7fYX rhO8e2aI6vBg6DV3Ta5ogi9rBPgjggfXTHct2+HZ9sfj1aXXRRGoR72HGmIY/jq334qT PetN/o5Sl/js9PlLgHRw34qsQg4LqINNFqR6aOtnb4HpL3/zKywDAfGECYMhA1cIUw0A tGICYsnp/xQDKlWOZimQPlJDIny5Hog5T+P6Tx3ytIfQru9nzRjWfCK/hCQ8QJjSC+Wh lpXFvp0hYmHWNPoYF2MgLdUwM7/VUL/YfiNAj6GCnioZhqRNm/E5YNDVU5I7aSUERBeV gk8Q== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=Xvhy2LZcYHdJi64i91B2Lilc71Cy7WZ3LTf+UAAyJ2g=; b=MXfKZlhHwhGOX1F/6PJBaucvx9Qj6RiOy5UPzTbcyP6BJlBzYu2HHXQzLs0wV3s9a4 /o7h8Z0+WujIuerf2nGphsdNLhvWdkHrGMc5DW421HQ/1FvDeUbY+FpEE8ixJk6ZSeTj uEdbJoFruvRbmBPOCd4ocudw2Fs/8ZuTQnkQMsPnyH2am9mIgP34QIStiKicDe1R/FeQ sQKAR5WYR14a0+ngA6cFGBIU4kYs5NLe2dqg8ncYtD8eNJxjiNKDYJO6AyjlP7tf/Dij LrlmnC58ls6SR9yoizz0MnT45gfQZd9OQBob1q1Xt0c7elZ+O+IsjmCO9LFL07l9cXx5 Lugg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=W/0DSrGE; 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 h125si425814yba.244.2018.02.07.15.10.49 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 07 Feb 2018 15:10:49 -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=W/0DSrGE; 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]:40818 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ejYrY-0003YS-JB for patch@linaro.org; Wed, 07 Feb 2018 18:10:48 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37583) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ejYdP-0007V4-C9 for qemu-devel@nongnu.org; Wed, 07 Feb 2018 17:56:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ejYdM-00055e-2p for qemu-devel@nongnu.org; Wed, 07 Feb 2018 17:56:11 -0500 Received: from mail-pl0-x243.google.com ([2607:f8b0:400e:c01::243]:42714) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ejYdL-00055K-QG for qemu-devel@nongnu.org; Wed, 07 Feb 2018 17:56:08 -0500 Received: by mail-pl0-x243.google.com with SMTP id 11-v6so975386plc.9 for ; Wed, 07 Feb 2018 14:56:07 -0800 (PST) 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 :mime-version:content-transfer-encoding; bh=Xvhy2LZcYHdJi64i91B2Lilc71Cy7WZ3LTf+UAAyJ2g=; b=W/0DSrGEmyIv1wFgRKpnPyPHW/RFpx9sOHXRTAhUZRQ12xSZU+cq6V76efUN1PpUYL 962ONnBsvx6LP1O4fwEssUvTJsJ6ez7Rhpg8bWVGnDV2kIiN24ehn3XmT9lSayQVCbaQ lQ3dHNk0dTd6PQaHGjsHJdq8b+c2d0Ljlqz/k= 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:mime-version:content-transfer-encoding; bh=Xvhy2LZcYHdJi64i91B2Lilc71Cy7WZ3LTf+UAAyJ2g=; b=TSXnChFR7qmqtHb+LQuysrRV72DRiXV1fxdHXcraqMyK+V1CgXgl0ZYKJ5Qqti0n+z FwVPC1b0E/t170vV1KxZ4FR2+rjliA+CAm3cLjg34WTKe5/9Ux51yRuStq3a8OOC8sfr 2xf9OB3hgGqYlJl0tY9JiKE9q5xMI+xHu+dHGKcovxfRO+4duuXlA3UHHTy89t09cqZc dpK/jESadzVRA+bXkKlxoSiRJg5MnUa881QQiyD9R6sFgfapv0V+ywgkqxb+7PswLpwb tYpTHVZEztP+uHvG71/0wMgz+cvmCZNFopmLi3NzEd7FG+HOJY/lz4qkey4Gu+KGAhss HuiQ== X-Gm-Message-State: APf1xPDResv0qOPnmWsWI0KBtuI9gT7mgXuQVVteuzM/DeegPX8/wLHR p09C0Y4TLQOU7K9IBxK/6JkwLSKV2Z4= X-Received: by 2002:a17:902:44a4:: with SMTP id l33-v6mr7478874pld.115.1518044166451; Wed, 07 Feb 2018 14:56:06 -0800 (PST) Received: from cloudburst.twiddle.net (174-21-6-47.tukw.qwest.net. [174.21.6.47]) by smtp.gmail.com with ESMTPSA id v73sm5874836pfk.84.2018.02.07.14.56.05 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 07 Feb 2018 14:56:05 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 7 Feb 2018 14:55:36 -0800 Message-Id: <20180207225540.31698-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180207225540.31698-1-richard.henderson@linaro.org> References: <20180207225540.31698-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::243 Subject: [Qemu-devel] [PULL 16/20] 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: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Alex Bennée Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/translate-a64.c | 93 +++++++++++++++++++++++++++++----------------- 1 file changed, 59 insertions(+), 34 deletions(-) -- 2.14.3 diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 5717e85def..2ac297fc14 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -7209,6 +7209,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) { @@ -7252,10 +7274,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) { @@ -9733,6 +9752,22 @@ static void disas_simd_3same_float(DisasContext *s, uint32_t insn) /* Integer op subgroup of C3.6.16. */ static void disas_simd_3same_int(DisasContext *s, uint32_t insn) { + 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 }, + }; + int is_q = extract32(insn, 30, 1); int u = extract32(insn, 29, 1); int size = extract32(insn, 22, 2); @@ -9741,6 +9776,7 @@ static void disas_simd_3same_int(DisasContext *s, uint32_t insn) int rn = extract32(insn, 5, 5); int rd = extract32(insn, 0, 5); int pass; + TCGCond cond; switch (opcode) { case 0x13: /* MUL, PMUL */ @@ -9788,6 +9824,25 @@ static void disas_simd_3same_int(DisasContext *s, uint32_t insn) gen_gvec_fn3(s, is_q, rd, rn, rm, tcg_gen_gvec_add, size); } return; + case 0x11: + if (!u) { /* CMTST */ + gen_gvec_op3(s, is_q, rd, rn, rm, &cmtst_op[size]); + return; + } + /* else CMEQ */ + cond = TCG_COND_EQ; + goto do_gvec_cmp; + 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) { @@ -9870,26 +9925,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] = { @@ -9962,16 +9997,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 */