diff options
| author | Nate Begeman <natebegeman@mac.com> | 2007-12-30 01:45:55 +0000 |
|---|---|---|
| committer | Nate Begeman <natebegeman@mac.com> | 2007-12-30 01:45:55 +0000 |
| commit | 627daba0fd80eae864d36920c291e9daa32af4b3 (patch) | |
| tree | 60dc731ba913d17e25f23ffa1a9c14f06e21d870 /clang/Sema/SemaExpr.cpp | |
| parent | 16a3a9d5f997bcecf98d2413e4a63f2b3fb92450 (diff) | |
| download | bcm5719-llvm-627daba0fd80eae864d36920c291e9daa32af4b3.tar.gz bcm5719-llvm-627daba0fd80eae864d36920c291e9daa32af4b3.zip | |
Allow splat casts for OCU vector assignments & add some comments.
llvm-svn: 45442
Diffstat (limited to 'clang/Sema/SemaExpr.cpp')
| -rw-r--r-- | clang/Sema/SemaExpr.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/Sema/SemaExpr.cpp b/clang/Sema/SemaExpr.cpp index 99426a29fb1..014e457b976 100644 --- a/clang/Sema/SemaExpr.cpp +++ b/clang/Sema/SemaExpr.cpp @@ -1129,7 +1129,15 @@ Sema::CheckAssignmentConstraints(QualType lhsType, QualType rhsType) { if (lhsType.getCanonicalType() != rhsType.getCanonicalType()) return Incompatible; } else { + // For OCUVector, allow vector splats; float -> <n x float> + if (const OCUVectorType *LV = lhsType->getAsOCUVectorType()) { + if (LV->getElementType().getTypePtr() == rhsType.getTypePtr()) + return Compatible; + } if (lhsType->isVectorType() && rhsType->isVectorType()) { + // If LHS and RHS are both integer or both floating point types, and + // the total vector length is the same, allow the conversion. This is + // a bitcast; no bits are changed but the result type is different. if ((lhsType->isIntegerType() && rhsType->isIntegerType()) || (lhsType->isRealFloatingType() && rhsType->isRealFloatingType())) { |

