From patchwork Fri Oct 13 16:24:25 2017 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: 825586 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="XxDT+8VX"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yDCtw6Vs5z9sRm for ; Sat, 14 Oct 2017 03:32:56 +1100 (AEDT) Received: from localhost ([::1]:51062 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e32tK-0000eL-WB for incoming@patchwork.ozlabs.org; Fri, 13 Oct 2017 12:32:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41878) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e32le-0002e9-Sw for qemu-devel@nongnu.org; Fri, 13 Oct 2017 12:25:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e32ld-0006ed-8b for qemu-devel@nongnu.org; Fri, 13 Oct 2017 12:24:58 -0400 Received: from mail-wm0-x22d.google.com ([2a00:1450:400c:c09::22d]:49855) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e32lc-0006e3-Vf for qemu-devel@nongnu.org; Fri, 13 Oct 2017 12:24:57 -0400 Received: by mail-wm0-x22d.google.com with SMTP id b189so22390434wmd.4 for ; Fri, 13 Oct 2017 09:24:56 -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 :mime-version:content-transfer-encoding; bh=7hTdCXZLjy064puy8prIIR90bO7zbElDumYBjizMjRs=; b=XxDT+8VXr3tz0lD1UaH+vXS6fEVsbyQ96OctKALkm5YwQ1+YEryO9aLiM8CT9T9ZWt nPnwNe8zJJz9Vp2Ybnz5MG0z01klnTkH2US7jDftJROLPKVpdwaCgEBcNgokIRF7CjWq S0vNvlL+2O4l60EU9Fl5/cUgkQ3kzPtEFSTtY= 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=7hTdCXZLjy064puy8prIIR90bO7zbElDumYBjizMjRs=; b=KvRXwi79ECG4TrZkxfne+DJmp9kc/Pgq0cET6sGM263q/MzWwZOrZBX8r8gDD9Doid 6L0cdxcKhc5YjgZpwFcOom0wT1M0GA6BruWPWyT3cjqjKoG+xo2zk0D0NgiGfX7d6kmu m/JvW6f4xWHKIC5HWBsNYzsZLUyvko9NDbC/XAS4gv/RbaHc13xbkbxGP1HJETpzZulv SeRZ5EFzmtKTx81A7PonLoFLh9Yod8aJRxfUe6n/JK8MiqCcP3Lz0qYrRjUoai4Cvnk9 wHbq6eo3UQhXTfXsSkWNjixYMWOwVNCGeBgmACQbiNS+eRb6YlQxFxIrQ6b3QMT32Pc+ vuPA== X-Gm-Message-State: AMCzsaWjZx1FGyAyNPvMTK54su6K4Oje3121nhlVlPC1rD/fAtouLoTh HFtl7M2mFLlIu8lhcT+qKnB1uw== X-Google-Smtp-Source: ABhQp+QmI+S3Z5C+crCoebBgrZnOo0Sszwc4YNsYHcHm6PnywMmuIdaEPg1knZ9jMVrP7w7mp3IUvg== X-Received: by 10.28.146.18 with SMTP id u18mr1855712wmd.28.1507911895839; Fri, 13 Oct 2017 09:24:55 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id 9sm1885815wml.24.2017.10.13.09.24.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Oct 2017 09:24:49 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id A38283E0D9C; Fri, 13 Oct 2017 17:24:39 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: richard.henderson@linaro.org Date: Fri, 13 Oct 2017 17:24:25 +0100 Message-Id: <20171013162438.32458-18-alex.bennee@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171013162438.32458-1-alex.bennee@linaro.org> References: <20171013162438.32458-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:c09::22d Subject: [Qemu-devel] [RFC PATCH 17/30] target/arm/translate-a64.c: add FP16 FMULX 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, qemu-arm@nongnu.org, =?utf-8?q?Alex_Benn?= =?utf-8?b?w6ll?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Alex Bennée --- target/arm/helper-a64.c | 18 ++++++++++++++++++ target/arm/helper-a64.h | 1 + target/arm/translate-a64.c | 45 +++++++++++++++++++++++++++++++++++---------- 3 files changed, 54 insertions(+), 10 deletions(-) diff --git a/target/arm/helper-a64.c b/target/arm/helper-a64.c index 8ef15c4c45..dd26675d5c 100644 --- a/target/arm/helper-a64.c +++ b/target/arm/helper-a64.c @@ -559,3 +559,21 @@ ADVSIMD_HALFOP(min) ADVSIMD_HALFOP(max) ADVSIMD_HALFOP(minnum) ADVSIMD_HALFOP(maxnum) + +/* Data processing - scalar floating-point and advanced SIMD */ + +float16 HELPER(advsimd_mulxh)(float16 a, float16 b, void *fpstp) +{ + float_status *fpst = fpstp; + + a = float16_squash_input_denormal(a, fpst); + b = float16_squash_input_denormal(b, fpst); + + if ((float16_is_zero(a) && float16_is_infinity(b)) || + (float16_is_infinity(a) && float16_is_zero(b))) { + /* 2.0 with the sign bit set to sign(A) XOR sign(B) */ + return make_float16((1U << 14) | + ((float16_val(a) ^ float16_val(b)) & (1U << 15))); + } + return float16_mul(a, b, fpst); +} diff --git a/target/arm/helper-a64.h b/target/arm/helper-a64.h index a4ce87970e..0f97eb607f 100644 --- a/target/arm/helper-a64.h +++ b/target/arm/helper-a64.h @@ -52,3 +52,4 @@ DEF_HELPER_3(advsimd_maxh, f16, f16, f16, ptr) DEF_HELPER_3(advsimd_minh, f16, f16, f16, ptr) DEF_HELPER_3(advsimd_maxnumh, f16, f16, f16, ptr) DEF_HELPER_3(advsimd_minnumh, f16, f16, f16, ptr) +DEF_HELPER_3(advsimd_mulxh, f16, f16, f16, ptr) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index f687bab214..d12106695f 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -10648,7 +10648,7 @@ static void disas_simd_indexed(DisasContext *s, uint32_t insn) } /* fall through */ case 0x9: /* FMUL, FMULX */ - if (!extract32(size, 1, 1)) { + if (!extract32(size, 1, 1) && !arm_dc_feature(s, ARM_FEATURE_V8_FP16)) { unallocated_encoding(s); return; } @@ -10660,18 +10660,30 @@ static void disas_simd_indexed(DisasContext *s, uint32_t insn) } if (is_fp) { - /* low bit of size indicates single/double */ - size = extract32(size, 0, 1) ? 3 : 2; - if (size == 2) { + /* convert insn encoded size to TCGMemOp size */ + switch (size) { + case 0: /* half-precision */ + size = MO_16; + index = h << 2 | l << 1 | m; + break; + case 2: /* single precision */ + size = MO_32; index = h << 1 | l; - } else { + rm |= (m << 4); + break; + case 3: /* double precision */ + size = MO_64; if (l || !is_q) { unallocated_encoding(s); return; } index = h; + rm |= (m << 4); + break; + default: + g_assert_not_reached(); + break; } - rm |= (m << 4); } else { switch (size) { case 1: @@ -10805,10 +10817,23 @@ static void disas_simd_indexed(DisasContext *s, uint32_t insn) gen_helper_vfp_muladds(tcg_res, tcg_op, tcg_idx, tcg_res, fpst); break; case 0x9: /* FMUL, FMULX */ - if (u) { - gen_helper_vfp_mulxs(tcg_res, tcg_op, tcg_idx, fpst); - } else { - gen_helper_vfp_muls(tcg_res, tcg_op, tcg_idx, fpst); + switch (size) { + case 1: + if (u) { + gen_helper_advsimd_mulxh(tcg_res, tcg_op, tcg_idx, fpst); + } else { + g_assert_not_reached(); + } + break; + case 2: + if (u) { + gen_helper_vfp_mulxs(tcg_res, tcg_op, tcg_idx, fpst); + } else { + gen_helper_vfp_muls(tcg_res, tcg_op, tcg_idx, fpst); + } + break; + default: + g_assert_not_reached(); } break; case 0xc: /* SQDMULH */