@@ -2451,6 +2451,52 @@ def CIR_CallOp : CIR_CallOpBase<"call", [NoRegionArguments]> {
24512451 ];
24522452}
24532453
2454+ //===----------------------------------------------------------------------===//
2455+ // CopyOp
2456+ //===----------------------------------------------------------------------===//
2457+
2458+ def CIR_CopyOp : CIR_Op<"copy",[
2459+ SameTypeOperands,
2460+ DeclareOpInterfaceMethods<PromotableMemOpInterface>
2461+ ]> {
2462+ let summary = "Copies contents from a CIR pointer to another";
2463+ let description = [{
2464+ Given two CIR pointers, `src` and `dst`, `cir.copy` will copy the memory
2465+ pointed by `src` to the memory pointed by `dst`.
2466+
2467+ The number of bytes copied is inferred from the pointee type. The pointee
2468+ type of `src` and `dst` must match and both must implement the
2469+ `DataLayoutTypeInterface`.
2470+
2471+ Examples:
2472+
2473+ ```mlir
2474+ // Copying contents from one record to another:
2475+ cir.copy %0 to %1 : !cir.ptr<!record_ty>
2476+ ```
2477+ }];
2478+
2479+ let arguments = (ins
2480+ Arg<CIR_PointerType, "", [MemWrite]>:$dst,
2481+ Arg<CIR_PointerType, "", [MemRead]>:$src
2482+ );
2483+
2484+ let assemblyFormat = [{$src `to` $dst
2485+ attr-dict `:` qualified(type($dst))
2486+ }];
2487+ let hasVerifier = 1;
2488+
2489+ let extraClassDeclaration = [{
2490+ /// Returns the pointer type being copied.
2491+ cir::PointerType getType() { return getSrc().getType(); }
2492+
2493+ /// Returns the number of bytes to be copied.
2494+ unsigned getLength(const mlir::DataLayout &dt) {
2495+ return dt.getTypeSize(getType().getPointee());
2496+ }
2497+ }];
2498+ }
2499+
24542500//===----------------------------------------------------------------------===//
24552501// ReturnAddrOp and FrameAddrOp
24562502//===----------------------------------------------------------------------===//
@@ -3752,12 +3798,23 @@ class CIR_UnaryFPToFPBuiltinOp<string mnemonic, string llvmOpName>
37523798 let llvmOp = llvmOpName;
37533799}
37543800
3801+ def CIR_ACosOp : CIR_UnaryFPToFPBuiltinOp<"acos", "ACosOp"> {
3802+ let summary = "Computes the arcus cosine of the specified value";
3803+ let description = [{
3804+ `cir.acos`computes the arcus cosine of a given value and
3805+ returns a result of the same type.
3806+
3807+ Floating-point exceptions are ignored, and it does not set `errno`.
3808+ }];
3809+ }
3810+
37553811def CIR_FAbsOp : CIR_UnaryFPToFPBuiltinOp<"fabs", "FAbsOp"> {
37563812 let summary = "Computes the floating-point absolute value";
37573813 let description = [{
37583814 `cir.fabs` computes the absolute value of a floating-point operand
3759- and returns a result of the same type, ignoring floating-point
3760- exceptions. It does not set `errno`.
3815+ and returns a result of the same type.
3816+
3817+ Floating-point exceptions are ignored, and it does not set `errno`.
37613818 }];
37623819}
37633820
0 commit comments