From: Julian Seward Date: Sat, 19 Sep 2020 10:05:26 +0000 (+0200) Subject: Bug 425820 - Failure to recognize vpcmpeqq as a dependency breaking idiom. X-Git-Tag: VALGRIND_3_17_0~161 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=92eec784a3f1863397ec00d333d16469795627bf;p=thirdparty%2Fvalgrind.git Bug 425820 - Failure to recognize vpcmpeqq as a dependency breaking idiom. In the IR optimiser (ir_opt.c): Recognise the following IROps as dependency-breaking ops that generate an all-ones output: Iop_CmpEQ16x4 Iop_CmpEQ32x2 Iop_CmpEQ64x2 Iop_CmpEQ8x32 Iop_CmpEQ16x16 Iop_CmpEQ64x4. I think this fixes all the known cases for sizes 32 bits to 256 bits. It also fixes bug 425820. --- diff --git a/VEX/priv/ir_opt.c b/VEX/priv/ir_opt.c index c5b7a2feaa..930fd49dd8 100644 --- a/VEX/priv/ir_opt.c +++ b/VEX/priv/ir_opt.c @@ -1292,13 +1292,19 @@ static IRExpr* mkOnesOfPrimopResultType ( IROp op ) case Iop_Or32: return IRExpr_Const(IRConst_U32(0xFFFFFFFF)); case Iop_CmpEQ8x8: + case Iop_CmpEQ16x4: + case Iop_CmpEQ32x2: case Iop_Or64: return IRExpr_Const(IRConst_U64(0xFFFFFFFFFFFFFFFFULL)); case Iop_CmpEQ8x16: case Iop_CmpEQ16x8: case Iop_CmpEQ32x4: + case Iop_CmpEQ64x2: return IRExpr_Const(IRConst_V128(0xFFFF)); + case Iop_CmpEQ8x32: + case Iop_CmpEQ16x16: case Iop_CmpEQ32x8: + case Iop_CmpEQ64x4: return IRExpr_Const(IRConst_V256(0xFFFFFFFF)); default: ppIROp(op); @@ -2402,13 +2408,23 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e ) } break; + // in total 32 bits case Iop_CmpEQ32: + // in total 64 bits case Iop_CmpEQ64: case Iop_CmpEQ8x8: + case Iop_CmpEQ16x4: + case Iop_CmpEQ32x2: + // in total 128 bits case Iop_CmpEQ8x16: case Iop_CmpEQ16x8: case Iop_CmpEQ32x4: + case Iop_CmpEQ64x2: + // in total 256 bits + case Iop_CmpEQ8x32: + case Iop_CmpEQ16x16: case Iop_CmpEQ32x8: + case Iop_CmpEQ64x4: if (sameIRExprs(env, e->Iex.Binop.arg1, e->Iex.Binop.arg2)) { e2 = mkOnesOfPrimopResultType(e->Iex.Binop.op); break;