diff mbox series

[1/3] target/hppa: add unit conditions for wide mode

Message ID 20240321184228.611897-1-svens@stackframe.org (mailing list archive)
State New, archived
Headers show
Series [1/3] target/hppa: add unit conditions for wide mode | expand

Commit Message

Sven Schnelle March 21, 2024, 6:42 p.m. UTC
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(-)

Comments

Richard Henderson March 21, 2024, 7:58 p.m. UTC | #1
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~
Sven Schnelle March 21, 2024, 8:10 p.m. UTC | #2
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?
Richard Henderson March 21, 2024, 9:06 p.m. UTC | #3
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~
diff mbox series

Patch

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