[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/8] fpu/softfloat: Add LoongArch specialization for pickNaNMulAd
From: |
Song Gao |
Subject: |
[PATCH 2/8] fpu/softfloat: Add LoongArch specialization for pickNaNMulAdd |
Date: |
Sat, 16 Jul 2022 16:54:20 +0800 |
LoongArch system follows IEEE754-2008 specificationa. The (inf,zero,nan)
case sets InvalidOp and returns the input value 'c', and Prefer sNaN
over qNaN, in the c, a, b order.
Signed-off-by: Song Gao <gaosong@loongson.cn>
---
fpu/softfloat-specialize.c.inc | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc
index 943e3301d2..948e1c1b24 100644
--- a/fpu/softfloat-specialize.c.inc
+++ b/fpu/softfloat-specialize.c.inc
@@ -574,6 +574,29 @@ static int pickNaNMulAdd(FloatClass a_cls, FloatClass
b_cls, FloatClass c_cls,
return 1;
}
}
+#elif defined(TARGET_LOONGARCH64)
+ /*
+ * For LoongArch systems that conform to IEEE754-2008, the (inf,zero,nan)
+ * case sets InvalidOp and returns the input value 'c'
+ */
+ if (infzero) {
+ float_raise(float_flag_invalid | float_flag_invalid_imz, status);
+ return 2;
+ }
+ /* Prefer sNaN over qNaN, in the c, a, b order. */
+ if (is_snan(c_cls)) {
+ return 2;
+ } else if (is_snan(a_cls)) {
+ return 0;
+ } else if (is_snan(b_cls)) {
+ return 1;
+ } else if (is_qnan(c_cls)) {
+ return 2;
+ } else if (is_qnan(a_cls)) {
+ return 0;
+ } else {
+ return 1;
+ }
#elif defined(TARGET_PPC)
/* For PPC, the (inf,zero,qnan) case sets InvalidOp, but we prefer
* to return an input NaN if we have one (ie c) rather than generating
--
2.31.1
- [PATCH 0/8] tests/tcg/loongarch64: Add some tests., Song Gao, 2022/07/16
- [PATCH 5/8] tests/tcg/loongarch64: Add div and mod related instructions test, Song Gao, 2022/07/16
- [PATCH 4/8] tests/tcg/loongarch64: Add clo related instructions test, Song Gao, 2022/07/16
- [PATCH 1/8] tests/tcg/loongarch64: Add float reference files, Song Gao, 2022/07/16
- [PATCH 6/8] tests/tcg/loongarch64: Add fclass test, Song Gao, 2022/07/16
- [PATCH 2/8] fpu/softfloat: Add LoongArch specialization for pickNaNMulAdd,
Song Gao <=
- [PATCH 8/8] tests/tcg/loongarch64: Add pcadd related instructions test, Song Gao, 2022/07/16
- [PATCH 3/8] target/loongarch: Fix float_convd/float_convs test failing, Song Gao, 2022/07/16
- [PATCH 7/8] tests/tcg/loongarch64: Add som comparison instructions test, Song Gao, 2022/07/16
- Re: [PATCH 0/8] tests/tcg/loongarch64: Add some tests., Richard Henderson, 2022/07/19