[clang] [llvm] [CIR][X86] Implement lowering for sqrt builtins (PR #169310)
Andy Kaylor via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 3 16:19:16 PST 2025
================
@@ -781,9 +781,21 @@ mlir::Value CIRGenFunction::emitX86BuiltinExpr(unsigned builtinID,
case X86::BI__builtin_ia32_sqrtsh_round_mask:
case X86::BI__builtin_ia32_sqrtsd_round_mask:
case X86::BI__builtin_ia32_sqrtss_round_mask:
+ 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_sqrtph256:
+ case X86::BI__builtin_ia32_sqrtph:
+ errorNYI("Unimplemented builtin");
+ return {};
case X86::BI__builtin_ia32_sqrtph512:
case X86::BI__builtin_ia32_sqrtps512:
- case X86::BI__builtin_ia32_sqrtpd512:
+ case X86::BI__builtin_ia32_sqrtpd512: {
+ mlir::Location loc = getLoc(expr->getExprLoc());
+ mlir::Value arg = ops[0];
+ return builder.create<cir::SqrtOp>(loc, arg.getType(), arg).getResult();
----------------
andykaylor wrote:
```suggestion
return cir::SqrtOp::create(builder, loc, arg.getType(), arg).getResult();
```
Co-pilot was wrong about this. Its suggested change is a format this is now deprecated.
https://github.com/llvm/llvm-project/pull/169310
More information about the llvm-commits
mailing list