qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] target-ppc: use softfloat min/max functions
@ 2011-04-18 19:23 Aurelien Jarno
  2011-04-18 20:28 ` Peter Maydell
  2011-04-18 21:15 ` Alexander Graf
  0 siblings, 2 replies; 3+ messages in thread
From: Aurelien Jarno @ 2011-04-18 19:23 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alexander Graf, Aurelien Jarno

Use the new softfloat float32_min() and float32_max() to implement the
vminfp and vmaxfp instructions.

Cc: Alexander Graf <agraf@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
 target-ppc/op_helper.c |   16 +++++-----------
 1 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/target-ppc/op_helper.c b/target-ppc/op_helper.c
index 9aa108e..9058d78 100644
--- a/target-ppc/op_helper.c
+++ b/target-ppc/op_helper.c
@@ -2369,22 +2369,16 @@ VMINMAX(uw, u32)
 #undef VMINMAX_DO
 #undef VMINMAX
 
-#define VMINMAXFP(suffix, rT, rF)                                       \
-    void helper_v##suffix (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b)    \
+#define VMINMAXFP(suffix)                                               \
+    void helper_v##suffix##fp (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b)\
     {                                                                   \
         int i;                                                          \
         for (i = 0; i < ARRAY_SIZE(r->f); i++) {                        \
-            HANDLE_NAN2(r->f[i], a->f[i], b->f[i]) {                    \
-                if (float32_lt_quiet(a->f[i], b->f[i], &env->vec_status)) { \
-                    r->f[i] = rT->f[i];                                 \
-                } else {                                                \
-                    r->f[i] = rF->f[i];                                 \
-                }                                                       \
-            }                                                           \
+            r->f[i] = float32_##suffix(a->f[i], b->f[i], &env->vec_status); \
         }                                                               \
     }
-VMINMAXFP(minfp, a, b)
-VMINMAXFP(maxfp, b, a)
+VMINMAXFP(min)
+VMINMAXFP(max)
 #undef VMINMAXFP
 
 void helper_vmladduhm (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b, ppc_avr_t *c)
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] target-ppc: use softfloat min/max functions
  2011-04-18 19:23 [Qemu-devel] [PATCH] target-ppc: use softfloat min/max functions Aurelien Jarno
@ 2011-04-18 20:28 ` Peter Maydell
  2011-04-18 21:15 ` Alexander Graf
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2011-04-18 20:28 UTC (permalink / raw)
  To: Aurelien Jarno; +Cc: qemu-devel, Alexander Graf

On 18 April 2011 20:23, Aurelien Jarno <aurelien@aurel32.net> wrote:
> diff --git a/target-ppc/op_helper.c b/target-ppc/op_helper.c
> index 9aa108e..9058d78 100644
> --- a/target-ppc/op_helper.c
> +++ b/target-ppc/op_helper.c
> @@ -2369,22 +2369,16 @@ VMINMAX(uw, u32)
>  #undef VMINMAX_DO
>  #undef VMINMAX
>
> -#define VMINMAXFP(suffix, rT, rF)                                       \
> -    void helper_v##suffix (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b)    \
> +#define VMINMAXFP(suffix)                                               \
> +    void helper_v##suffix##fp (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b)\
>     {                                                                   \
>         int i;                                                          \
>         for (i = 0; i < ARRAY_SIZE(r->f); i++) {                        \
> -            HANDLE_NAN2(r->f[i], a->f[i], b->f[i]) {                    \
> -                if (float32_lt_quiet(a->f[i], b->f[i], &env->vec_status)) { \
> -                    r->f[i] = rT->f[i];                                 \
> -                } else {                                                \
> -                    r->f[i] = rF->f[i];                                 \
> -                }                                                       \
> -            }                                                           \
> +            r->f[i] = float32_##suffix(a->f[i], b->f[i], &env->vec_status); \
>         }                                                               \
>     }
> -VMINMAXFP(minfp, a, b)
> -VMINMAXFP(maxfp, b, a)
> +VMINMAXFP(min)
> +VMINMAXFP(max)
>  #undef VMINMAXFP
>
>  void helper_vmladduhm (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b, ppc_avr_t *c)

I think you should be able to remove the HANDLE_NAN2 line from the
VARITHFP macro (used for vaddfp, vsubfp) and then you can just say
 VARITHFP(minfp, float32_min)
 VARITHFP(maxfp, float32_max)
rather than needing a separate macro for them, right?

-- PMM

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] target-ppc: use softfloat min/max functions
  2011-04-18 19:23 [Qemu-devel] [PATCH] target-ppc: use softfloat min/max functions Aurelien Jarno
  2011-04-18 20:28 ` Peter Maydell
@ 2011-04-18 21:15 ` Alexander Graf
  1 sibling, 0 replies; 3+ messages in thread
From: Alexander Graf @ 2011-04-18 21:15 UTC (permalink / raw)
  To: Aurelien Jarno; +Cc: qemu-devel


On 18.04.2011, at 21:23, Aurelien Jarno wrote:

> Use the new softfloat float32_min() and float32_max() to implement the
> vminfp and vmaxfp instructions.
> 
> Cc: Alexander Graf <agraf@suse.de>
> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
> ---
> target-ppc/op_helper.c |   16 +++++-----------
> 1 files changed, 5 insertions(+), 11 deletions(-)
> 
> diff --git a/target-ppc/op_helper.c b/target-ppc/op_helper.c
> index 9aa108e..9058d78 100644
> --- a/target-ppc/op_helper.c
> +++ b/target-ppc/op_helper.c
> @@ -2369,22 +2369,16 @@ VMINMAX(uw, u32)
> #undef VMINMAX_DO
> #undef VMINMAX
> 
> -#define VMINMAXFP(suffix, rT, rF)                                       \
> -    void helper_v##suffix (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b)    \
> +#define VMINMAXFP(suffix)                                               \
> +    void helper_v##suffix##fp (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b)\
>     {                                                                   \
>         int i;                                                          \
>         for (i = 0; i < ARRAY_SIZE(r->f); i++) {                        \
> -            HANDLE_NAN2(r->f[i], a->f[i], b->f[i]) {                    \
> -                if (float32_lt_quiet(a->f[i], b->f[i], &env->vec_status)) { \
> -                    r->f[i] = rT->f[i];                                 \
> -                } else {                                                \
> -                    r->f[i] = rF->f[i];                                 \
> -                }                                                       \
> -            }                                                           \
> +            r->f[i] = float32_##suffix(a->f[i], b->f[i], &env->vec_status); \

Now that you've removed all the magic from the macro, it'd probably be easier to read if you open coded it, no? :)


Alex

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-04-18 21:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-18 19:23 [Qemu-devel] [PATCH] target-ppc: use softfloat min/max functions Aurelien Jarno
2011-04-18 20:28 ` Peter Maydell
2011-04-18 21:15 ` Alexander Graf

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).