qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] target/hppa: add unit conditions for wide mode
@ 2024-03-21 18:42 Sven Schnelle
  2024-03-21 18:42 ` [PATCH 2/3] target/hppa: sub: fix trap on overflow for narrow mode Sven Schnelle
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Sven Schnelle @ 2024-03-21 18:42 UTC (permalink / raw)
  To: Richard Henderson; +Cc: qemu-devel, Helge Deller, Sven Schnelle

Wide mode provides two more conditions, add them.

Signed-off-by: Sven Schnelle <svens@stackframe.org>
---
 target/hppa/translate.c | 25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/target/hppa/translate.c b/target/hppa/translate.c
index 8a87996fc1..f493e207e1 100644
--- a/target/hppa/translate.c
+++ b/target/hppa/translate.c
@@ -963,11 +963,22 @@ static DisasCond do_unit_cond(unsigned cf, bool d, TCGv_i64 res,
 
     switch (cf >> 1) {
     case 0: /* never / TR */
-    case 1: /* undefined */
-    case 5: /* undefined */
         cond = cond_make_f();
         break;
 
+    case 1:
+        if (d) {
+            tmp = tcg_temp_new_i64();
+            tcg_gen_subi_i64(tmp, res, d_repl * 0x00000001u);
+            tcg_gen_andc_i64(tmp, tmp, res);
+            tcg_gen_andi_i64(tmp, tmp, d_repl * 0x80000000u);
+            cond = cond_make_0(TCG_COND_NE, tmp);
+        } else {
+            /* undefined */
+            cond = cond_make_f();
+        }
+        break;
+
     case 2: /* SBZ / NBZ */
         /* See hasless(v,1) from
          * https://graphics.stanford.edu/~seander/bithacks.html#ZeroInWord
@@ -992,6 +1003,16 @@ static DisasCond do_unit_cond(unsigned cf, bool d, TCGv_i64 res,
         cond = cond_make_0(TCG_COND_NE, cb);
         break;
 
+    case 5:
+        if (d) {
+            tcg_gen_andi_i64(cb, cb, d_repl * 0x80000000u);
+            cond = cond_make_0(TCG_COND_NE, cb);
+        } else {
+            /* undefined */
+            cond = cond_make_f();
+        }
+        break;
+
     case 6: /* SBC / NBC */
         tcg_gen_andi_i64(cb, cb, d_repl * 0x80808080u);
         cond = cond_make_0(TCG_COND_NE, cb);
-- 
2.43.2



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

* [PATCH 2/3] target/hppa: sub: fix trap on overflow for narrow mode
  2024-03-21 18:42 [PATCH 1/3] target/hppa: add unit conditions for wide mode Sven Schnelle
@ 2024-03-21 18:42 ` Sven Schnelle
  2024-03-21 20:03   ` Richard Henderson
  2024-03-21 18:42 ` [PATCH 3/3] target/hppa: add: " Sven Schnelle
  2024-03-21 19:58 ` [PATCH 1/3] target/hppa: add unit conditions for wide mode Richard Henderson
  2 siblings, 1 reply; 9+ messages in thread
From: Sven Schnelle @ 2024-03-21 18:42 UTC (permalink / raw)
  To: Richard Henderson; +Cc: qemu-devel, Helge Deller, Sven Schnelle

Signed-off-by: Sven Schnelle <svens@stackframe.org>
---
 target/hppa/translate.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/target/hppa/translate.c b/target/hppa/translate.c
index f493e207e1..4d2b96f876 100644
--- a/target/hppa/translate.c
+++ b/target/hppa/translate.c
@@ -1213,6 +1213,9 @@ static void do_sub(DisasContext *ctx, unsigned rt, TCGv_i64 in1,
     if (is_tsv || cond_need_sv(c)) {
         sv = do_sub_sv(ctx, dest, in1, in2);
         if (is_tsv) {
+            if (!d) {
+                tcg_gen_ext32s_i64(sv, sv);
+            }
             gen_helper_tsv(tcg_env, sv);
         }
     }
-- 
2.43.2



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

* [PATCH 3/3] target/hppa: add: fix trap on overflow for narrow mode
  2024-03-21 18:42 [PATCH 1/3] target/hppa: add unit conditions for wide mode Sven Schnelle
  2024-03-21 18:42 ` [PATCH 2/3] target/hppa: sub: fix trap on overflow for narrow mode Sven Schnelle
