Skip to content

Commit 83f8a19

Browse files
committed
Add tests for cir.sqrt (f32, f64, vector<4xf32>)
1 parent a194781 commit 83f8a19

File tree

6 files changed

+388
-36
lines changed

6 files changed

+388
-36
lines changed

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

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -822,6 +822,119 @@ def CIR_GlobalDtorAttr : CIR_GlobalCtorDtor<"Dtor", "dtor"> {
822822
}];
823823
}
824824

825+
//===----------------------------------------------------------------------===//
826+
// CXX SpecialMemberAttr
827+
//===----------------------------------------------------------------------===//
828+
829+
def CIR_CtorKind : CIR_I32EnumAttr<"CtorKind", "CXX Constructor Kind", [
830+
I32EnumAttrCase<"Custom", 0, "custom">,
831+
I32EnumAttrCase<"Default", 1, "default">,
832+
I32EnumAttrCase<"Copy", 2, "copy">,
833+
I32EnumAttrCase<"Move", 3, "move">,
834+
]> {
835+
let genSpecializedAttr = 0;
836+
}
837+
838+
def CIR_CXXCtorAttr : CIR_Attr<"CXXCtor", "cxx_ctor"> {
839+
let summary = "Marks a function as a C++ constructor";
840+
let description = [{
841+
This attribute identifies a C++ constructor and classifies its kind:
842+
843+
- `custom`: a user-defined constructor
844+
- `default`: a default constructor
845+
- `copy`: a copy constructor
846+
- `move`: a move constructor
847+
848+
Example:
849+
```mlir
850+
#cir.cxx_ctor<!rec_a, copy>
851+
#cir.cxx_ctor<!rec_b, default, trivial>
852+
```
853+
}];
854+
855+
let parameters = (ins
856+
"mlir::Type":$type,
857+
EnumParameter<CIR_CtorKind>:$ctor_kind,
858+
DefaultValuedParameter<"bool", "false">:$is_trivial
859+
);
860+
861+
let builders = [
862+
AttrBuilderWithInferredContext<(ins "mlir::Type":$type,
863+
CArg<"CtorKind", "cir::CtorKind::Custom">:$ctorKind,
864+
CArg<"bool", "false">:$isTrivial), [{
865+
return $_get(type.getContext(), type, ctorKind, isTrivial);
866+
}]>,
867+
];
868+
869+
let assemblyFormat = [{
870+
`<` $type `,` $ctor_kind (`,` `trivial` $is_trivial^)? `>`
871+
}];
872+
}
873+
874+
def CIR_CXXDtorAttr : CIR_Attr<"CXXDtor", "cxx_dtor"> {
875+
let summary = "Marks a function as a CXX destructor";
876+
let description = [{
877+
This attribute identifies a C++ destructor.
878+
}];
879+
880+
let parameters = (ins
881+
"mlir::Type":$type,
882+
DefaultValuedParameter<"bool", "false">:$is_trivial
883+
);
884+
885+
let builders = [
886+
AttrBuilderWithInferredContext<(ins "mlir::Type":$type,
887+
CArg<"bool", "false">:$isTrivial), [{
888+
return $_get(type.getContext(), type, isTrivial);
889+
}]>
890+
];
891+
892+
let assemblyFormat = [{
893+
`<` $type (`,` `trivial` $is_trivial^)? `>`
894+
}];
895+
}
896+
897+
def CIR_AssignKind : CIR_I32EnumAttr<"AssignKind", "CXX Assignment Operator Kind", [
898+
I32EnumAttrCase<"Copy", 0, "copy">,
899+
I32EnumAttrCase<"Move", 1, "move">,
900+
]> {
901+
let genSpecializedAttr = 0;
902+
}
903+
904+
def CIR_CXXAssignAttr : CIR_Attr<"CXXAssign", "cxx_assign"> {
905+
let summary = "Marks a function as a CXX assignment operator";
906+
let description = [{
907+
This attribute identifies a C++ assignment operator and classifies its kind:
908+
909+
- `copy`: a copy assignment
910+
- `move`: a move assignment
911+
}];
912+
913+
let parameters = (ins
914+
"mlir::Type":$type,
915+
EnumParameter<CIR_AssignKind>:$assign_kind,
916+
DefaultValuedParameter<"bool", "false">:$is_trivial
917+
);
918+
919+
let builders = [
920+
AttrBuilderWithInferredContext<(ins "mlir::Type":$type,
921+
CArg<"AssignKind">:$assignKind,
922+
CArg<"bool", "false">:$isTrivial), [{
923+
return $_get(type.getContext(), type, assignKind, isTrivial);
924+
}]>
925+
];
926+
927+
let assemblyFormat = [{
928+
`<` $type `,` $assign_kind (`,` `trivial` $is_trivial^)? `>`
929+
}];
930+
}
931+
932+
def CIR_CXXSpecialMemberAttr : AnyAttrOf<[
933+
CIR_CXXCtorAttr,
934+
CIR_CXXDtorAttr,
935+
CIR_CXXAssignAttr
936+
]>;
937+
825938
//===----------------------------------------------------------------------===//
826939
// BitfieldInfoAttr
827940
//===----------------------------------------------------------------------===//

0 commit comments

Comments
 (0)