On 12/10/25 07:16, Paolo Bonzini wrote:
This is more efficient both when generating code and when testing
flags.

I guess sbb x,x appears quite frequently in x86 setcc computation, and the testing of the flags is much less important than the straight line code generation?


diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index ecca38ed0b5..314e773a5d4 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -1515,7 +1515,18 @@ typedef enum {
      CC_OP_POPCNTL__,
      CC_OP_POPCNTQ__,
      CC_OP_POPCNT = sizeof(target_ulong) == 8 ? CC_OP_POPCNTQ__ : 
CC_OP_POPCNTL__,
-#define CC_OP_LAST_BWLQ CC_OP_POPCNTQ__
+
+    /*
+     * Note that only CC_OP_SBB_SELF (i.e. the one with MO_TL size)
+     * is used or implemented, because the translation produces a
+     * sign-extended CC_DST.
+     */
+    CC_OP_SBB_SELFB__, /* S/Z/C/A via CC_DST, O clear, P set.  */
+    CC_OP_SBB_SELFW__,
+    CC_OP_SBB_SELFL__,
+    CC_OP_SBB_SELFQ__,
+    CC_OP_SBB_SELF = sizeof(target_ulong) == 8 ? CC_OP_SBB_SELFQ__ : 
CC_OP_SBB_SELFL__,
+#define CC_OP_LAST_BWLQ CC_OP_SBB_SELFQ__

The documentation here could be improved to note that CC_DST is always in {-1, 0}. The fact that you can derive all other flags via masking less immediately relevant.

Otherwise,
Reviewed-by: Richard Henderson <[email protected]>


r~

Reply via email to