Skip to contentSkip to conversation

target/arm: Implement SVE2 fp convert precision

PATCH In review Stephen Long 2 participants 2 messages Apr 30, 2020 – Jun 16, 2020

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 target/arm: Implement SVE2 fp convert precision

Implements FCVTLT, FCVTX, FCVTNT, FCVTXNT

---

Fixed a compilation error and collapsed the translation functions with a macro.

Quoted 3 lines

Ignore my previous patchset. I missed the insn FCVTX and I ended up squashing those commits into this one. At the moment, I'm working on a patch for the SVE2 bitwise shift by imm insns.

 target/arm/helper-sve.h    | 16 +++++++++++
 target/arm/sve.decode      |  8 ++++++
 target/arm/sve_helper.c    | 59 ++++++++++++++++++++++++++++++++++++++
 target/arm/translate-sve.c | 18 ++++++++++++
 4 files changed, 101 insertions(+)
target/arm/helper-sve.h +16 -0
index 0a62eef94e..7c734334b2 100644
@@ -2731,3 +2731,19 @@ DEF_HELPER_FLAGS_5(sve2_sqrdcmlah_idx_h, TCG_CALL_NO_RWG,
                    void, ptr, ptr, ptr, ptr, i32)
 DEF_HELPER_FLAGS_5(sve2_sqrdcmlah_idx_s, TCG_CALL_NO_RWG,
                    void, ptr, ptr, ptr, ptr, i32)
+
+DEF_HELPER_FLAGS_5(sve2_fcvtxnt, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32)
+
+DEF_HELPER_FLAGS_5(sve2_fcvtnt_sh, TCG_CALL_NO_RWG,
+                   void, ptr, ptr, ptr, ptr, i32)
+DEF_HELPER_FLAGS_5(sve2_fcvtnt_ds, TCG_CALL_NO_RWG,
+                   void, ptr, ptr, ptr, ptr, i32)
+
+DEF_HELPER_FLAGS_5(sve2_fcvtlt_hs, TCG_CALL_NO_RWG,
+                   void, ptr, ptr, ptr, ptr, i32)
+DEF_HELPER_FLAGS_5(sve2_fcvtlt_sd, TCG_CALL_NO_RWG,
+                   void, ptr, ptr, ptr, ptr, i32)
+
+DEF_HELPER_FLAGS_5(do_fcvtx, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32)
+DEF_HELPER_FLAGS_5(sve2_fcvtx_ds, TCG_CALL_NO_RWG,
+                   void, ptr, ptr, ptr, ptr, i32)
target/arm/sve.decode +8 -0
index 3cf824bac5..bc48094ed8 100644
@@ -1568,3 +1568,11 @@ SM4E            01000101 00 10001 1 11100 0 ..... .....  @rdn_rm_e0
 # SVE2 crypto constructive binary operations
 SM4EKEY         01000101 00 1 ..... 11110 0 ..... .....  @rd_rn_rm_e0
 RAX1            01000101 00 1 ..... 11110 1 ..... .....  @rd_rn_rm_e0
+
+### SVE2 floating-point convert precision
+FCVTXNT         01100100 00 0010 10 101 ... ..... .....         @rd_pg_rn_e0
+FCVTNT_sh       01100100 10 0010 00 101 ... ..... .....         @rd_pg_rn_e0
+FCVTLT_hs       01100100 10 0010 01 101 ... ..... .....         @rd_pg_rn_e0
+FCVTNT_ds       01100100 11 0010 10 101 ... ..... .....         @rd_pg_rn_e0
+FCVTLT_sd       01100100 11 0010 11 101 ... ..... .....         @rd_pg_rn_e0
+FCVTX_ds        01100101 00 0010 10 101 ... ..... .....         @rd_pg_rn_e0
target/arm/sve_helper.c +59 -0

68 lines not on this page · raw message

target/arm/translate-sve.c +18 -0
index a8e57ea5f4..dbfc0c337e 100644
@@ -8253,3 +8253,21 @@ static bool trans_RAX1(DisasContext *s, arg_rrr_esz *a)
     }
     return true;
 }
+
+#define DO_SVE2_FP_CONVERT(NAME, name) \
+static bool trans_##NAME(DisasContext *s, arg_rpr_esz *a)                      \
+{                                                                              \
+    if (!dc_isar_feature(aa64_sve2, s)) {                                      \
+        return false;                                                          \
+    }                                                                          \
+    return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve2_##name);  \
+}
+
+DO_SVE2_FP_CONVERT(FCVTX_ds, fcvtx_ds)
+DO_SVE2_FP_CONVERT(FCVTXNT, fcvtxnt)
+
+DO_SVE2_FP_CONVERT(FCVTNT_sh, fcvtnt_sh)
+DO_SVE2_FP_CONVERT(FCVTNT_ds, fcvtnt_ds)
+
+DO_SVE2_FP_CONVERT(FCVTLT_hs, fcvtlt_hs)
+DO_SVE2_FP_CONVERT(FCVTLT_sd, fcvtlt_sd)
Signature · 1 line
2.17.1
#1 lore raw
Quoted 11 lines · Stephen Long

Implements FCVTLT, FCVTX, FCVTNT, FCVTXNT

---

Fixed a compilation error and collapsed the translation functions with a macro.

Quoted 3 lines

Ignore my previous patchset. I missed the insn FCVTX and I ended up squashing those commits into this one. At the moment, I'm working on a patch for the SVE2 bitwise shift by imm insns.

Having missed this just a minute ago, I squashed FCVTX into the adjusted v1 patch for FCVTXNT, using do_frint_mode.

r~