• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 additional traits.
24// CHECK: []
25// It has a result.
26// CHECK: 1>
27// CHECK: Arguments<(ins LLVM_Type, LLVM_Type
28
29//---------------------------------------------------------------------------//
30
31// This checks that the ODS we produce can be consumed by MLIR tablegen. We only
32// make sure the entire process does not fail and produces some C++. The shape
33// of this C++ code is tested by ODS tests.
34
35// RUN: cat %S/../../../llvm/include/llvm/IR/Intrinsics.td \
36// RUN: | grep -v "llvm/IR/Intrinsics" \
37// RUN: | mlir-tblgen -gen-llvmir-intrinsics -I %S/../../../llvm/include/ --llvmir-intrinsics-filter=vastart \
38// RUN: | mlir-tblgen -gen-op-decls -I %S/../../include \
39// RUN: | FileCheck --check-prefix=ODS %s
40
41// ODS-LABEL: class vastart
42
43// RUN: cat %S/../../../llvm/include/llvm/IR/Intrinsics.td \
44// RUN: | grep -v "llvm/IR/Intrinsics" \
45// RUN: | mlir-tblgen -gen-llvmir-intrinsics -I %S/../../../llvm/include/ --llvmir-intrinsics-filter=ptrmask -dialect-opclass-base My_OpBase \
46// RUN: | FileCheck %s --check-prefix=DIALECT-OPBASE
47
48// DIALECT-OPBASE-LABEL: def LLVM_ptrmask
49// DIALECT-OPBASE: My_OpBase<"ptrmask
50