@ 2024-03-21 18:42 ` Sven Schnelle
  2024-03-21 20:04   ` Richard Henderson
  2024-03-21 19:58 ` [PATCH 1/3] target/hppa: add unit conditions for wide mode Richard Henderson
  2 siblings, 1 reply; 9+ messages in thread
From: Sven Schnelle @ 2024-03-21 18:42 UTC (permalink / raw)
  To: Richard Henderson; +Cc: qemu-devel, Helge Deller, Sven Schnelle

Signed-off-by: Sven Schnelle <svens@stackframe.org>
---
 target/hppa/translate.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/target/hppa/translate.c b/target/hppa/translate.c
index 4d2b96f876..74a9ea0cd8 100644
--- a/target/hppa/translate.c
+++ b/target/hppa/translate.c
@@ -1122,6 +1122,9 @@ static void do_add(DisasContext *ctx, unsigned rt, TCGv_i64 in1,
     if (is_tsv || cond_need_sv(c)) {
         sv = do_add_sv(ctx, dest, in1, in2);
         if (is_tsv) {
+            if (!d) {
+                tcg_gen_ext32s_i64(sv, sv);
+            }
             /* ??? Need to include overflow from shift.  */
             gen_helper_tsv(tcg_env, sv);
         }
-- 
2.43.2



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

* Re: [PATCH 1/3] target/hppa: add unit conditions for wide mode
  2024-03-21 18:42 [PATCH 1/3] target/hppa: add unit conditions for wide mode Sven Schnelle
  2024-03-21 18:42 ` [PATCH 2/3] target/hppa: sub: fix trap on overflow for narrow mode Sven Schnelle
  2024-03-21 18:42 ` [PATCH 3/3] target/hppa: add: " Sven Schnelle
@ 2024-03-21 19:58 ` Richard Henderson
  2024-03-21 20:10   ` Sven Schnelle
  2 siblings, 1 reply; 9+ messages in thread
From: Richard Henderson @ 2024-03-21 19:58 UTC (permalink / raw)
  To: Sven Schnelle; +Cc: qemu-devel, Helge Deller

On 3/21/24 08:42, Sven Schnelle wrote:
> Wide mode provides two more conditions, add them.
> 
> Signed-off-by: Sven Schnelle <svens@stackframe.org>
> ---
>   target/hppa/translate.c | 25 +++++++++++++++++++++++--
>   1 file changed, 23 insertions(+), 2 deletions(-)
> 
> diff --git a/target/hppa/translate.c b/target/hppa/translate.c
> index 8a87996fc1..f493e207e1 100644
> --- a/target/hppa/translate.c
> +++ b/target/hppa/translate.c
> @@ -963,11 +963,22 @@ static DisasCond do_unit_cond(unsigned cf, bool d, TCGv_i64 res,
>   
>       switch (cf >> 1) {
>       case 0: /* never / TR */
> -    case 1: /* undefined */
> -    case 5: /* undefined */
>           cond = cond_make_f();
>           break;
>   
> +    case 1:

Wants a comment for /* SWZ / NWZ */

> +    case 5:

/* SWC / NWC */

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~


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

* Re: [PATCH 2/3] target/hppa: sub: fix trap on overflow for narrow mode
  2024-03-21 18:42 ` [PATCH 2/3] target/hppa: sub: fix trap on overflow for narrow mode Sven Schnelle
@ 2024-03-21 20:03   ` Richard Henderson
  2024-03-21 20:08     ` Sven Schnelle
  0 siblings, 1 reply; 9+ messages in thread
From: Richard Henderson @ 2024-03-21 20:03 UTC (permalink / raw)
  To: Sven Schnelle; +Cc: qemu-devel, Helge Deller

