From patchwork Thu Jun 21 01:53:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 139422 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp1481690lji; Wed, 20 Jun 2018 19:12:33 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKxZVpAIcLdiTbmygWetsfqTz7i+JNMdyA6/UgAV3zU5V0r3mN6q/8znIlwMr7uFDPpp2mW X-Received: by 2002:a37:16d1:: with SMTP id 78-v6mr3912355qkw.271.1529547152992; Wed, 20 Jun 2018 19:12:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529547152; cv=none; d=google.com; s=arc-20160816; b=iOox3n2StXkHDB1fJrm4m7D48YZwBK4MjnJat6eMDgbkzVvEhgFy+4cxNxZXmNQuVx i7yMhQBTPXiyZD0aVEngiSB8ptWyV78MEqe+DXDDY+2Tof7I/7veYoDQz8zdK9qr2Kf4 zFY9aNQkiLlcAs1R/rbV6XJQu+yQizi9gJrRXBprO/n4gBwpLAzfrEkwSt4Bm4PwwmVb XRudmZsobJT+9sn2kQI3z1xetX9mzpeL2SqlC3Qp6OC0Fo6MQuC6uIZfa+Aj4GVQ1ofa W4GLkCxxcKrCkY90MmFNdk0Dt5Pw+taAXXRAVFVlar+Q5ArO0VBcjxps4hSsHh+7GJtx XVbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=fcBqKOfz/OhWxZj3vl+NSnfdZzqnqtvhx9FbSAfYtQI=; b=sMsPwBpZbMoM+TkaFXj+x1eMVTz7G5C/7X4IuNWm9LikLaF3qP140oJ7mGcDZz36AT n4fUMH+yqNvlLJLhLfrGzgZEeuFPpYQ8ldJgEBBp1hhSnzf1YPlq0vwxqYLdZV/SEgF8 F25IOGYXPKWsozSRat4H0t5mf2B8yqhw2JisYSjGRwCQlC7APraWgjbLeg/Lk+qHFzLf M7VlpV1T/YaqbB+C8KctFjlV6YHrRYejBF/KqL3vBhk8eq2pQr2g2yrtJGaa7PPhe8ZJ JuKOe4Q3q5di36LyqCAPyM6oqZnencagiycDvacLlGwsvYsGVhBvtANQzoBL2EbPhFis w0+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=DDVtR+IP; 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 w10-v6si2478483qtk.365.2018.06.20.19.12.32 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 20 Jun 2018 19:12:32 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=DDVtR+IP; 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]:52573 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVp5M-0001CG-DP for patch@linaro.org; Wed, 20 Jun 2018 22:12:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39391) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVooG-0004is-Cb for qemu-devel@nongnu.org; Wed, 20 Jun 2018 21:54:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fVooF-0003MF-BK for qemu-devel@nongnu.org; Wed, 20 Jun 2018 21:54:52 -0400 Received: from mail-pf0-x232.google.com ([2607:f8b0:400e:c00::232]:37729) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fVooF-0003Lj-2f for qemu-devel@nongnu.org; Wed, 20 Jun 2018 21:54:51 -0400 Received: by mail-pf0-x232.google.com with SMTP id y5-v6so685998pfn.4 for ; Wed, 20 Jun 2018 18:54:50 -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=fcBqKOfz/OhWxZj3vl+NSnfdZzqnqtvhx9FbSAfYtQI=; b=DDVtR+IPTnfPti8/xA5a86+TdFJjdcq/TOilp6C4x6q2iwxo+R+wePs2ge2XcMtHMW Qwb4Dop8Z5Hhu1KKJ4SMiBSUOaeFdX1ORZh6JZ5oZOR8JKClLrMh2wuuoTRhev5Amwxg 4ceWPT98Yrrb9g0yYfSr8kLKK5CVt/f7zCwR4= 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=fcBqKOfz/OhWxZj3vl+NSnfdZzqnqtvhx9FbSAfYtQI=; b=Iy1XLUzmrLzJTFLBasDp/6aa4rvmK5tCC8HfPyLhgpgDw7k85HcxYrfSUytgxx1Lwl 4frbG21UKgPXfAsrADDDFcGujnAzTCdcM6p4z3+tWwE0ZR1apYm1j1KgNTAcsaPrA0cQ OLjVWbfe+Iu6exKN2wstpPZ6LwK2lxPZdaX4WM/tapYE6n1N8d6Zrnwsb8gvx/rNMAv0 lp10B+tZR8f9RIjZ3PDz9ZLTM1j45F/4afK3jLEHiEES+ak6HFK4EtdocAPQ3grQ8vch Kwor9eZx3O/cjEdTInKpOOOYL6T4EwuREyftWLhiOjleDSAZpK12O9KYWJujuxPX4Zzz X+3w== X-Gm-Message-State: APt69E3CtT/9O1e3tEfIKO9qOWvGhbb/o0FHA482QWQVkgjvOwCAdJJm rOcu0F0YYFlgUP879bCRzjHjiRZ2Nro= X-Received: by 2002:a62:4f4f:: with SMTP id d76-v6mr25014999pfb.188.1529546089754; Wed, 20 Jun 2018 18:54:49 -0700 (PDT) Received: from cloudburst.twiddle.net (mta-98-147-121-51.hawaii.rr.com. [98.147.121.51]) by smtp.gmail.com with ESMTPSA id a27-v6sm6187946pfc.18.2018.06.20.18.54.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 20 Jun 2018 18:54:48 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 20 Jun 2018 15:53:47 -1000 Message-Id: <20180621015359.12018-24-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180621015359.12018-1-richard.henderson@linaro.org> References: <20180621015359.12018-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::232 Subject: [Qemu-devel] [PATCH v5 23/35] target/arm: Implement SVE floating-point convert precision X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- target/arm/helper-sve.h | 13 +++++++++++++ target/arm/sve_helper.c | 27 +++++++++++++++++++++++++++ target/arm/translate-sve.c | 30 ++++++++++++++++++++++++++++++ target/arm/sve.decode | 8 ++++++++ 4 files changed, 78 insertions(+) -- 2.17.1 diff --git a/target/arm/helper-sve.h b/target/arm/helper-sve.h index aca137fc37..4c379dbb05 100644 --- a/target/arm/helper-sve.h +++ b/target/arm/helper-sve.h @@ -942,6 +942,19 @@ DEF_HELPER_FLAGS_6(sve_fmins_s, TCG_CALL_NO_RWG, DEF_HELPER_FLAGS_6(sve_fmins_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i64, ptr, i32) +DEF_HELPER_FLAGS_5(sve_fcvt_sh, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_5(sve_fcvt_dh, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_5(sve_fcvt_hs, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_5(sve_fcvt_ds, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_5(sve_fcvt_hd, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_5(sve_fcvt_sd, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, i32) + DEF_HELPER_FLAGS_5(sve_scvt_hh, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_5(sve_scvt_sh, TCG_CALL_NO_RWG, diff --git a/target/arm/sve_helper.c b/target/arm/sve_helper.c index 3dc35d8b12..e1bbe1f550 100644 --- a/target/arm/sve_helper.c +++ b/target/arm/sve_helper.c @@ -3147,6 +3147,33 @@ void HELPER(NAME)(void *vd, void *vn, void *vg, void *status, uint32_t desc) \ } while (i != 0); \ } +static inline float32 sve_f16_to_f32(float16 f, float_status *s) +{ + return float16_to_float32(f, true, s); +} + +static inline float64 sve_f16_to_f64(float16 f, float_status *s) +{ + return float16_to_float64(f, true, s); +} + +static inline float16 sve_f32_to_f16(float32 f, float_status *s) +{ + return float32_to_float16(f, true, s); +} + +static inline float16 sve_f64_to_f16(float64 f, float_status *s) +{ + return float64_to_float16(f, true, s); +} + +DO_ZPZ_FP(sve_fcvt_sh, uint32_t, H1_4, sve_f32_to_f16) +DO_ZPZ_FP(sve_fcvt_hs, uint32_t, H1_4, sve_f16_to_f32) +DO_ZPZ_FP(sve_fcvt_dh, uint64_t, , sve_f64_to_f16) +DO_ZPZ_FP(sve_fcvt_hd, uint64_t, , sve_f16_to_f64) +DO_ZPZ_FP(sve_fcvt_ds, uint64_t, , float64_to_float32) +DO_ZPZ_FP(sve_fcvt_sd, uint64_t, , float32_to_float64) + DO_ZPZ_FP(sve_scvt_hh, uint16_t, H1_2, int16_to_float16) DO_ZPZ_FP(sve_scvt_sh, uint32_t, H1_4, int32_to_float16) DO_ZPZ_FP(sve_scvt_ss, uint32_t, H1_4, int32_to_float32) diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index fb225d56a1..c08c1263f1 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -3940,6 +3940,36 @@ static bool do_zpz_ptr(DisasContext *s, int rd, int rn, int pg, return true; } +static bool trans_FCVT_sh(DisasContext *s, arg_rpr_esz *a, uint32_t insn) +{ + return do_zpz_ptr(s, a->rd, a->rn, a->pg, true, gen_helper_sve_fcvt_sh); +} + +static bool trans_FCVT_hs(DisasContext *s, arg_rpr_esz *a, uint32_t insn) +{ + return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_fcvt_hs); +} + +static bool trans_FCVT_dh(DisasContext *s, arg_rpr_esz *a, uint32_t insn) +{ + return do_zpz_ptr(s, a->rd, a->rn, a->pg, true, gen_helper_sve_fcvt_dh); +} + +static bool trans_FCVT_hd(DisasContext *s, arg_rpr_esz *a, uint32_t insn) +{ + return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_fcvt_hd); +} + +static bool trans_FCVT_ds(DisasContext *s, arg_rpr_esz *a, uint32_t insn) +{ + return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_fcvt_ds); +} + +static bool trans_FCVT_sd(DisasContext *s, arg_rpr_esz *a, uint32_t insn) +{ + return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_fcvt_sd); +} + static bool trans_SCVTF_hh(DisasContext *s, arg_rpr_esz *a, uint32_t insn) { return do_zpz_ptr(s, a->rd, a->rn, a->pg, true, gen_helper_sve_scvt_hh); diff --git a/target/arm/sve.decode b/target/arm/sve.decode index e29c598783..fd45f51029 100644 --- a/target/arm/sve.decode +++ b/target/arm/sve.decode @@ -816,6 +816,14 @@ FNMLS_zpzzz 01100101 .. 1 ..... 111 ... ..... ..... @rdn_pg_rm_ra ### SVE FP Unary Operations Predicated Group +# SVE floating-point convert precision +FCVT_sh 01100101 10 0010 00 101 ... ..... ..... @rd_pg_rn_e0 +FCVT_hs 01100101 10 0010 01 101 ... ..... ..... @rd_pg_rn_e0 +FCVT_dh 01100101 11 0010 00 101 ... ..... ..... @rd_pg_rn_e0 +FCVT_hd 01100101 11 0010 01 101 ... ..... ..... @rd_pg_rn_e0 +FCVT_ds 01100101 11 0010 10 101 ... ..... ..... @rd_pg_rn_e0 +FCVT_sd 01100101 11 0010 11 101 ... ..... ..... @rd_pg_rn_e0 + # SVE integer convert to floating-point SCVTF_hh 01100101 01 010 01 0 101 ... ..... ..... @rd_pg_rn_e0 SCVTF_sh 01100101 01 010 10 0 101 ... ..... ..... @rd_pg_rn_e0