Skip to content

Commit b27024f

Browse files
committed
Add SqrtOp definition to CIROps.td
1 parent ed3bfe1 commit b27024f

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

clang/include/clang/CIR/Dialect/IR/CIROps.td

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3185,6 +3185,39 @@ def CIR_InlineAsmOp : CIR_Op<"asm", [RecursiveMemoryEffects]> {
31853185
let hasCustomAssemblyFormat = 1;
31863186
}
31873187

3188+
//===----------------------------------------------------------------------===//
3189+
// SqrtOp
3190+
//===----------------------------------------------------------------------===//
3191+
3192+
def CIR_SqrtOp : CIR_Op<"sqrt", [Pure]> {
3193+
let summary = "Floating-point square root";
3194+
3195+
let description = [{
3196+
The `cir.sqrt` operation computes the element-wise square root of its input.
3197+
3198+
The input must be either:
3199+
• a floating-point scalar type, or
3200+
• a vector whose element type is floating-point.
3201+
3202+
The result type must match the input type exactly.
3203+
3204+
Examples:
3205+
// scalar
3206+
%r = cir.sqrt %x : !cir.fp64
3207+
3208+
// vector
3209+
%v = cir.sqrt %vec : !cir.vector<!cir.fp32 x 4>
3210+
}];
3211+
3212+
// input and output types: float or vector-of-float
3213+
let arguments = (ins CIR_AnyFloatOrVecOfFloatType:$input);
3214+
let results = (outs CIR_AnyFloatOrVecOfFloatType:$result);
3215+
3216+
let assemblyFormat = [{
3217+
$input `:` type($input) attr-dict
3218+
}];
3219+
}
3220+
31883221
//===----------------------------------------------------------------------===//
31893222
// UnreachableOp
31903223
//===----------------------------------------------------------------------===//

0 commit comments

Comments
 (0)