mirror of
https://github.com/RPCS3/llvm.git
synced 2024-11-27 13:40:43 +00:00
[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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@373437 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
26b694efd7
commit
e9c6f620f4
@ -101,7 +101,7 @@ namespace Intrinsic {
|
||||
Argument, ExtendArgument, TruncArgument, HalfVecArgument,
|
||||
SameVecWidthArgument, PtrToArgument, PtrToElt, VecOfAnyPtrsToElt,
|
||||
VecElementArgument, ScalableVecArgument, Subdivide2Argument,
|
||||
Subdivide4Argument
|
||||
Subdivide4Argument, VecOfBitcastsToInt
|
||||
} Kind;
|
||||
|
||||
union {
|
||||
@ -127,7 +127,8 @@ namespace Intrinsic {
|
||||
Kind == TruncArgument || Kind == HalfVecArgument ||
|
||||
Kind == SameVecWidthArgument || Kind == PtrToArgument ||
|
||||
Kind == PtrToElt || Kind == VecElementArgument ||
|
||||
Kind == Subdivide2Argument || Kind == Subdivide4Argument);
|
||||
Kind == Subdivide2Argument || Kind == Subdivide4Argument ||
|
||||
Kind == VecOfBitcastsToInt);
|
||||
return Argument_Info >> 3;
|
||||
}
|
||||
ArgKind getArgumentKind() const {
|
||||
@ -135,7 +136,7 @@ namespace Intrinsic {
|
||||
Kind == TruncArgument || Kind == HalfVecArgument ||
|
||||
Kind == SameVecWidthArgument || Kind == PtrToArgument ||
|
||||
Kind == VecElementArgument || Kind == Subdivide2Argument ||
|
||||
Kind == Subdivide4Argument);
|
||||
Kind == Subdivide4Argument || Kind == VecOfBitcastsToInt);
|
||||
return (ArgKind)(Argument_Info & 7);
|
||||
}
|
||||
|
||||
|
@ -193,6 +193,10 @@ class LLVMHalfElementsVectorType<int num> : LLVMMatchType<num>;
|
||||
class LLVMSubdivide2VectorType<int num> : LLVMMatchType<num>;
|
||||
class LLVMSubdivide4VectorType<int num> : LLVMMatchType<num>;
|
||||
|
||||
// Match the element count and bit width of another intrinsic parameter, but
|
||||
// change the element type to an integer.
|
||||
class LLVMVectorOfBitcastsToInt<int num> : LLVMMatchType<num>;
|
||||
|
||||
def llvm_void_ty : LLVMType<isVoid>;
|
||||
let isAny = 1 in {
|
||||
def llvm_any_ty : LLVMType<Any>;
|
||||
|
@ -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");
|
||||
}
|
||||
|
@ -223,7 +223,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 EncodeFixedValueType(MVT::SimpleValueType VT,
|
||||
@ -299,6 +300,8 @@ static void EncodeFixedType(Record *R, std::vector<unsigned char> &ArgCodes,
|
||||
Sig.push_back(IIT_SUBDIVIDE2_ARG);
|
||||
else if (R->isSubClassOf("LLVMSubdivide4VectorType"))
|
||||
Sig.push_back(IIT_SUBDIVIDE4_ARG);
|
||||
else if (R->isSubClassOf("LLVMVectorOfBitcastsToInt"))
|
||||
Sig.push_back(IIT_VEC_OF_BITCASTS_TO_INT);
|
||||
else
|
||||
Sig.push_back(IIT_ARG);
|
||||
return Sig.push_back((Number << 3) | 7 /*IITDescriptor::AK_MatchType*/);
|
||||
|
Loading…
Reference in New Issue
Block a user