aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorBob Wilson <bob.wilson@apple.com>2009-01-07 00:09:01 +0000
committerBob Wilson <bob.wilson@apple.com>2009-01-07 00:09:01 +0000
commitbc03979536a1ecb220f1330719f3e3973a81ab0b (patch)
tree6912431eb97120b5367a48af807c2368345ec45a /include
parent0a79a2f8b04aeb74901ebc91be2206cc70d6d823 (diff)
downloadexternal_llvm-bc03979536a1ecb220f1330719f3e3973a81ab0b.zip
external_llvm-bc03979536a1ecb220f1330719f3e3973a81ab0b.tar.gz
external_llvm-bc03979536a1ecb220f1330719f3e3973a81ab0b.tar.bz2
Improve support for type-generic vector intrinsics by teaching TableGen how
to handle LLVMMatchType intrinsic parameters, and by adding new subclasses of LLVMMatchType to match vector types with integral elements that are either twice as wide or half as wide as the elements of the matched type. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61834 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/DerivedTypes.h20
-rw-r--r--include/llvm/Intrinsics.td7
2 files changed, 27 insertions, 0 deletions
diff --git a/include/llvm/DerivedTypes.h b/include/llvm/DerivedTypes.h
index 04a73fe..3bc00e9 100644
--- a/include/llvm/DerivedTypes.h
+++ b/include/llvm/DerivedTypes.h
@@ -369,6 +369,26 @@ public:
return VectorType::get(EltTy, VTy->getNumElements());
}
+ /// VectorType::getExtendedElementVectorType - This static method is like
+ /// getInteger except that the element types are twice as wide as the
+ /// elements in the input type.
+ ///
+ static VectorType *getExtendedElementVectorType(const VectorType *VTy) {
+ unsigned EltBits = VTy->getElementType()->getPrimitiveSizeInBits();
+ const Type *EltTy = IntegerType::get(EltBits * 2);
+ return VectorType::get(EltTy, VTy->getNumElements());
+ }
+
+ /// VectorType::getTruncatedElementVectorType - This static method is like
+ /// getInteger except that the element types are half as wide as the
+ /// elements in the input type.
+ ///
+ static VectorType *getTruncatedElementVectorType(const VectorType *VTy) {
+ unsigned EltBits = VTy->getElementType()->getPrimitiveSizeInBits();
+ const Type *EltTy = IntegerType::get(EltBits / 2);
+ return VectorType::get(EltTy, VTy->getNumElements());
+ }
+
/// @brief Return the number of elements in the Vector type.
inline unsigned getNumElements() const { return NumElements; }
diff --git a/include/llvm/Intrinsics.td b/include/llvm/Intrinsics.td
index 154106e..a641caa 100644
--- a/include/llvm/Intrinsics.td
+++ b/include/llvm/Intrinsics.td
@@ -74,6 +74,13 @@ class LLVMMatchType<int num>
int Number = num;
}
+// Match the type of another intrinsic parameter that is expected to be
+// an integral vector type, but change the element size to be twice as wide
+// or half as wide as the other type. This is only useful when the intrinsic
+// is overloaded, so the matched type should be declared as iAny.
+class LLVMExtendedElementVectorType<int num> : LLVMMatchType<num>;
+class LLVMTruncatedElementVectorType<int num> : LLVMMatchType<num>;
+
def llvm_void_ty : LLVMType<isVoid>;
def llvm_anyint_ty : LLVMType<iAny>;
def llvm_anyfloat_ty : LLVMType<fAny>;