From patchwork Tue Feb 27 14:38:31 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: 129818 Delivered-To: patch@linaro.org Received: by 10.80.172.228 with SMTP id x91csp375007edc; Tue, 27 Feb 2018 06:59:49 -0800 (PST) X-Google-Smtp-Source: AH8x225Z4AJq7apxkTPU0cBbhPa8frOpFAYS2Zi2SkNZA/7GTIRRw2yDDRi6gEhng1WyU9J83pOP X-Received: by 10.129.172.67 with SMTP id z3mr9485513ywj.274.1519743589157; Tue, 27 Feb 2018 06:59:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519743589; cv=none; d=google.com; s=arc-20160816; b=WqApF8Trxc2fffki2a4xBA/A9b9/coZAOF+5AggNS9AfpNZdb/rFdPCOS49Uey4Jda O+ou7zjIcz6nPyc96wl+VrW1iX8t8S4qe3YmxSnHn2Sx9wwGDohQ13mElebZ4cawLwU9 A6tE2cAq58/zw7qMaakKppp1HxBtXnnhqAp5uT4e6qpZMOR+dvja0VjDlfpRidCcmEqF HfHCZ3n5u6X44pCCM9zBIdANkEcumfttDvMKgefudtot/hbE0W8O+lNae9GUl/qklLVA 698ydO/zZNJ1wFW+6xtfzrqRRW2Bq94Z/XJPVVxBMKg9XOmuVr88m0QJJ/jSOmpKvuWN wAWw== 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=aMF5EFMIfmgDHcAcUtJQ+mMjaKQoI6swhZLrjQq1RZc=; b=kzlV5fvbq5oEthLP7YpyKTgN+DQFrj3KO8XKTW8wzqpwN73MJ8s4DNFWPWg2ozspaC 7Ul8Mxco8mnCuJBK3IQ9NL9SIOE1dvyf9HUf3Ept7v6rAFf8qcbgKaxvsmElRgU2r5I6 IRgFayua8CAqnsnGlzwNKdmwTi9QWITHCbuIPZ8u6KknkQXDEbvytQy/Ow25hdnSbdDZ 3L/t2TAvqAeneHYPY82s9yuXdkTV1rvYzs702b2lfOBULaHFBR9C2HiXscRggGcFSlWX BA4nzIIt1ri2GijzDSK/QgQQwGYjKrkjnZgnUlcp1Oe8DXjovq14U3vWorgyG08al4SA zcDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=GGh6e7qw; 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 c11-v6si1759717ybg.350.2018.02.27.06.59.48 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 27 Feb 2018 06:59: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=GGh6e7qw; 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]:37801 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eqgjM-0004Oh-Gk for patch@linaro.org; Tue, 27 Feb 2018 09:59:48 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55899) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eqgPQ-0003jy-0o for qemu-devel@nongnu.org; Tue, 27 Feb 2018 09:39:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eqgPM-00081E-5X for qemu-devel@nongnu.org; Tue, 27 Feb 2018 09:39:11 -0500 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]:40031) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eqgPL-00080Y-T5 for qemu-devel@nongnu.org; Tue, 27 Feb 2018 09:39:08 -0500 Received: by mail-wr0-x241.google.com with SMTP id o76so25127916wrb.7 for ; Tue, 27 Feb 2018 06:39: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=aMF5EFMIfmgDHcAcUtJQ+mMjaKQoI6swhZLrjQq1RZc=; b=GGh6e7qwo3MQ7GOw3iDo52e3aXdaOEbl254mkGm/6Q64FbHvcs3FwM273MPO4vCzfc UzWMIU+j2uLd8hCYpdp8RTkX9QFxpp9eAbhdqzGucTTE4lgT3byiBDCqI1pmYizgwSBm g4n2Qq9bTDDCTg077CcPaIDC7ruKEjRT2o4jY= 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=aMF5EFMIfmgDHcAcUtJQ+mMjaKQoI6swhZLrjQq1RZc=; b=UUfvoyxpVFqn3OUT4miFOeY5wx5hvShQaiC1L05mobOAMCH4h28Hb/IXwU3XjR5l7X aTbyhahUbRL2MOhUD2sEzuKTbNe+d53ILH/nLfkhvXLt/GNGEQMdOVVl6fVOoFc3sXYl wLpRDebNmT+/tF+MzGkCDAmycDRxcruC/nmjBABY7EGdwf2DgarcAiMXJis4Zz7oAfQ0 2/kv17/VnMOikSSf2cwz5Ej0NgLvDL9WhubyiRihzPjyjJOxLEaYJh4jYkfeTXomPtuL lkbUQrBZ/l3sO2PSewrTIPOCW8jhQL1+B/UyVO0unr6qNY7EvQM3z7oJ4XM7BbEAWsjn fecg== X-Gm-Message-State: APf1xPBa2XSElJ49Kq9cHgTqjXYlW8zBBu9K9VBGNBLh9kEJqNH6ZMOg dw+Yew17hgKHSKk9TRiV//9G9Q== X-Received: by 10.223.136.71 with SMTP id e7mr12429297wre.252.1519742346716; Tue, 27 Feb 2018 06:39:06 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id 55sm17210536wrw.87.2018.02.27.06.38.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Feb 2018 06:38:59 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id A1B613E09C4; Tue, 27 Feb 2018 14:38:53 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-arm@nongnu.org Date: Tue, 27 Feb 2018 14:38:31 +0000 Message-Id: <20180227143852.11175-11-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::241 Subject: [Qemu-devel] [PATCH v4 10/31] arm/translate-a64: add FP16 F[A]C[EQ/GE/GT] to simd_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" These use the generic float16_compare functionality which in turn uses the common float_compare code from the softfloat re-factor. Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson --- target/arm/helper-a64.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++ target/arm/helper-a64.h | 5 +++++ target/arm/translate-a64.c | 15 ++++++++++++++ 3 files changed, 69 insertions(+) -- 2.15.1 diff --git a/target/arm/helper-a64.c b/target/arm/helper-a64.c index 931a6d3c34..d0b284fec4 100644 --- a/target/arm/helper-a64.c +++ b/target/arm/helper-a64.c @@ -594,3 +594,52 @@ ADVSIMD_HALFOP(min) ADVSIMD_HALFOP(max) ADVSIMD_HALFOP(minnum) ADVSIMD_HALFOP(maxnum) + +/* + * Floating point comparisons produce an integer result. Softfloat + * routines return float_relation types which we convert to the 0/-1 + * Neon requires. + */ + +#define ADVSIMD_CMPRES(test) (test) ? 0xffff : 0 + +uint32_t HELPER(advsimd_ceq_f16)(float16 a, float16 b, void *fpstp) +{ + float_status *fpst = fpstp; + int compare = float16_compare_quiet(a, b, fpst); + return ADVSIMD_CMPRES(compare == float_relation_equal); +} + +uint32_t HELPER(advsimd_cge_f16)(float16 a, float16 b, void *fpstp) +{ + float_status *fpst = fpstp; + int compare = float16_compare(a, b, fpst); + return ADVSIMD_CMPRES(compare == float_relation_greater || + compare == float_relation_equal); +} + +uint32_t HELPER(advsimd_cgt_f16)(float16 a, float16 b, void *fpstp) +{ + float_status *fpst = fpstp; + int compare = float16_compare(a, b, fpst); + return ADVSIMD_CMPRES(compare == float_relation_greater); +} + +uint32_t HELPER(advsimd_acge_f16)(float16 a, float16 b, void *fpstp) +{ + float_status *fpst = fpstp; + float16 f0 = float16_abs(a); + float16 f1 = float16_abs(b); + int compare = float16_compare(f0, f1, fpst); + return ADVSIMD_CMPRES(compare == float_relation_greater || + compare == float_relation_equal); +} + +uint32_t HELPER(advsimd_acgt_f16)(float16 a, float16 b, void *fpstp) +{ + float_status *fpst = fpstp; + float16 f0 = float16_abs(a); + float16 f1 = float16_abs(b); + int compare = float16_compare(f0, f1, fpst); + return ADVSIMD_CMPRES(compare == float_relation_greater); +} diff --git a/target/arm/helper-a64.h b/target/arm/helper-a64.h index bac9469426..1cf40bda5e 100644 --- a/target/arm/helper-a64.h +++ b/target/arm/helper-a64.h @@ -56,3 +56,8 @@ DEF_HELPER_3(advsimd_addh, f16, f16, f16, ptr) DEF_HELPER_3(advsimd_subh, f16, f16, f16, ptr) DEF_HELPER_3(advsimd_mulh, f16, f16, f16, ptr) DEF_HELPER_3(advsimd_divh, f16, f16, f16, ptr) +DEF_HELPER_3(advsimd_ceq_f16, i32, f16, f16, ptr) +DEF_HELPER_3(advsimd_cge_f16, i32, f16, f16, ptr) +DEF_HELPER_3(advsimd_cgt_f16, i32, f16, f16, ptr) +DEF_HELPER_3(advsimd_acge_f16, i32, f16, f16, ptr) +DEF_HELPER_3(advsimd_acgt_f16, i32, f16, f16, ptr) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index f8770ee1e9..fb74dc1c45 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -10289,6 +10289,9 @@ static void disas_simd_three_reg_same_fp16(DisasContext *s, uint32_t insn) case 0x2: /* FADD */ gen_helper_advsimd_addh(tcg_res, tcg_op1, tcg_op2, fpst); break; + case 0x4: /* FCMEQ */ + gen_helper_advsimd_ceq_f16(tcg_res, tcg_op1, tcg_op2, fpst); + break; case 0x6: /* FMAX */ gen_helper_advsimd_maxh(tcg_res, tcg_op1, tcg_op2, fpst); break; @@ -10304,6 +10307,12 @@ static void disas_simd_three_reg_same_fp16(DisasContext *s, uint32_t insn) case 0x13: /* FMUL */ gen_helper_advsimd_mulh(tcg_res, tcg_op1, tcg_op2, fpst); break; + case 0x14: /* FCMGE */ + 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 0x17: /* FDIV */ gen_helper_advsimd_divh(tcg_res, tcg_op1, tcg_op2, fpst); break; @@ -10311,6 +10320,12 @@ static void disas_simd_three_reg_same_fp16(DisasContext *s, uint32_t insn) gen_helper_advsimd_subh(tcg_res, tcg_op1, tcg_op2, fpst); tcg_gen_andi_i32(tcg_res, tcg_res, 0x7fff); break; + case 0x1c: /* FCMGT */ + 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: fprintf(stderr, "%s: insn %#04x, fpop %#2x @ %#" PRIx64 "\n", __func__, insn, fpopcode, s->pc);