================
@@ -2239,6 +2239,39 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, 
unsigned BuiltinID,
       return true;
     ICEArguments &= ~(1 << ArgNo);
   }
+  // if the call has the elementwise attribute, then
+  // make sure that an elementwise expr is emitted.
+  if (FDecl->hasAttr<ElementwiseBuiltinAliasAttr>()) {
+    switch (FDecl->getNumParams()) {
+    case 1: {
+      if (PrepareBuiltinElementwiseMathOneArgCall(TheCall))
+        return ExprError();
+
+      QualType ArgTy = TheCall->getArg(0)->getType();
+      if (checkFPMathBuiltinElementType(
+              *this, TheCall->getArg(0)->getBeginLoc(), ArgTy, 1))
+        return ExprError();
+      break;
+    }
+    case 2: {
+      if (SemaBuiltinElementwiseMath(TheCall))
+        return ExprError();
+
+      QualType ArgTy = TheCall->getArg(0)->getType();
+      if (checkFPMathBuiltinElementType(
+              *this, TheCall->getArg(0)->getBeginLoc(), ArgTy, 1) ||
+          checkFPMathBuiltinElementType(
+              *this, TheCall->getArg(1)->getBeginLoc(), ArgTy, 2))
+        return ExprError();
+      break;
+    }
+    case 3: {
+      if (SemaBuiltinElementwiseTernaryMath(TheCall))
----------------
farzonl wrote:

there are ternaryMath calls that are not floating point  only so you really 
want to do this instead:

```c++
if (SemaBuiltinElementwiseTernaryMath(
            TheCall, /*CheckForFloatArgs*/
            TheCall->getArg(0)->getType()->hasFloatingRepresentation()))
```

https://github.com/llvm/llvm-project/pull/86175
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to