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: Luis Fernando Fujita Pires
Subject: RE: [PATCH v3 33/48] tcg/optimize: Add type to OptContext
Date: Fri, 22 Oct 2021 22:11:15 +0000

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()?

> @@ -1457,15 +1473,19 @@ void tcg_optimize(TCGContext *s)
>                  TCGOpcode not_op;
>                  bool have_not;
> 
> -                if (def->flags & TCG_OPF_VECTOR) {
> +                switch (ctx.type) {
> +                default:
>                      not_op = INDEX_op_not_vec;
>                      have_not = TCG_TARGET_HAS_not_vec;

And here too?

Either way,

Reviewed-by: Luis Pires <luis.pires@eldorado.org.br>

--
Luis Pires
Instituto de Pesquisas ELDORADO
Aviso Legal - Disclaimer <https://www.eldorado.org.br/disclaimer.html>



reply via email to

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