A narrow n-bit operation,
where n < FLEN, checks that input operands
are correctly NaN-boxed, i.e., all upper FLEN - n bits are
1.
If so, the n least-significant bits of the input are used as
the input value,
otherwise the input value is treated as an n-bit canonical
NaN.
Signed-off-by: LIU Zhiwei <zhiwei_liu@c-sky.com>
---
target/riscv/translate.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/target/riscv/translate.c
b/target/riscv/translate.c
index 4b1534c9a6..1c9b809d4a 100644
--- a/target/riscv/translate.c
+++ b/target/riscv/translate.c
@@ -104,6 +104,35 @@ static void gen_nanbox_fpr(DisasContext
*ctx, int regno)
}
}
+/*
+ * A narrow n-bit operation, where n < FLEN, checks that
input operands
+ * are correctly NaN-boxed, i.e., all upper FLEN - n bits
are 1.
+ * If so, the n least-signicant bits of the input are used
as the input value,
+ * otherwise the input value is treated as an n-bit
canonical NaN.
+ * (riscv-spec-v2.2 Section 9.2).
+ */
+static void check_nanboxed(DisasContext *ctx, int num, ...)
+{
+ if (has_ext(ctx, RVD)) {
+ int i;
+ TCGv_i64 cond1 = tcg_temp_new_i64();
forget to remove ?