From patchwork Tue May 8 15:14:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 135181 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp4518424lji; Tue, 8 May 2018 08:21:55 -0700 (PDT) X-Google-Smtp-Source: AB8JxZp8KOmeBUanv7X9QuZ8IqTSlNe1rqP6L3Nl3EdEQhGEH4F/GdTv9U0h+zu9BtKZgdnhYP3m X-Received: by 2002:a0c:a3c3:: with SMTP id v61-v6mr30230362qvv.72.1525792915527; Tue, 08 May 2018 08:21:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525792915; cv=none; d=google.com; s=arc-20160816; b=Gwm0/ehveQOUBnwfhOwGGY2EIA8zjYmEhmkWzPa0DcZqqHnaT1WcLZZThuE0vrcNJY /qZ5xinsUAuze7i3Sm8kffjE7n6YbTF2XCcjcnzPPxLwVTdvPONMbtcxd4D96vPaKS0B F8PmSoxhdiV7v6NnSQ6brLMENVOEOTsDkAxzsy2VV5sljjn5FzST36VBOkm6KloIYc68 irfjDXaHhEtnPiPuCX6MRuT9KYC/kMwSKaLk9qXk0eODcDhbTw00PR5KMKbKBbQhUzD2 4YgKXIzaBY/dcaXxmUCySzlIhfw7woIdduLIVzAM7YZrLKKW29dtHZy411nzS5nn8dtA yF7w== 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:arc-authentication-results; bh=JPbKyRbGHUC+ZTBbJLdOh2b1BPPW3PUldr8irMjIU1o=; b=oddLrulksU3Svj0z4tN8t8WjooT3TQAuKRO7eZGAPpx2wMt3V+nVUE4QBo9tHH/EQ0 OHjJFKQT1qNYrMAh13Pvy6MgVI9HqGwdGrP+0KwPUGk3fAy/BFBwlPjXiCNpUgofhTk7 sjjLkQbhsR2aejuSCIg5thAYhjI0PQzKdA1onvIYB1qiBpi4lyu0sxmxdg7jOOyNBJp3 R4HJ3j/lOKLYmogiBbpkzGosFTlkLLSuX7CF2aiml62lUkXN5TeHWNcHy7GN/qPqtRf4 wKZXmdMMB8QPzPQK3EmNkTMKpi6K8v/b+JRtZsgDjtB3oYiSEg0luLpoo/eFEe0Bw+xt /pVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=EoDaCnXQ; 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 m89-v6si5310896qva.63.2018.05.08.08.21.55 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 08 May 2018 08:21:55 -0700 (PDT) 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=EoDaCnXQ; 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]:51846 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fG4R8-0003PL-UW for patch@linaro.org; Tue, 08 May 2018 11:21:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59476) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fG4KC-0006Xf-VO for qemu-devel@nongnu.org; Tue, 08 May 2018 11:14:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fG4KB-000870-L1 for qemu-devel@nongnu.org; Tue, 08 May 2018 11:14:44 -0400 Received: from mail-pf0-x243.google.com ([2607:f8b0:400e:c00::243]:32940) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fG4KB-00086K-Ct for qemu-devel@nongnu.org; Tue, 08 May 2018 11:14:43 -0400 Received: by mail-pf0-x243.google.com with SMTP id f20so15325000pfn.0 for ; Tue, 08 May 2018 08:14:43 -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=JPbKyRbGHUC+ZTBbJLdOh2b1BPPW3PUldr8irMjIU1o=; b=EoDaCnXQMnPI1/jT/3Ak2hHHdPktlHZ4/W2fshpXlZ/gJi4WJNYhJgEwEiytKhi2q5 GGPGGbYGpmwDhMWAeAd1g+qGhcs1AUpDfCa6Jj4Pg9Mzit7OMGQ1i1/1pA7PIcFPiNRY 8BKNUdunjOy0756vuLwDR7nq4oDublViqKx74= 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=JPbKyRbGHUC+ZTBbJLdOh2b1BPPW3PUldr8irMjIU1o=; b=S9gzlhq90iySHt4zdalQjTGXzZ08NzUPJ8wvq2ATp5pLp6SJcnx6Awnqz8AHPUclag 1rU3NCksl6XIN5oe1YDEIsOUawO+oC5mfpomZeUV1stoeLsgWNS74AJYomXoVd6f9PuT 9k7gJq4EjolZdKOGtbqgEQH5QNY8DREoig6pWSWTb6ESbKODaeSLcNTSc74LWr3vxl8s kiRiFQEzCe60RVXoSpkq09J9acr/IqT+6w+VYScexqEEtUSoQ/tbDxhvetzqIfb1U/UJ +vbzMRTItYMA4v0m2PELKgOFR97PEsn9mnl1q2CdQK2DSK2Sj3U4+zNzDPwfWa1bO8Kf xVrA== X-Gm-Message-State: ALQs6tDVbPdyYPtgv4dDVxGhyBHF16kh3AO0U/sSQq3NPlNaPvSR5ASK PVn3PM3bnYWkgE2M6sUIEiuGqFSmC4M= X-Received: by 10.98.229.13 with SMTP id n13mr40432641pff.125.1525792482064; Tue, 08 May 2018 08:14:42 -0700 (PDT) Received: from cloudburst.twiddle.net (97-113-2-170.tukw.qwest.net. [97.113.2.170]) by smtp.gmail.com with ESMTPSA id n10sm55598896pfj.68.2018.05.08.08.14.40 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 08 May 2018 08:14:41 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 8 May 2018 08:14:29 -0700 Message-Id: <20180508151437.4232-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180508151437.4232-1-richard.henderson@linaro.org> References: <20180508151437.4232-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::243 Subject: [Qemu-devel] [PATCH v3 02/10] target/arm: Use new min/max expanders 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" The generic expanders replace nearly identical code in the translator. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/translate-a64.c | 46 ++++++++++++-------------------------- 1 file changed, 14 insertions(+), 32 deletions(-) -- 2.17.0 diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index bff4e13bf6..d916fea3a3 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -6021,15 +6021,18 @@ static void disas_simd_across_lanes(DisasContext *s, uint32_t insn) tcg_gen_add_i64(tcg_res, tcg_res, tcg_elt); break; case 0x0a: /* SMAXV / UMAXV */ - tcg_gen_movcond_i64(is_u ? TCG_COND_GEU : TCG_COND_GE, - tcg_res, - tcg_res, tcg_elt, tcg_res, tcg_elt); + if (is_u) { + tcg_gen_umax_i64(tcg_res, tcg_res, tcg_elt); + } else { + tcg_gen_smax_i64(tcg_res, tcg_res, tcg_elt); + } break; case 0x1a: /* SMINV / UMINV */ - tcg_gen_movcond_i64(is_u ? TCG_COND_LEU : TCG_COND_LE, - tcg_res, - tcg_res, tcg_elt, tcg_res, tcg_elt); - break; + if (is_u) { + tcg_gen_umin_i64(tcg_res, tcg_res, tcg_elt); + } else { + tcg_gen_smin_i64(tcg_res, tcg_res, tcg_elt); + } break; default: g_assert_not_reached(); @@ -9931,27 +9934,6 @@ static void disas_simd_3same_logic(DisasContext *s, uint32_t insn) } } -/* Helper functions for 32 bit comparisons */ -static void gen_max_s32(TCGv_i32 res, TCGv_i32 op1, TCGv_i32 op2) -{ - tcg_gen_movcond_i32(TCG_COND_GE, res, op1, op2, op1, op2); -} - -static void gen_max_u32(TCGv_i32 res, TCGv_i32 op1, TCGv_i32 op2) -{ - tcg_gen_movcond_i32(TCG_COND_GEU, res, op1, op2, op1, op2); -} - -static void gen_min_s32(TCGv_i32 res, TCGv_i32 op1, TCGv_i32 op2) -{ - tcg_gen_movcond_i32(TCG_COND_LE, res, op1, op2, op1, op2); -} - -static void gen_min_u32(TCGv_i32 res, TCGv_i32 op1, TCGv_i32 op2) -{ - tcg_gen_movcond_i32(TCG_COND_LEU, res, op1, op2, op1, op2); -} - /* Pairwise op subgroup of C3.6.16. * * This is called directly or via the handle_3same_float for float pairwise @@ -10051,7 +10033,7 @@ static void handle_simd_3same_pair(DisasContext *s, int is_q, int u, int opcode, static NeonGenTwoOpFn * const fns[3][2] = { { gen_helper_neon_pmax_s8, gen_helper_neon_pmax_u8 }, { gen_helper_neon_pmax_s16, gen_helper_neon_pmax_u16 }, - { gen_max_s32, gen_max_u32 }, + { tcg_gen_smax_i32, tcg_gen_umax_i32 }, }; genfn = fns[size][u]; break; @@ -10061,7 +10043,7 @@ static void handle_simd_3same_pair(DisasContext *s, int is_q, int u, int opcode, static NeonGenTwoOpFn * const fns[3][2] = { { gen_helper_neon_pmin_s8, gen_helper_neon_pmin_u8 }, { gen_helper_neon_pmin_s16, gen_helper_neon_pmin_u16 }, - { gen_min_s32, gen_min_u32 }, + { tcg_gen_smin_i32, tcg_gen_umin_i32 }, }; genfn = fns[size][u]; break; @@ -10516,7 +10498,7 @@ static void disas_simd_3same_int(DisasContext *s, uint32_t insn) static NeonGenTwoOpFn * const fns[3][2] = { { gen_helper_neon_max_s8, gen_helper_neon_max_u8 }, { gen_helper_neon_max_s16, gen_helper_neon_max_u16 }, - { gen_max_s32, gen_max_u32 }, + { tcg_gen_smax_i32, tcg_gen_umax_i32 }, }; genfn = fns[size][u]; break; @@ -10527,7 +10509,7 @@ static void disas_simd_3same_int(DisasContext *s, uint32_t insn) static NeonGenTwoOpFn * const fns[3][2] = { { gen_helper_neon_min_s8, gen_helper_neon_min_u8 }, { gen_helper_neon_min_s16, gen_helper_neon_min_u16 }, - { gen_min_s32, gen_min_u32 }, + { tcg_gen_smin_i32, tcg_gen_umin_i32 }, }; genfn = fns[size][u]; break;