summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/Function.cpp
diff options
context:
space:
mode:
authorKerry McLaughlin <kerry.mclaughlin@arm.com>2019-10-02 09:25:02 +0000
committerKerry McLaughlin <kerry.mclaughlin@arm.com>2019-10-02 09:25:02 +0000
commit76365b3b24dce0ab3c6a4bce3f84f632b6f825e0 (patch)
tree6ab27e002af5353b3d43a021fbfd606cdb8d89c5 /llvm/lib/IR/Function.cpp
parent442be727773408581f59041c77e5441ca021dedd (diff)
downloadbcm5719-llvm-76365b3b24dce0ab3c6a4bce3f84f632b6f825e0.tar.gz
bcm5719-llvm-76365b3b24dce0ab3c6a4bce3f84f632b6f825e0.zip
[IntrinsicEmitter] Add overloaded type VecOfBitcastsToInt for SVE intrinsics
Summary: This allows intrinsics such as the following to be defined: - declare <n x 4 x i32> @llvm.something.nxv4f32(<n x 4 x i32>, <n x 4 x i1>, <n x 4 x float>) ...where <n x 4 x i32> is derived from <n x 4 x float>, but the element needs bitcasting to int. Reviewers: c-rhodes, sdesmalen, rovka Reviewed By: c-rhodes Subscribers: tschuett, hiraditya, jdoerfert, llvm-commits, cfe-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D68021 llvm-svn: 373437
Diffstat (limited to 'llvm/lib/IR/Function.cpp')
-rw-r--r--llvm/lib/IR/Function.cpp24
1 files changed, 23 insertions, 1 deletions
diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp
index 5c22109ffd5..3f70d2c904e 100644
--- a/llvm/lib/IR/Function.cpp
+++ b/llvm/lib/IR/Function.cpp
@@ -706,7 +706,8 @@ enum IIT_Info {
IIT_VEC_ELEMENT = 42,
IIT_SCALABLE_VEC = 43,
IIT_SUBDIVIDE2_ARG = 44,
- IIT_SUBDIVIDE4_ARG = 45
+ IIT_SUBDIVIDE4_ARG = 45,
+ IIT_VEC_OF_BITCASTS_TO_INT = 46
};
static void DecodeIITType(unsigned &NextElt, ArrayRef<unsigned char> Infos,
@@ -895,6 +896,12 @@ static void DecodeIITType(unsigned &NextElt, ArrayRef<unsigned char> Infos,
DecodeIITType(NextElt, Infos, OutputTable);
return;
}
+ case IIT_VEC_OF_BITCASTS_TO_INT: {
+ unsigned ArgInfo = (NextElt == Infos.size() ? 0 : Infos[NextElt++]);
+ OutputTable.push_back(IITDescriptor::get(IITDescriptor::VecOfBitcastsToInt,
+ ArgInfo));
+ return;
+ }
}
llvm_unreachable("unhandled");
}
@@ -1021,6 +1028,12 @@ static Type *DecodeFixedType(ArrayRef<Intrinsic::IITDescriptor> &Infos,
return VTy->getElementType();
llvm_unreachable("Expected an argument of Vector Type");
}
+ case IITDescriptor::VecOfBitcastsToInt: {
+ Type *Ty = Tys[D.getArgumentNumber()];
+ VectorType *VTy = dyn_cast<VectorType>(Ty);
+ assert(VTy && "Expected an argument of Vector Type");
+ return VectorType::getInteger(VTy);
+ }
case IITDescriptor::VecOfAnyPtrsToElt:
// Return the overloaded type (which determines the pointers address space)
return Tys[D.getOverloadArgNumber()];
@@ -1314,6 +1327,15 @@ static bool matchIntrinsicType(
return matchIntrinsicType(VTy, Infos, ArgTys, DeferredChecks,
IsDeferredCheck);
}
+ case IITDescriptor::VecOfBitcastsToInt: {
+ if (D.getArgumentNumber() >= ArgTys.size())
+ return IsDeferredCheck || DeferCheck(Ty);
+ auto *ReferenceType = dyn_cast<VectorType>(ArgTys[D.getArgumentNumber()]);
+ auto *ThisArgVecTy = dyn_cast<VectorType>(Ty);
+ if (!ThisArgVecTy || !ReferenceType)
+ return true;
+ return ThisArgVecTy != VectorType::getInteger(ReferenceType);
+ }
}
llvm_unreachable("unhandled");
}
OpenPOWER on IntegriCloud