forked from OSchip/llvm-project
A few style changes.
Change CheckVectorLogicalOperands to pass params by ref. Add another test case. llvm-svn: 148452
This commit is contained in:
parent
9e2c7f659e
commit
3dd33b296a
|
@ -5938,7 +5938,7 @@ public:
|
||||||
QualType GetSignedVectorType(QualType V);
|
QualType GetSignedVectorType(QualType V);
|
||||||
QualType CheckVectorCompareOperands(ExprResult &LHS, ExprResult &RHS,
|
QualType CheckVectorCompareOperands(ExprResult &LHS, ExprResult &RHS,
|
||||||
SourceLocation Loc, bool isRelational);
|
SourceLocation Loc, bool isRelational);
|
||||||
QualType CheckVectorLogicalOperands(ExprResult LHS, ExprResult RHS,
|
QualType CheckVectorLogicalOperands(ExprResult &LHS, ExprResult &RHS,
|
||||||
SourceLocation Loc);
|
SourceLocation Loc);
|
||||||
|
|
||||||
/// type checking declaration initializers (C99 6.7.8)
|
/// type checking declaration initializers (C99 6.7.8)
|
||||||
|
|
|
@ -6944,9 +6944,8 @@ QualType Sema::CheckVectorCompareOperands(ExprResult &LHS, ExprResult &RHS,
|
||||||
return GetSignedVectorType(LHSType);
|
return GetSignedVectorType(LHSType);
|
||||||
}
|
}
|
||||||
|
|
||||||
QualType Sema::CheckVectorLogicalOperands(ExprResult LHS, ExprResult RHS,
|
QualType Sema::CheckVectorLogicalOperands(ExprResult &LHS, ExprResult &RHS,
|
||||||
SourceLocation Loc)
|
SourceLocation Loc) {
|
||||||
{
|
|
||||||
// Ensure that either both operands are of the same vector type, or
|
// Ensure that either both operands are of the same vector type, or
|
||||||
// one operand is of a vector type and the other is of its element type.
|
// one operand is of a vector type and the other is of its element type.
|
||||||
QualType vType = CheckVectorOperands(LHS, RHS, Loc, false);
|
QualType vType = CheckVectorOperands(LHS, RHS, Loc, false);
|
||||||
|
@ -8281,9 +8280,7 @@ ExprResult Sema::CreateBuiltinUnaryOp(SourceLocation OpLoc,
|
||||||
Input = ImpCastExprToType(Input.take(), Context.BoolTy,
|
Input = ImpCastExprToType(Input.take(), Context.BoolTy,
|
||||||
ScalarTypeToBooleanCastKind(resultType));
|
ScalarTypeToBooleanCastKind(resultType));
|
||||||
}
|
}
|
||||||
}
|
} else if (resultType->isExtVectorType()) {
|
||||||
else if (resultType->isExtVectorType()) {
|
|
||||||
// Handle vector types.
|
|
||||||
// Vector logical not returns the signed variant of the operand type.
|
// Vector logical not returns the signed variant of the operand type.
|
||||||
resultType = GetSignedVectorType(resultType);
|
resultType = GetSignedVectorType(resultType);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
// RUN: %clang_cc1 -O3 %s -emit-llvm -o - | FileCheck %s
|
||||||
|
|
||||||
|
typedef int int2 __attribute((ext_vector_type(2)));
|
||||||
|
|
||||||
|
int test1()
|
||||||
|
{
|
||||||
|
int2 a = (int2)(1,0);
|
||||||
|
int2 b = (int2)(1,1);
|
||||||
|
return (a&&b).x + (a||b).y;
|
||||||
|
// CHECK: ret i32 -2
|
||||||
|
}
|
||||||
|
|
||||||
|
int test2()
|
||||||
|
{
|
||||||
|
int2 a = (int2)(1,0);
|
||||||
|
return (!a).y;
|
||||||
|
// CHECK: ret i32 -1
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue