[Qemu-devel] [PATCH v4 02/15] target/ppc: update ov flag from remaining paths

Nikunj A Dadhania posted 15 patches 8 years, 11 months ago
There is a newer version of this series
[Qemu-devel] [PATCH v4 02/15] target/ppc: update ov flag from remaining paths
Posted by Nikunj A Dadhania 8 years, 11 months ago
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
---
 target/ppc/int_helper.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c
index da4e1a6..b376860 100644
--- a/target/ppc/int_helper.c
+++ b/target/ppc/int_helper.c
@@ -320,22 +320,24 @@ target_ulong helper_divo(CPUPPCState *env, target_ulong arg1,
                          target_ulong arg2)
 {
     uint64_t tmp = (uint64_t)arg1 << 32 | env->spr[SPR_MQ];
+    int ov;
 
     if (((int32_t)tmp == INT32_MIN && (int32_t)arg2 == (int32_t)-1) ||
         (int32_t)arg2 == 0) {
-        env->so = env->ov = 1;
+        ov = 1;
         env->spr[SPR_MQ] = 0;
         return INT32_MIN;
     } else {
         env->spr[SPR_MQ] = tmp % arg2;
         tmp /= (int32_t)arg2;
         if ((int32_t)tmp != tmp) {
-            env->so = env->ov = 1;
+            ov = 1;
         } else {
-            env->ov = 0;
+            ov = 0;
         }
         return tmp;
     }
+    helper_update_ov_legacy(env, ov);
 }
 
 target_ulong helper_divs(CPUPPCState *env, target_ulong arg1,
@@ -356,11 +358,11 @@ target_ulong helper_divso(CPUPPCState *env, target_ulong arg1,
 {
     if (((int32_t)arg1 == INT32_MIN && (int32_t)arg2 == (int32_t)-1) ||
         (int32_t)arg2 == 0) {
-        env->so = env->ov = 1;
+        helper_update_ov_legacy(env, 1);
         env->spr[SPR_MQ] = 0;
         return INT32_MIN;
     } else {
-        env->ov = 0;
+        helper_update_ov_legacy(env, 0);
         env->spr[SPR_MQ] = (int32_t)arg1 % (int32_t)arg2;
         return (int32_t)arg1 / (int32_t)arg2;
     }
-- 
2.7.4


Re: [Qemu-devel] [PATCH v4 02/15] target/ppc: update ov flag from remaining paths
Posted by Richard Henderson 8 years, 11 months ago
On 02/24/2017 06:56 AM, Nikunj A Dadhania wrote:
> @@ -320,22 +320,24 @@ target_ulong helper_divo(CPUPPCState *env, target_ulong arg1,
>                           target_ulong arg2)
>  {
>      uint64_t tmp = (uint64_t)arg1 << 32 | env->spr[SPR_MQ];
> +    int ov;
>
>      if (((int32_t)tmp == INT32_MIN && (int32_t)arg2 == (int32_t)-1) ||
>          (int32_t)arg2 == 0) {
> -        env->so = env->ov = 1;
> +        ov = 1;
>          env->spr[SPR_MQ] = 0;
>          return INT32_MIN;
>      } else {
>          env->spr[SPR_MQ] = tmp % arg2;
>          tmp /= (int32_t)arg2;
>          if ((int32_t)tmp != tmp) {
> -            env->so = env->ov = 1;
> +            ov = 1;
>          } else {
> -            env->ov = 0;
> +            ov = 0;
>          }
>          return tmp;
>      }
> +    helper_update_ov_legacy(env, ov);
>  }
>

You're attempting to run the helper after "return".


r~

Re: [Qemu-devel] [PATCH v4 02/15] target/ppc: update ov flag from remaining paths
Posted by Nikunj A Dadhania 8 years, 11 months ago
Richard Henderson <rth@twiddle.net> writes:

> On 02/24/2017 06:56 AM, Nikunj A Dadhania wrote:
>> @@ -320,22 +320,24 @@ target_ulong helper_divo(CPUPPCState *env, target_ulong arg1,
>>                           target_ulong arg2)
>>  {
>>      uint64_t tmp = (uint64_t)arg1 << 32 | env->spr[SPR_MQ];
>> +    int ov;
>>
>>      if (((int32_t)tmp == INT32_MIN && (int32_t)arg2 == (int32_t)-1) ||
>>          (int32_t)arg2 == 0) {
>> -        env->so = env->ov = 1;
>> +        ov = 1;
>>          env->spr[SPR_MQ] = 0;
>>          return INT32_MIN;
>>      } else {
>>          env->spr[SPR_MQ] = tmp % arg2;
>>          tmp /= (int32_t)arg2;
>>          if ((int32_t)tmp != tmp) {
>> -            env->so = env->ov = 1;
>> +            ov = 1;
>>          } else {
>> -            env->ov = 0;
>> +            ov = 0;
>>          }
>>          return tmp;
>>      }
>> +    helper_update_ov_legacy(env, ov);
>>  }
>>
>
> You're attempting to run the helper after "return".

Right, will correct it.

Regards
Nikunj