aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/CodeGen/ValueTypes.h
diff options
context:
space:
mode:
authorNate Begeman <natebegeman@mac.com>2005-11-30 08:22:07 +0000
committerNate Begeman <natebegeman@mac.com>2005-11-30 08:22:07 +0000
commitf43a3ca26d7bf431be5cdfb5963350a158e840af (patch)
tree7bacbc487489a6dde94a6ab88ce1503037c19609 /include/llvm/CodeGen/ValueTypes.h
parent7f0db91f86cfbd7c7268f945385d7a3056150bc7 (diff)
First chunk of actually generating vector code for packed types. These
changes allow us to generate the following code: _foo: li r2, 0 lvx v0, r2, r3 vaddfp v0, v0, v0 stvx v0, r2, r3 blr for this llvm: void %foo(<4 x float>* %a) { entry: %tmp1 = load <4 x float>* %a %tmp2 = add <4 x float> %tmp1, %tmp1 store <4 x float> %tmp2, <4 x float>* %a ret void } git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24534 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen/ValueTypes.h')
-rw-r--r--include/llvm/CodeGen/ValueTypes.h21
1 files changed, 17 insertions, 4 deletions
diff --git a/include/llvm/CodeGen/ValueTypes.h b/include/llvm/CodeGen/ValueTypes.h
index 783c0f8acf..5a36a3eeec 100644
--- a/include/llvm/CodeGen/ValueTypes.h
+++ b/include/llvm/CodeGen/ValueTypes.h
@@ -45,10 +45,8 @@ namespace MVT { // MVT = Machine Value Types
isVoid = 12, // This has no value
Vector = 13, // This is an abstract vector type, which will
- // be refined into a target vector type, or
- // scalarized.
-
- // These are 128 bit vectors of varying packed types
+ // be expanded into a target vector type, or scalars
+ // if no matching vector type is available.
v16i8 = 14, // 16 x i8
v8i16 = 15, // 8 x i16
v4i32 = 16, // 4 x i32
@@ -70,6 +68,21 @@ namespace MVT { // MVT = Machine Value Types
return (VT >= v16i8 && VT <= v2f64);
}
+ /// getVectorType - Returns the ValueType that represents a vector NumElements
+ /// in length, where each element is of type VT. If there is no ValueType
+ /// that represents this vector, a ValueType of Other is returned.
+ ///
+ static inline ValueType getVectorType(ValueType VT, unsigned NumElements) {
+ switch (VT) {
+ default:
+ break;
+ case MVT::f32:
+ if (NumElements == 4) return MVT::v4f32;
+ break;
+ }
+ return MVT::Other;
+ }
+
static inline unsigned getSizeInBits(ValueType VT) {
switch (VT) {
default: assert(0 && "ValueType has no known size!");