[PATCH 1/5] target/i386/tcg: remove dead code

Paolo Bonzini posted 5 patches 1 month ago
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, Zhao Liu <zhao1.liu@intel.com>, Richard Henderson <richard.henderson@linaro.org>, Eduardo Habkost <eduardo@habkost.net>
[PATCH 1/5] target/i386/tcg: remove dead code
Posted by Paolo Bonzini 1 month ago
Remove dead code; it arose when I noticed that, because 0x3? opcodes do
have a pop, case 0x32 works just fine as fcomp (even though 0x?2 is fcom):
there is no need to hack the op to 0x03.

Reported by Coverity as CID 1643922.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target/i386/tcg/translate.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c
index 7c444d5006d..460848e4223 100644
--- a/target/i386/tcg/translate.c
+++ b/target/i386/tcg/translate.c
@@ -2543,9 +2543,6 @@ static void gen_x87(DisasContext *s, X86DecodedInsn *decode)
                 break;
             }
             break;
-            /* map to fcomp; op & 7 == 2 would not pop  */
-            op = 0x03;
-            /* fallthrough */
         case 0x00 ... 0x07: /* fxxx st, sti */
         case 0x22 ... 0x23: /* fcom2 and fcomp3, undocumented ops */
         case 0x32: /* fcomp5, undocumented op */
-- 
2.52.0
Re: [PATCH 1/5] target/i386/tcg: remove dead code
Posted by Richard Henderson 1 month ago
On 1/8/26 02:13, Paolo Bonzini wrote:
> Remove dead code; it arose when I noticed that, because 0x3? opcodes do
> have a pop, case 0x32 works just fine as fcomp (even though 0x?2 is fcom):
> there is no need to hack the op to 0x03.
> 
> Reported by Coverity as CID 1643922.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   target/i386/tcg/translate.c | 3 ---
>   1 file changed, 3 deletions(-)
> 
> diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c
> index 7c444d5006d..460848e4223 100644
> --- a/target/i386/tcg/translate.c
> +++ b/target/i386/tcg/translate.c
> @@ -2543,9 +2543,6 @@ static void gen_x87(DisasContext *s, X86DecodedInsn *decode)
>                   break;
>               }
>               break;
> -            /* map to fcomp; op & 7 == 2 would not pop  */
> -            op = 0x03;
> -            /* fallthrough */
>           case 0x00 ... 0x07: /* fxxx st, sti */
>           case 0x22 ... 0x23: /* fcom2 and fcomp3, undocumented ops */
>           case 0x32: /* fcomp5, undocumented op */

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

r~