1 // This checks that we can consume LLVM's Intrinsic definitions from TableGen
2 // files and produce ODS. Unlike MLIR, LLVM's main Intrinsics.td file that
3 // contains the definition of the Intrinsic class also includes files for
4 // platform-specific intrinsics, so we need to give it to TableGen instead of
5 // writing a local test source. We filter out platform-specific intrinsic
6 // includes from the main file to avoid unnecessary dependencies and decrease
7 // the test cost. The command-line flags further ensure a specific intrinsic is
8 // processed and we only check the output below.
9 // We also verify emission of type specialization for overloadable intrinsics.
11 // RUN: cat %S/../../../llvm/include/llvm/IR/Intrinsics.td \
12 // RUN: | grep -v "llvm/IR/Intrinsics" \
13 // RUN: | mlir-tblgen -gen-llvmir-intrinsics -I %S/../../../llvm/include/ --llvmir-intrinsics-filter=ptrmask \
14 // RUN: | FileCheck %s
16 // CHECK-LABEL: def LLVM_ptrmask
17 // CHECK: LLVM_IntrOp<"ptrmask
18 // The result of this intrinsic result is overloadable.
20 // The second operand is overloadable, but the first operand needs to
21 // match the result type.
23 // It has no side effects.
24 // CHECK: [NoMemoryEffect]
27 // It does not implement the access group interface.
29 // It does not implement the alias analysis interface.
31 // CHECK: Arguments<(ins LLVM_Type, LLVM_Type
33 //---------------------------------------------------------------------------//
35 // This checks that we can define an op that takes in an access group metadata.
37 // RUN: cat %S/../../../llvm/include/llvm/IR/Intrinsics.td \
38 // RUN: | grep -v "llvm/IR/Intrinsics" \
39 // RUN: | mlir-tblgen -gen-llvmir-intrinsics -I %S/../../../llvm/include/ --llvmir-intrinsics-filter=ptrmask --llvmir-intrinsics-access-group-regexp=ptrmask \
40 // RUN: | FileCheck --check-prefix=GROUPS %s
42 // GROUPS-LABEL: def LLVM_ptrmask
43 // GROUPS: LLVM_IntrOp<"ptrmask
44 // It has no side effects.
45 // GROUPS: [NoMemoryEffect]
48 // It implements the access group interface.
50 // It does not implement the alias analysis interface.
52 // It has an access group attribute.
53 // GROUPS: OptionalAttr<LLVM_AccessGroupArrayAttr>:$access_groups
55 //---------------------------------------------------------------------------//
57 // This checks that we can define an op that takes in alias analysis metadata.
59 // RUN: cat %S/../../../llvm/include/llvm/IR/Intrinsics.td \
60 // RUN: | grep -v "llvm/IR/Intrinsics" \
61 // RUN: | mlir-tblgen -gen-llvmir-intrinsics -I %S/../../../llvm/include/ --llvmir-intrinsics-filter=ptrmask --llvmir-intrinsics-alias-analysis-regexp=ptrmask \
62 // RUN: | FileCheck --check-prefix=ALIAS %s
64 // ALIAS-LABEL: def LLVM_ptrmask
65 // ALIAS: LLVM_IntrOp<"ptrmask
66 // It has no side effects.
67 // ALIAS: [NoMemoryEffect]
70 // It does not implement the access group interface.
72 // It implements the alias analysis interface.
74 // It has alias scopes, noalias, and tbaa.
75 // ALIAS: OptionalAttr<LLVM_AliasScopeArrayAttr>:$alias_scopes
76 // ALIAS: OptionalAttr<LLVM_AliasScopeArrayAttr>:$noalias_scopes
77 // ALIAS: OptionalAttr<LLVM_TBAATagArrayAttr>:$tbaa
79 //---------------------------------------------------------------------------//
81 // This checks that the ODS we produce can be consumed by MLIR tablegen. We only
82 // make sure the entire process does not fail and produces some C++. The shape
83 // of this C++ code is tested by ODS tests.
85 // RUN: cat %S/../../../llvm/include/llvm/IR/Intrinsics.td \
86 // RUN: | grep -v "llvm/IR/Intrinsics" \
87 // RUN: | mlir-tblgen -gen-llvmir-intrinsics -I %S/../../../llvm/include/ --llvmir-intrinsics-filter=vastart \
88 // RUN: | mlir-tblgen -gen-op-decls -I %S/../../include \
89 // RUN: | FileCheck --check-prefix=ODS %s
91 // ODS-LABEL: class vastart
93 // RUN: cat %S/../../../llvm/include/llvm/IR/Intrinsics.td \
94 // RUN: | grep -v "llvm/IR/Intrinsics" \
95 // RUN: | mlir-tblgen -gen-llvmir-intrinsics -I %S/../../../llvm/include/ --llvmir-intrinsics-filter=ptrmask -dialect-opclass-base My_OpBase \
96 // RUN: | FileCheck %s --check-prefix=DIALECT-OPBASE
98 // DIALECT-OPBASE-LABEL: def LLVM_ptrmask
99 // DIALECT-OPBASE: My_OpBase<"ptrmask