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. 10// 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 15 16// CHECK-LABEL: def LLVM_ptrmask 17// CHECK: LLVM_IntrOp<"ptrmask 18// The result of this intrinsic result is overloadable. 19// CHECK: [0] 20// The second operand is overloadable, but the first operand needs to 21// match the result type. 22// CHECK: [1] 23// It has no side effects. 24// CHECK: [NoMemoryEffect] 25// It has a result. 26// CHECK: 1, 27// It does not implement the access group interface. 28// CHECK: 0, 29// It does not implement the alias analysis interface. 30// CHECK: 0> 31// CHECK: Arguments<(ins LLVM_Type, LLVM_Type 32 33//---------------------------------------------------------------------------// 34 35// This checks that we can define an op that takes in an access group metadata. 36// 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 41 42// GROUPS-LABEL: def LLVM_ptrmask 43// GROUPS: LLVM_IntrOp<"ptrmask 44// It has no side effects. 45// GROUPS: [NoMemoryEffect] 46// It has a result. 47// GROUPS: 1, 48// It implements the access group interface. 49// GROUPS: 1, 50// It does not implement the alias analysis interface. 51// GROUPS: 0> 52// It has an access group attribute. 53// GROUPS: OptionalAttr<LLVM_AccessGroupArrayAttr>:$access_groups 54 55//---------------------------------------------------------------------------// 56 57// This checks that we can define an op that takes in alias analysis metadata. 58// 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 63 64// ALIAS-LABEL: def LLVM_ptrmask 65// ALIAS: LLVM_IntrOp<"ptrmask 66// It has no side effects. 67// ALIAS: [NoMemoryEffect] 68// It has a result. 69// ALIAS: 1, 70// It does not implement the access group interface. 71// ALIAS: 0, 72// It implements the alias analysis interface. 73// ALIAS: 1> 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 78 79//---------------------------------------------------------------------------// 80 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. 84 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 90 91// ODS-LABEL: class vastart 92 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 97 98// DIALECT-OPBASE-LABEL: def LLVM_ptrmask 99// DIALECT-OPBASE: My_OpBase<"ptrmask 100