tcg/optimize: Fix folding of vector bitsel
It looks like a typo. When the false value (C) is the constant -1, the
correct fold should be: R = B | ~A
Reproducer (LoongArch64 assembly):
.text
.globl _start
_start:
vldi $vr1, 3073
vldi $vr2, 1023
vbitsel.v $vr0, $vr2, $vr1, $vr2
vpickve2gr.d $a1, $vr0, 1
xori $a0, $a1, 1
li.w $a7, 93
syscall 0
Fixes: e58b977238 ("tcg/optimize: Optimize bitsel_vec")
Link: https://github.com/llvm/llvm-project/issues/159610
Signed-off-by: WANG Rui <wangrui@loongson.cn>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20250919124901.2756538-1-wangrui@loongson.cn>
This commit is contained in:
parent
76d2b8d42a
commit
a50347a414
1 changed files with 2 additions and 1 deletions
|
|
@ -1568,9 +1568,10 @@ static bool fold_bitsel_vec(OptContext *ctx, TCGOp *op)
|
|||
return fold_and(ctx, op);
|
||||
}
|
||||
if (fv == -1 && TCG_TARGET_HAS_orc_vec) {
|
||||
TCGArg ta = op->args[2];
|
||||
op->opc = INDEX_op_orc_vec;
|
||||
op->args[2] = op->args[1];
|
||||
op->args[1] = op->args[3];
|
||||
op->args[1] = ta;
|
||||
return fold_orc(ctx, op);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue