Allow splat casts for OCU vector assignments & add some comments.

llvm-svn: 45442
This commit is contained in:
Nate Begeman 2007-12-30 01:45:55 +00:00
parent 16a3a9d5f9
commit 627daba0fd
1 changed files with 8 additions and 0 deletions

View File

@ -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())) {