From: Richard Henderson <richard.hender...@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.pi...@eldorado.org.br> -- Luis Pires Instituto de Pesquisas ELDORADO Aviso Legal - Disclaimer <https://www.eldorado.org.br/disclaimer.html>