2020-01-18 01:16:07 +08:00
|
|
|
// This checks that we can consume LLVM's Intrinsic definitions from TableGen
|
|
|
|
// files and produce ODS. Unlike MLIR, LLVM's main Intrinsics.td file that
|
|
|
|
// contains the definition of the Intrinsic class also includes files for
|
|
|
|
// platform-specific intrinsics, so we need to give it to TableGen instead of
|
|
|
|
// writing a local test source. We filter out platform-specific intrinsic
|
|
|
|
// includes from the main file to avoid unnecessary dependencies and decrease
|
|
|
|
// the test cost. The command-line flags further ensure a specific intrinsic is
|
[mlir] NFC: fix trivial typo in documents
Reviewers: mravishankar, antiagainst, nicolasvasilache, herhut, aartbik, mehdi_amini, bondhugula
Reviewed By: mehdi_amini, bondhugula
Subscribers: bondhugula, jdoerfert, mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, csigg, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, Joonsoo, bader, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D76993
2020-03-29 02:20:02 +08:00
|
|
|
// processed and we only check the output below.
|
[mlir] Fix LLVM intrinsic convesion generator for overloadable types.
Summary:
If an intrinsic has overloadable types like llvm_anyint_ty or
llvm_anyfloat_ty then to getDeclaration() we need to pass a list
of the types that are "undefined" essentially concretizing them.
This patch add support for deriving such types from the MLIR op
that has been matched.
Reviewers: andydavis1, ftynse, nicolasvasilache, antiagainst
Subscribers: mehdi_amini, rriddle, jpienaar, burmako, shauheen, arpith-jacob, mgester, lucyrfox, liufengdb, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D72974
2020-01-18 11:26:46 +08:00
|
|
|
// We also verify emission of type specialization for overloadable intrinsics.
|
2020-01-18 01:16:07 +08:00
|
|
|
//
|
|
|
|
// RUN: cat %S/../../../llvm/include/llvm/IR/Intrinsics.td \
|
|
|
|
// RUN: | grep -v "llvm/IR/Intrinsics" \
|
[mlir] Add option to use custom base class for dialect in LLVMIRIntrinsicGen.
Summary:
LLVMIRIntrinsicGen is using LLVM_Op as the base class for intrinsics.
This works for LLVM intrinsics in the LLVM Dialect, but when we are
trying to convert custom intrinsics that originate from a custom
LLVM dialect (like NVVM or ROCDL) these usually have a different
"cppNamespace" that needs to be applied to these dialect.
These dialect specific characteristics (like "cppNamespace")
are typically organized by creating a custom op (like NVVM_Op or
ROCDL_Op) that passes the correct dialect to the LLVM_OpBase class.
It seems natural to allow LLVMIRIntrinsicGen to take that into
consideration when generating the conversion code from one of these
dialect to a set of target specific intrinsics.
Reviewers: rriddle, andydavis1, antiagainst, nicolasvasilache, ftynse
Subscribers: jdoerfert, mehdi_amini, jpienaar, burmako, shauheen, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D73233
2020-01-23 06:22:29 +08:00
|
|
|
// RUN: | mlir-tblgen -gen-llvmir-intrinsics -I %S/../../../llvm/include/ --llvmir-intrinsics-filter=ptrmask \
|
2020-01-18 01:16:07 +08:00
|
|
|
// RUN: | FileCheck %s
|
|
|
|
|
[mlir] Add option to use custom base class for dialect in LLVMIRIntrinsicGen.
Summary:
LLVMIRIntrinsicGen is using LLVM_Op as the base class for intrinsics.
This works for LLVM intrinsics in the LLVM Dialect, but when we are
trying to convert custom intrinsics that originate from a custom
LLVM dialect (like NVVM or ROCDL) these usually have a different
"cppNamespace" that needs to be applied to these dialect.
These dialect specific characteristics (like "cppNamespace")
are typically organized by creating a custom op (like NVVM_Op or
ROCDL_Op) that passes the correct dialect to the LLVM_OpBase class.
It seems natural to allow LLVMIRIntrinsicGen to take that into
consideration when generating the conversion code from one of these
dialect to a set of target specific intrinsics.
Reviewers: rriddle, andydavis1, antiagainst, nicolasvasilache, ftynse
Subscribers: jdoerfert, mehdi_amini, jpienaar, burmako, shauheen, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D73233
2020-01-23 06:22:29 +08:00
|
|
|
// CHECK-LABEL: def LLVM_ptrmask
|
|
|
|
// CHECK: LLVM_IntrOp<"ptrmask
|
2020-02-21 21:46:14 +08:00
|
|
|
// The result of this intrinsic result is overloadable.
|
|
|
|
// CHECK: [0]
|
2020-05-16 05:32:58 +08:00
|
|
|
// The second operand is overloadable, but the first operand needs to
|
|
|
|
// match the result type.
|
|
|
|
// CHECK: [1]
|
2021-02-10 08:48:08 +08:00
|
|
|
// It has no side effects.
|
|
|
|
// CHECK: [NoSideEffect]
|
2020-02-21 21:46:14 +08:00
|
|
|
// It has a result.
|
2021-03-05 01:12:56 +08:00
|
|
|
// CHECK: 1,
|
|
|
|
// It does not require an access group.
|
2021-09-02 00:54:04 +08:00
|
|
|
// CHECK: 0,
|
|
|
|
// It does not require alias scopes.
|
2021-03-05 01:12:56 +08:00
|
|
|
// CHECK: 0>
|
2020-02-21 21:46:14 +08:00
|
|
|
// CHECK: Arguments<(ins LLVM_Type, LLVM_Type
|
2020-01-18 01:16:07 +08:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------------//
|
|
|
|
|
2021-03-05 01:12:56 +08:00
|
|
|
// This checks that we can define an op that takes in an access group metadata.
|
|
|
|
//
|
|
|
|
// RUN: cat %S/../../../llvm/include/llvm/IR/Intrinsics.td \
|
|
|
|
// RUN: | grep -v "llvm/IR/Intrinsics" \
|
|
|
|
// RUN: | mlir-tblgen -gen-llvmir-intrinsics -I %S/../../../llvm/include/ --llvmir-intrinsics-filter=ptrmask --llvmir-intrinsics-access-group-regexp=ptrmask \
|
|
|
|
// RUN: | FileCheck --check-prefix=GROUPS %s
|
|
|
|
|
|
|
|
// GROUPS-LABEL: def LLVM_ptrmask
|
|
|
|
// GROUPS: LLVM_IntrOp<"ptrmask
|
|
|
|
// It has no side effects.
|
|
|
|
// GROUPS: [NoSideEffect]
|
|
|
|
// It has a result.
|
|
|
|
// GROUPS: 1,
|
|
|
|
// It requires generation of an access group LLVM metadata.
|
2021-09-02 00:54:04 +08:00
|
|
|
// GROUPS: 1,
|
|
|
|
// It does not require alias scopes.
|
|
|
|
// GROUPS: 0>
|
2021-03-05 01:12:56 +08:00
|
|
|
// It has an access group attribute.
|
|
|
|
// GROUPS: OptionalAttr<SymbolRefArrayAttr>:$access_groups
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------//
|
|
|
|
|
2021-09-02 00:54:04 +08:00
|
|
|
// This checks that we can define an op that takes in alias scopes metadata.
|
|
|
|
//
|
|
|
|
// RUN: cat %S/../../../llvm/include/llvm/IR/Intrinsics.td \
|
|
|
|
// RUN: | grep -v "llvm/IR/Intrinsics" \
|
|
|
|
// RUN: | mlir-tblgen -gen-llvmir-intrinsics -I %S/../../../llvm/include/ --llvmir-intrinsics-filter=ptrmask --llvmir-intrinsics-alias-scopes-regexp=ptrmask \
|
|
|
|
// RUN: | FileCheck --check-prefix=ALIAS %s
|
|
|
|
|
|
|
|
// ALIAS-LABEL: def LLVM_ptrmask
|
|
|
|
// ALIAS: LLVM_IntrOp<"ptrmask
|
|
|
|
// It has no side effects.
|
|
|
|
// ALIAS: [NoSideEffect]
|
|
|
|
// It has a result.
|
|
|
|
// ALIAS: 1,
|
|
|
|
// It does not require an access group.
|
|
|
|
// ALIAS: 0,
|
|
|
|
// It requires generation of alias scopes LLVM metadata.
|
|
|
|
// ALIAS: 1>
|
|
|
|
// It has alias scopes and noalias.
|
|
|
|
// ALIAS: OptionalAttr<SymbolRefArrayAttr>:$alias_scopes
|
|
|
|
// ALIAS: OptionalAttr<SymbolRefArrayAttr>:$noalias_scopes
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------//
|
|
|
|
|
2020-01-18 01:16:07 +08:00
|
|
|
// This checks that the ODS we produce can be consumed by MLIR tablegen. We only
|
|
|
|
// make sure the entire process does not fail and produces some C++. The shape
|
|
|
|
// of this C++ code is tested by ODS tests.
|
|
|
|
|
|
|
|
// RUN: cat %S/../../../llvm/include/llvm/IR/Intrinsics.td \
|
|
|
|
// RUN: | grep -v "llvm/IR/Intrinsics" \
|
|
|
|
// RUN: | mlir-tblgen -gen-llvmir-intrinsics -I %S/../../../llvm/include/ --llvmir-intrinsics-filter=vastart \
|
|
|
|
// RUN: | mlir-tblgen -gen-op-decls -I %S/../../include \
|
|
|
|
// RUN: | FileCheck --check-prefix=ODS %s
|
|
|
|
|
|
|
|
// ODS-LABEL: class vastart
|
[mlir] Add option to use custom base class for dialect in LLVMIRIntrinsicGen.
Summary:
LLVMIRIntrinsicGen is using LLVM_Op as the base class for intrinsics.
This works for LLVM intrinsics in the LLVM Dialect, but when we are
trying to convert custom intrinsics that originate from a custom
LLVM dialect (like NVVM or ROCDL) these usually have a different
"cppNamespace" that needs to be applied to these dialect.
These dialect specific characteristics (like "cppNamespace")
are typically organized by creating a custom op (like NVVM_Op or
ROCDL_Op) that passes the correct dialect to the LLVM_OpBase class.
It seems natural to allow LLVMIRIntrinsicGen to take that into
consideration when generating the conversion code from one of these
dialect to a set of target specific intrinsics.
Reviewers: rriddle, andydavis1, antiagainst, nicolasvasilache, ftynse
Subscribers: jdoerfert, mehdi_amini, jpienaar, burmako, shauheen, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D73233
2020-01-23 06:22:29 +08:00
|
|
|
|
|
|
|
// RUN: cat %S/../../../llvm/include/llvm/IR/Intrinsics.td \
|
|
|
|
// RUN: | grep -v "llvm/IR/Intrinsics" \
|
|
|
|
// RUN: | mlir-tblgen -gen-llvmir-intrinsics -I %S/../../../llvm/include/ --llvmir-intrinsics-filter=ptrmask -dialect-opclass-base My_OpBase \
|
|
|
|
// RUN: | FileCheck %s --check-prefix=DIALECT-OPBASE
|
|
|
|
|
|
|
|
// DIALECT-OPBASE-LABEL: def LLVM_ptrmask
|
|
|
|
// DIALECT-OPBASE: My_OpBase<"ptrmask
|