qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Vivier <laurent@vivier.eu>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Aurelien Jarno <aurelien@aurel32.net>,
	Bastian Koppelmann <kbastian@mail.uni-paderborn.de>,
	Stafford Horne <shorne@gmail.com>,
	qemu-arm@nongnu.org, Laurent Vivier <laurent@vivier.eu>
Subject: [Qemu-devel] [PATCH 3/4] tricore: use make_float32() and float32_val()
Date: Fri,  3 Nov 2017 21:26:23 +0100	[thread overview]
Message-ID: <20171103202624.5956-4-laurent@vivier.eu> (raw)
In-Reply-To: <20171103202624.5956-1-laurent@vivier.eu>

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 target/tricore/fpu_helper.c | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/target/tricore/fpu_helper.c b/target/tricore/fpu_helper.c
index 7979bb6692..d233d010c5 100644
--- a/target/tricore/fpu_helper.c
+++ b/target/tricore/fpu_helper.c
@@ -21,10 +21,10 @@
 #include "cpu.h"
 #include "exec/helper-proto.h"
 
-#define QUIET_NAN 0x7fc00000
-#define ADD_NAN   0x7fc00001
-#define DIV_NAN   0x7fc00008
-#define MUL_NAN   0x7fc00002
+#define QUIET_NAN make_float32(0x7fc00000)
+#define ADD_NAN   make_float32(0x7fc00001)
+#define DIV_NAN   make_float32(0x7fc00008)
+#define MUL_NAN   make_float32(0x7fc00002)
 #define FPU_FS PSW_USB_C
 #define FPU_FI PSW_USB_V
 #define FPU_FV PSW_USB_SV
@@ -63,13 +63,13 @@ static inline float32 f_maddsub_nan_result(float32 arg1, float32 arg2,
     } else if (float32_is_zero(arg1) && float32_is_infinity(arg2)) {
         return MUL_NAN;
     } else {
-        aSign = arg1 >> 31;
-        bSign = arg2 >> 31;
-        cSign = arg3 >> 31;
+        aSign = float32_val(arg1) >> 31;
+        bSign = float32_val(arg2) >> 31;
+        cSign = float32_val(arg3) >> 31;
 
-        aExp = (arg1 >> 23) & 0xff;
-        bExp = (arg2 >> 23) & 0xff;
-        cExp = (arg3 >> 23) & 0xff;
+        aExp = (float32_val(arg1) >> 23) & 0xff;
+        bExp = (float32_val(arg2) >> 23) & 0xff;
+        cExp = (float32_val(arg3) >> 23) & 0xff;
 
         if (muladd_negate_c) {
             cSign ^= 1;
@@ -139,7 +139,7 @@ uint32_t helper_f##op(CPUTriCoreState *env, uint32_t r1, uint32_t r2)          \
     } else {                                                                   \
         env->FPU_FS = 0;                                                       \
     }                                                                          \
-    return (uint32_t)f_result;                                                 \
+    return float32_val(f_result);                                              \
 }
 FADD_SUB(add)
 FADD_SUB(sub)
@@ -166,7 +166,7 @@ uint32_t helper_fmul(CPUTriCoreState *env, uint32_t r1, uint32_t r2)
     } else {
         env->FPU_FS = 0;
     }
-    return (uint32_t)f_result;
+    return float32_val(f_result);
 
 }
 
@@ -193,7 +193,7 @@ uint32_t helper_fdiv(CPUTriCoreState *env, uint32_t r1, uint32_t r2)
         env->FPU_FS = 0;
     }
 
-    return (uint32_t)f_result;
+    return float32_val(f_result);
 }
 
 uint32_t helper_fmadd(CPUTriCoreState *env, uint32_t r1,
@@ -219,7 +219,7 @@ uint32_t helper_fmadd(CPUTriCoreState *env, uint32_t r1,
     } else {
         env->FPU_FS = 0;
     }
-    return (uint32_t)f_result;
+    return float32_val(f_result);
 }
 
 uint32_t helper_fmsub(CPUTriCoreState *env, uint32_t r1,
@@ -247,7 +247,7 @@ uint32_t helper_fmsub(CPUTriCoreState *env, uint32_t r1,
     } else {
         env->FPU_FS = 0;
     }
-    return (uint32_t)f_result;
+    return float32_val(f_result);
 }
 
 uint32_t helper_fcmp(CPUTriCoreState *env, uint32_t r1, uint32_t r2)
@@ -304,7 +304,7 @@ uint32_t helper_itof(CPUTriCoreState *env, uint32_t arg)
     } else {
         env->FPU_FS = 0;
     }
-    return (uint32_t)f_result;
+    return float32_val(f_result);
 }
 
 uint32_t helper_ftouz(CPUTriCoreState *env, uint32_t arg)
@@ -321,7 +321,7 @@ uint32_t helper_ftouz(CPUTriCoreState *env, uint32_t arg)
         if (float32_is_any_nan(f_arg)) {
             result = 0;
         }
-    } else if (float32_lt_quiet(f_arg, 0, &env->fp_status)) {
+    } else if (float32_lt_quiet(f_arg, float32_zero, &env->fp_status)) {
         flags = float_flag_invalid;
         result = 0;
     }
-- 
2.13.6

  parent reply	other threads:[~2017-11-03 20:26 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-03 20:26 [Qemu-devel] [PATCH 0/4] softfloat: fix some helper definitions Laurent Vivier
2017-11-03 20:26 ` [Qemu-devel] [PATCH 1/4] arm: fix float64 " Laurent Vivier
2017-11-07 14:54   ` [Qemu-devel] [Qemu-arm] " Philippe Mathieu-Daudé
2017-11-03 20:26 ` [Qemu-devel] [PATCH 2/4] openrisc: fix float32 and " Laurent Vivier
2017-11-04 21:20   ` Stafford Horne
2017-11-05 14:39     ` Laurent Vivier
2017-11-07 10:59       ` Stafford Horne
2017-11-07 14:38   ` [Qemu-devel] [Qemu-arm] " Philippe Mathieu-Daudé
2017-11-03 20:26 ` Laurent Vivier [this message]
2017-11-07 14:40   ` [Qemu-devel] [Qemu-arm] [PATCH 3/4] tricore: use make_float32() and float32_val() Philippe Mathieu-Daudé
2017-11-03 20:26 ` [Qemu-devel] [PATCH 4/4] softfloat: use floatXX_val() in XX_minmax() Laurent Vivier
2017-11-03 21:27 ` [Qemu-devel] [Qemu-arm] [PATCH 0/4] softfloat: fix some helper definitions Philippe Mathieu-Daudé
2017-11-03 21:51   ` Philippe Mathieu-Daudé
2017-11-04  8:55     ` Laurent Vivier
2017-11-04 16:18       ` Philippe Mathieu-Daudé
2017-11-07 14:52         ` Philippe Mathieu-Daudé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171103202624.5956-4-laurent@vivier.eu \
    --to=laurent@vivier.eu \
    --cc=aurelien@aurel32.net \
    --cc=kbastian@mail.uni-paderborn.de \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=shorne@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).