On 25/3/25 15:07, Richard Henderson wrote:
On 3/25/25 05:39, Philippe Mathieu-Daudé wrote:
@@ -2750,12 +2752,16 @@ static bool trans_SETHI(DisasContext *dc, arg_SETHI *a)
  static bool do_tcc(DisasContext *dc, int cond, int cc,
                     int rs1, bool imm, int rs2_or_imm)
  {
-    int mask = ((dc->def->features & CPU_FEATURE_HYPV) && supervisor(dc)
-                ? UA2005_HTRAP_MASK : V8_TRAP_MASK);
+    int mask = 0;
      DisasCompare cmp;
      TCGLabel *lab;
      TCGv_i32 trap;
+#ifdef TARGET_SPARC64
+    mask = ((dc->def->features & CPU_FEATURE_HYPV) && supervisor(dc))
+           ? UA2005_HTRAP_MASK : V8_TRAP_MASK;
+#endif

This is wrong.  The conversion could have been

   int mask = V8_TRAP_MASK;
#ifdef
   if (HYPV && super) {
     mask = UA2005_HTRAP_MASK;
   }
#endif

Oh indeed. I guess I got confused by the parenthesis.

but that's an excellent reason not to have the ifdef at all.

If you want to hide the features from sparc32, so they don't show up on the command-line, fine.  But I think you want to introduce

#define CPU_FEATURE_HYPV 0

etc for sparc32 to automatically fail such tests as these without further modification.

Hmm maybe not a big win after all since you said sparc32 and sparc64
will likely be considered as distinct architectures (in terms of QEMU
target implementations).

Reply via email to