1 //===- Intrinsics.h - MLIR EDSC Intrinsics for StandardOps ------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 #ifndef MLIR_DIALECT_STANDARDOPS_EDSC_INTRINSICS_H_
9 #define MLIR_DIALECT_STANDARDOPS_EDSC_INTRINSICS_H_
10 
11 #include "mlir/Dialect/StandardOps/EDSC/Builders.h"
12 
13 namespace mlir {
14 namespace edsc {
15 namespace intrinsics {
16 
17 using std_addi = ValueBuilder<AddIOp>;
18 using std_addf = ValueBuilder<AddFOp>;
19 using std_alloc = ValueBuilder<AllocOp>;
20 using std_alloca = ValueBuilder<AllocaOp>;
21 using std_call = OperationBuilder<CallOp>;
22 using std_create_complex = ValueBuilder<CreateComplexOp>;
23 using std_constant = ValueBuilder<ConstantOp>;
24 using std_constant_float = ValueBuilder<ConstantFloatOp>;
25 using std_constant_index = ValueBuilder<ConstantIndexOp>;
26 using std_constant_int = ValueBuilder<ConstantIntOp>;
27 using std_dealloc = OperationBuilder<DeallocOp>;
28 using std_divis = ValueBuilder<SignedDivIOp>;
29 using std_diviu = ValueBuilder<UnsignedDivIOp>;
30 using std_dim = ValueBuilder<DimOp>;
31 using std_extract_element = ValueBuilder<ExtractElementOp>;
32 using std_fpext = ValueBuilder<FPExtOp>;
33 using std_fptrunc = ValueBuilder<FPTruncOp>;
34 using std_im = ValueBuilder<ImOp>;
35 using std_index_cast = ValueBuilder<IndexCastOp>;
36 using std_muli = ValueBuilder<MulIOp>;
37 using std_mulf = ValueBuilder<MulFOp>;
38 using std_memref_cast = ValueBuilder<MemRefCastOp>;
39 using std_re = ValueBuilder<ReOp>;
40 using std_ret = OperationBuilder<ReturnOp>;
41 using std_rsqrt = ValueBuilder<RsqrtOp>;
42 using std_select = ValueBuilder<SelectOp>;
43 using std_load = ValueBuilder<LoadOp>;
44 using std_splat = ValueBuilder<SplatOp>;
45 using std_store = OperationBuilder<StoreOp>;
46 using std_subf = ValueBuilder<SubFOp>;
47 using std_subi = ValueBuilder<SubIOp>;
48 using std_sub_view = ValueBuilder<SubViewOp>;
49 using std_tanh = ValueBuilder<TanhOp>;
50 using std_tensor_load = ValueBuilder<TensorLoadOp>;
51 using std_tensor_store = OperationBuilder<TensorStoreOp>;
52 using std_view = ValueBuilder<ViewOp>;
53 using std_zero_extendi = ValueBuilder<ZeroExtendIOp>;
54 using std_sign_extendi = ValueBuilder<SignExtendIOp>;
55 
56 /// Branches into `block` with `operands`.
57 BranchOp std_br(Block *block, ValueRange operands);
58 
59 /// Branches into `trueBranch` with `trueOperands` if `cond` evaluates to `true`
60 /// or to `falseBranch` and `falseOperand` if `cond` evaluates to `false`.
61 CondBranchOp std_cond_br(Value cond, Block *trueBranch, ValueRange trueOperands,
62                          Block *falseBranch, ValueRange falseOperands);
63 
64 /// Provide an index notation around sdt_load and std_store.
65 using StdIndexedValue =
66     TemplatedIndexedValue<intrinsics::std_load, intrinsics::std_store>;
67 } // namespace intrinsics
68 } // namespace edsc
69 } // namespace mlir
70 
71 #endif // MLIR_DIALECT_STANDARDOPS_EDSC_INTRINSICS_H_
72