Added a type checking which handle the case of an ext vector and integral scalar
llvm-svn: 183602
This commit is contained in:
parent
60a2442476
commit
0b5ca604a9
|
@ -6411,12 +6411,19 @@ QualType Sema::CheckVectorOperands(ExprResult &LHS, ExprResult &RHS,
|
|||
return LHSType;
|
||||
}
|
||||
}
|
||||
if (EltTy->isRealFloatingType() && RHSType->isScalarType() &&
|
||||
RHSType->isRealFloatingType()) {
|
||||
int order = Context.getFloatingTypeOrder(EltTy, RHSType);
|
||||
if (order > 0)
|
||||
RHS = ImpCastExprToType(RHS.take(), EltTy, CK_FloatingCast);
|
||||
if (order >= 0) {
|
||||
if (EltTy->isRealFloatingType() && RHSType->isScalarType()) {
|
||||
if (RHSType->isRealFloatingType()) {
|
||||
int order = Context.getFloatingTypeOrder(EltTy, RHSType);
|
||||
if (order > 0)
|
||||
RHS = ImpCastExprToType(RHS.take(), EltTy, CK_FloatingCast);
|
||||
if (order >= 0) {
|
||||
RHS = ImpCastExprToType(RHS.take(), LHSType, CK_VectorSplat);
|
||||
if (swapped) std::swap(RHS, LHS);
|
||||
return LHSType;
|
||||
}
|
||||
}
|
||||
if (RHSType->isIntegralType(Context)) {
|
||||
RHS = ImpCastExprToType(RHS.take(), EltTy, CK_IntegralToFloating);
|
||||
RHS = ImpCastExprToType(RHS.take(), LHSType, CK_VectorSplat);
|
||||
if (swapped) std::swap(RHS, LHS);
|
||||
return LHSType;
|
||||
|
|
|
@ -286,3 +286,8 @@ int4 test15(uint4 V0) {
|
|||
V = V || V;
|
||||
return V;
|
||||
}
|
||||
|
||||
// CHECK: @test16
|
||||
void test16(float2 a, float2 b) {
|
||||
float2 t0 = (a + b) / 2;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue