brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.2 KiB · ed2fcf1 Raw
100 lines · plain
1// This checks that we can consume LLVM's Intrinsic definitions from TableGen2// files and produce ODS. Unlike MLIR, LLVM's main Intrinsics.td file that3// contains the definition of the Intrinsic class also includes files for4// platform-specific intrinsics, so we need to give it to TableGen instead of5// writing a local test source. We filter out platform-specific intrinsic6// includes from the main file to avoid unnecessary dependencies and decrease7// the test cost. The command-line flags further ensure a specific intrinsic is8// 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 %s15 16// CHECK-LABEL: def LLVM_ptrmask17// CHECK: LLVM_IntrOp<"ptrmask18// The result of this intrinsic result is overloadable.19// CHECK: [0]20// The second operand is overloadable, but the first operand needs to21// 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_Type32 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 %s41 42// GROUPS-LABEL: def LLVM_ptrmask43// GROUPS: LLVM_IntrOp<"ptrmask44// 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_groups54 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 %s63 64// ALIAS-LABEL: def LLVM_ptrmask65// ALIAS: LLVM_IntrOp<"ptrmask66// 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_scopes76// ALIAS: OptionalAttr<LLVM_AliasScopeArrayAttr>:$noalias_scopes77// ALIAS: OptionalAttr<LLVM_TBAATagArrayAttr>:$tbaa78 79//---------------------------------------------------------------------------//80 81// This checks that the ODS we produce can be consumed by MLIR tablegen. We only82// make sure the entire process does not fail and produces some C++. The shape83// 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 %s90 91// ODS-LABEL: class vastart92 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-OPBASE97 98// DIALECT-OPBASE-LABEL: def LLVM_ptrmask99// DIALECT-OPBASE: My_OpBase<"ptrmask100