summaryrefslogtreecommitdiffstats
path: root/include/llvm/CodeGen
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-03-19 23:41:32 +0000
committerChris Lattner <sabre@nondot.org>2006-03-19 23:41:32 +0000
commit074ad68d5a712213b176d3a98bdebaea1b15fc0e (patch)
tree9da267ed0dbb1b214b6fd1daa8a0c3e7fb746ad5 /include/llvm/CodeGen
parent8bcf926277a49223021ce447e3342dfeffcb6814 (diff)
downloadexternal_llvm-074ad68d5a712213b176d3a98bdebaea1b15fc0e.zip
external_llvm-074ad68d5a712213b176d3a98bdebaea1b15fc0e.tar.gz
external_llvm-074ad68d5a712213b176d3a98bdebaea1b15fc0e.tar.bz2
Add a helper method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26878 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen')
-rw-r--r--include/llvm/CodeGen/ValueTypes.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/llvm/CodeGen/ValueTypes.h b/include/llvm/CodeGen/ValueTypes.h
index 88eddd2..43ac60b 100644
--- a/include/llvm/CodeGen/ValueTypes.h
+++ b/include/llvm/CodeGen/ValueTypes.h
@@ -161,6 +161,24 @@ namespace MVT { // MVT = Machine Value Types
}
}
+ /// MVT::getVectorNumElements - Given a packed vector type, return the number
+ /// of elements it contains.
+ static inline unsigned getVectorNumElements(ValueType VT) {
+ switch (VT) {
+ default: assert(0 && "Invalid vector type!");
+ case v16i8: return 16;
+ case v8i8 :
+ case v8i16: return 8;
+ case v4i16:
+ case v4i32:
+ case v4f32: return 4;
+ case v2i32:
+ case v2i64:
+ case v2f32:
+ case v2f64: return 2;
+ }
+ }
+
/// MVT::getIntVTBitMask - Return an integer with 1's every place there are
/// bits in the specified integer value type.
static inline uint64_t getIntVTBitMask(ValueType VT) {