mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-26 07:24:25 +00:00
SLPVectorizer: Only vectorize intrinsics whose operands are widened equally
The vectorizer only knows how to vectorize intrinics by widening all operands by the same factor. Patch by Tyler Nowicki! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205855 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -91,6 +91,7 @@
|
||||
#include "llvm/Transforms/Scalar.h"
|
||||
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
|
||||
#include "llvm/Transforms/Utils/Local.h"
|
||||
#include "llvm/Transforms/Utils/VectorUtils.h"
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
|
||||
@ -2266,32 +2267,12 @@ static Intrinsic::ID
|
||||
getIntrinsicIDForCall(CallInst *CI, const TargetLibraryInfo *TLI) {
|
||||
// If we have an intrinsic call, check if it is trivially vectorizable.
|
||||
if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(CI)) {
|
||||
switch (II->getIntrinsicID()) {
|
||||
case Intrinsic::sqrt:
|
||||
case Intrinsic::sin:
|
||||
case Intrinsic::cos:
|
||||
case Intrinsic::exp:
|
||||
case Intrinsic::exp2:
|
||||
case Intrinsic::log:
|
||||
case Intrinsic::log10:
|
||||
case Intrinsic::log2:
|
||||
case Intrinsic::fabs:
|
||||
case Intrinsic::copysign:
|
||||
case Intrinsic::floor:
|
||||
case Intrinsic::ceil:
|
||||
case Intrinsic::trunc:
|
||||
case Intrinsic::rint:
|
||||
case Intrinsic::nearbyint:
|
||||
case Intrinsic::round:
|
||||
case Intrinsic::pow:
|
||||
case Intrinsic::fma:
|
||||
case Intrinsic::fmuladd:
|
||||
case Intrinsic::lifetime_start:
|
||||
case Intrinsic::lifetime_end:
|
||||
return II->getIntrinsicID();
|
||||
default:
|
||||
Intrinsic::ID ID = II->getIntrinsicID();
|
||||
if (isTriviallyVectorizable(ID) || ID == Intrinsic::lifetime_start ||
|
||||
ID == Intrinsic::lifetime_end)
|
||||
return ID;
|
||||
else
|
||||
return Intrinsic::not_intrinsic;
|
||||
}
|
||||
}
|
||||
|
||||
if (!TLI)
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include "llvm/Transforms/Utils/VectorUtils.h"
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
|
||||
@ -949,7 +950,9 @@ void BoUpSLP::buildTree_rec(ArrayRef<Value *> VL, unsigned Depth) {
|
||||
case Instruction::Call: {
|
||||
// Check if the calls are all to the same vectorizable intrinsic.
|
||||
IntrinsicInst *II = dyn_cast<IntrinsicInst>(VL[0]);
|
||||
if (II==NULL) {
|
||||
Intrinsic::ID ID = II ? II->getIntrinsicID() : Intrinsic::not_intrinsic;
|
||||
|
||||
if (!isTriviallyVectorizable(ID)) {
|
||||
newTreeEntry(VL, false);
|
||||
DEBUG(dbgs() << "SLP: Non-vectorizable call.\n");
|
||||
return;
|
||||
|
Reference in New Issue
Block a user