tcg: Do not recreate INDEX_op_neg_vec unless supported

Use tcg_can_emit_vec_op instead of just TCG_TARGET_HAS_neg_vec,
so that we check the type and vece for the actual operation.

Backports commit ac383dde33405106469d04a78de1d76f1a730cb1 from qemu
This commit is contained in:
Richard Henderson 2019-05-16 14:28:33 -04:00 committed by Lioncash
parent f3b4a64d27
commit 9a9b681b38
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -733,9 +733,13 @@ void tcg_optimize(TCGContext *s)
} else if (opc == INDEX_op_sub_i64) {
neg_op = INDEX_op_neg_i64;
have_neg = TCG_TARGET_HAS_neg_i64;
} else {
} else if (TCG_TARGET_HAS_neg_vec) {
TCGType type = TCGOP_VECL(op) + TCG_TYPE_V64;
unsigned vece = TCGOP_VECE(op);
neg_op = INDEX_op_neg_vec;
have_neg = TCG_TARGET_HAS_neg_vec;
have_neg = tcg_can_emit_vec_op(neg_op, type, vece) > 0;
} else {
break;
}
if (!have_neg) {
break;