r183602 - Added a type checking which handle the case of an ext vector and integral scalar
Jin-Gu Kang
jaykang10 at imrc.kist.re.kr
Fri Jun 7 19:15:37 PDT 2013
Author: jaykang10
Date: Fri Jun 7 21:15:36 2013
New Revision: 183602
URL: http://llvm.org/viewvc/llvm-project?rev=183602&view=rev
Log:
Added a type checking which handle the case of an ext vector and integral scalar
Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/test/CodeGen/ext-vector.c
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=183602&r1=183601&r2=183602&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Fri Jun 7 21:15:36 2013
@@ -6411,12 +6411,19 @@ QualType Sema::CheckVectorOperands(ExprR
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;
Modified: cfe/trunk/test/CodeGen/ext-vector.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ext-vector.c?rev=183602&r1=183601&r2=183602&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/ext-vector.c (original)
+++ cfe/trunk/test/CodeGen/ext-vector.c Fri Jun 7 21:15:36 2013
@@ -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;
+}
More information about the cfe-commits
mailing list