diff mbox

target-mips: fix logically dead code reported by Coverity

Message ID 1436868495-4359-2-git-send-email-leon.alrae@imgtec.com
State New
Headers show

Commit Message

Leon Alrae July 14, 2015, 10:08 a.m. UTC
Make use of CMPOP in floating-point compare instructions.

Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
---
 target-mips/translate.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Aurelien Jarno July 14, 2015, 3:45 p.m. UTC | #1
On 2015-07-14 11:08, Leon Alrae wrote:
> Make use of CMPOP in floating-point compare instructions.
> 
> Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
> ---
>  target-mips/translate.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/target-mips/translate.c b/target-mips/translate.c
> index 7302857..4a1ffdb 100644
> --- a/target-mips/translate.c
> +++ b/target-mips/translate.c
> @@ -9552,6 +9552,7 @@ static void gen_farith (DisasContext *ctx, enum fopcode op1,
>              gen_cmp_s(ctx, func-48, ft, fs, cc);
>              opn = condnames[func-48];
>          }
> +        optype = CMPOP;
>          break;
>      case OPC_ADD_D:
>          check_cp1_registers(ctx, fs | ft | fd);
> @@ -10036,6 +10037,7 @@ static void gen_farith (DisasContext *ctx, enum fopcode op1,
>              gen_cmp_d(ctx, func-48, ft, fs, cc);
>              opn = condnames[func-48];
>          }
> +        optype = CMPOP;
>          break;
>      case OPC_CVT_S_D:
>          check_cp1_registers(ctx, fs);
> @@ -10461,6 +10463,7 @@ static void gen_farith (DisasContext *ctx, enum fopcode op1,
>              gen_cmp_ps(ctx, func-48, ft, fs, cc);
>              opn = condnames[func-48];
>          }
> +        optype = CMPOP;
>          break;
>      default:
>          MIPS_INVAL(opn);

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>

By the way, is this debug code really useful? I think by looking at the
TCG code (-d in_asm,op), it's easy to determine if an instruction is
correctly disassembled or not.
Leon Alrae July 14, 2015, 4:22 p.m. UTC | #2
On 14/07/2015 16:45, Aurelien Jarno wrote:
> By the way, is this debug code really useful? I think by looking at the
> TCG code (-d in_asm,op), it's easy to determine if an instruction is
> correctly disassembled or not.
> 

For me this debug code doesn't seem to be useful at all and it only clutters
translate.c :) In this patch I just wanted to make Coverity happy so I
followed the existing code but generally would vote for removal all of MIPS_DEBUG.

Leon
Aurelien Jarno July 14, 2015, 4:26 p.m. UTC | #3
On 2015-07-14 17:22, Leon Alrae wrote:
> On 14/07/2015 16:45, Aurelien Jarno wrote:
> > By the way, is this debug code really useful? I think by looking at the
> > TCG code (-d in_asm,op), it's easy to determine if an instruction is
> > correctly disassembled or not.
> > 
> 
> For me this debug code doesn't seem to be useful at all and it only clutters
> translate.c :) In this patch I just wanted to make Coverity happy so I
> followed the existing code but generally would vote for removal all of MIPS_DEBUG.

Ok, I'll work on a patch for 2.5. That said I think we should still
merge the patch for 2.4.
diff mbox

Patch

diff --git a/target-mips/translate.c b/target-mips/translate.c
index 7302857..4a1ffdb 100644
--- a/target-mips/translate.c
+++ b/target-mips/translate.c
@@ -9552,6 +9552,7 @@  static void gen_farith (DisasContext *ctx, enum fopcode op1,
             gen_cmp_s(ctx, func-48, ft, fs, cc);
             opn = condnames[func-48];
         }
+        optype = CMPOP;
         break;
     case OPC_ADD_D:
         check_cp1_registers(ctx, fs | ft | fd);
@@ -10036,6 +10037,7 @@  static void gen_farith (DisasContext *ctx, enum fopcode op1,
             gen_cmp_d(ctx, func-48, ft, fs, cc);
             opn = condnames[func-48];
         }
+        optype = CMPOP;
         break;
     case OPC_CVT_S_D:
         check_cp1_registers(ctx, fs);
@@ -10461,6 +10463,7 @@  static void gen_farith (DisasContext *ctx, enum fopcode op1,
             gen_cmp_ps(ctx, func-48, ft, fs, cc);
             opn = condnames[func-48];
         }
+        optype = CMPOP;
         break;
     default:
         MIPS_INVAL(opn);