Patchwork [v2,6/9] target-i386: use floatx80 constants in helper_fld*_ST0()

login
register
mail settings
Submitter Aurelien Jarno
Date May 23, 2011, 9:42 p.m.
Message ID <1306186971-9528-7-git-send-email-aurelien@aurel32.net>
Download mbox | patch
Permalink /patch/97088/
State New
Headers show

Comments

Aurelien Jarno - May 23, 2011, 9:42 p.m.
Instead of using a table which doesn't correspond to anything from
physical in the CPU, use directly the constants in helper_fld*_ST0().

Cc: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
 target-i386/op_helper.c |   27 ++++++++-------------------
 1 files changed, 8 insertions(+), 19 deletions(-)
Peter Maydell - May 23, 2011, 10:11 p.m.
On 23 May 2011 22:42, Aurelien Jarno <aurelien@aurel32.net> wrote:
> Instead of using a table which doesn't correspond to anything from
> physical in the CPU, use directly the constants in helper_fld*_ST0().
>
> Cc: Andreas Färber <andreas.faerber@web.de>
> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Andreas Färber - May 29, 2011, 10:38 a.m.
Am 23.05.2011 um 23:42 schrieb Aurelien Jarno:

> Instead of using a table which doesn't correspond to anything from
> physical in the CPU, use directly the constants in helper_fld*_ST0().
>
> Cc: Andreas Färber <andreas.faerber@web.de>
> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

Tested-by: Andreas Färber <andreas.faerber@web.de>

I'm still wondering *why* the table doesn't work though... cf. reply  
to Peter. I'll try some simplified sample code.

Andreas

> ---
> target-i386/op_helper.c |   27 ++++++++-------------------
> 1 files changed, 8 insertions(+), 19 deletions(-)
>
> diff --git a/target-i386/op_helper.c b/target-i386/op_helper.c
> index 4d309ab..cec0c76 100644
> --- a/target-i386/op_helper.c
> +++ b/target-i386/op_helper.c
> @@ -99,17 +99,6 @@ static const uint8_t rclb_table[32] = {
> #define floatx80_l2e make_floatx80( 0x3fff, 0xb8aa3b295c17f0bcLL )
> #define floatx80_l2t make_floatx80( 0x4000, 0xd49a784bcd1b8afeLL )
>
> -static const floatx80 f15rk[7] =
> -{
> -    floatx80_zero,
> -    floatx80_one,
> -    floatx80_pi,
> -    floatx80_lg2,
> -    floatx80_ln2,
> -    floatx80_l2e,
> -    floatx80_l2t,
> -};
> -
> /* broken thread support */
>
> static spinlock_t global_cpu_lock = SPIN_LOCK_UNLOCKED;
> @@ -3816,42 +3805,42 @@ void helper_fabs_ST0(void)
>
> void helper_fld1_ST0(void)
> {
> -    ST0 = f15rk[1];
> +    ST0 = floatx80_one;
> }
>
> void helper_fldl2t_ST0(void)
> {
> -    ST0 = f15rk[6];
> +    ST0 = floatx80_l2t;
> }
>
> void helper_fldl2e_ST0(void)
> {
> -    ST0 = f15rk[5];
> +    ST0 = floatx80_l2e;
> }
>
> void helper_fldpi_ST0(void)
> {
> -    ST0 = f15rk[2];
> +    ST0 = floatx80_pi;
> }
>
> void helper_fldlg2_ST0(void)
> {
> -    ST0 = f15rk[3];
> +    ST0 = floatx80_lg2;
> }
>
> void helper_fldln2_ST0(void)
> {
> -    ST0 = f15rk[4];
> +    ST0 = floatx80_ln2;
> }
>
> void helper_fldz_ST0(void)
> {
> -    ST0 = f15rk[0];
> +    ST0 = floatx80_zero;
> }
>
> void helper_fldz_FT0(void)
> {
> -    FT0 = f15rk[0];
> +    FT0 = floatx80_zero;
> }
>
> uint32_t helper_fnstsw(void)
> -- 
> 1.7.5.1
>
>

Patch

diff --git a/target-i386/op_helper.c b/target-i386/op_helper.c
index 4d309ab..cec0c76 100644
--- a/target-i386/op_helper.c
+++ b/target-i386/op_helper.c
@@ -99,17 +99,6 @@  static const uint8_t rclb_table[32] = {
 #define floatx80_l2e make_floatx80( 0x3fff, 0xb8aa3b295c17f0bcLL )
 #define floatx80_l2t make_floatx80( 0x4000, 0xd49a784bcd1b8afeLL )
 
-static const floatx80 f15rk[7] =
-{
-    floatx80_zero,
-    floatx80_one,
-    floatx80_pi,
-    floatx80_lg2,
-    floatx80_ln2,
-    floatx80_l2e,
-    floatx80_l2t,
-};
-
 /* broken thread support */
 
 static spinlock_t global_cpu_lock = SPIN_LOCK_UNLOCKED;
@@ -3816,42 +3805,42 @@  void helper_fabs_ST0(void)
 
 void helper_fld1_ST0(void)
 {
-    ST0 = f15rk[1];
+    ST0 = floatx80_one;
 }
 
 void helper_fldl2t_ST0(void)
 {
-    ST0 = f15rk[6];
+    ST0 = floatx80_l2t;
 }
 
 void helper_fldl2e_ST0(void)
 {
-    ST0 = f15rk[5];
+    ST0 = floatx80_l2e;
 }
 
 void helper_fldpi_ST0(void)
 {
-    ST0 = f15rk[2];
+    ST0 = floatx80_pi;
 }
 
 void helper_fldlg2_ST0(void)
 {
-    ST0 = f15rk[3];
+    ST0 = floatx80_lg2;
 }
 
 void helper_fldln2_ST0(void)
 {
-    ST0 = f15rk[4];
+    ST0 = floatx80_ln2;
 }
 
 void helper_fldz_ST0(void)
 {
-    ST0 = f15rk[0];
+    ST0 = floatx80_zero;
 }
 
 void helper_fldz_FT0(void)
 {
-    FT0 = f15rk[0];
+    FT0 = floatx80_zero;
 }
 
 uint32_t helper_fnstsw(void)