All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] target/i386: Don't clear C1 for FCOMI/FCOMIP/FUCOMI/FUCOMIP
@ 2026-09-11 10:58 Simon Scherer
  2026-09-16 13:34 ` Paolo Bonzini
  0 siblings, 1 reply; 2+ messages in thread
From: Simon Scherer @ 2026-09-11 10:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, richard.henderson, qemu-stable, Simon Scherer

Commit 6802a4b23919 ("target/i386: clear C1 for all x87 compare
instructions") added an unconditional C1 clear to helper_fcomi_ST0_FT0()
and helper_fucomi_ST0_FT0(), based on the SDM listing "C1 Set to 0" under
FPU Flags Affected for FCOMI/FCOMIP/FUCOMI/FUCOMIP.

Testing on real x86-64 Intel and AMD hardware shows these instructions leave
C1 unchanged, unlike FCOM/FUCOM/FICOM. The SDM text appears to have been
carried over from the FCOM/FUCOM description.

Revert that part of the commit. The FCOM/FUCOM/FICOM changes are kept.

Fixes: 6802a4b23919 ("target/i386: clear C1 for all x87 compare instructions")
Signed-off-by: Simon Scherer <scherer.simon89@gmail.com>
---
This was caught before 6802a4b23919 landed. V3 [1] dropped the
fcomi/fucomi changes, but v2 was the version applied

[1] https://patchew.org/QEMU/20260902135705.261863-1-scherer.simon89@gmail.com/

 target/i386/tcg/fpu_helper.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/target/i386/tcg/fpu_helper.c b/target/i386/tcg/fpu_helper.c
index 54ff4fe31313..56d093da8c9a 100644
--- a/target/i386/tcg/fpu_helper.c
+++ b/target/i386/tcg/fpu_helper.c
@@ -565,8 +565,6 @@ void helper_fcomi_ST0_FT0(CPUX86State *env)
     /* OF, SF, and AF are unconditionally cleared to 0 */
     CC_SRC = fcomi_ccval[ret + 1];
     CC_OP = CC_OP_EFLAGS;
-    /* C1 is unconditionally cleared to 0 */
-    env->fpus &= ~0x0200;
     merge_exception_flags(env, old_flags);
 }
 
@@ -579,8 +577,6 @@ void helper_fucomi_ST0_FT0(CPUX86State *env)
     /* OF, SF, and AF are unconditionally cleared to 0 */
     CC_SRC = fcomi_ccval[ret + 1];
     CC_OP = CC_OP_EFLAGS;
-    /* C1 is unconditionally cleared to 0 */
-    env->fpus &= ~0x0200;
     merge_exception_flags(env, old_flags);
 }
 
-- 
2.53.0



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

end of thread, other threads:[~2026-09-16 13:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-11 10:58 [PATCH] target/i386: Don't clear C1 for FCOMI/FCOMIP/FUCOMI/FUCOMIP Simon Scherer
2026-09-16 13:34 ` Paolo Bonzini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.