mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-10-25 10:27:04 +00:00
Simplify a vpermil* with constant mask.
With a constant mask a vpermil* is just a shufflevector. This patch implements that simplification. This allows us to produce denser code. It should also allow more folding down the line. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206801 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -577,6 +577,21 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) {
|
||||
break;
|
||||
}
|
||||
|
||||
case Intrinsic::x86_avx_vpermilvar_ps:
|
||||
case Intrinsic::x86_avx_vpermilvar_ps_256:
|
||||
case Intrinsic::x86_avx_vpermilvar_pd:
|
||||
case Intrinsic::x86_avx_vpermilvar_pd_256: {
|
||||
// Convert vpermil* to shufflevector if the mask is constant.
|
||||
Value *V = II->getArgOperand(1);
|
||||
if (auto C = dyn_cast<ConstantDataVector>(V)) {
|
||||
auto V1 = II->getArgOperand(0);
|
||||
auto V2 = UndefValue::get(V1->getType());
|
||||
auto Shuffle = Builder->CreateShuffleVector(V1, V2, C);
|
||||
return ReplaceInstUsesWith(CI, Shuffle);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case Intrinsic::ppc_altivec_vperm:
|
||||
// Turn vperm(V1,V2,mask) -> shuffle(V1,V2,mask) if mask is a constant.
|
||||
if (Constant *Mask = dyn_cast<Constant>(II->getArgOperand(2))) {
|
||||
|
||||
Reference in New Issue
Block a user