[cfe-dev] [OpenCL patch] Vector logical operations

Eli Friedman eli.friedman at gmail.com
Thu Jan 12 12:33:49 PST 2012


On Thu, Jan 12, 2012 at 3:04 AM, Anton Lokhmotov
<Anton.Lokhmotov at arm.com> wrote:
> Please review a patch implementing support for vector logical operations in
> OpenCL.  It's based on Tanya's patch [1], with Peter's suggestions [2]
> applied.
>
> Many thanks,
> Anton.

+inline QualType Sema::CheckVectorLogicalOperands(ExprResult LHS,
ExprResult RHS,

There's no point to marking this inline.

+    } else if (const ExtVectorType *EVT = resultType->getAs<ExtVectorType>()) {
+      // Handle vector types.
+      // Vector logical not returns the signed variant of the operand type.
+      QualType EltTy =  EVT->getElementType();
+      EltTy = EltTy->getAs<BuiltinType>()->getSignedVariant(EltTy, Context);
+      resultType = Context.getExtVectorType(EltTy, EVT->getNumElements());
+      break;

What if EVT is a float4?

More generally, we already have code to compute the correct result
type for both of these operations in Sema::CheckVectorCompareOperands;
please refactor the patch to use it.

-Eli




More information about the cfe-dev mailing list