qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 33/48] tcg/optimize: Add type to OptContext


From: Richard Henderson
Subject: Re: [PATCH v3 33/48] tcg/optimize: Add type to OptContext
Date: Sat, 23 Oct 2021 11:25:37 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0

On 10/22/21 3:11 PM, Luis Fernando Fujita Pires wrote:
From: Richard Henderson <richard.henderson@linaro.org>

@@ -1392,18 +1408,18 @@ void tcg_optimize(TCGContext *s)
                      /* Proceed with possible constant folding. */
                      break;
                  }
-                if (opc == INDEX_op_sub_i32) {
+                switch (ctx.type) {
+                case TCG_TYPE_I32:
                      neg_op = INDEX_op_neg_i32;
                      have_neg = TCG_TARGET_HAS_neg_i32;
-                } else if (opc == INDEX_op_sub_i64) {
+                    break;
+                case TCG_TYPE_I64:
                      neg_op = INDEX_op_neg_i64;
                      have_neg = TCG_TARGET_HAS_neg_i64;
-                } else if (TCG_TARGET_HAS_neg_vec) {
-                    TCGType type = TCGOP_VECL(op) + TCG_TYPE_V64;
-                    unsigned vece = TCGOP_VECE(op);
+                    break;
+                default:
                      neg_op = INDEX_op_neg_vec;
-                    have_neg = tcg_can_emit_vec_op(neg_op, type, vece) > 0;
-                } else {
+                    have_neg = tcg_can_emit_vec_op(neg_op, ctx.type,
+ TCGOP_VECE(op)) > 0;

Should we replace the 'default' here with a case for TCG_TYPE_V{64,128,256} and 
add a new 'default' with g_assert_not_reached()?

Yes, that's probably a good idea.


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]