File: llvm-intrinsics.td

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (99 lines) | stat: -rw-r--r-- 4,255 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
// 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
// processed and we only check the output below.
// We also verify emission of type specialization for overloadable intrinsics.
//
// 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 \
// RUN: | FileCheck %s

// CHECK-LABEL: def LLVM_ptrmask
// CHECK: LLVM_IntrOp<"ptrmask
// The result of this intrinsic result is overloadable.
// CHECK: [0]
// The second operand is overloadable, but the first operand needs to
// match the result type.
// CHECK: [1]
// It has no side effects.
// CHECK: [NoMemoryEffect]
// It has a result.
// CHECK: 1,
// It does not implement the access group interface.
// CHECK: 0,
// It does not implement the alias analysis interface.
// CHECK: 0>
// CHECK: Arguments<(ins LLVM_Type, LLVM_Type

//---------------------------------------------------------------------------//

// 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: [NoMemoryEffect]
// It has a result.
// GROUPS: 1,
// It implements the access group interface.
// GROUPS: 1,
// It does not implement the alias analysis interface.
// GROUPS: 0>
// It has an access group attribute.
// GROUPS: OptionalAttr<LLVM_AccessGroupArrayAttr>:$access_groups

//---------------------------------------------------------------------------//

// This checks that we can define an op that takes in alias analysis 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-analysis-regexp=ptrmask \
// RUN: | FileCheck --check-prefix=ALIAS %s

// ALIAS-LABEL: def LLVM_ptrmask
// ALIAS: LLVM_IntrOp<"ptrmask
// It has no side effects.
// ALIAS: [NoMemoryEffect]
// It has a result.
// ALIAS: 1,
// It does not implement the access group interface.
// ALIAS: 0,
// It implements the alias analysis interface.
// ALIAS: 1>
// It has alias scopes, noalias, and tbaa.
// ALIAS: OptionalAttr<LLVM_AliasScopeArrayAttr>:$alias_scopes
// ALIAS: OptionalAttr<LLVM_AliasScopeArrayAttr>:$noalias_scopes
// ALIAS: OptionalAttr<LLVM_TBAATagArrayAttr>:$tbaa

//---------------------------------------------------------------------------//

// 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

// 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