On 3/21/24 08:42, Sven Schnelle wrote:
> Signed-off-by: Sven Schnelle <svens@stackframe.org>
> ---
>   target/hppa/translate.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/target/hppa/translate.c b/target/hppa/translate.c
> index f493e207e1..4d2b96f876 100644
> --- a/target/hppa/translate.c
> +++ b/target/hppa/translate.c
> @@ -1213,6 +1213,9 @@ static void do_sub(DisasContext *ctx, unsigned rt, TCGv_i64 in1,
>       if (is_tsv || cond_need_sv(c)) {
>           sv = do_sub_sv(ctx, dest, in1, in2);
>           if (is_tsv) {
> +            if (!d) {
> +                tcg_gen_ext32s_i64(sv, sv);
> +            }
>               gen_helper_tsv(tcg_env, sv);
>           }
>       }

Difficult to pinpoint exactly which patch should have added this.  :-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


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

* Re: [PATCH 3/3] target/hppa: add: fix trap on overflow for narrow mode
  2024-03-21 18:42 ` [PATCH 3/3] target/hppa: add: " Sven Schnelle
@ 2024-03-21 20:04   ` Richard Henderson
  0 siblings, 0 replies; 9+ messages in thread
From: Richard Henderson @ 2024-03-21 20:04 UTC (permalink / raw)
  To: Sven Schnelle; +Cc: qemu-devel, Helge Deller

On 3/21/24 08:42, Sven Schnelle wrote:
> Signed-off-by: Sven Schnelle <svens@stackframe.org>
> ---
>   target/hppa/translate.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/target/hppa/translate.c b/target/hppa/translate.c
> index 4d2b96f876..74a9ea0cd8 100644
> --- a/target/hppa/translate.c
> +++ b/target/hppa/translate.c
> @@ -1122,6 +1122,9 @@ static void do_add(DisasContext *ctx, unsigned rt, TCGv_i64 in1,
>       if (is_tsv || cond_need_sv(c)) {
>           sv = do_add_sv(ctx, dest, in1, in2);
>           if (is_tsv) {
> +            if (!d) {
> +                tcg_gen_ext32s_i64(sv, sv);
> +            }
>               /* ??? Need to include overflow from shift.  */
>               gen_helper_tsv(tcg_env, sv);
>           }

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


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

* Re: [PATCH 2/3] target/hppa: sub: fix trap on overflow for narrow mode
  2024-03-21 20:03   ` Richard Henderson
@ 2024-03-21 20:08     ` Sven Schnelle
  0 siblings, 0 replies; 9+ messages in thread
From: Sven Schnelle @ 2024-03-21 20:08 UTC (permalink / raw)
  To: Richard Henderson; +Cc: qemu-devel, Helge Deller

Richard Henderson <richard.henderson@linaro.org> writes:

> On 3/21/24 08:42, Sven Schnelle wrote:
>> Signed-off-by: Sven Schnelle <svens@stackframe.org>
>> ---
>>   target/hppa/translate.c | 3 +++
>>   1 file changed, 3 insertions(+)
>> diff --git a/target/hppa/translate.c b/target/hppa/translate.c
>> index f493e207e1..4d2b96f876 100644
>> --- a/target/hppa/translate.c
>> +++ b/target/hppa/translate.c
>> @@ -1213,6 +1213,9 @@ static void do_sub(DisasContext *ctx, unsigned rt, TCGv_i64 in1,
>>       if (is_tsv || cond_need_sv(c)) {
>>           sv = do_sub_sv(ctx, dest, in1, in2);
>>           if (is_tsv) {
>> +            if (!d) {
>> +                tcg_gen_ext32s_i64(sv, sv);
>> +            }
>>               gen_helper_tsv(tcg_env, sv);
>>           }
>>       }
>
> Difficult to pinpoint exactly which patch should have added this.  :-)

Yes, after missing the Fixes: tags on all of my patches in the last
patchset, i tried add one but wasn't sure either. :-)

> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

Thanks!


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

* Re: [PATCH 1/3] target/hppa: add unit conditions for wide mode
  2024-03-21 19:58 ` [PATCH 1/3] target/hppa: add unit conditions for wide mode Richard Henderson
@ 2024-03-21 20:10   ` Sven Schnelle
  2024-03-21 21:06     ` Richard Henderson
  0 siblings, 1 reply; 9+ messages in thread
From: Sven Schnelle @ 2024-03-21 20:10 UTC (permalink / raw)
  To: Richard Henderson; +Cc: qemu-devel, Helge Deller

Richard Henderson <richard.henderson@linaro.org> writes:

> On 3/21/24 08:42, Sven Schnelle wrote:
>> Wide mode provides two more conditions, add them.
>> Signed-off-by: Sven Schnelle <svens@stackframe.org>
>> ---
>>   target/hppa/translate.c | 25 +++++++++++++++++++++++--
>>   1 file changed, 23 insertions(+), 2 deletions(-)
>> diff --git a/target/hppa/translate.c b/target/hppa/translate.c
>> index 8a87996fc1..f493e207e1 100644
>> --- a/target/hppa/translate.c
>> +++ b/target/hppa/translate.c
>> @@ -963,11 +963,22 @@ static DisasCond do_unit_cond(unsigned cf, bool d, TCGv_i64 res,
>>         switch (cf >> 1) {
>>       case 0: /* never / TR */
>> -    case 1: /* undefined */
>> -    case 5: /* undefined */
>>           cond = cond_make_f();
>>           break;
>>   +    case 1:
>
> Wants a comment for /* SWZ / NWZ */
>
>> +    case 5:
>
> /* SWC / NWC */

Are you going to fix that up, or should i send a v2?


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

* Re: [PATCH 1/3] target/hppa: add unit conditions for wide mode
  2024-03-21 20:10   ` Sven Schnelle
@ 2024-03-21 21:06     ` Richard Henderson
  0 siblings, 0 replies; 9+ messages in thread
From: Richard Henderson @ 2024-03-21 21:06 UTC (permalink / raw)
  To: Sven Schnelle; +Cc: qemu-devel, Helge Deller

On 3/21/24 10:10, Sven Schnelle wrote:
> Richard Henderson <richard.henderson@linaro.org> writes:
> 
>> On 3/21/24 08:42, Sven Schnelle wrote:
>>> Wide mode provides two more conditions, add them.
>>> Signed-off-by: Sven Schnelle <svens@stackframe.org>
>>> ---
>>>    target/hppa/translate.c | 25 +++++++++++++++++++++++--
>>>    1 file changed, 23 insertions(+), 2 deletions(-)
>>> diff --git a/target/hppa/translate.c b/target/hppa/translate.c
>>> index 8a87996fc1..f493e207e1 100644
>>> --- a/target/hppa/translate.c
>>> +++ b/target/hppa/translate.c
>>> @@ -963,11 +963,22 @@ static DisasCond do_unit_cond(unsigned cf, bool d, TCGv_i64 res,
>>>          switch (cf >> 1) {
>>>        case 0: /* never / TR */
>>> -    case 1: /* undefined */
>>> -    case 5: /* undefined */
>>>            cond = cond_make_f();
>>>            break;
>>>    +    case 1:
>>
>> Wants a comment for /* SWZ / NWZ */
>>
>>> +    case 5:
>>
>> /* SWC / NWC */
> 
> Are you going to fix that up, or should i send a v2?

I'll fix it up.


r~


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

end of thread, other threads:[~2024-03-21 21:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-21 18:42 [PATCH 1/3] target/hppa: add unit conditions for wide mode Sven Schnelle
2024-03-21 18:42 ` [PATCH 2/3] target/hppa: sub: fix trap on overflow for narrow mode Sven Schnelle
2024-03-21 20:03   ` Richard Henderson
2024-03-21 20:08     ` Sven Schnelle
2024-03-21 18:42 ` [PATCH 3/3] target/hppa: add: " Sven Schnelle
2024-03-21 20:04   ` Richard Henderson
2024-03-21 19:58 ` [PATCH 1/3] target/hppa: add unit conditions for wide mode Richard Henderson
2024-03-21 20:10   ` Sven Schnelle
2024-03-21 21:06     ` Richard Henderson

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