From nobody Wed Oct 29 06:41:43 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1526085457527844.0097843428096; Fri, 11 May 2018 17:37:37 -0700 (PDT) Received: from localhost ([::1]:58628 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fHIXU-0002fS-CR for importer@patchew.org; Fri, 11 May 2018 20:37:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59063) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fHISX-0005xO-JI for qemu-devel@nongnu.org; Fri, 11 May 2018 20:32:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fHISV-00086u-I8 for qemu-devel@nongnu.org; Fri, 11 May 2018 20:32:25 -0400 Received: from mail-pl0-x242.google.com ([2607:f8b0:400e:c01::242]:35938) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fHISV-00086e-CJ for qemu-devel@nongnu.org; Fri, 11 May 2018 20:32:23 -0400 Received: by mail-pl0-x242.google.com with SMTP id v24-v6so4142822plo.3 for ; Fri, 11 May 2018 17:32:23 -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 v186-v6sm7599735pfb.45.2018.05.11.17.32.20 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 11 May 2018 17:32:21 -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=pk+dSijseYdTRgdSgGsyBzJpy+TamubJS4GeiDT8GoQ=; b=aEyyAhipDhRsWX7qjTL8poG7I5jN28Z95ZrcUJg5nYQebQX9Pe35s9bbv922ps8zz0 Gfbcv2t6b72AesB1O/NBdS2eJz9u8MAVPhGs3AfJLytzwbyITRwoj4tQ87CeHLDrb5VO j6/j9zIBMmkCdJcCIT6K0CYlg11PsLY3yedx0= 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=pk+dSijseYdTRgdSgGsyBzJpy+TamubJS4GeiDT8GoQ=; b=SM27ZOCZqaSCIwmB1YFfZTBVISnTPbdW6yHSRsIb9PcDKUult/2GV5B2eKTYRSEKIF ljCI8/dehy+f/bP1lK1WryfU2XURT6usO2ohzJtD0URKLKC9B2ghz3BJbUWwekFEY/Mi mk0YSWv3EEjUFSI45YoOltkhmQW4x98/nie1hfUScTv+gbb/g2u2vqns7aNW30WQydho En51+HTs+IVTfkGdvEULdq3MxeqsHtBO0EXdIbGg3fbFBzfdIAp5lNgu9wyO75gJpp6B FpD9Pq6YxIQHUyGGZjmI9iyILT24F1gF3/1PjzHTFkwW8w4Tn8V7Z38HB/upDDIBg1aC ZCVw== X-Gm-Message-State: ALKqPwcqs8auGfIWtN+/dg4qD7LMTmmH24vN9iy2LZBR8Lun3XcEMfDC CqfqQryQI7oCdJFvVmlcgutFS/VFJAI= X-Google-Smtp-Source: AB8JxZro6V9BeFTQDHPco0tImUkQF36M0bQINjebwEcQ+ik82MPxYLoUjnZTp7lGaq2m9xMRa58R2w== X-Received: by 2002:a17:902:8b85:: with SMTP id ay5-v6mr273034plb.30.1526085142087; Fri, 11 May 2018 17:32:22 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 11 May 2018 17:32:07 -0700 Message-Id: <20180512003217.9105-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180512003217.9105-1-richard.henderson@linaro.org> References: <20180512003217.9105-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:c01::242 Subject: [Qemu-devel] [PATCH v4 01/11] target/arm: Implement FMOV (general) for 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: peter.maydell@linaro.org, alex.bennee@linaro.org, qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Adding the fp16 moves to/from general registers. Cc: qemu-stable@nongnu.org Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e Tested-by: Alex Benn=C3=A9e --- target/arm/translate-a64.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 4d1b220cc6..5b8cf75e9f 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -5700,6 +5700,15 @@ static void handle_fmov(DisasContext *s, int rd, int= rn, int type, bool itof) tcg_gen_st_i64(tcg_rn, cpu_env, fp_reg_hi_offset(s, rd)); clear_vec_high(s, true, rd); break; + case 3: + /* 16 bit */ + tmp =3D tcg_temp_new_i64(); + tcg_gen_ext16u_i64(tmp, tcg_rn); + write_fp_dreg(s, rd, tmp); + tcg_temp_free_i64(tmp); + break; + default: + g_assert_not_reached(); } } else { TCGv_i64 tcg_rd =3D cpu_reg(s, rd); @@ -5717,6 +5726,12 @@ static void handle_fmov(DisasContext *s, int rd, int= rn, int type, bool itof) /* 64 bits from top half */ tcg_gen_ld_i64(tcg_rd, cpu_env, fp_reg_hi_offset(s, rn)); break; + case 3: + /* 16 bit */ + tcg_gen_ld16u_i64(tcg_rd, cpu_env, fp_reg_offset(s, rn, MO_16)= ); + break; + default: + g_assert_not_reached(); } } } @@ -5756,6 +5771,12 @@ static void disas_fp_int_conv(DisasContext *s, uint3= 2_t insn) case 0xa: /* 64 bit */ case 0xd: /* 64 bit to top half of quad */ break; + case 0x6: /* 16-bit float, 32-bit int */ + case 0xe: /* 16-bit float, 64-bit int */ + if (arm_dc_feature(s, ARM_FEATURE_V8_FP16)) { + break; + } + /* fallthru */ default: /* all other sf/type/rmode combinations are invalid */ unallocated_encoding(s); --=20 2.17.0 From nobody Wed Oct 29 06:41:43 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1526085269546232.51610967966906; Fri, 11 May 2018 17:34:29 -0700 (PDT) Received: from localhost ([::1]:58515 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fHIUT-00022l-Lj for importer@patchew.org; Fri, 11 May 2018 20:34:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59069) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fHISX-0005xg-LX for qemu-devel@nongnu.org; Fri, 11 May 2018 20:32:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fHISW-00087K-Sz for qemu-devel@nongnu.org; Fri, 11 May 2018 20:32:25 -0400 Received: from mail-pl0-x244.google.com ([2607:f8b0:400e:c01::244]:39220) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fHISW-000879-MU for qemu-devel@nongnu.org; Fri, 11 May 2018 20:32:24 -0400 Received: by mail-pl0-x244.google.com with SMTP id c19-v6so4135366pls.6 for ; Fri, 11 May 2018 17:32:24 -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 v186-v6sm7599735pfb.45.2018.05.11.17.32.22 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 11 May 2018 17:32:22 -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=8nt3h1IH0+UiszYDj+ThjvjYSVQ8B4VP+KF2V1KxY9M=; b=CImqcuro7q73DoAsO7REdej6wdvQQkyMNR/EDm4YuEuMJszBSGqseyo75poct4jc/x ZGcE3KFtp6kvP7UB4e6aWkkOUNlV0g82igtvtOSEgKqHlG+z/Bppo1diT/BPWhH0BEbF atAhG2v5qe5ePREUCv5DUpmAwIq97BLKpAWHo= 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=8nt3h1IH0+UiszYDj+ThjvjYSVQ8B4VP+KF2V1KxY9M=; b=NW1tAjUktm262QrQ8FULEVRf0blO1wUK1WExJfK8NjvZ33JwElp8ZtW8Ycl/qr26Hg 1I4UvL0Fa4TgxNoJJOzFPvgxs0ZdZMONJ8bgdXBeHD0WnKIUggNPADPNZ41GV6r2NyoX 8l0hZgObRK/DhrdYpjqNxv6aqVOMmT+RnnFU5ttFNUOBNKxIVoZNasT7RbQVGE70jOSY B2LpcB9cAg+sR3I4eehOw4v8A+xWQW5T4WY/hkaR2OCKzJvQUdPWYepF+1+o1s5ErxMO D0Av8aWwKTCz8fl8Q6yt1tezwYuhV7WXCYFRRvrCgCKyIaTX6xnLtPD9/BD7cRgNxJzR wrPQ== X-Gm-Message-State: ALKqPweFoKC5oDP8IlN4km0FVKQZM2u0ss0DJRlLY1Utq10LyAtYDSve TUMy2ZdpV+wGenoKLHXMcgKuEcWgQGQ= X-Google-Smtp-Source: AB8JxZpZUIP1E9Xv4punqT7k7odmeZdGolY/FTZdJ2gNA+BI7YIrPPou+EV1YJX9XIBP/DYlr0GfWA== X-Received: by 2002:a17:902:704c:: with SMTP id h12-v6mr237092plt.269.1526085143451; Fri, 11 May 2018 17:32:23 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 11 May 2018 17:32:08 -0700 Message-Id: <20180512003217.9105-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180512003217.9105-1-richard.henderson@linaro.org> References: <20180512003217.9105-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:c01::244 Subject: [Qemu-devel] [PATCH v4 02/11] target/arm: Early exit after unallocated_encoding in disas_fp_int_conv 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, alex.bennee@linaro.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" No sense in emitting code after the exception. Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e Tested-by: Alex Benn=C3=A9e --- target/arm/translate-a64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 5b8cf75e9f..11d8c07943 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -5780,7 +5780,7 @@ static void disas_fp_int_conv(DisasContext *s, uint32= _t insn) default: /* all other sf/type/rmode combinations are invalid */ unallocated_encoding(s); - break; + return; } =20 if (!fp_access_check(s)) { --=20 2.17.0 From nobody Wed Oct 29 06:41:43 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1526085337939656.3385226428951; Fri, 11 May 2018 17:35:37 -0700 (PDT) Received: from localhost ([::1]:58517 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fHIVc-0005sx-TY for importer@patchew.org; Fri, 11 May 2018 20:35:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59115) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fHISZ-00065w-Pa for qemu-devel@nongnu.org; Fri, 11 May 2018 20:32:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fHISY-000887-99 for qemu-devel@nongnu.org; Fri, 11 May 2018 20:32:27 -0400 Received: from mail-pl0-x243.google.com ([2607:f8b0:400e:c01::243]:38667) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fHISY-00087Z-1S for qemu-devel@nongnu.org; Fri, 11 May 2018 20:32:26 -0400 Received: by mail-pl0-x243.google.com with SMTP id c11-v6so4140961plr.5 for ; Fri, 11 May 2018 17:32:25 -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 v186-v6sm7599735pfb.45.2018.05.11.17.32.23 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 11 May 2018 17:32:23 -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=+NoTAm4TBPlBfRvDj4D7czDRYKfogQkN7zNNR4esdc8=; b=YrCKQAPI59+h75y97yWxRBqFyz/uI3bGjZSEUFJ9u0kvcUlouv30qtcioNaIVzKAO2 6HnAF6v7fLSLqqU2ajQvObGrBqOcMNebNhOUBVJuDgBrxxzUd4rz5Bk+Ts6UY4ugW816 J/3RnWYgn/7yzakotc2VHXW2cbhQX9X3OV++0= 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=+NoTAm4TBPlBfRvDj4D7czDRYKfogQkN7zNNR4esdc8=; b=ckKZBj7EoRCtDH+rViFpNXLX5GD/svNO7mZvCiIO5sTEPOENf7pQVDkV+il7XC8Aks dlOQYiGPNoho7rMxv7om2vpHjihClTLFj2LGowTfFjrNUMA/gM7oFfA/43HyIXngnzpJ i0KrrvEIJkRb/PCmDW61zFhkE5Zeh9xIbRTFK/1XFNOT52l+9Fm74SzS7NPs4k8yh63v yI3+gv+bpgpnDbBMFK/+EFLFB1WDNVLzJRWV/D6r0VGEMNW7oz6ERzHyHmt/oatjZZo8 4iCWhIwwO0KNFM9hOWCG/8ytdpbYZ6ZEODFxu+NdzO1itFDVQN/MfYCZb2P1zgkB0t75 8rJg== X-Gm-Message-State: ALKqPwdLePkC80Djtk3TXqNZvowDSYpkb3eIL0G53XcjqzHViO6e2TPn 27CxSlhlWyZdE9S4Bn/eu6gjU+n2CIc= X-Google-Smtp-Source: AB8JxZqrjgrLo6jQvAG+ex8nG8olaGFpCrCEth+SozG9Ng0NOO++WyHFqwuwJAOD2/PtGw6fXJRWOw== X-Received: by 2002:a17:902:f44:: with SMTP id 62-v6mr263235ply.318.1526085144723; Fri, 11 May 2018 17:32:24 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 11 May 2018 17:32:09 -0700 Message-Id: <20180512003217.9105-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180512003217.9105-1-richard.henderson@linaro.org> References: <20180512003217.9105-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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] [PATCH v4 03/11] target/arm: Implement FCVT (scalar, integer) for 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: peter.maydell@linaro.org, alex.bennee@linaro.org, qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Cc: qemu-stable@nongnu.org Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Richard Henderson Tested-by: Alex Benn=C3=A9e --- target/arm/helper.h | 6 +++ target/arm/helper.c | 38 ++++++++++++++- target/arm/translate-a64.c | 96 +++++++++++++++++++++++++++++++------- 3 files changed, 122 insertions(+), 18 deletions(-) diff --git a/target/arm/helper.h b/target/arm/helper.h index 1969b37f2d..ce89968b2d 100644 --- a/target/arm/helper.h +++ b/target/arm/helper.h @@ -151,6 +151,10 @@ DEF_HELPER_3(vfp_touhd_round_to_zero, i64, f64, i32, p= tr) DEF_HELPER_3(vfp_tould_round_to_zero, i64, f64, i32, ptr) DEF_HELPER_3(vfp_touhh, i32, f16, i32, ptr) DEF_HELPER_3(vfp_toshh, i32, f16, i32, ptr) +DEF_HELPER_3(vfp_toulh, i32, f16, i32, ptr) +DEF_HELPER_3(vfp_toslh, i32, f16, i32, ptr) +DEF_HELPER_3(vfp_touqh, i64, f16, i32, ptr) +DEF_HELPER_3(vfp_tosqh, i64, f16, i32, ptr) DEF_HELPER_3(vfp_toshs, i32, f32, i32, ptr) DEF_HELPER_3(vfp_tosls, i32, f32, i32, ptr) DEF_HELPER_3(vfp_tosqs, i64, f32, i32, ptr) @@ -177,6 +181,8 @@ DEF_HELPER_3(vfp_ultod, f64, i64, i32, ptr) DEF_HELPER_3(vfp_uqtod, f64, i64, i32, ptr) DEF_HELPER_3(vfp_sltoh, f16, i32, i32, ptr) DEF_HELPER_3(vfp_ultoh, f16, i32, i32, ptr) +DEF_HELPER_3(vfp_sqtoh, f16, i64, i32, ptr) +DEF_HELPER_3(vfp_uqtoh, f16, i64, i32, ptr) =20 DEF_HELPER_FLAGS_2(set_rmode, TCG_CALL_NO_RWG, i32, i32, ptr) DEF_HELPER_FLAGS_2(set_neon_rmode, TCG_CALL_NO_RWG, i32, i32, env) diff --git a/target/arm/helper.c b/target/arm/helper.c index 817f9d81a0..c6fd7f9479 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -11427,8 +11427,12 @@ VFP_CONV_FIX_A64(uq, s, 32, 64, uint64) #undef VFP_CONV_FIX_A64 =20 /* Conversion to/from f16 can overflow to infinity before/after scaling. - * Therefore we convert to f64 (which does not round), scale, - * and then convert f64 to f16 (which may round). + * Therefore we convert to f64, scale, and then convert f64 to f16; or + * vice versa for conversion to integer. + * + * For 16- and 32-bit integers, the conversion to f64 never rounds. + * For 64-bit integers, any integer that would cause rounding will also + * overflow to f16 infinity, so there is no double rounding problem. */ =20 static float16 do_postscale_fp16(float64 f, int shift, float_status *fpst) @@ -11446,6 +11450,16 @@ float16 HELPER(vfp_ultoh)(uint32_t x, uint32_t shi= ft, void *fpst) return do_postscale_fp16(uint32_to_float64(x, fpst), shift, fpst); } =20 +float16 HELPER(vfp_sqtoh)(uint64_t x, uint32_t shift, void *fpst) +{ + return do_postscale_fp16(int64_to_float64(x, fpst), shift, fpst); +} + +float16 HELPER(vfp_uqtoh)(uint64_t x, uint32_t shift, void *fpst) +{ + return do_postscale_fp16(uint64_to_float64(x, fpst), shift, fpst); +} + static float64 do_prescale_fp16(float16 f, int shift, float_status *fpst) { if (unlikely(float16_is_any_nan(f))) { @@ -11475,6 +11489,26 @@ uint32_t HELPER(vfp_touhh)(float16 x, uint32_t shi= ft, void *fpst) return float64_to_uint16(do_prescale_fp16(x, shift, fpst), fpst); } =20 +uint32_t HELPER(vfp_toslh)(float16 x, uint32_t shift, void *fpst) +{ + return float64_to_int32(do_prescale_fp16(x, shift, fpst), fpst); +} + +uint32_t HELPER(vfp_toulh)(float16 x, uint32_t shift, void *fpst) +{ + return float64_to_uint32(do_prescale_fp16(x, shift, fpst), fpst); +} + +uint64_t HELPER(vfp_tosqh)(float16 x, uint32_t shift, void *fpst) +{ + return float64_to_int64(do_prescale_fp16(x, shift, fpst), fpst); +} + +uint64_t HELPER(vfp_touqh)(float16 x, uint32_t shift, void *fpst) +{ + return float64_to_uint64(do_prescale_fp16(x, shift, fpst), fpst); +} + /* Set the current fp rounding mode and return the old one. * The argument is a softfloat float_round_ value. */ diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 11d8c07943..93fb15d185 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -5511,11 +5511,11 @@ static void handle_fpfpcvt(DisasContext *s, int rd,= int rn, int opcode, bool itof, int rmode, int scale, int sf, int ty= pe) { bool is_signed =3D !(opcode & 1); - bool is_double =3D type; TCGv_ptr tcg_fpstatus; - TCGv_i32 tcg_shift; + TCGv_i32 tcg_shift, tcg_single; + TCGv_i64 tcg_double; =20 - tcg_fpstatus =3D get_fpstatus_ptr(false); + tcg_fpstatus =3D get_fpstatus_ptr(type =3D=3D 3); =20 tcg_shift =3D tcg_const_i32(64 - scale); =20 @@ -5533,8 +5533,9 @@ static void handle_fpfpcvt(DisasContext *s, int rd, i= nt rn, int opcode, tcg_int =3D tcg_extend; } =20 - if (is_double) { - TCGv_i64 tcg_double =3D tcg_temp_new_i64(); + switch (type) { + case 1: /* float64 */ + tcg_double =3D tcg_temp_new_i64(); if (is_signed) { gen_helper_vfp_sqtod(tcg_double, tcg_int, tcg_shift, tcg_fpstatus); @@ -5544,8 +5545,10 @@ static void handle_fpfpcvt(DisasContext *s, int rd, = int rn, int opcode, } write_fp_dreg(s, rd, tcg_double); tcg_temp_free_i64(tcg_double); - } else { - TCGv_i32 tcg_single =3D tcg_temp_new_i32(); + break; + + case 0: /* float32 */ + tcg_single =3D tcg_temp_new_i32(); if (is_signed) { gen_helper_vfp_sqtos(tcg_single, tcg_int, tcg_shift, tcg_fpstatus); @@ -5555,6 +5558,23 @@ static void handle_fpfpcvt(DisasContext *s, int rd, = int rn, int opcode, } write_fp_sreg(s, rd, tcg_single); tcg_temp_free_i32(tcg_single); + break; + + case 3: /* float16 */ + tcg_single =3D tcg_temp_new_i32(); + if (is_signed) { + gen_helper_vfp_sqtoh(tcg_single, tcg_int, + tcg_shift, tcg_fpstatus); + } else { + gen_helper_vfp_uqtoh(tcg_single, tcg_int, + tcg_shift, tcg_fpstatus); + } + write_fp_sreg(s, rd, tcg_single); + tcg_temp_free_i32(tcg_single); + break; + + default: + g_assert_not_reached(); } } else { TCGv_i64 tcg_int =3D cpu_reg(s, rd); @@ -5571,8 +5591,9 @@ static void handle_fpfpcvt(DisasContext *s, int rd, i= nt rn, int opcode, =20 gen_helper_set_rmode(tcg_rmode, tcg_rmode, tcg_fpstatus); =20 - if (is_double) { - TCGv_i64 tcg_double =3D read_fp_dreg(s, rn); + switch (type) { + case 1: /* float64 */ + tcg_double =3D read_fp_dreg(s, rn); if (is_signed) { if (!sf) { gen_helper_vfp_tosld(tcg_int, tcg_double, @@ -5590,9 +5611,14 @@ static void handle_fpfpcvt(DisasContext *s, int rd, = int rn, int opcode, tcg_shift, tcg_fpstatus); } } + if (!sf) { + tcg_gen_ext32u_i64(tcg_int, tcg_int); + } tcg_temp_free_i64(tcg_double); - } else { - TCGv_i32 tcg_single =3D read_fp_sreg(s, rn); + break; + + case 0: /* float32 */ + tcg_single =3D read_fp_sreg(s, rn); if (sf) { if (is_signed) { gen_helper_vfp_tosqs(tcg_int, tcg_single, @@ -5614,14 +5640,39 @@ static void handle_fpfpcvt(DisasContext *s, int rd,= int rn, int opcode, tcg_temp_free_i32(tcg_dest); } tcg_temp_free_i32(tcg_single); + break; + + case 3: /* float16 */ + tcg_single =3D read_fp_sreg(s, rn); + if (sf) { + if (is_signed) { + gen_helper_vfp_tosqh(tcg_int, tcg_single, + tcg_shift, tcg_fpstatus); + } else { + gen_helper_vfp_touqh(tcg_int, tcg_single, + tcg_shift, tcg_fpstatus); + } + } else { + TCGv_i32 tcg_dest =3D tcg_temp_new_i32(); + if (is_signed) { + gen_helper_vfp_toslh(tcg_dest, tcg_single, + tcg_shift, tcg_fpstatus); + } else { + gen_helper_vfp_toulh(tcg_dest, tcg_single, + tcg_shift, tcg_fpstatus); + } + tcg_gen_extu_i32_i64(tcg_int, tcg_dest); + tcg_temp_free_i32(tcg_dest); + } + tcg_temp_free_i32(tcg_single); + break; + + default: + g_assert_not_reached(); } =20 gen_helper_set_rmode(tcg_rmode, tcg_rmode, tcg_fpstatus); tcg_temp_free_i32(tcg_rmode); - - if (!sf) { - tcg_gen_ext32u_i64(tcg_int, tcg_int); - } } =20 tcg_temp_free_ptr(tcg_fpstatus); @@ -5791,7 +5842,20 @@ static void disas_fp_int_conv(DisasContext *s, uint3= 2_t insn) /* actual FP conversions */ bool itof =3D extract32(opcode, 1, 1); =20 - if (type > 1 || (rmode !=3D 0 && opcode > 1)) { + if (rmode !=3D 0 && opcode > 1) { + unallocated_encoding(s); + return; + } + switch (type) { + case 0: /* float32 */ + case 1: /* float64 */ + break; + case 3: /* float16 */ + if (arm_dc_feature(s, ARM_FEATURE_V8_FP16)) { + break; + } + /* fallthru */ + default: unallocated_encoding(s); return; } --=20 2.17.0 From nobody Wed Oct 29 06:41:43 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1526085597961347.0366414914638; Fri, 11 May 2018 17:39:57 -0700 (PDT) Received: from localhost ([::1]:58688 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fHIZj-0000gi-6X for importer@patchew.org; Fri, 11 May 2018 20:39:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59117) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fHISZ-00066Q-VX for qemu-devel@nongnu.org; Fri, 11 May 2018 20:32:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fHISZ-00088c-9Y for qemu-devel@nongnu.org; Fri, 11 May 2018 20:32:28 -0400 Received: from mail-pl0-x244.google.com ([2607:f8b0:400e:c01::244]:34158) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fHISZ-00088J-4c for qemu-devel@nongnu.org; Fri, 11 May 2018 20:32:27 -0400 Received: by mail-pl0-x244.google.com with SMTP id ay10-v6so4134316plb.1 for ; Fri, 11 May 2018 17:32:27 -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 v186-v6sm7599735pfb.45.2018.05.11.17.32.24 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 11 May 2018 17:32:25 -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=6bdRmNY9EBI86U7FdesDXir0dyAmVZgVaLPl9qWN0QM=; b=VlTrxvVudNqG3dOcISEJaQjvvVcGBEH/0VQ5LQHMUIFyRIo+YEdStRlizxpJMy/dDx bAgZpkZ2O4I/qDLiAi31Ra/sPPIuzjaqqhU8u2Alp5eDmhbO5tDg3nfHa3mU0wD+UvQl DaepaRFu2qZgRDc5gGSkXnsIYhqAUItGsf+9w= 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=6bdRmNY9EBI86U7FdesDXir0dyAmVZgVaLPl9qWN0QM=; b=go9GA3Dys93vHLERYglT8deuyfeEGIyT+uExMlnWwGhBGFQNtcnb4e2Nx2sVZfJMmh 7sjRtUK9fds6WCp9rXAyTmkvLhXza9CSSQTfHxlYC67Zhd3lf/UNWmZsRN6tk9HEJzPa 9sXEVrhAxvxVgWcBw7Vxln2iWgP6xb+lUr5qhwd0oRyBvSFNhMxtS8AO9LZBAaSzuKkf Aj31wLrlmMdnaNGRYtAopEDBpwQ5sKGGNAdWO37pMSHiC0SqXveSTFX13kD16GxutvN9 7yvhZUP2YeXHWVZq2AbrczxAtV6j+hCeJT23aBdxtxgDWsFecTtTsvKSo4s6g4J5rCgu BPVw== X-Gm-Message-State: ALKqPweWpilDAG9JWh83RkdC8vD4cJMZJGR63VuzeLNk+YAVIRRpCPhK 2HHrurO7mgJqF5YRCMbuQtB2qi+p/ik= X-Google-Smtp-Source: AB8JxZopHqPoPcHCVNv9eC/bFAQydw5FqYTjB1xJEUyRN60byEuxI7y98sroAWldyrGmxXsyWO++EA== X-Received: by 2002:a17:902:a60d:: with SMTP id u13-v6mr281185plq.40.1526085145971; Fri, 11 May 2018 17:32:25 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 11 May 2018 17:32:10 -0700 Message-Id: <20180512003217.9105-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180512003217.9105-1-richard.henderson@linaro.org> References: <20180512003217.9105-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::244 Subject: [Qemu-devel] [PATCH v4 04/11] target/arm: Implement FCVT (scalar, fixed-point) for 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: peter.maydell@linaro.org, alex.bennee@linaro.org, qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Cc: qemu-stable@nongnu.org Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Richard Henderson Tested-by: Alex Benn=C3=A9e --- target/arm/translate-a64.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 93fb15d185..d0ed125442 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -5697,8 +5697,21 @@ static void disas_fp_fixed_conv(DisasContext *s, uin= t32_t insn) bool sf =3D extract32(insn, 31, 1); bool itof; =20 - if (sbit || (type > 1) - || (!sf && scale < 32)) { + if (sbit || (!sf && scale < 32)) { + unallocated_encoding(s); + return; + } + + switch (type) { + case 0: /* float32 */ + case 1: /* float64 */ + break; + case 3: /* float16 */ + if (arm_dc_feature(s, ARM_FEATURE_V8_FP16)) { + break; + } + /* fallthru */ + default: unallocated_encoding(s); return; } --=20 2.17.0 From nobody Wed Oct 29 06:41:43 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1526085475129716.2589297164677; Fri, 11 May 2018 17:37:55 -0700 (PDT) Received: from localhost ([::1]:58636 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fHIXq-0003ep-DU for importer@patchew.org; Fri, 11 May 2018 20:37:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59156) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fHISb-0006Ef-Vz for qemu-devel@nongnu.org; Fri, 11 May 2018 20:32:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fHISa-0008AM-Um for qemu-devel@nongnu.org; Fri, 11 May 2018 20:32:30 -0400 Received: from mail-pl0-x241.google.com ([2607:f8b0:400e:c01::241]:34156) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fHISa-00089F-QZ for qemu-devel@nongnu.org; Fri, 11 May 2018 20:32:28 -0400 Received: by mail-pl0-x241.google.com with SMTP id ay10-v6so4134338plb.1 for ; Fri, 11 May 2018 17:32:28 -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 v186-v6sm7599735pfb.45.2018.05.11.17.32.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 11 May 2018 17:32:26 -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=Gl9IacEMEk7hTYbHfUyGESBtRu8Edb0SzjekHtJHhvI=; b=U8soI7RGo+8JXIOGQ6PNoFU87O++gLbddTBJRpGQds3qnpzvVqpncg1I+skDk791tG 3aZflIhuFy5UsmyO3KfSQ8Tz5181ld6Pl7f2Ekn/s+z9XmnZnrct4zOCLuPvuMdrj5sV P4IG74m8cTk437f9nxrGg1yrYuYVvTrRI1M+Y= 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=Gl9IacEMEk7hTYbHfUyGESBtRu8Edb0SzjekHtJHhvI=; b=SqkN0Y23IHVll+vJNEmX9RhmTLpBLbUgnvfcfBUuIWRQAZpwuTxekDi35+PNihsrf/ L8x6eTlkvG0WPXqu1pq0OE4sNZ9bO/ifpOEww/aTsohz9rCGcdtI7gzeunYsAbJay0hd Ykh49fVCJpNnqEE25XyhC2/Hk37O9lt1wU3s9M2cD2fMFp6rhUNHUAuWdVWe0jNHW1xY b2KJh/Is5ND9IYAz77MDHQNbBOQYXoBdb3wr0MjaFIkSJXdbv/zHb4SEANKMUQ12CVzz w2mk6fhzg93vMJYF/5O+sR6SodTJgJY5WxuXlNxi55oModCgPCRxBkE0y0W1F5zLWkRW 4JPQ== X-Gm-Message-State: ALKqPwcaiIFMwPtMN3TYRnJZdWnPzA8kLznl/S329xl4chKZRGa5nI6w r2tEXFTWfwSrQ1KusHsfVLkOpoQKbkM= X-Google-Smtp-Source: AB8JxZrcsTk3llwlnAX4aZog9SFwh2HCD44mo6GGHbSwTRkwCls/BBLt0YQ35JlKG3EW16x7HlO29A== X-Received: by 2002:a17:902:4545:: with SMTP id m63-v6mr269459pld.268.1526085147619; Fri, 11 May 2018 17:32:27 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 11 May 2018 17:32:11 -0700 Message-Id: <20180512003217.9105-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180512003217.9105-1-richard.henderson@linaro.org> References: <20180512003217.9105-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:c01::241 Subject: [Qemu-devel] [PATCH v4 05/11] target/arm: Introduce and use read_fp_hreg 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, alex.bennee@linaro.org, qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Cc: qemu-stable@nongnu.org Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e Tested-by: Alex Benn=C3=A9e --- target/arm/translate-a64.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index d0ed125442..78f12daaf6 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -615,6 +615,14 @@ static TCGv_i32 read_fp_sreg(DisasContext *s, int reg) return v; } =20 +static TCGv_i32 read_fp_hreg(DisasContext *s, int reg) +{ + TCGv_i32 v =3D tcg_temp_new_i32(); + + tcg_gen_ld16u_i32(v, cpu_env, fp_reg_offset(s, reg, MO_16)); + return v; +} + /* Clear the bits above an N-bit vector, for N =3D (is_q ? 128 : 64). * If SVE is not enabled, then there are only 128 bits in the vector. */ @@ -4881,11 +4889,9 @@ static void disas_fp_csel(DisasContext *s, uint32_t = insn) static void handle_fp_1src_half(DisasContext *s, int opcode, int rd, int r= n) { TCGv_ptr fpst =3D NULL; - TCGv_i32 tcg_op =3D tcg_temp_new_i32(); + TCGv_i32 tcg_op =3D read_fp_hreg(s, rn); TCGv_i32 tcg_res =3D tcg_temp_new_i32(); =20 - read_vec_element_i32(s, tcg_op, rn, 0, MO_16); - switch (opcode) { case 0x0: /* FMOV */ tcg_gen_mov_i32(tcg_res, tcg_op); @@ -7784,13 +7790,10 @@ static void disas_simd_scalar_three_reg_diff(DisasC= ontext *s, uint32_t insn) tcg_temp_free_i64(tcg_op2); tcg_temp_free_i64(tcg_res); } else { - TCGv_i32 tcg_op1 =3D tcg_temp_new_i32(); - TCGv_i32 tcg_op2 =3D tcg_temp_new_i32(); + TCGv_i32 tcg_op1 =3D read_fp_hreg(s, rn); + TCGv_i32 tcg_op2 =3D read_fp_hreg(s, rm); TCGv_i64 tcg_res =3D tcg_temp_new_i64(); =20 - read_vec_element_i32(s, tcg_op1, rn, 0, MO_16); - read_vec_element_i32(s, tcg_op2, rm, 0, MO_16); - gen_helper_neon_mull_s16(tcg_res, tcg_op1, tcg_op2); gen_helper_neon_addl_saturate_s32(tcg_res, cpu_env, tcg_res, tcg_r= es); =20 @@ -8331,13 +8334,10 @@ static void disas_simd_scalar_three_reg_same_fp16(D= isasContext *s, =20 fpst =3D get_fpstatus_ptr(true); =20 - tcg_op1 =3D tcg_temp_new_i32(); - tcg_op2 =3D tcg_temp_new_i32(); + tcg_op1 =3D read_fp_hreg(s, rn); + tcg_op2 =3D read_fp_hreg(s, rm); tcg_res =3D tcg_temp_new_i32(); =20 - 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); @@ -12235,11 +12235,9 @@ static void disas_simd_two_reg_misc_fp16(DisasCont= ext *s, uint32_t insn) } =20 if (is_scalar) { - TCGv_i32 tcg_op =3D tcg_temp_new_i32(); + TCGv_i32 tcg_op =3D read_fp_hreg(s, rn); TCGv_i32 tcg_res =3D tcg_temp_new_i32(); =20 - read_vec_element_i32(s, tcg_op, rn, 0, MO_16); - switch (fpop) { case 0x1a: /* FCVTNS */ case 0x1b: /* FCVTMS */ --=20 2.17.0 From nobody Wed Oct 29 06:41:43 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1526085763763539.6993013229887; Fri, 11 May 2018 17:42:43 -0700 (PDT) Received: from localhost ([::1]:58918 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fHIcQ-0000on-5W for importer@patchew.org; Fri, 11 May 2018 20:42:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59178) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fHISd-0006Ld-BO for qemu-devel@nongnu.org; Fri, 11 May 2018 20:32:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fHISc-0008BP-CB for qemu-devel@nongnu.org; Fri, 11 May 2018 20:32:31 -0400 Received: from mail-pl0-x241.google.com ([2607:f8b0:400e:c01::241]:41330) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fHISc-0008B4-7C for qemu-devel@nongnu.org; Fri, 11 May 2018 20:32:30 -0400 Received: by mail-pl0-x241.google.com with SMTP id az12-v6so4127474plb.8 for ; Fri, 11 May 2018 17:32:30 -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 v186-v6sm7599735pfb.45.2018.05.11.17.32.27 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 11 May 2018 17:32:28 -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=go/aa16PzRx4OtSxW2YHgX7wkUGXn+mUkmEp3rEJhGE=; b=UoV2zyeLlzur0/5PPJV5TxBzNN8WmTGl2ALZ9S8boL4QkwhC0Aj6ePxUiO1NWFb1lH 3zihocrkwpY7x2m+bVnTIkF+endGnetdKO1t0ONagF3/fGCwp+xm/qxI0jhgE8YxdG+U TYgHtc/+RugHOqN3TegAtMxjClehmxL3PhUyY= 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=go/aa16PzRx4OtSxW2YHgX7wkUGXn+mUkmEp3rEJhGE=; b=csLb7NyhJOWUFZxNkTjgJQfIaEOJzQULwNSrxmE6FDC4smOYqtRe9ozyIwd1dHfoDZ DFEmJSfVCEGhYCircGtCz20nsMhPyvQXSjG4Nq1Y/Mv/xbAdyl9iuvFuAtnv9C7sR2sZ MMhgQk8l6/5UsRWk0K5innY56BB/0gcGB2RTtWprHTm9Q5f4KG3XuLinROwc5wLXGeAX m4nDFqedOab98+Y4Ha6AcRjW+AUiiY0LXFyhoYs8O5rZAX0KBHZxpxRG1Xwm2Jhtwyg8 Z53b3P0MmGouZKuZhAZ6KgiM0Cg97Z0CR3pVFLM85K1kRMvIxqhMCtcdzGbCLEFRMv98 pTXg== X-Gm-Message-State: ALKqPweU0oW7RJ4hCT9pbtEDrbPwjC5rehWmjC0fGJuff8RRcPWX8OCa 9CQKY4u94/PF8cwsq/07n26K0CMqJck= X-Google-Smtp-Source: AB8JxZqU/lWNqRR53cM69JvvBqy7IsgHl9slPIe+maHWBB1Sn3syKP5Fu0VjhmrTHUlIdDOHGVEffA== X-Received: by 2002:a17:902:5a88:: with SMTP id r8-v6mr281475pli.78.1526085148965; Fri, 11 May 2018 17:32:28 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 11 May 2018 17:32:12 -0700 Message-Id: <20180512003217.9105-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180512003217.9105-1-richard.henderson@linaro.org> References: <20180512003217.9105-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::241 Subject: [Qemu-devel] [PATCH v4 06/11] target/arm: Implement FP data-processing (2 source) for 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: peter.maydell@linaro.org, alex.bennee@linaro.org, qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 We missed all of the scalar fp16 binary operations. Cc: qemu-stable@nongnu.org Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Richard Henderson Tested-by: Alex Benn=C3=A9e --- target/arm/translate-a64.c | 65 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 78f12daaf6..66607668ce 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -5299,6 +5299,61 @@ static void handle_fp_2src_double(DisasContext *s, i= nt opcode, tcg_temp_free_i64(tcg_res); } =20 +/* Floating-point data-processing (2 source) - half precision */ +static void handle_fp_2src_half(DisasContext *s, int opcode, + int rd, int rn, int rm) +{ + TCGv_i32 tcg_op1; + TCGv_i32 tcg_op2; + TCGv_i32 tcg_res; + TCGv_ptr fpst; + + tcg_res =3D tcg_temp_new_i32(); + fpst =3D get_fpstatus_ptr(true); + tcg_op1 =3D read_fp_hreg(s, rn); + tcg_op2 =3D read_fp_hreg(s, rm); + + switch (opcode) { + case 0x0: /* FMUL */ + gen_helper_advsimd_mulh(tcg_res, tcg_op1, tcg_op2, fpst); + break; + case 0x1: /* FDIV */ + gen_helper_advsimd_divh(tcg_res, tcg_op1, tcg_op2, fpst); + break; + case 0x2: /* FADD */ + gen_helper_advsimd_addh(tcg_res, tcg_op1, tcg_op2, fpst); + break; + case 0x3: /* FSUB */ + gen_helper_advsimd_subh(tcg_res, tcg_op1, tcg_op2, fpst); + break; + case 0x4: /* FMAX */ + gen_helper_advsimd_maxh(tcg_res, tcg_op1, tcg_op2, fpst); + break; + case 0x5: /* FMIN */ + gen_helper_advsimd_minh(tcg_res, tcg_op1, tcg_op2, fpst); + break; + case 0x6: /* FMAXNM */ + gen_helper_advsimd_maxnumh(tcg_res, tcg_op1, tcg_op2, fpst); + break; + case 0x7: /* FMINNM */ + gen_helper_advsimd_minnumh(tcg_res, tcg_op1, tcg_op2, fpst); + break; + case 0x8: /* FNMUL */ + gen_helper_advsimd_mulh(tcg_res, tcg_op1, tcg_op2, fpst); + tcg_gen_xori_i32(tcg_res, tcg_res, 0x8000); + break; + default: + g_assert_not_reached(); + } + + write_fp_sreg(s, rd, tcg_res); + + tcg_temp_free_ptr(fpst); + tcg_temp_free_i32(tcg_op1); + tcg_temp_free_i32(tcg_op2); + tcg_temp_free_i32(tcg_res); +} + /* Floating point data-processing (2 source) * 31 30 29 28 24 23 22 21 20 16 15 12 11 10 9 5 4 0 * +---+---+---+-----------+------+---+------+--------+-----+------+------+ @@ -5331,6 +5386,16 @@ static void disas_fp_2src(DisasContext *s, uint32_t = insn) } handle_fp_2src_double(s, opcode, rd, rn, rm); break; + case 3: + if (!arm_dc_feature(s, ARM_FEATURE_V8_FP16)) { + unallocated_encoding(s); + return; + } + if (!fp_access_check(s)) { + return; + } + handle_fp_2src_half(s, opcode, rd, rn, rm); + break; default: unallocated_encoding(s); } --=20 2.17.0 From nobody Wed Oct 29 06:41:43 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1526085280197868.1701111257084; Fri, 11 May 2018 17:34:40 -0700 (PDT) Received: from localhost ([::1]:58516 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fHIUh-0002bv-8H for importer@patchew.org; Fri, 11 May 2018 20:34:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59210) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fHISg-0006ak-Bp for qemu-devel@nongnu.org; Fri, 11 May 2018 20:32:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fHISd-0008C0-OQ for qemu-devel@nongnu.org; Fri, 11 May 2018 20:32:34 -0400 Received: from mail-pg0-x244.google.com ([2607:f8b0:400e:c05::244]:45648) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fHISd-0008Bf-JY for qemu-devel@nongnu.org; Fri, 11 May 2018 20:32:31 -0400 Received: by mail-pg0-x244.google.com with SMTP id w3-v6so3066802pgv.12 for ; Fri, 11 May 2018 17:32:31 -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 v186-v6sm7599735pfb.45.2018.05.11.17.32.29 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 11 May 2018 17:32:29 -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=qstt3KV9XEiU6WYp5Gae8EBTk4KXlhdI+Nfr21Jhw6I=; b=J7Aed4FiFmkZAJxuzy5K5BoFs8ZtOwOnThE0GXo+4z9qnnCKXzqRS+W49J5ge+sr+M SHolf1/5VJBvpnVvshAnfkFUMTQpQbBtPnJ2LGbn5QezA913+roIOUXPe1AB5ohSgtLG SDTe4I6GkBCtP2c1VmXfJusyjQaBvYmhMcgVo= 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=qstt3KV9XEiU6WYp5Gae8EBTk4KXlhdI+Nfr21Jhw6I=; b=loxQDFoJC1hMpBkBEHvkIYBnWzngDnKC9dFcslLPAsXT8mP+jazoJeukEb8ZtXDCe0 NZlbL0UShrFYyoqK89XuoQ5s7/mA64NxE8Jpo60wyFvrulVL2hJGCTsNzwtNG8SsC2qa h9ehqjMVfsOMzxxFtSEqc9Uljx3G8vGnVCAYZ2fROkIIAhcpkxnYAI3bCXkDnRCku4Zh fSrjKbUUMNR2sEVX5+qYUB/5G3PRhEVQUlOlvhOMYmlRVph3VdDx5fTBgpQIlRDCqr7D ayD+Wnzzlnahkf5HmIoRkhHR4J7dJguHcJbRXtMFZf9t216JrkOSRfM/ERLy+j3zIaAz 2b4A== X-Gm-Message-State: ALKqPwe/HDU9+eW0KrndYW/3T9KcUkWYdO3khiohW878b0hlQY0OtjzI ukritMT3DKbNqULyIKcvW+optoI1Pa4= X-Google-Smtp-Source: AB8JxZr1kq0fPAIYAROJxEeL3HOsIvFEUAsxsxc7zsAAM57xocG3/iYiQKQ5KFDHpFXU5qDcxhJrUA== X-Received: by 2002:a62:1a4e:: with SMTP id a75-v6mr957733pfa.84.1526085150229; Fri, 11 May 2018 17:32:30 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 11 May 2018 17:32:13 -0700 Message-Id: <20180512003217.9105-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180512003217.9105-1-richard.henderson@linaro.org> References: <20180512003217.9105-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c05::244 Subject: [Qemu-devel] [PATCH v4 07/11] target/arm: Implement FP data-processing (3 source) for 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: peter.maydell@linaro.org, alex.bennee@linaro.org, qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 We missed all of the scalar fp16 fma operations. Cc: qemu-stable@nongnu.org Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Richard Henderson Tested-by: Alex Benn=C3=A9e --- target/arm/translate-a64.c | 48 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 66607668ce..a79c09eda2 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -5477,6 +5477,44 @@ static void handle_fp_3src_double(DisasContext *s, b= ool o0, bool o1, tcg_temp_free_i64(tcg_res); } =20 +/* Floating-point data-processing (3 source) - half precision */ +static void handle_fp_3src_half(DisasContext *s, bool o0, bool o1, + int rd, int rn, int rm, int ra) +{ + TCGv_i32 tcg_op1, tcg_op2, tcg_op3; + TCGv_i32 tcg_res =3D tcg_temp_new_i32(); + TCGv_ptr fpst =3D get_fpstatus_ptr(true); + + tcg_op1 =3D read_fp_hreg(s, rn); + tcg_op2 =3D read_fp_hreg(s, rm); + tcg_op3 =3D read_fp_hreg(s, ra); + + /* These are fused multiply-add, and must be done as one + * floating point operation with no rounding between the + * multiplication and addition steps. + * NB that doing the negations here as separate steps is + * correct : an input NaN should come out with its sign bit + * flipped if it is a negated-input. + */ + if (o1 =3D=3D true) { + tcg_gen_xori_i32(tcg_op3, tcg_op3, 0x8000); + } + + if (o0 !=3D o1) { + tcg_gen_xori_i32(tcg_op1, tcg_op1, 0x8000); + } + + gen_helper_advsimd_muladdh(tcg_res, tcg_op1, tcg_op2, tcg_op3, fpst); + + write_fp_sreg(s, rd, tcg_res); + + tcg_temp_free_ptr(fpst); + tcg_temp_free_i32(tcg_op1); + tcg_temp_free_i32(tcg_op2); + tcg_temp_free_i32(tcg_op3); + tcg_temp_free_i32(tcg_res); +} + /* Floating point data-processing (3 source) * 31 30 29 28 24 23 22 21 20 16 15 14 10 9 5 4 0 * +---+---+---+-----------+------+----+------+----+------+------+------+ @@ -5506,6 +5544,16 @@ static void disas_fp_3src(DisasContext *s, uint32_t = insn) } handle_fp_3src_double(s, o0, o1, rd, rn, rm, ra); break; + case 3: + if (!arm_dc_feature(s, ARM_FEATURE_V8_FP16)) { + unallocated_encoding(s); + return; + } + if (!fp_access_check(s)) { + return; + } + handle_fp_3src_half(s, o0, o1, rd, rn, rm, ra); + break; default: unallocated_encoding(s); } --=20 2.17.0 From nobody Wed Oct 29 06:41:43 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1526085521751437.6600404801202; Fri, 11 May 2018 17:38:41 -0700 (PDT) Received: from localhost ([::1]:58649 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fHIYV-0005X7-Sc for importer@patchew.org; Fri, 11 May 2018 20:38:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59218) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fHISg-0006c9-Kw for qemu-devel@nongnu.org; Fri, 11 May 2018 20:32:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fHISf-0008CT-6W for qemu-devel@nongnu.org; Fri, 11 May 2018 20:32:34 -0400 Received: from mail-pg0-x244.google.com ([2607:f8b0:400e:c05::244]:36085) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fHISe-0008CD-VM for qemu-devel@nongnu.org; Fri, 11 May 2018 20:32:33 -0400 Received: by mail-pg0-x244.google.com with SMTP id z70-v6so3075049pgz.3 for ; Fri, 11 May 2018 17:32:32 -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 v186-v6sm7599735pfb.45.2018.05.11.17.32.30 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 11 May 2018 17:32:30 -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=lrDMCiJQcx5bgYFEZNLR3lTllZ2WXdzXlFUjge+eWHE=; b=UpDQhsPXgiwESHMHd1JOwb7y7IJXdVTRvEMGVXyRbN8B01/UaFKtbLjHlGjMb66hXI JIdO5rbcBNBW41tdhNaSBnsi7kvFhliV9uxAyFnP31iyFV4hdpo28HG+pAMXXprp/aBK d+7CFGKjiviGsd4DUR6hHs+o2KCsFiFNZ+MAY= 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=lrDMCiJQcx5bgYFEZNLR3lTllZ2WXdzXlFUjge+eWHE=; b=EhQTAzqKzczV0hLJ3osWsaVqGYnfgrggr7H8wCxK3MpNHAC6DsuzxhLncgBZ0Wid2A d4ebOSC1egMjFboJ+iprJjdHukh/swNjN0NfCRbAWBFU/70en0+cZpB+SeUCeTRVyKoy UbXW7M9xNN95sm633vm4BKyGKoXkY61U+F69vQJR9FaUdADlR7Kr1kZ3VFdHfSpK8WvV z7FumBizhpmwohzfTYMneEHB5RcStaFfnh2Ls6xicZmMzn3+L9njDZVx+T5K9157UhwF T6vTthRYlASfE97QUf8QWo6ilkvfCaPSYQXhkBDG5BN6GBOsm73qQWPEOCvAHhoqdMLa hQRw== X-Gm-Message-State: ALKqPwdUc4BuDLinUDnXfWZp687RWBtzNdqXwmokZhp5/IjHZYUcZjCd O3P5HBdvgHhm72xr+P59frpzSTfHt6w= X-Google-Smtp-Source: AB8JxZrgeHlZiRNBDPp7r5XpXJMIuful8iebP6t5FKjfQ3zBR/cntlpEeuLddnom74iKHF0M1VC6Rw== X-Received: by 2002:a62:f713:: with SMTP id h19-v6mr918589pfi.165.1526085151671; Fri, 11 May 2018 17:32:31 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 11 May 2018 17:32:14 -0700 Message-Id: <20180512003217.9105-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180512003217.9105-1-richard.henderson@linaro.org> References: <20180512003217.9105-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c05::244 Subject: [Qemu-devel] [PATCH v4 08/11] target/arm: Implement FCMP for 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: peter.maydell@linaro.org, alex.bennee@linaro.org, qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Alex Benn=C3=A9e These where missed out from the rest of the half-precision work. Cc: qemu-stable@nongnu.org Reviewed-by: Peter Maydell Signed-off-by: Alex Benn=C3=A9e [rth: Diagnose lack of FP16 before fp_access_check] Signed-off-by: Richard Henderson Tested-by: Alex Benn=C3=A9e --- target/arm/helper-a64.h | 2 + target/arm/helper-a64.c | 10 +++++ target/arm/translate-a64.c | 88 ++++++++++++++++++++++++++++++-------- 3 files changed, 83 insertions(+), 17 deletions(-) diff --git a/target/arm/helper-a64.h b/target/arm/helper-a64.h index b8028ac98c..9d3a907049 100644 --- a/target/arm/helper-a64.h +++ b/target/arm/helper-a64.h @@ -19,6 +19,8 @@ DEF_HELPER_FLAGS_2(udiv64, TCG_CALL_NO_RWG_SE, i64, i64, i64) DEF_HELPER_FLAGS_2(sdiv64, TCG_CALL_NO_RWG_SE, s64, s64, s64) DEF_HELPER_FLAGS_1(rbit64, TCG_CALL_NO_RWG_SE, i64, i64) +DEF_HELPER_3(vfp_cmph_a64, i64, f16, f16, ptr) +DEF_HELPER_3(vfp_cmpeh_a64, i64, f16, f16, ptr) DEF_HELPER_3(vfp_cmps_a64, i64, f32, f32, ptr) DEF_HELPER_3(vfp_cmpes_a64, i64, f32, f32, ptr) DEF_HELPER_3(vfp_cmpd_a64, i64, f64, f64, ptr) diff --git a/target/arm/helper-a64.c b/target/arm/helper-a64.c index 549ed3513e..4f8034c513 100644 --- a/target/arm/helper-a64.c +++ b/target/arm/helper-a64.c @@ -85,6 +85,16 @@ static inline uint32_t float_rel_to_flags(int res) return flags; } =20 +uint64_t HELPER(vfp_cmph_a64)(float16 x, float16 y, void *fp_status) +{ + return float_rel_to_flags(float16_compare_quiet(x, y, fp_status)); +} + +uint64_t HELPER(vfp_cmpeh_a64)(float16 x, float16 y, void *fp_status) +{ + return float_rel_to_flags(float16_compare(x, y, fp_status)); +} + uint64_t HELPER(vfp_cmps_a64)(float32 x, float32 y, void *fp_status) { return float_rel_to_flags(float32_compare_quiet(x, y, fp_status)); diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index a79c09eda2..c078a54fa5 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -4712,14 +4712,14 @@ static void disas_data_proc_reg(DisasContext *s, ui= nt32_t insn) } } =20 -static void handle_fp_compare(DisasContext *s, bool is_double, +static void handle_fp_compare(DisasContext *s, int size, unsigned int rn, unsigned int rm, bool cmp_with_zero, bool signal_all_nans) { TCGv_i64 tcg_flags =3D tcg_temp_new_i64(); - TCGv_ptr fpst =3D get_fpstatus_ptr(false); + TCGv_ptr fpst =3D get_fpstatus_ptr(size =3D=3D MO_16); =20 - if (is_double) { + if (size =3D=3D MO_64) { TCGv_i64 tcg_vn, tcg_vm; =20 tcg_vn =3D read_fp_dreg(s, rn); @@ -4736,19 +4736,35 @@ static void handle_fp_compare(DisasContext *s, bool= is_double, tcg_temp_free_i64(tcg_vn); tcg_temp_free_i64(tcg_vm); } else { - TCGv_i32 tcg_vn, tcg_vm; + TCGv_i32 tcg_vn =3D tcg_temp_new_i32(); + TCGv_i32 tcg_vm =3D tcg_temp_new_i32(); =20 - tcg_vn =3D read_fp_sreg(s, rn); + read_vec_element_i32(s, tcg_vn, rn, 0, size); if (cmp_with_zero) { - tcg_vm =3D tcg_const_i32(0); + tcg_gen_movi_i32(tcg_vm, 0); } else { - tcg_vm =3D read_fp_sreg(s, rm); + read_vec_element_i32(s, tcg_vm, rm, 0, size); } - if (signal_all_nans) { - gen_helper_vfp_cmpes_a64(tcg_flags, tcg_vn, tcg_vm, fpst); - } else { - gen_helper_vfp_cmps_a64(tcg_flags, tcg_vn, tcg_vm, fpst); + + switch (size) { + case MO_32: + if (signal_all_nans) { + gen_helper_vfp_cmpes_a64(tcg_flags, tcg_vn, tcg_vm, fpst); + } else { + gen_helper_vfp_cmps_a64(tcg_flags, tcg_vn, tcg_vm, fpst); + } + break; + case MO_16: + if (signal_all_nans) { + gen_helper_vfp_cmpeh_a64(tcg_flags, tcg_vn, tcg_vm, fpst); + } else { + gen_helper_vfp_cmph_a64(tcg_flags, tcg_vn, tcg_vm, fpst); + } + break; + default: + g_assert_not_reached(); } + tcg_temp_free_i32(tcg_vn); tcg_temp_free_i32(tcg_vm); } @@ -4769,16 +4785,35 @@ static void handle_fp_compare(DisasContext *s, bool= is_double, static void disas_fp_compare(DisasContext *s, uint32_t insn) { unsigned int mos, type, rm, op, rn, opc, op2r; + int size; =20 mos =3D extract32(insn, 29, 3); - type =3D extract32(insn, 22, 2); /* 0 =3D single, 1 =3D double */ + type =3D extract32(insn, 22, 2); rm =3D extract32(insn, 16, 5); op =3D extract32(insn, 14, 2); rn =3D extract32(insn, 5, 5); opc =3D extract32(insn, 3, 2); op2r =3D extract32(insn, 0, 3); =20 - if (mos || op || op2r || type > 1) { + if (mos || op || op2r) { + unallocated_encoding(s); + return; + } + + switch (type) { + case 0: + size =3D MO_32; + break; + case 1: + size =3D MO_64; + break; + case 3: + size =3D MO_16; + if (arm_dc_feature(s, ARM_FEATURE_V8_FP16)) { + break; + } + /* fallthru */ + default: unallocated_encoding(s); return; } @@ -4787,7 +4822,7 @@ static void disas_fp_compare(DisasContext *s, uint32_= t insn) return; } =20 - handle_fp_compare(s, type, rn, rm, opc & 1, opc & 2); + handle_fp_compare(s, size, rn, rm, opc & 1, opc & 2); } =20 /* Floating point conditional compare @@ -4801,16 +4836,35 @@ static void disas_fp_ccomp(DisasContext *s, uint32_= t insn) unsigned int mos, type, rm, cond, rn, op, nzcv; TCGv_i64 tcg_flags; TCGLabel *label_continue =3D NULL; + int size; =20 mos =3D extract32(insn, 29, 3); - type =3D extract32(insn, 22, 2); /* 0 =3D single, 1 =3D double */ + type =3D extract32(insn, 22, 2); rm =3D extract32(insn, 16, 5); cond =3D extract32(insn, 12, 4); rn =3D extract32(insn, 5, 5); op =3D extract32(insn, 4, 1); nzcv =3D extract32(insn, 0, 4); =20 - if (mos || type > 1) { + if (mos) { + unallocated_encoding(s); + return; + } + + switch (type) { + case 0: + size =3D MO_32; + break; + case 1: + size =3D MO_64; + break; + case 3: + size =3D MO_16; + if (arm_dc_feature(s, ARM_FEATURE_V8_FP16)) { + break; + } + /* fallthru */ + default: unallocated_encoding(s); return; } @@ -4831,7 +4885,7 @@ static void disas_fp_ccomp(DisasContext *s, uint32_t = insn) gen_set_label(label_match); } =20 - handle_fp_compare(s, type, rn, rm, false, op); + handle_fp_compare(s, size, rn, rm, false, op); =20 if (cond < 0x0e) { gen_set_label(label_continue); --=20 2.17.0 From nobody Wed Oct 29 06:41:43 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1526085657918648.8681868853279; Fri, 11 May 2018 17:40:57 -0700 (PDT) Received: from localhost ([::1]:58710 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fHIan-0003o8-1y for importer@patchew.org; Fri, 11 May 2018 20:40:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59246) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fHISh-0006h4-M0 for qemu-devel@nongnu.org; Fri, 11 May 2018 20:32:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fHISg-0008Cy-FW for qemu-devel@nongnu.org; Fri, 11 May 2018 20:32:35 -0400 Received: from mail-pf0-x243.google.com ([2607:f8b0:400e:c00::243]:34116) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fHISg-0008Cd-9o for qemu-devel@nongnu.org; Fri, 11 May 2018 20:32:34 -0400 Received: by mail-pf0-x243.google.com with SMTP id a14-v6so3431430pfi.1 for ; Fri, 11 May 2018 17:32:34 -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 v186-v6sm7599735pfb.45.2018.05.11.17.32.31 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 11 May 2018 17:32:32 -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=QvCuyjUfaw1h1bigRtHN6ndPqdFn4Ity7SY0/WHmjgA=; b=U9UJjOsNIYUZPEOIYzURnzaOGBmK9PEwucNp4uaXA/NPhl8JlX2k1/ywC+0FCruWt0 V6pir/54XH4gxeNG+QLLsp2TehJUHSjmXLbSkuMeoLrAtJfaC1GFH/d26p1R8QaoNddY 4cqf8C7XOD1RY1p3XWelKOZaYCmEUS3+wGfCQ= 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=QvCuyjUfaw1h1bigRtHN6ndPqdFn4Ity7SY0/WHmjgA=; b=cSybSGUG1ygWWwkg3pzOj9uWkCFTy4/C6CQ65kZ6PyTrfzBmg9RledfmFI4zGRWyRL M/Yd9dxm+Eb/0j9R09etbMM5FjqM1JFmu4Ke0dWyIYlV9WMiHJzS4JO8mJfZK+A1IDYO IUGOBg6yphWJCYwGazsOp6Y6qmJFY2p9FdrQ/UWbqhVudiAEHeElhdqbUptsqOZhxzUq 1ba69K1eYrF1JP9TSWZVP2gh6GZztnIqtnstusMC7eHbnrUYTaa27j4pYfA6ldD09LIB zta4NtmSkMFTE3A/uFxENs4713M9u/tCW2V2Le7p3cqu6wtrNwUXFRAAfr+kCYfcdB9a AQDg== X-Gm-Message-State: ALKqPwct7s1xKOZKUt0c/HOoMZZNdd/55+GwP4dFPeIiyVnFYgymNMtN szmvz0HpCadVf8GIo4brmBxF162JOrA= X-Google-Smtp-Source: AB8JxZrT00dV0EJXClRLu4R7S1BLWUI1L4dFi54PxB8qdLcQivc54+U7Mn588qhwDWuxsdjpdnYp3Q== X-Received: by 2002:a65:4acc:: with SMTP id c12-v6mr950441pgu.329.1526085152967; Fri, 11 May 2018 17:32:32 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 11 May 2018 17:32:15 -0700 Message-Id: <20180512003217.9105-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180512003217.9105-1-richard.henderson@linaro.org> References: <20180512003217.9105-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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 v4 09/11] target/arm: Implement FCSEL for 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: peter.maydell@linaro.org, alex.bennee@linaro.org, qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Alex Benn=C3=A9e These were missed out from the rest of the half-precision work. Cc: qemu-stable@nongnu.org Reviewed-by: Peter Maydell Signed-off-by: Alex Benn=C3=A9e [rth: Fix erroneous check vs type] Signed-off-by: Richard Henderson Tested-by: Alex Benn=C3=A9e --- target/arm/translate-a64.c | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index c078a54fa5..9dacb583ae 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -4903,15 +4903,34 @@ static void disas_fp_csel(DisasContext *s, uint32_t= insn) unsigned int mos, type, rm, cond, rn, rd; TCGv_i64 t_true, t_false, t_zero; DisasCompare64 c; + TCGMemOp sz; =20 mos =3D extract32(insn, 29, 3); - type =3D extract32(insn, 22, 2); /* 0 =3D single, 1 =3D double */ + type =3D extract32(insn, 22, 2); rm =3D extract32(insn, 16, 5); cond =3D extract32(insn, 12, 4); rn =3D extract32(insn, 5, 5); rd =3D extract32(insn, 0, 5); =20 - if (mos || type > 1) { + if (mos) { + unallocated_encoding(s); + return; + } + + switch (type) { + case 0: + sz =3D MO_32; + break; + case 1: + sz =3D MO_64; + break; + case 3: + sz =3D MO_16; + if (arm_dc_feature(s, ARM_FEATURE_V8_FP16)) { + break; + } + /* fallthru */ + default: unallocated_encoding(s); return; } @@ -4920,11 +4939,11 @@ static void disas_fp_csel(DisasContext *s, uint32_t= insn) return; } =20 - /* Zero extend sreg inputs to 64 bits now. */ + /* Zero extend sreg & hreg inputs to 64 bits now. */ t_true =3D tcg_temp_new_i64(); t_false =3D tcg_temp_new_i64(); - read_vec_element(s, t_true, rn, 0, type ? MO_64 : MO_32); - read_vec_element(s, t_false, rm, 0, type ? MO_64 : MO_32); + read_vec_element(s, t_true, rn, 0, sz); + read_vec_element(s, t_false, rm, 0, sz); =20 a64_test_cc(&c, cond); t_zero =3D tcg_const_i64(0); @@ -4933,7 +4952,7 @@ static void disas_fp_csel(DisasContext *s, uint32_t i= nsn) tcg_temp_free_i64(t_false); a64_free_cc(&c); =20 - /* Note that sregs write back zeros to the high bits, + /* Note that sregs & hregs write back zeros to the high bits, and we've already done the zero-extension. */ write_fp_dreg(s, rd, t_true); tcg_temp_free_i64(t_true); --=20 2.17.0 From nobody Wed Oct 29 06:41:43 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1526085636102160.91629340987765; Fri, 11 May 2018 17:40:36 -0700 (PDT) Received: from localhost ([::1]:58696 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fHIaR-0002ec-AG for importer@patchew.org; Fri, 11 May 2018 20:40:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59267) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fHISi-0006lj-HW for qemu-devel@nongnu.org; Fri, 11 May 2018 20:32:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fHISh-0008Dh-Ok for qemu-devel@nongnu.org; Fri, 11 May 2018 20:32:36 -0400 Received: from mail-pf0-x242.google.com ([2607:f8b0:400e:c00::242]:44939) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fHISh-0008DM-Jo for qemu-devel@nongnu.org; Fri, 11 May 2018 20:32:35 -0400 Received: by mail-pf0-x242.google.com with SMTP id q22-v6so3423122pff.11 for ; Fri, 11 May 2018 17:32:35 -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 v186-v6sm7599735pfb.45.2018.05.11.17.32.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 11 May 2018 17:32:33 -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=z7RHRgG2s+F0ZUK/4NX4wdUU/J9Oz5lKrqYK8foQtYA=; b=PYE1+CajTqcoTC4/9YssfdssPNSrAXzy5MABPjlZSqPiVYDWrWBZEOpy7rKLhGE76Z VFBYMOJhCr+OOTPQdo0vwyV2bIJ3pi1JnSVUFVdr4oA45tg0yAPUA+JXiEGufLf1g8LU 6SqeT6U5VmuXUVGPP4ICk7yur6z6OK7N4MAXo= 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=z7RHRgG2s+F0ZUK/4NX4wdUU/J9Oz5lKrqYK8foQtYA=; b=Oadhdg6pvDNu+qPoEINEBybYjjHDBjLv+G91QTdvcpKxG5xwzANJx8rUW3xiuFm/5t lJB+FOcxDZiC1NQudcOEjNJ9gaOY1oLItC7Gn3hj281M+ef9Zb4BJA3j79rDCMr2DZTT o5HxFVVUaqeXATQw7BWHuBPEvM8S/0Bg11/E9Qlqq1wUa+WDbjJTFbqjAICngK9jyUeU /cINqngEtR3uYKZswCMKwF72FoBkTGjY4SppjQU4HPmd0/0urKQ9sdDw8cI/OvAVZsq8 I4Tu3JNM+3/O0+XMHA3r172eHuMsMSrIY40+Up+ARf+HpER8h2er6W4sAN8olX4HdnAI O8+w== X-Gm-Message-State: ALKqPwfHlkndF0BEqtrehNtcFGCl3yanZCVEnuH6uGyVyTrr22/Mzzhv n539aNDfVZlHrqAKU/01qm3ARGMT1NA= X-Google-Smtp-Source: AB8JxZqM9zBe+5DSJu6Ncj97cA2zPOQQ3I3dDwyVOcZNTZZPBBJ7UIhIap6yJm64iLK2rVt5iCVaeg== X-Received: by 2002:a63:6016:: with SMTP id u22-v6mr980103pgb.284.1526085154328; Fri, 11 May 2018 17:32:34 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 11 May 2018 17:32:16 -0700 Message-Id: <20180512003217.9105-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180512003217.9105-1-richard.henderson@linaro.org> References: <20180512003217.9105-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::242 Subject: [Qemu-devel] [PATCH v4 10/11] target/arm: Implement FMOV (immediate) for 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: peter.maydell@linaro.org, alex.bennee@linaro.org, qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Alex Benn=C3=A9e All the hard work is already done by vfp_expand_imm, we just need to make sure we pick up the correct size. Cc: qemu-stable@nongnu.org Reviewed-by: Peter Maydell Signed-off-by: Alex Benn=C3=A9e [rth: Merge unallocated_encoding check with TCGMemOp conversion.] Signed-off-by: Richard Henderson Tested-by: Alex Benn=C3=A9e --- target/arm/translate-a64.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 9dacb583ae..35997969b4 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -5674,11 +5674,25 @@ static void disas_fp_imm(DisasContext *s, uint32_t = insn) { int rd =3D extract32(insn, 0, 5); int imm8 =3D extract32(insn, 13, 8); - int is_double =3D extract32(insn, 22, 2); + int type =3D extract32(insn, 22, 2); uint64_t imm; TCGv_i64 tcg_res; + TCGMemOp sz; =20 - if (is_double > 1) { + switch (type) { + case 0: + sz =3D MO_32; + break; + case 1: + sz =3D MO_64; + break; + case 3: + sz =3D MO_16; + if (arm_dc_feature(s, ARM_FEATURE_V8_FP16)) { + break; + } + /* fallthru */ + default: unallocated_encoding(s); return; } @@ -5687,7 +5701,7 @@ static void disas_fp_imm(DisasContext *s, uint32_t in= sn) return; } =20 - imm =3D vfp_expand_imm(MO_32 + is_double, imm8); + imm =3D vfp_expand_imm(sz, imm8); =20 tcg_res =3D tcg_const_i64(imm); write_fp_dreg(s, rd, tcg_res); --=20 2.17.0 From nobody Wed Oct 29 06:41:43 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1526085941320110.9466872776519; Fri, 11 May 2018 17:45:41 -0700 (PDT) Received: from localhost ([::1]:59091 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fHIfM-000245-Dr for importer@patchew.org; Fri, 11 May 2018 20:45:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59293) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fHISk-0006tp-8C for qemu-devel@nongnu.org; Fri, 11 May 2018 20:32:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fHISj-0008Ed-Dm for qemu-devel@nongnu.org; Fri, 11 May 2018 20:32:38 -0400 Received: from mail-pg0-x241.google.com ([2607:f8b0:400e:c05::241]:37390) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fHISj-0008EL-8x for qemu-devel@nongnu.org; Fri, 11 May 2018 20:32:37 -0400 Received: by mail-pg0-x241.google.com with SMTP id a13-v6so3074850pgu.4 for ; Fri, 11 May 2018 17:32:37 -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 v186-v6sm7599735pfb.45.2018.05.11.17.32.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 11 May 2018 17:32:35 -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=ahx5TxsYCFJPvg60ecBo+YmrSbBJ1ycPaPAC0BGwSvo=; b=kHV7Im7yZzzbjzgsb06GeCF16uLqcXxsBU0038fSlEEplhPiWZgRtnpwY1WTrwykIC VHAs4uSjeVMAhdsbwOfz7umvc0ScWeYFxHJAqm9K1Z5YgIkgbIHJVxoDUn20BBXnBEsx 30Mwu+VUX9iLX4fjwgGhr+I45cP3T4cu1L7+w= 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=ahx5TxsYCFJPvg60ecBo+YmrSbBJ1ycPaPAC0BGwSvo=; b=b7TKl6YPT/GB5EfWFLaiUbBcJD3toCZM3Gdu7Z3kJ7BbeJTuIoATSA+Auppzk5+evR nbeJ3MHWNIJGmWxc3wAZaNvu8p9Krwx0yW0oTSU6xQzMmC98e+0TatnKVgxGrs4UkTLw 1NiZEh9T6zJ0IGZds+C5tBfe4Tj/JcB8jBdtmW7EsKWJJCpZOJ+3L86LU20N61fragPl jOUbgjLtc+Q5ZxJv8Jr/Fi18COJR9Vk+UVGoZSZUw4IRSo5O8JFD5tT2I4fBadEiqPRe 3xUDEUszF3hG4zbVMfFRK5p2e/o/KTm6nT5tkypsHqDaqtBUsOO72JCTPLZlae5LBweS 5VGA== X-Gm-Message-State: ALKqPwcSD8if/LFt+SL7XDXxT5AxB5+L1ZU8Bjf2jn0tpeGc5pPsJLQH Jef1d62SLc85qmrnznjTS2TqI+PwQi0= X-Google-Smtp-Source: AB8JxZprvZHjvtgh5M4SKI3zh28kATBqMMYqAo7t5qLPtCkiyHPwpvsOgJcyPsEISmFmSLMX4CVUpA== X-Received: by 2002:a63:b54b:: with SMTP id u11-v6mr950325pgo.365.1526085156053; Fri, 11 May 2018 17:32:36 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 11 May 2018 17:32:17 -0700 Message-Id: <20180512003217.9105-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180512003217.9105-1-richard.henderson@linaro.org> References: <20180512003217.9105-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c05::241 Subject: [Qemu-devel] [PATCH v4 11/11] target/arm: Fix sqrt_f16 exception raising 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, alex.bennee@linaro.org, qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Alex Benn=C3=A9e We are meant to explicitly pass fpst, not cpu_env. Cc: qemu-stable@nongnu.org Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson Signed-off-by: Richard Henderson Tested-by: Alex Benn=C3=A9e --- target/arm/translate-a64.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 35997969b4..a0b0c43d12 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -4976,7 +4976,8 @@ static void handle_fp_1src_half(DisasContext *s, int = opcode, int rd, int rn) tcg_gen_xori_i32(tcg_res, tcg_op, 0x8000); break; case 0x3: /* FSQRT */ - gen_helper_sqrt_f16(tcg_res, tcg_op, cpu_env); + fpst =3D get_fpstatus_ptr(true); + gen_helper_sqrt_f16(tcg_res, tcg_op, fpst); break; case 0x8: /* FRINTN */ case 0x9: /* FRINTP */ --=20 2.17.0