================
@@ -716,7 +716,19 @@ mlir::Value CIRGenFunction::emitX86BuiltinExpr(unsigned 
builtinID,
   case X86::BI__builtin_ia32_sqrtpd256:
   case X86::BI__builtin_ia32_sqrtpd:
   case X86::BI__builtin_ia32_sqrtps256:
-  case X86::BI__builtin_ia32_sqrtps:
+  case X86::BI__builtin_ia32_sqrtps: {
+    auto loc = getLoc(E->getExprLoc());
+    assert(E->getNumArgs() == 1 && "__builtin_ia32_sqrtps takes one argument");
+    mlir::Value arg = emitScalarExpr(E->getArg(0));
+    mlir::Type argTy = arg.getType();
+    if (auto vecTy = argTy.dyn_cast<mlir::VectorType>()) {
+      assert(vecTy.getNumElements() == 4 &&
+             vecTy.getElementType().isa<mlir::FloatType>() &&
+             "__builtin_ia32_sqrtps expects <4 x float> / __m128");
+    }
----------------
andykaylor wrote:

This assertion is too narrow because multiple variations of the sqrt builtin 
fall through to this code. I suggest just removing the assertion.

https://github.com/llvm/llvm-project/pull/169310
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to