From patchwork Tue Feb 27 14:38:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 129817 Delivered-To: patch@linaro.org Received: by 10.80.172.228 with SMTP id x91csp372514edc; Tue, 27 Feb 2018 06:57:26 -0800 (PST) X-Google-Smtp-Source: AG47ELtDdp16gXNJwJfv9KUU6/jKoq7j2PqTrSO1/YTDQFixDFBi5n1o5Y+OWyk5XEzf7pIlNgIL X-Received: by 2002:a25:f409:: with SMTP id q9-v6mr9612740ybd.95.1519743446736; Tue, 27 Feb 2018 06:57:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519743446; cv=none; d=google.com; s=arc-20160816; b=jsj52IUShh5WEya7fWqNhhEimhL/lEebDBiLsyKnUqnLCYrm50sXyIrKGjUCnLoTrl 9vhpnFZsNE/TP3cYjSNIdCyW/ahEcSIw6e7i46mA91AnDVLkhexH7bKh2jAayM1TJdy6 s1JCZfpJtrj3BduB3+3hSa+2rNYOOmLL0YJ6bA6YEIS7LeFTO2KPLoFWO9vf8fI57HI2 qoWtMhk1JCWAirlnQ1BRNOQfiR0XDLXCddr8u6oCsYhqNoeYPgC0RRTeC29gTZvdHjbR 7O8oTjgDLvF2hKCF2No6vXbqzribZUHWDuTtq52fHHAnlWwPjxSSFB8iRfp1syhFxZwz MgJQ== 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=nFF84gHyau8tIOz75MBzWgGQz7SBviWAi/Ej6sJGy0Y=; b=Baa1OpG7HyxjZR0y4yGLw62BZwH21+prjQy9RR8Ma3LcBnyAvy2PtVBL3DMTx0EJgu vD4p4xb04YdtbEOtuAaFWs5AIHtXU2XPqWZV9Gth4UQTfwYHnMn4jYToCM4p2sZzfICu eHwJPGCREd2dEr6cV/1pX4lVuBQTmWUmvJmnrbqci1ydwJdQ7jYW9BMPshsA4yJrDHLr qZX5PA0OYxcABlgeVi2fP5zc4IZJJsjHg9VIIqOG1mF922X7Hb3onvfbgWRk/Yqg4ker zTp7o0ABvD+DzYzP1Y2FC1qSh7XutLZHARfyfiy4oyazqZYJnMgG991COyKzPYq5JS6p k3/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=FFpth2qV; 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 b20si593282ywe.372.2018.02.27.06.57.26 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 27 Feb 2018 06:57:26 -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=FFpth2qV; 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]:37791 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eqgh4-000359-5N for patch@linaro.org; Tue, 27 Feb 2018 09:57:26 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58282) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eqgY3-0003Vq-86 for qemu-devel@nongnu.org; Tue, 27 Feb 2018 09:48:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eqgY0-00018A-BG for qemu-devel@nongnu.org; Tue, 27 Feb 2018 09:48:07 -0500 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]:36562) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eqgXz-00013P-WE for qemu-devel@nongnu.org; Tue, 27 Feb 2018 09:48:04 -0500 Received: by mail-wr0-x242.google.com with SMTP id v111so12921780wrb.3 for ; Tue, 27 Feb 2018 06:48:03 -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=nFF84gHyau8tIOz75MBzWgGQz7SBviWAi/Ej6sJGy0Y=; b=FFpth2qVfE6oW5MIVhXQxQ3RcR7BVX97yeiND6MjyH7lky8MqYFazqKsm+lYHAClGR +T6nDALGZFm7NS7ykhm3ft82hQ0UfPXiVarmLdpQnGcukOE+NT8iDQ5OQa/Hjd1LTAP9 4x4qunHmig95EDRzBlsmrFD8dmyuvX9JAAwTo= 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=nFF84gHyau8tIOz75MBzWgGQz7SBviWAi/Ej6sJGy0Y=; b=huRNG1IqPNlT2quGXPZjakACOBgLXp3nmimCtAaHrFAeFb5bqK4c94WDdtNG7TNbZ+ qF5OUdatbYl0R4DT+yu9EAbooNA1T6+hfsFA0miVkORYHpMBqM6CBf/WVL7wIdnU4FML gsQcWe6rVZhhALllXA1PDptc6t/uF7M98MsAxtVqWgTr9Wnxaz1xwrqBwOM8OFwPdeRF gq48DK89U+TyvLqNd8Zjs88o8zusVyGT8MmPpo/I0oeUTntStrCHfGphWP7xmCPWftG9 2GFz2JQ7yfzTIv4cIAmOeaqEvfeVYoy/161YUlFFEvahHwgYCHP+o5sUWGK8mWbjRVfe trnA== X-Gm-Message-State: APf1xPCsl9jwxLxEfstxnA97uAQDdfeBdqpDtm31GB/+wkVmAYuAG/Eh SHM0p1DrtD7vwU0WKRA8iK7Q6A== X-Received: by 10.223.135.114 with SMTP id 47mr7702447wrz.238.1519742882823; Tue, 27 Feb 2018 06:48:02 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id k45sm10770888wrf.62.2018.02.27.06.48.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Feb 2018 06:48:00 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 2E10B3E166A; Tue, 27 Feb 2018 14:38:55 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-arm@nongnu.org Date: Tue, 27 Feb 2018 14:38:51 +0000 Message-Id: <20180227143852.11175-31-alex.bennee@linaro.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180227143852.11175-1-alex.bennee@linaro.org> References: <20180227143852.11175-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::242 Subject: [Qemu-devel] [PATCH v4 30/31] arm/translate-a64: implement simd_scalar_three_reg_same_fp16 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: =?utf-8?q?Alex_Benn=C3=A9e?= , richard.henderson@linaro.org, qemu-devel@nongnu.org, Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This covers the encoding group: Advanced SIMD scalar three same FP16 As all the helpers are already there it is simply a case of calling the existing helpers in the scalar context. Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson --- v2 - checkpatch fixes v3 - check for FP16 feature - remove stray debug - make abs a bitwise operation - checkpatch long line --- target/arm/translate-a64.c | 99 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) -- 2.15.1 diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 9d3a6ac49f..52cecae047 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -7802,6 +7802,104 @@ static void disas_simd_scalar_three_reg_same(DisasContext *s, uint32_t insn) tcg_temp_free_i64(tcg_rd); } +/* AdvSIMD scalar three same FP16 + * 31 30 29 28 24 23 22 21 20 16 15 14 13 11 10 9 5 4 0 + * +-----+---+-----------+---+-----+------+-----+--------+---+----+----+ + * | 0 1 | U | 1 1 1 1 0 | a | 1 0 | Rm | 0 0 | opcode | 1 | Rn | Rd | + * +-----+---+-----------+---+-----+------+-----+--------+---+----+----+ + * v: 0101 1110 0100 0000 0000 0100 0000 0000 => 5e400400 + * m: 1101 1111 0110 0000 1100 0100 0000 0000 => df60c400 + */ +static void disas_simd_scalar_three_reg_same_fp16(DisasContext *s, + uint32_t insn) +{ + int rd = extract32(insn, 0, 5); + int rn = extract32(insn, 5, 5); + int opcode = extract32(insn, 11, 3); + int rm = extract32(insn, 16, 5); + bool u = extract32(insn, 29, 1); + bool a = extract32(insn, 23, 1); + int fpopcode = opcode | (a << 3) | (u << 4); + TCGv_ptr fpst; + TCGv_i32 tcg_op1; + TCGv_i32 tcg_op2; + TCGv_i32 tcg_res; + + switch (fpopcode) { + case 0x03: /* FMULX */ + case 0x04: /* FCMEQ (reg) */ + case 0x07: /* FRECPS */ + case 0x0f: /* FRSQRTS */ + case 0x14: /* FCMGE (reg) */ + case 0x15: /* FACGE */ + case 0x1a: /* FABD */ + case 0x1c: /* FCMGT (reg) */ + case 0x1d: /* FACGT */ + break; + default: + unallocated_encoding(s); + return; + } + + if (!arm_dc_feature(s, ARM_FEATURE_V8_FP16)) { + unallocated_encoding(s); + } + + if (!fp_access_check(s)) { + return; + } + + fpst = get_fpstatus_ptr(true); + + tcg_op1 = tcg_temp_new_i32(); + tcg_op2 = tcg_temp_new_i32(); + tcg_res = tcg_temp_new_i32(); + + read_vec_element_i32(s, tcg_op1, rn, 0, MO_16); + read_vec_element_i32(s, tcg_op2, rm, 0, MO_16); + + switch (fpopcode) { + case 0x03: /* FMULX */ + gen_helper_advsimd_mulxh(tcg_res, tcg_op1, tcg_op2, fpst); + break; + case 0x04: /* FCMEQ (reg) */ + gen_helper_advsimd_ceq_f16(tcg_res, tcg_op1, tcg_op2, fpst); + break; + case 0x07: /* FRECPS */ + gen_helper_recpsf_f16(tcg_res, tcg_op1, tcg_op2, fpst); + break; + case 0x0f: /* FRSQRTS */ + gen_helper_rsqrtsf_f16(tcg_res, tcg_op1, tcg_op2, fpst); + break; + case 0x14: /* FCMGE (reg) */ + gen_helper_advsimd_cge_f16(tcg_res, tcg_op1, tcg_op2, fpst); + break; + case 0x15: /* FACGE */ + gen_helper_advsimd_acge_f16(tcg_res, tcg_op1, tcg_op2, fpst); + break; + case 0x1a: /* FABD */ + gen_helper_advsimd_subh(tcg_res, tcg_op1, tcg_op2, fpst); + tcg_gen_andi_i32(tcg_res, tcg_res, 0x7fff); + break; + case 0x1c: /* FCMGT (reg) */ + gen_helper_advsimd_cgt_f16(tcg_res, tcg_op1, tcg_op2, fpst); + break; + case 0x1d: /* FACGT */ + gen_helper_advsimd_acgt_f16(tcg_res, tcg_op1, tcg_op2, fpst); + break; + default: + g_assert_not_reached(); + } + + write_fp_sreg(s, rd, tcg_res); + + + tcg_temp_free_i32(tcg_res); + tcg_temp_free_i32(tcg_op1); + tcg_temp_free_i32(tcg_op2); + tcg_temp_free_ptr(fpst); +} + static void handle_2misc_64(DisasContext *s, int opcode, bool u, TCGv_i64 tcg_rd, TCGv_i64 tcg_rn, TCGv_i32 tcg_rmode, TCGv_ptr tcg_fpstatus) @@ -12653,6 +12751,7 @@ static const AArch64DecodeTable data_proc_simd[] = { { 0xce408000, 0xffe0c000, disas_crypto_three_reg_imm2 }, { 0x0e400400, 0x9f60c400, disas_simd_three_reg_same_fp16 }, { 0x0e780800, 0x8f7e0c00, disas_simd_two_reg_misc_fp16 }, + { 0x5e400400, 0xdf60c400, disas_simd_scalar_three_reg_same_fp16 }, { 0x00000000, 0x00000000, NULL } };