mirror of https://github.com/llvm/circt.git
Import handshake dialect
This commit is contained in:
parent
7d03c27a82
commit
0c00022c74
|
@ -1,2 +1,3 @@
|
|||
add_subdirectory(Conversion)
|
||||
add_subdirectory(Dialect)
|
||||
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
//===- StandardToHandshake.h ------------------------------------*- C++ -*-===//
|
||||
//
|
||||
// Copyright 2019 The CIRCT Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
// =============================================================================
|
||||
|
||||
#ifndef MLIR_CONVERSION_STANDARDTOHANDSHAKE_H_
|
||||
#define MLIR_CONVERSION_STANDARDTOHANDSHAKE_H_
|
||||
|
||||
#include <memory>
|
||||
#include "mlir/Dialect/StandardOps/IR/Ops.h"
|
||||
#include "circt/Dialect/Handshake/HandshakeOps.h"
|
||||
|
||||
namespace mlir {
|
||||
namespace handshake {
|
||||
class FuncOp;
|
||||
void registerStandardToHandshakePasses();
|
||||
}
|
||||
} // namespace mlir
|
||||
|
||||
#endif // MLIR_CONVERSION_STANDARDTOHANDSHAKE_H_
|
|
@ -1,2 +1,3 @@
|
|||
add_subdirectory(FIRRTL)
|
||||
add_subdirectory(Handshake)
|
||||
add_subdirectory(RTL)
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
add_mlir_dialect(HandshakeOps handshake)
|
||||
|
||||
set(LLVM_TARGET_DEFINITIONS HandshakeOps.td)
|
||||
mlir_tablegen(HandshakeOps.inc -gen-rewriters)
|
||||
add_public_tablegen_target(MLIRHandshakeRewritersIncGen)
|
||||
|
||||
set(LLVM_TARGET_DEFINITIONS HandshakeInterfaces.td)
|
||||
mlir_tablegen(HandshakeInterfaces.h.inc -gen-op-interface-decls)
|
||||
mlir_tablegen(HandshakeInterfaces.cpp.inc -gen-op-interface-defs)
|
||||
add_public_tablegen_target(MLIRHandshakeInterfacesIncGen)
|
||||
|
||||
#set(LLVM_TARGET_DEFINITIONS HandshakeOps.td)
|
||||
#mlir_tablegen(HandshakeOps.h.inc - gen - op - decls)
|
||||
#mlir_tablegen(HandshakeOps.cpp.inc - gen - op - defs)
|
||||
#mlir_tablegen(HandshakeOps.inc - gen - rewriters)
|
||||
#add_public_tablegen_target(MLIRHandshakeOpsIncGen)
|
|
@ -0,0 +1,47 @@
|
|||
//===- HandshakeInterfaces.td - Handshake interfaces -------*- tablegen -*-===//
|
||||
//
|
||||
// Copyright 2019 The CIRCT Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
// =============================================================================
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifdef HANDSHAKE_INTERFACES
|
||||
#else
|
||||
#define HANDSHAKE_INTERFACES
|
||||
|
||||
#ifdef OP_BASE
|
||||
#else
|
||||
include "mlir/IR/OpBase.td"
|
||||
#endif // OP_BASE
|
||||
|
||||
def MergeLikeOpInterface : OpInterface<"MergeLikeOpInterface"> {
|
||||
let description = [{
|
||||
Some handshake operations can have predecessors in other
|
||||
blocks. This is primarily useful for verification purposes during
|
||||
lowering from other dialect, such as the standard CDFG dialect.
|
||||
}];
|
||||
|
||||
let methods = [
|
||||
InterfaceMethod<[{
|
||||
|
||||
}],
|
||||
"OperandRange", "dataOperands", (ins)
|
||||
>,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
#endif // HANDSHAKE_INTERFACES
|
|
@ -0,0 +1,72 @@
|
|||
//===- Ops.h - Handshake MLIR Operations -----------------------------*- C++
|
||||
//-*-===//
|
||||
//
|
||||
// Copyright 2019 The CIRCT Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
// =============================================================================
|
||||
//
|
||||
// This file defines convenience types for working with handshake operations.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef MLIR_HANDSHAKEOPS_OPS_H_
|
||||
#define MLIR_HANDSHAKEOPS_OPS_H_
|
||||
|
||||
#include "mlir/IR/Attributes.h"
|
||||
#include "mlir/IR/Builders.h"
|
||||
#include "mlir/IR/Dialect.h"
|
||||
#include "mlir/IR/Function.h"
|
||||
#include "mlir/IR/Operation.h"
|
||||
#include "mlir/IR/OpDefinition.h"
|
||||
#include "mlir/IR/OpImplementation.h"
|
||||
#include "mlir/IR/RegionKindInterface.h"
|
||||
#include "mlir/IR/StandardTypes.h"
|
||||
#include "mlir/IR/TypeSupport.h"
|
||||
#include "mlir/IR/Types.h"
|
||||
#include "mlir/Interfaces/SideEffectInterfaces.h"
|
||||
#include "mlir/Pass/Pass.h"
|
||||
|
||||
namespace mlir {
|
||||
namespace handshake {
|
||||
|
||||
class TerminatorOp;
|
||||
|
||||
class HandshakeOpsDialect : public Dialect {
|
||||
public:
|
||||
HandshakeOpsDialect(MLIRContext *context);
|
||||
static StringRef getDialectNamespace() { return "handshake"; }
|
||||
};
|
||||
|
||||
#include "circt/Dialect/Handshake/HandshakeInterfaces.h.inc"
|
||||
|
||||
#define GET_OP_CLASSES
|
||||
#include "circt/Dialect/Handshake/HandshakeOps.h.inc"
|
||||
|
||||
// template <typename T> struct FunctionPass : public OperationPass<T, FuncOp> {
|
||||
// /// The polymorphic API that runs the pass over the currently held
|
||||
// function. virtual void runOnFunction() = 0;
|
||||
|
||||
// /// The polymorphic API that runs the pass over the currently held
|
||||
// operation. void runOnOperation() final {
|
||||
// if (!getFunction().isExternal())
|
||||
// runOnFunction();
|
||||
// }
|
||||
|
||||
// /// Return the current module being transformed.
|
||||
// FuncOp getFunction() { return this->getOperation(); }
|
||||
// };
|
||||
|
||||
} // end namespace handshake
|
||||
} // end namespace mlir
|
||||
#endif // MLIR_HANDSHAKEOPS_OPS_H_
|
|
@ -0,0 +1,647 @@
|
|||
//===- Ops.td - Handshake operation definitions ---------------*- tablegen
|
||||
//-*-===//
|
||||
//
|
||||
// Copyright 2019 The CIRCT Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
// =============================================================================
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifdef HANDSHAKE_OPS
|
||||
#else
|
||||
#define HANDSHAKE_OPS
|
||||
|
||||
#ifdef OP_BASE
|
||||
#else
|
||||
include "mlir/IR/OpBase.td"
|
||||
#endif // OP_BASE
|
||||
|
||||
include "mlir/IR/SymbolInterfaces.td"
|
||||
include "mlir/IR/RegionKindInterface.td"
|
||||
include "mlir/Interfaces/CallInterfaces.td"
|
||||
include "mlir/Interfaces/SideEffectInterfaces.td"
|
||||
|
||||
def Handshake_Dialect : Dialect {
|
||||
let name = "handshake";
|
||||
let cppNamespace = "";
|
||||
}
|
||||
|
||||
def MergeLikeOpInterface : OpInterface<"MergeLikeOpInterface"> {
|
||||
let description = [{
|
||||
Some handshake operations can have predecessors in other
|
||||
blocks. This is primarily useful for verification purposes during
|
||||
lowering from other dialect, such as the standard CDFG dialect.
|
||||
}];
|
||||
|
||||
let methods = [
|
||||
InterfaceMethod<[{
|
||||
|
||||
}],
|
||||
"OperandRange", "dataOperands", (ins)
|
||||
>,
|
||||
];
|
||||
}
|
||||
|
||||
// Base class for Handshake dialect ops.
|
||||
class Handshake_Op<string mnemonic, list<OpTrait> traits = []>
|
||||
: Op<Handshake_Dialect, mnemonic,
|
||||
!listconcat(traits, [HasParent<"handshake::FuncOp">])> {
|
||||
// let printer = [{ return ::print(p, *this); }];
|
||||
// let verifier = [{ return ::verify(p, *this); }];
|
||||
// let parser = [{ return ::parse$cppClass(parser, result); }];
|
||||
}
|
||||
|
||||
// This is almost exactly like a standard FuncOp, except that it has some
|
||||
// extra verification conditions. In particular, each Value must
|
||||
// only have a single use. Also, it defines a Dominance-Free Scope
|
||||
def FuncOp : Op<Handshake_Dialect, "func", [
|
||||
NativeOpTrait<"IsIsolatedFromAbove">,
|
||||
NativeOpTrait<"FunctionLike">,
|
||||
Symbol,
|
||||
RegionKindInterface
|
||||
]> {
|
||||
let summary = "Handshake dialect function.";
|
||||
let description = [{
|
||||
The "handshake.func" operation represents a handshaked function.
|
||||
This is almost exactly like a standard FuncOp, except that it has
|
||||
some extra verification conditions. In particular, each Value must
|
||||
only have a single use.
|
||||
}];
|
||||
|
||||
let arguments = (ins);
|
||||
let results = (outs);
|
||||
let regions = (region AnyRegion : $body);
|
||||
|
||||
let skipDefaultBuilders = 1;
|
||||
|
||||
let builders =
|
||||
[OpBuilder<"Builder builder, OperationState &result, StringRef name, "
|
||||
"FunctionType type, ArrayRef<NamedAttribute> attrs = {}, "
|
||||
"ArrayRef<MutableDictionaryAttr> argAttrs = {}",
|
||||
[{
|
||||
result.addAttribute(SymbolTable::getSymbolAttrName(),
|
||||
builder.getStringAttr(name));
|
||||
result.addAttribute(getTypeAttrName(), TypeAttr::get(type));
|
||||
result.attributes.append(attrs.begin(), attrs.end());
|
||||
result.addRegion();
|
||||
|
||||
// Not needed?? Arguments are already included in attrs
|
||||
/* assert(type.getNumInputs() == argAttrs.size());
|
||||
SmallString<8> argAttrName;
|
||||
for (unsigned i = 0, e = type.getNumInputs(); i != e; ++i)
|
||||
if (auto argDict = argAttrs[i].getDictionary())
|
||||
result.addAttribute(getArgAttrName(i, argAttrName),
|
||||
argDict);*/
|
||||
}]>];
|
||||
|
||||
let extraClassDeclaration = [{
|
||||
// Add an entry block to an empty function, and set up the block arguments
|
||||
// to match the signature of the function.
|
||||
Block *addEntryBlock();
|
||||
|
||||
FunctionType getType() {
|
||||
return getAttrOfType<TypeAttr>(getTypeAttrName())
|
||||
.getValue()
|
||||
.cast<FunctionType>();
|
||||
}
|
||||
// bool isVarArg() {
|
||||
// return getType().getUnderlyingType()->isFunctionVarArg();
|
||||
// }
|
||||
|
||||
// This trait needs access to the hooks defined below.
|
||||
friend class OpTrait::FunctionLike<handshake::FuncOp>;
|
||||
|
||||
/// Implement RegionKindInterface.
|
||||
static RegionKind getRegionKind(unsigned index) { return RegionKind::Graph; }
|
||||
|
||||
/// Returns the number of arguments. This is a hook for
|
||||
/// OpTrait::FunctionLike.
|
||||
unsigned getNumFuncArguments() { return getType().getInputs().size(); }
|
||||
|
||||
/// Returns the number of results. This is a hook for OpTrait::FunctionLike.
|
||||
unsigned getNumFuncResults() { return getType().getResults().size(); }
|
||||
|
||||
/// Hook for OpTrait::FunctionLike, called after verifying that the 'type'
|
||||
/// attribute is present and checks if it holds a function type. Ensures
|
||||
/// getType, getNumFuncArguments, and getNumFuncResults can be called
|
||||
/// safely.
|
||||
LogicalResult verifyType() {
|
||||
auto type = getTypeAttr().getValue();
|
||||
if (!type.isa<FunctionType>())
|
||||
return emitOpError("requires '" + getTypeAttrName() +
|
||||
"' attribute of function type");
|
||||
return success();
|
||||
}
|
||||
}];
|
||||
|
||||
let verifier = [{
|
||||
// If this function is external there is nothing to do.
|
||||
if (isExternal())
|
||||
return success();
|
||||
|
||||
// Verify that the argument list of the function and the arg list of the
|
||||
// entry block line up. The trait already verified that the number of
|
||||
// arguments is the same between the signature and the block.
|
||||
auto fnInputTypes = getType().getInputs();
|
||||
Block &entryBlock = front();
|
||||
|
||||
for (unsigned i = 0, e = entryBlock.getNumArguments(); i != e; ++i)
|
||||
if (fnInputTypes[i] != entryBlock.getArgument(i).getType())
|
||||
return emitOpError("type of entry block argument #")
|
||||
<< i << '(' << entryBlock.getArgument(i).getType()
|
||||
<< ") must match the type of the corresponding argument in "
|
||||
<< "function signature(" << fnInputTypes[i] << ')';
|
||||
|
||||
for (auto ®ion : this->getOperation()->getRegions())
|
||||
for (auto &block : region)
|
||||
for (auto &nestedOp : block)
|
||||
for (mlir::Value out : nestedOp.getResults())
|
||||
if (!out.hasOneUse())
|
||||
return nestedOp.emitOpError("does not have exactly one use");
|
||||
|
||||
return success();
|
||||
}];
|
||||
let printer = [{
|
||||
FunctionType fnType = getType();
|
||||
impl::printFunctionLikeOp(p, *this, fnType.getInputs(), /*isVariadic=*/true,
|
||||
fnType.getResults());
|
||||
}];
|
||||
let parser = [{
|
||||
auto buildFuncType =
|
||||
[](Builder & builder, ArrayRef<Type> argTypes, ArrayRef<Type> results,
|
||||
impl::VariadicFlag, std::string &) {
|
||||
return builder.getFunctionType(argTypes, results);
|
||||
};
|
||||
|
||||
return impl::parseFunctionLikeOp(parser, result, /*allowVariadic=*/true,
|
||||
buildFuncType);
|
||||
}];
|
||||
}
|
||||
|
||||
// InstanceOp
|
||||
def InstanceOp : Handshake_Op<"instance", [CallOpInterface]> {
|
||||
let summary = "module instantiate operation";
|
||||
let description = [{
|
||||
The `instance` operation represents the instantiation of a module. This
|
||||
is similar to a function call, except that different instances of the
|
||||
same module are guaranteed to have their own distinct state.
|
||||
The instantiated module is encoded as a
|
||||
symbol reference attribute named "module".
|
||||
|
||||
Example:
|
||||
|
||||
```mlir
|
||||
%2 = handshake.instance @my_add(%0, %1) : (f32, f32) -> f32
|
||||
```
|
||||
}];
|
||||
|
||||
let arguments = (ins FlatSymbolRefAttr:$module, Variadic<AnyType>:$operands);
|
||||
let results = (outs Variadic<AnyType>);
|
||||
|
||||
let builders = [OpBuilder<
|
||||
"OpBuilder &builder, OperationState &result, FuncOp module,"
|
||||
"ValueRange operands = {}", [{
|
||||
result.addOperands(operands);
|
||||
result.addAttribute("module", builder.getSymbolRefAttr(module));
|
||||
result.addTypes(module.getType().getResults());
|
||||
}]>, OpBuilder<
|
||||
"OpBuilder &builder, OperationState &result, SymbolRefAttr module,"
|
||||
"ArrayRef<Type> results, ValueRange operands = {}", [{
|
||||
result.addOperands(operands);
|
||||
result.addAttribute("module", module);
|
||||
result.addTypes(results);
|
||||
}]>, OpBuilder<
|
||||
"OpBuilder &builder, OperationState &result, StringRef module,"
|
||||
"ArrayRef<Type> results, ValueRange operands = {}", [{
|
||||
build(builder, result, builder.getSymbolRefAttr(module), results,
|
||||
operands);
|
||||
}]>];
|
||||
|
||||
let extraClassDeclaration = [{
|
||||
StringRef getModule() { return module(); }
|
||||
FunctionType getModuleType();
|
||||
|
||||
/// Get the argument operands to the called function.
|
||||
operand_range getArgOperands() {
|
||||
return {arg_operand_begin(), arg_operand_end()};
|
||||
}
|
||||
|
||||
operand_iterator arg_operand_begin() { return operand_begin(); }
|
||||
operand_iterator arg_operand_end() { return operand_end(); }
|
||||
|
||||
/// Return the module of this operation.
|
||||
CallInterfaceCallable getCallableForCallee() {
|
||||
return getAttrOfType<SymbolRefAttr>("module");
|
||||
}
|
||||
}];
|
||||
|
||||
let assemblyFormat = [{
|
||||
$module `(` $operands `)` attr-dict `:` functional-type($operands, results)
|
||||
}];
|
||||
}
|
||||
|
||||
// This is almost exactly like a standard FuncOp, except that it has some
|
||||
// extra verification conditions. In particular, each Value must
|
||||
// only have a single use.
|
||||
def ReturnOp : Handshake_Op<"return", [Terminator]> {
|
||||
let summary = "Handshake dialect return.";
|
||||
let description = [{
|
||||
The "handshake.return" operation represents a handshaked
|
||||
function. This is almost exactly like a standard ReturnOp, except
|
||||
that it exists in a handshake.func. It has the same operands as
|
||||
standard ReturnOp which it replaces and an additional control -
|
||||
only operand(exit point of control - only network).
|
||||
}];
|
||||
|
||||
let arguments = (ins Variadic<AnyType> : $operands, NoneType : $control);
|
||||
|
||||
let skipDefaultBuilders = 1;
|
||||
|
||||
let builders = [OpBuilder<
|
||||
"Builder builder, OperationState &result, ArrayRef<Value> operands">];
|
||||
|
||||
let printer = [{ return ::print(p, *this); }];
|
||||
let verifier = [{ return ::verify(*this); }];
|
||||
let parser = [{ return ::parse$cppClass(parser, result); }];
|
||||
}
|
||||
|
||||
def ForkOp : Handshake_Op<"fork", [NoSideEffect]> {
|
||||
let summary = "fork operation";
|
||||
|
||||
let description = [{
|
||||
The "handshake.fork" operation represents a fork operation. A
|
||||
single input is replicated to N outputs and distributed to each
|
||||
output as soon as the corresponding successor is available.
|
||||
}];
|
||||
|
||||
let arguments = (ins AnyType, BoolAttr : $control);
|
||||
let results = (outs Variadic<AnyType>);
|
||||
|
||||
let hasCanonicalizer = 1;
|
||||
let skipDefaultBuilders = 1;
|
||||
let builders = [OpBuilder<
|
||||
"Builder builder, OperationState &result, Value operand, int outputs ">];
|
||||
|
||||
let extraClassDeclaration = [{
|
||||
bool isControl() { return getAttrOfType<BoolAttr>("control").getValue(); }
|
||||
}];
|
||||
}
|
||||
|
||||
def LazyForkOp : Handshake_Op<"lazy_fork", [NoSideEffect]> {
|
||||
let summary = "lazy fork operation";
|
||||
let description = [{
|
||||
The "handshake.lfork" operation represents a lazy fork operation.
|
||||
A single input is replicated to N outputs and distributed to each
|
||||
output when all successors are available.
|
||||
}];
|
||||
|
||||
let arguments = (ins AnyType, BoolAttr : $control);
|
||||
let results = (outs Variadic<AnyType>);
|
||||
|
||||
let skipDefaultBuilders = 1;
|
||||
let builders = [OpBuilder<
|
||||
"Builder builder, OperationState &result, Value operand, int outputs ">];
|
||||
|
||||
let extraClassDeclaration = [{
|
||||
bool isControl() { return getAttrOfType<BoolAttr>("control").getValue(); }
|
||||
}];
|
||||
}
|
||||
|
||||
def MergeOp : Handshake_Op<"merge", [NoSideEffect, MergeLikeOpInterface]> {
|
||||
let summary = "merge operation";
|
||||
let description = [{
|
||||
The "handshake.merge" operation represents a (nondeterministic)
|
||||
merge operation. Any input is propagated to the single output. The
|
||||
number of inputs corresponds to the number of predecessor
|
||||
blocks.
|
||||
}];
|
||||
|
||||
let arguments = (ins Variadic<AnyType>:$dataOperands);
|
||||
let results = (outs AnyType);
|
||||
|
||||
let hasCanonicalizer = 1;
|
||||
let skipDefaultBuilders = 1;
|
||||
let builders = [OpBuilder<
|
||||
"Builder builder, OperationState &result, Value operand, int inputs ">];
|
||||
}
|
||||
|
||||
def MuxOp : Handshake_Op<"mux", [NoSideEffect, MergeLikeOpInterface]> {
|
||||
let summary = "mux operation";
|
||||
let description = [{
|
||||
The "handshake.mux" operation represents a(deterministic)
|
||||
merge operation.
|
||||
Operands: select, data0, data1, data2, ...
|
||||
|
||||
The 'select' operand is received from ControlMerge of the same
|
||||
block and it represents the index of the data operand that the mux
|
||||
should propagate to its single output. The number of data inputs
|
||||
corresponds to the number of predecessor blocks.
|
||||
}];
|
||||
let arguments = (ins AnyType : $selectOperand,
|
||||
Variadic<AnyType> : $dataOperands);
|
||||
let results = (outs AnyType);
|
||||
|
||||
let skipDefaultBuilders = 1;
|
||||
let builders = [OpBuilder<
|
||||
"Builder builder, OperationState &result, Value operand, int inputs ">
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
def ControlMergeOp : Handshake_Op<"control_merge",
|
||||
[NoSideEffect, MergeLikeOpInterface]> {
|
||||
let summary = "control merge operation";
|
||||
let description = [{
|
||||
The "handshake.control_merge" operation represents a
|
||||
(nondeterministic) control merge. Any input is propagated to the
|
||||
first output and the index of the propagated input is sent to the
|
||||
second output. The number of inputs corresponds to the number of
|
||||
predecessor blocks. ControlMerge is a control-only
|
||||
component(i.e., has no data but only bidirectional handshake).
|
||||
}];
|
||||
|
||||
let arguments = (ins Variadic<AnyType>:$dataOperands, BoolAttr : $control);
|
||||
let results = (outs Variadic<AnyType>);
|
||||
|
||||
let skipDefaultBuilders = 1;
|
||||
let builders = [OpBuilder<
|
||||
"Builder builder, OperationState &result, Value operand, int inputs ">];
|
||||
}
|
||||
|
||||
def BranchOp : Handshake_Op<"branch", [NoSideEffect]> {
|
||||
let summary = "branch operation";
|
||||
let description = [{
|
||||
The "handshake.branch" operation represents an unconditional
|
||||
branch. The single data input is propagated to the single
|
||||
successor. The input must be triggered by some predecessor to
|
||||
avoid continous triggering of a successor block.
|
||||
}];
|
||||
let arguments = (ins AnyType : $dataOperand,
|
||||
BoolAttr : $control);
|
||||
let results = (outs AnyType : $dataResult);
|
||||
|
||||
let skipDefaultBuilders = 1;
|
||||
let builders = [
|
||||
OpBuilder<"Builder builder, OperationState &result, Value dataOperand ">
|
||||
];
|
||||
|
||||
let hasCanonicalizer = 1;
|
||||
let extraClassDeclaration = [{
|
||||
bool isControl() {
|
||||
return getAttrOfType<BoolAttr>("control").getValue();
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
def ConditionalBranchOp : Handshake_Op<"conditional_branch", [NoSideEffect]> {
|
||||
let summary = "conditional branch operation";
|
||||
let description = [{
|
||||
The "handshake.cbranch" operation represents a conditional
|
||||
branch. The data input is propagated to one of the two outputs
|
||||
based on the condition input.
|
||||
}];
|
||||
|
||||
let arguments = (ins I1 : $conditionOperand,
|
||||
AnyType : $dataOperand,
|
||||
BoolAttr : $control);
|
||||
let results = (outs AnyType : $trueResult,
|
||||
AnyType : $falseResult);
|
||||
|
||||
let skipDefaultBuilders = 1;
|
||||
let builders = [OpBuilder<"Builder builder, OperationState &result, Value "
|
||||
"condOperand, Value dataOperand ">];
|
||||
|
||||
let extraClassDeclaration = [{
|
||||
// These are the indices into the dests list.
|
||||
enum { trueIndex = 0, falseIndex = 1 };
|
||||
|
||||
Value getFalseResult() { return getResult(falseIndex); }
|
||||
|
||||
Value getTrueResult() { return getResult(trueIndex); }
|
||||
|
||||
Value getDataOperand() { return getOperand(1); }
|
||||
|
||||
bool isControl() { return getAttrOfType<BoolAttr>("control").getValue(); }
|
||||
}];
|
||||
}
|
||||
|
||||
def SinkOp : Handshake_Op<"sink", []> {
|
||||
let summary = "sink operation";
|
||||
let description = [{
|
||||
The "handshake.sink" operation discards any data that arrives at its
|
||||
input.The sink has no successors and it can continuously consume data.
|
||||
}];
|
||||
let arguments = (ins AnyType);
|
||||
|
||||
let skipDefaultBuilders = 1;
|
||||
let builders =
|
||||
[OpBuilder<"Builder builder, OperationState &result, Value operand ">];
|
||||
}
|
||||
|
||||
def SourceOp : Handshake_Op<"source", [NoSideEffect]> {
|
||||
let summary = "source operation";
|
||||
let description = [{
|
||||
The "handshake.source" operation represents continuous data
|
||||
source. The source continously sets a 'valid' signal which the
|
||||
successor can consume at any point in time.
|
||||
}];
|
||||
|
||||
let results = (outs AnyType);
|
||||
}
|
||||
|
||||
def ConstantOp : Handshake_Op<"constant", [NoSideEffect]> {
|
||||
let summary = "constant operation";
|
||||
let description = [{
|
||||
The "handshake.const" has a constant value.When triggered by its
|
||||
single input, it sends the constant value to its single
|
||||
successor.
|
||||
}];
|
||||
|
||||
let arguments = (ins AnyType, AnyAttr : $value);
|
||||
let results = (outs AnyType);
|
||||
|
||||
// let skipDefaultBuilders = 1;
|
||||
let builders = [OpBuilder<"Builder builder, OperationState &result, "
|
||||
"Attribute value, Value operand">];
|
||||
|
||||
let extraClassDeclaration = [{
|
||||
Attribute getValue() { return getAttr("value"); }
|
||||
}];
|
||||
}
|
||||
|
||||
def EndOp : Handshake_Op<"end"> {
|
||||
let summary = "end operation";
|
||||
let description = [{
|
||||
The "handshake.end" propagates the result of the appropriate
|
||||
return operation from one of its inputs to its single output after
|
||||
all memory accesses have completed. Currently not used(data
|
||||
returned through ReturnOp).
|
||||
}];
|
||||
let arguments = (ins AnyType : $control, Variadic<AnyType>);
|
||||
|
||||
let skipDefaultBuilders = 1;
|
||||
let builders =
|
||||
[OpBuilder<"Builder builder, OperationState &result, Value operand">];
|
||||
}
|
||||
|
||||
def StartOp : Handshake_Op<"start", [NoSideEffect]> {
|
||||
let summary = "start operation";
|
||||
let description = [{
|
||||
Triggers execution of the control - only network. Placed in entry
|
||||
block. Currently not used( trigger given as function argument)
|
||||
}];
|
||||
|
||||
let arguments = (ins BoolAttr : $control);
|
||||
let results = (outs NoneType);
|
||||
|
||||
let skipDefaultBuilders = 1;
|
||||
let builders = [OpBuilder<"Builder builder, OperationState &result">];
|
||||
}
|
||||
|
||||
def TerminatorOp : Handshake_Op<"terminator", [Terminator]> {
|
||||
let summary = "handshake terminator operation";
|
||||
let description = [{
|
||||
This op is used as a terminator in every block of the dataflow
|
||||
netlist (as a replacement for StandardOp branches). It has no
|
||||
functionality and can be removed in some subsequent pass, when the
|
||||
block structure is removed.
|
||||
}];
|
||||
|
||||
let successors = (successor VariadicSuccessor<AnySuccessor>:$dests);
|
||||
let skipDefaultBuilders = 1;
|
||||
let builders = [OpBuilder<"Builder builder, OperationState &result, "
|
||||
"ArrayRef<Block *> successors ">];
|
||||
}
|
||||
|
||||
def MemRefTypeAttr : TypeAttrBase<"MemRefType", "memref type attribute">;
|
||||
def MemoryOp : Handshake_Op<"memory"> {
|
||||
let summary = "memory";
|
||||
let description = [{
|
||||
Each MemoryOp represents an independent memory or memory region (BRAM or external memory).
|
||||
It receives memory access requests from load and store operations. For every request,
|
||||
it returns data (for load) and a data-less token indicating completion.
|
||||
Operands: all stores (stdata1, staddr1, stdata2, staddr2, ...), then all loads (ldaddr1, ldaddr2,...)
|
||||
Outputs: all load outputs, ordered the same as
|
||||
load addresses (lddata1, lddata2, ...), followed by all none outputs,
|
||||
ordered as operands (stnone1, stnone2,...ldnone1, ldnone2,...)
|
||||
}];
|
||||
let arguments = (ins Variadic<AnyType>,
|
||||
I32Attr : $ld_count,
|
||||
I32Attr : $st_count,
|
||||
I32Attr : $id,
|
||||
MemRefTypeAttr : $type);
|
||||
let results = (outs Variadic<AnyType>);
|
||||
|
||||
let skipDefaultBuilders = 1;
|
||||
let builders = [OpBuilder<
|
||||
"Builder builder, OperationState &result, ArrayRef<Value> operands, int "
|
||||
"outputs, int control_outputs, bool lsq, int id, Value memref ">
|
||||
|
||||
];
|
||||
let extraClassDeclaration = [{
|
||||
APInt getLdCount() {
|
||||
return getAttrOfType<IntegerAttr>("ld_count").getValue();
|
||||
}
|
||||
APInt getStCount() {
|
||||
return getAttrOfType<IntegerAttr>("st_count").getValue();
|
||||
}
|
||||
unsigned getID() {
|
||||
return getAttrOfType<IntegerAttr>("id").getValue().getZExtValue();
|
||||
}
|
||||
MemRefType getMemRefType() {
|
||||
return getAttrOfType<TypeAttr>("type").getValue().cast<MemRefType>();
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
def LoadOp : Handshake_Op<"load"> {
|
||||
let summary = "load operation";
|
||||
let description = [{
|
||||
Load memory port, sends load requests to MemoryOp. From dataflow
|
||||
predecessor, receives address indices and a control-only value
|
||||
which signals completion of all previous memory accesses which
|
||||
target the same memory. When all inputs are received, the load
|
||||
sends the address indices to MemoryOp. When the MemoryOp returns
|
||||
a piece of data, the load sends it to its dataflow successor.
|
||||
|
||||
Operands: address indices (from predecessor), data (from MemoryOp), control-only input.
|
||||
Results: data (to successor), address indices (to MemoryOp).
|
||||
}];
|
||||
|
||||
let arguments = (ins Variadic<Index>, AnyType, NoneType);
|
||||
let results = (outs AnyType, Variadic<Index>:$addressResults);
|
||||
|
||||
let builders = [OpBuilder<"Builder builder, OperationState &result, Value "
|
||||
"memref, ArrayRef<Value> indices ">];
|
||||
|
||||
}
|
||||
|
||||
def StoreOp : Handshake_Op<"store"> {
|
||||
let summary = "store operation";
|
||||
let description = [{
|
||||
Store memory port, sends store requests to MemoryOp. From dataflow
|
||||
predecessors, receives address indices, data, and a control-only
|
||||
value which signals completion of all previous memory accesses
|
||||
which target the same memory. When all inputs are received, the
|
||||
store sends the address and data to MemoryOp.
|
||||
|
||||
Operands: address indices, data, control-only input.
|
||||
Results: data and address indices (sent to MemoryOp).
|
||||
}];
|
||||
|
||||
let arguments = (ins AnyType, Variadic<Index>, NoneType);
|
||||
let results = (outs AnyType, Variadic<Index>);
|
||||
|
||||
let builders =
|
||||
[OpBuilder<"Builder , OperationState &result, Value valueToStore,"
|
||||
"ArrayRef<Value> indices ">];
|
||||
}
|
||||
|
||||
def JoinOp : Handshake_Op<"join"> {
|
||||
let summary = "join operation";
|
||||
let description = [{
|
||||
A control-only synchronizer. Produces a valid output when all
|
||||
inputs become available.
|
||||
}];
|
||||
let arguments = (ins Variadic<NoneType>, BoolAttr : $control);
|
||||
let results = (outs NoneType);
|
||||
|
||||
let skipDefaultBuilders = 1;
|
||||
let builders = [OpBuilder<
|
||||
"Builder builder, OperationState &result, ArrayRef<Value> operands">];
|
||||
}
|
||||
|
||||
def I4 : I<4>;
|
||||
def I4Attr : SignlessIntegerAttrBase<I4, "4-bit integer attribute">;
|
||||
|
||||
def HasOneResult : Constraint<CPred<"$_self.size() == 1">, "has one result">;
|
||||
|
||||
def EliminateSimpleMergesPattern : Pat<(MergeOp $a), (replaceWithValue $a)>;
|
||||
|
||||
def EliminateSimpleBranchesPattern
|
||||
: Pat<(BranchOp $a, $attr), (replaceWithValue $a)>;
|
||||
|
||||
def EliminateSimpleForksPattern : Pat<(ForkOp
|
||||
: $op $a, $attr),
|
||||
(replaceWithValue $a), [(HasOneResult
|
||||
: $op)]>;
|
||||
|
||||
// def EliminateSimpleControlMergesPattern :
|
||||
// Pattern<(ControlMergeOp $a),
|
||||
// [(replaceWithValue $a),
|
||||
// (ConstantOp $a__0, ConstantAttr<I4Attr,
|
||||
// "0">)]>;
|
||||
|
||||
#endif // HANDSHAKE_OPS
|
|
@ -1,3 +1,4 @@
|
|||
add_subdirectory(Conversion)
|
||||
add_subdirectory(Dialect)
|
||||
add_subdirectory(FIRParser)
|
||||
add_subdirectory(EmitVerilog)
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
add_subdirectory(StandardToHandshake)
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
add_mlir_library(MLIRStandardToHandshake
|
||||
StandardToHandshake.cpp
|
||||
|
||||
ADDITIONAL_HEADER_DIRS
|
||||
${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/StandardToHandshake
|
||||
|
||||
LINK_LIBS
|
||||
MLIRIR
|
||||
MLIRPass
|
||||
MLIRStandardOps
|
||||
MLIRSupport
|
||||
MLIRTransforms
|
||||
MLIRHandshakeOps
|
||||
)
|
File diff suppressed because it is too large
Load Diff
|
@ -1,2 +1,3 @@
|
|||
add_subdirectory(FIRRTL)
|
||||
add_subdirectory(Handshake)
|
||||
add_subdirectory(RTL)
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
set(LLVM_OPTIONAL_SOURCES
|
||||
DialectRegistration.cpp
|
||||
HandshakeOps.cpp
|
||||
mlir_std_runner.cpp
|
||||
)
|
||||
|
||||
add_mlir_dialect_library(MLIRHandshakeOps
|
||||
HandshakeOps.cpp
|
||||
|
||||
ADDITIONAL_HEADER_DIRS
|
||||
${PROJECT_SOURCE_DIR}/include
|
||||
${PROJECT_BINARY_DIR}/include
|
||||
|
||||
LINK_LIBS
|
||||
MLIRStandardOps
|
||||
MLIRIR
|
||||
)
|
||||
add_dependencies(MLIRHandshakeOps
|
||||
MLIRHandshakeOpsIncGen
|
||||
MLIRHandshakeInterfacesIncGen
|
||||
MLIRHandshakeRewritersIncGen
|
||||
)
|
|
@ -0,0 +1,393 @@
|
|||
//===- HandshakeOps.cpp - Handshake MLIR Operations -----------------------===//
|
||||
//
|
||||
// Copyright 2019 The CIRCT Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
// =============================================================================
|
||||
|
||||
#include "circt/Dialect/Handshake/HandshakeOps.h"
|
||||
|
||||
#include "mlir/Dialect/StandardOps/IR/Ops.h"
|
||||
#include "mlir/IR/Builders.h"
|
||||
#include "mlir/IR/Function.h"
|
||||
#include "mlir/IR/FunctionImplementation.h"
|
||||
#include "mlir/IR/Matchers.h"
|
||||
#include "mlir/IR/Module.h"
|
||||
#include "mlir/IR/OpDefinition.h"
|
||||
#include "mlir/IR/OpImplementation.h"
|
||||
#include "mlir/IR/StandardTypes.h"
|
||||
#include "mlir/IR/Value.h"
|
||||
|
||||
using namespace mlir;
|
||||
using namespace mlir::handshake;
|
||||
|
||||
#include "mlir/IR/IntegerSet.h"
|
||||
#include "mlir/IR/PatternMatch.h"
|
||||
#include "mlir/Transforms/InliningUtils.h"
|
||||
#include "llvm/ADT/SetVector.h"
|
||||
#include "llvm/ADT/SmallBitVector.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
|
||||
namespace mlir {
|
||||
namespace handshake {
|
||||
#include "circt/Dialect/Handshake/HandshakeOps.inc"
|
||||
}
|
||||
} // namespace mlir
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// HandshakeOpsDialect
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
HandshakeOpsDialect::HandshakeOpsDialect(MLIRContext *context)
|
||||
: Dialect(getDialectNamespace(), context) {
|
||||
addOperations<
|
||||
#define GET_OP_LIST
|
||||
#include "circt/Dialect/Handshake/HandshakeOps.cpp.inc"
|
||||
>();
|
||||
}
|
||||
|
||||
void ForkOp::build(Builder builder, OperationState &result, Value operand,
|
||||
int outputs) {
|
||||
|
||||
auto type = operand.getType();
|
||||
|
||||
// Fork has results as many as there are successor ops
|
||||
result.types.append(outputs, type);
|
||||
|
||||
// Single operand
|
||||
result.addOperands(operand);
|
||||
|
||||
// Fork is control-only if it is the no-data output of a ControlMerge or a
|
||||
// StartOp
|
||||
auto *op = operand.getDefiningOp();
|
||||
bool isControl = ((dyn_cast<ControlMergeOp>(op) || dyn_cast<StartOp>(op)) &&
|
||||
operand == op->getResult(0))
|
||||
? true
|
||||
: false;
|
||||
result.addAttribute("control", builder.getBoolAttr(isControl));
|
||||
}
|
||||
void handshake::ForkOp::getCanonicalizationPatterns(
|
||||
OwningRewritePatternList &results, MLIRContext *context) {
|
||||
results.insert<mlir::handshake::EliminateSimpleForksPattern>(context);
|
||||
}
|
||||
|
||||
void LazyForkOp::build(Builder builder, OperationState &result, Value operand,
|
||||
int outputs) {
|
||||
|
||||
auto type = operand.getType();
|
||||
|
||||
// Fork has results as many as there are successor ops
|
||||
result.types.append(outputs, type);
|
||||
|
||||
// Single operand
|
||||
result.addOperands(operand);
|
||||
|
||||
// Fork is control-only if it is the no-data output of a ControlMerge or a
|
||||
// StartOp
|
||||
auto *op = operand.getDefiningOp();
|
||||
bool isControl = ((dyn_cast<ControlMergeOp>(op) || dyn_cast<StartOp>(op)) &&
|
||||
operand == op->getResult(0))
|
||||
? true
|
||||
: false;
|
||||
result.addAttribute("control", builder.getBoolAttr(isControl));
|
||||
}
|
||||
|
||||
void MergeOp::build(Builder builder, OperationState &result, Value operand,
|
||||
int inputs) {
|
||||
|
||||
auto type = operand.getType();
|
||||
result.types.push_back(type);
|
||||
|
||||
// Operand to keep defining value (used when connecting merges)
|
||||
// Removed afterwards
|
||||
result.addOperands(operand);
|
||||
|
||||
// Operands from predecessor blocks
|
||||
for (int i = 0, e = inputs; i < e; ++i)
|
||||
result.addOperands(operand);
|
||||
}
|
||||
|
||||
void MergeOp::getCanonicalizationPatterns(OwningRewritePatternList &results,
|
||||
MLIRContext *context) {
|
||||
results.insert<mlir::handshake::EliminateSimpleMergesPattern>(context);
|
||||
}
|
||||
|
||||
void MuxOp::build(Builder builder, OperationState &result, Value operand,
|
||||
int inputs) {
|
||||
|
||||
auto type = operand.getType();
|
||||
result.types.push_back(type);
|
||||
|
||||
// Operand connected to ControlMerge from same block
|
||||
result.addOperands(operand);
|
||||
|
||||
// Operands from predecessor blocks
|
||||
for (int i = 0, e = inputs; i < e; ++i)
|
||||
result.addOperands(operand);
|
||||
}
|
||||
|
||||
void ControlMergeOp::build(Builder builder, OperationState &result,
|
||||
Value operand, int inputs) {
|
||||
|
||||
auto type = operand.getType();
|
||||
result.types.push_back(type);
|
||||
// Second result gives the input index to the muxes
|
||||
// Number of bits depends on encoding (log2/1-hot)
|
||||
result.types.push_back(builder.getIndexType());
|
||||
|
||||
// Operand to keep defining value (used when connecting merges)
|
||||
// Removed afterwards
|
||||
result.addOperands(operand);
|
||||
|
||||
// Operands from predecessor blocks
|
||||
for (int i = 0, e = inputs; i < e; ++i)
|
||||
result.addOperands(operand);
|
||||
|
||||
result.addAttribute("control", builder.getBoolAttr(true));
|
||||
}
|
||||
// void ControlMergeOp::getCanonicalizationPatterns(OwningRewritePatternList
|
||||
// &results,
|
||||
// MLIRContext *context) {
|
||||
// results.insert<mlir::handshake::EliminateSimpleControlMergesPattern>(context);
|
||||
// }
|
||||
|
||||
void handshake::BranchOp::build(Builder builder, OperationState &result,
|
||||
Value dataOperand) {
|
||||
|
||||
auto type = dataOperand.getType();
|
||||
result.types.push_back(type);
|
||||
result.addOperands(dataOperand);
|
||||
|
||||
// Branch is control-only if it is the no-data output of a ControlMerge or a
|
||||
// StartOp This holds because Branches are inserted before Forks
|
||||
auto *op = dataOperand.getDefiningOp();
|
||||
bool isControl = ((dyn_cast<ControlMergeOp>(op) || dyn_cast<StartOp>(op)) &&
|
||||
dataOperand == op->getResult(0))
|
||||
? true
|
||||
: false;
|
||||
result.addAttribute("control", builder.getBoolAttr(isControl));
|
||||
}
|
||||
void handshake::BranchOp::getCanonicalizationPatterns(
|
||||
OwningRewritePatternList &results, MLIRContext *context) {
|
||||
results.insert<mlir::handshake::EliminateSimpleBranchesPattern>(context);
|
||||
}
|
||||
|
||||
void handshake::ConditionalBranchOp::build(Builder builder,
|
||||
OperationState &result,
|
||||
Value condOperand,
|
||||
Value dataOperand) {
|
||||
|
||||
auto type = dataOperand.getType();
|
||||
result.types.append(2, type);
|
||||
result.addOperands(condOperand);
|
||||
result.addOperands(dataOperand);
|
||||
|
||||
// Branch is control-only if it is the no-data output of a ControlMerge or a
|
||||
// StartOp This holds because Branches are inserted before Forks
|
||||
auto *op = dataOperand.getDefiningOp();
|
||||
bool isControl = ((dyn_cast<ControlMergeOp>(op) || dyn_cast<StartOp>(op)) &&
|
||||
dataOperand == op->getResult(0))
|
||||
? true
|
||||
: false;
|
||||
result.addAttribute("control", builder.getBoolAttr(isControl));
|
||||
}
|
||||
|
||||
void StartOp::build(Builder builder, OperationState &result) {
|
||||
// Control-only output, has no type
|
||||
auto type = builder.getNoneType();
|
||||
result.types.push_back(type);
|
||||
result.addAttribute("control", builder.getBoolAttr(true));
|
||||
}
|
||||
|
||||
void EndOp::build(Builder builder, OperationState &result, Value operand) {
|
||||
|
||||
result.addOperands(operand);
|
||||
}
|
||||
|
||||
void handshake::ReturnOp::build(Builder builder, OperationState &result,
|
||||
ArrayRef<Value> operands) {
|
||||
|
||||
result.addOperands(operands);
|
||||
}
|
||||
|
||||
void SinkOp::build(Builder builder, OperationState &result, Value operand) {
|
||||
|
||||
result.addOperands(operand);
|
||||
}
|
||||
|
||||
void handshake::ConstantOp::build(Builder builder, OperationState &result,
|
||||
Attribute value, Value operand) {
|
||||
|
||||
result.addOperands(operand);
|
||||
|
||||
auto type = value.getType();
|
||||
result.types.push_back(type);
|
||||
|
||||
result.addAttribute("value", value);
|
||||
}
|
||||
|
||||
void handshake::TerminatorOp::build(Builder builder, OperationState &result,
|
||||
ArrayRef<Block *> successors) {
|
||||
// Add all the successor blocks of the block which contains this terminator
|
||||
result.addSuccessors(successors);
|
||||
// for (auto &succ : successors)
|
||||
// result.addSuccessor(succ, {});
|
||||
}
|
||||
|
||||
void MemoryOp::build(Builder builder, OperationState &result,
|
||||
ArrayRef<Value> operands, int outputs, int control_outputs,
|
||||
bool lsq, int id, Value memref) {
|
||||
|
||||
result.addOperands(operands);
|
||||
|
||||
auto memrefType = memref.getType().cast<MemRefType>();
|
||||
|
||||
// Data outputs (get their type from memref)
|
||||
result.types.append(outputs, memrefType.getElementType());
|
||||
|
||||
// Control outputs
|
||||
result.types.append(control_outputs, builder.getNoneType());
|
||||
|
||||
// Indicates whether a memory is an LSQ
|
||||
result.addAttribute("lsq", builder.getBoolAttr(lsq));
|
||||
|
||||
// Memref info
|
||||
result.addAttribute("type", TypeAttr::get(memrefType));
|
||||
|
||||
// Memory ID (individual ID for each MemoryOp)
|
||||
Type i32Type = builder.getIntegerType(32);
|
||||
result.addAttribute("id", builder.getIntegerAttr(i32Type, id));
|
||||
|
||||
if (!lsq) {
|
||||
|
||||
result.addAttribute("ld_count", builder.getIntegerAttr(i32Type, outputs));
|
||||
result.addAttribute("st_count", builder.getIntegerAttr(
|
||||
i32Type, control_outputs - outputs));
|
||||
}
|
||||
}
|
||||
|
||||
void handshake::LoadOp::build(Builder builder, OperationState &result,
|
||||
Value memref, ArrayRef<Value> indices) {
|
||||
|
||||
// Address indices
|
||||
// result.addOperands(memref);
|
||||
result.addOperands(indices);
|
||||
|
||||
// Data type
|
||||
auto memrefType = memref.getType().cast<MemRefType>();
|
||||
|
||||
// Data output (from load to successor ops)
|
||||
result.types.push_back(memrefType.getElementType());
|
||||
|
||||
// Address outputs (to lsq)
|
||||
result.types.append(indices.size(), builder.getIndexType());
|
||||
}
|
||||
|
||||
void handshake::StoreOp::build(Builder builder, OperationState &result,
|
||||
Value valueToStore, ArrayRef<Value> indices) {
|
||||
|
||||
// Data
|
||||
result.addOperands(valueToStore);
|
||||
|
||||
// Address indices
|
||||
result.addOperands(indices);
|
||||
|
||||
// Data output (from store to LSQ)
|
||||
result.types.push_back(valueToStore.getType());
|
||||
|
||||
// Address outputs (from store to lsq)
|
||||
result.types.append(indices.size(), builder.getIndexType());
|
||||
}
|
||||
|
||||
void JoinOp::build(Builder builder, OperationState &result,
|
||||
ArrayRef<Value> operands) {
|
||||
|
||||
auto type = builder.getNoneType();
|
||||
result.types.push_back(type);
|
||||
|
||||
result.addOperands(operands);
|
||||
|
||||
result.addAttribute("control", builder.getBoolAttr(true));
|
||||
}
|
||||
|
||||
// for let printer/parser/verifier in Handshake_Op class
|
||||
/*static LogicalResult verify(ForkOp op) {
|
||||
return success();
|
||||
}
|
||||
void print(OpAsmPrinter &p, ForkOp op) {
|
||||
p << "handshake.fork ";
|
||||
p.printOperands(op.getOperands());
|
||||
// p << " : " << op.getType();
|
||||
}
|
||||
ParseResult parseForkOp(OpAsmParser &parser, OperationState &result) {
|
||||
return success();
|
||||
}*/
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// TableGen'd op method definitions
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// Code below is largely duplicated from Standard/Ops.cpp
|
||||
static ParseResult parseReturnOp(OpAsmParser &parser, OperationState &result) {
|
||||
SmallVector<OpAsmParser::OperandType, 2> opInfo;
|
||||
SmallVector<Type, 2> types;
|
||||
llvm::SMLoc loc = parser.getCurrentLocation();
|
||||
return failure(parser.parseOperandList(opInfo) ||
|
||||
(!opInfo.empty() && parser.parseColonTypeList(types)) ||
|
||||
parser.resolveOperands(opInfo, types, loc, result.operands));
|
||||
}
|
||||
|
||||
static void print(OpAsmPrinter &p, handshake::ReturnOp op) {
|
||||
p << "handshake.return";
|
||||
if (op.getNumOperands() != 0) {
|
||||
p << ' ';
|
||||
p.printOperands(op.getOperands());
|
||||
p << " : ";
|
||||
interleaveComma(op.getOperandTypes(), p);
|
||||
}
|
||||
}
|
||||
|
||||
static LogicalResult verify(handshake::ReturnOp op) {
|
||||
auto *parent = op.getParentOp();
|
||||
auto function = dyn_cast<handshake::FuncOp>(parent);
|
||||
if (!function)
|
||||
return op.emitOpError("must have a handshake.func parent");
|
||||
|
||||
// The operand number and types must match the function signature.
|
||||
const auto &results = function.getType().getResults();
|
||||
if (op.getNumOperands() != results.size())
|
||||
return op.emitOpError("has ")
|
||||
<< op.getNumOperands()
|
||||
<< " operands, but enclosing function returns " << results.size();
|
||||
|
||||
for (unsigned i = 0, e = results.size(); i != e; ++i)
|
||||
if (op.getOperand(i).getType() != results[i])
|
||||
return op.emitError()
|
||||
<< "type of return operand " << i << " ("
|
||||
<< op.getOperand(i).getType()
|
||||
<< ") doesn't match function result type (" << results[i] << ")";
|
||||
|
||||
return success();
|
||||
}
|
||||
|
||||
namespace mlir {
|
||||
namespace handshake {
|
||||
|
||||
#include "circt/Dialect/Handshake/HandshakeInterfaces.cpp.inc"
|
||||
|
||||
#define GET_OP_CLASSES
|
||||
#include "circt/Dialect/Handshake/HandshakeOps.cpp.inc"
|
||||
|
||||
|
||||
} // namespace handshake
|
||||
} // namespace mlir
|
|
@ -9,6 +9,7 @@ set(CIRCT_TEST_DEPENDS
|
|||
FileCheck count not
|
||||
circt-opt
|
||||
circt-translate
|
||||
handshake-runner
|
||||
firtool
|
||||
)
|
||||
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
// NOTE: Assertions have been autogenerated by utils/update_mlir_test_checks.py
|
||||
// RUN: circt-opt -create-dataflow %s | FileCheck %s
|
||||
func @simple_loop() {
|
||||
// CHECK: module {
|
||||
|
||||
// CHECK-LABEL: handshake.func @simple_loop(
|
||||
// CHECK-SAME: %[[VAL_0:.*]]: none, ...) -> none {
|
||||
// CHECK: %[[VAL_1:.*]] = "handshake.branch"(%[[VAL_0]]) {control = true} : (none) -> none
|
||||
// CHECK: "handshake.terminator"()[^bb1] : () -> ()
|
||||
// CHECK: ^bb1:
|
||||
// CHECK: %[[VAL_2:.*]]:2 = "handshake.control_merge"(%[[VAL_1]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: %[[VAL_3:.*]]:3 = "handshake.fork"(%[[VAL_2]]#0) {control = true} : (none) -> (none, none, none)
|
||||
// CHECK: "handshake.sink"(%[[VAL_2]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_4:.*]] = "handshake.constant"(%[[VAL_3]]#1) {value = 1 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_5:.*]] = "handshake.constant"(%[[VAL_3]]#0) {value = 42 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_6:.*]] = "handshake.branch"(%[[VAL_3]]#2) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_7:.*]] = "handshake.branch"(%[[VAL_4]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_8:.*]] = "handshake.branch"(%[[VAL_5]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb2] : () -> ()
|
||||
// CHECK: ^bb2:
|
||||
// CHECK: %[[VAL_9:.*]] = "handshake.mux"(%[[VAL_10:.*]]#1, %[[VAL_11:.*]], %[[VAL_8]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_12:.*]]:2 = "handshake.fork"(%[[VAL_9]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_13:.*]]:2 = "handshake.control_merge"(%[[VAL_14:.*]], %[[VAL_6]]) {control = true} : (none, none) -> (none, index)
|
||||
// CHECK: %[[VAL_10]]:2 = "handshake.fork"(%[[VAL_13]]#1) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_15:.*]] = "handshake.mux"(%[[VAL_10]]#0, %[[VAL_16:.*]], %[[VAL_7]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_17:.*]]:2 = "handshake.fork"(%[[VAL_15]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_18:.*]] = cmpi "slt", %[[VAL_17]]#1, %[[VAL_12]]#1 : index
|
||||
// CHECK: %[[VAL_19:.*]]:3 = "handshake.fork"(%[[VAL_18]]) {control = false} : (i1) -> (i1, i1, i1)
|
||||
// CHECK: %[[VAL_20:.*]], %[[VAL_21:.*]] = "handshake.conditional_branch"(%[[VAL_19]]#2, %[[VAL_12]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_21]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_22:.*]], %[[VAL_23:.*]] = "handshake.conditional_branch"(%[[VAL_19]]#1, %[[VAL_13]]#0) {control = true} : (i1, none) -> (none, none)
|
||||
// CHECK: %[[VAL_24:.*]], %[[VAL_25:.*]] = "handshake.conditional_branch"(%[[VAL_19]]#0, %[[VAL_17]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_25]]) : (index) -> ()
|
||||
// CHECK: "handshake.terminator"()[^bb3, ^bb4] : () -> ()
|
||||
// CHECK: ^bb3:
|
||||
// CHECK: %[[VAL_26:.*]] = "handshake.merge"(%[[VAL_24]]) : (index) -> index
|
||||
// CHECK: %[[VAL_27:.*]] = "handshake.merge"(%[[VAL_20]]) : (index) -> index
|
||||
// CHECK: %[[VAL_28:.*]]:2 = "handshake.control_merge"(%[[VAL_22]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: %[[VAL_29:.*]]:2 = "handshake.fork"(%[[VAL_28]]#0) {control = true} : (none) -> (none, none)
|
||||
// CHECK: "handshake.sink"(%[[VAL_28]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_30:.*]] = "handshake.constant"(%[[VAL_29]]#0) {value = 1 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_31:.*]] = addi %[[VAL_26]], %[[VAL_30]] : index
|
||||
// CHECK: %[[VAL_11]] = "handshake.branch"(%[[VAL_27]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_14]] = "handshake.branch"(%[[VAL_29]]#1) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_16]] = "handshake.branch"(%[[VAL_31]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb2] : () -> ()
|
||||
// CHECK: ^bb4:
|
||||
// CHECK: %[[VAL_32:.*]]:2 = "handshake.control_merge"(%[[VAL_23]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_32]]#1) : (index) -> ()
|
||||
// CHECK: handshake.return %[[VAL_32]]#0 : none
|
||||
// CHECK: }
|
||||
// CHECK: }
|
||||
^bb0:
|
||||
br ^bb1
|
||||
^bb1: // pred: ^bb0
|
||||
%c1 = constant 1 : index
|
||||
%c42 = constant 42 : index
|
||||
br ^bb2(%c1 : index)
|
||||
^bb2(%0: index): // 2 preds: ^bb1, ^bb3
|
||||
%1 = cmpi "slt", %0, %c42 : index
|
||||
cond_br %1, ^bb3, ^bb4
|
||||
^bb3: // pred: ^bb2
|
||||
%c1_0 = constant 1 : index
|
||||
%2 = addi %0, %c1_0 : index
|
||||
br ^bb2(%2 : index)
|
||||
^bb4: // pred: ^bb2
|
||||
return
|
||||
}
|
|
@ -0,0 +1,131 @@
|
|||
// NOTE: Assertions have been autogenerated by utils/update_mlir_test_checks.py
|
||||
// RUN: circt-opt -create-dataflow %s | FileCheck %s
|
||||
func @affine_dma_start(%arg0: index) {
|
||||
// CHECK: module {
|
||||
|
||||
// CHECK-LABEL: handshake.func @affine_dma_start(
|
||||
// CHECK-SAME: %[[VAL_0:.*]]: index, %[[VAL_1:.*]]: none, ...) -> none {
|
||||
// CHECK: %[[VAL_2:.*]] = "handshake.merge"(%[[VAL_0]]) : (index) -> index
|
||||
// CHECK: %[[VAL_3:.*]]:6 = "handshake.fork"(%[[VAL_1]]) {control = true} : (none) -> (none, none, none, none, none, none)
|
||||
// CHECK: %[[VAL_4:.*]] = alloc() : memref<100xf32>
|
||||
// CHECK: %[[VAL_5:.*]] = alloc() : memref<100xf32, 2>
|
||||
// CHECK: %[[VAL_6:.*]] = alloc() : memref<1xi32>
|
||||
// CHECK: %[[VAL_7:.*]] = "handshake.constant"(%[[VAL_3]]#4) {value = 0 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_8:.*]] = "handshake.constant"(%[[VAL_3]]#3) {value = 64 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_9:.*]] = "handshake.constant"(%[[VAL_3]]#2) {value = 0 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_10:.*]] = "handshake.constant"(%[[VAL_3]]#1) {value = 10 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_11:.*]] = "handshake.constant"(%[[VAL_3]]#0) {value = 1 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_12:.*]] = "handshake.branch"(%[[VAL_2]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_13:.*]] = "handshake.branch"(%[[VAL_3]]#5) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_14:.*]] = "handshake.branch"(%[[VAL_4]]) {control = false} : (memref<100xf32>) -> memref<100xf32>
|
||||
// CHECK: %[[VAL_15:.*]] = "handshake.branch"(%[[VAL_5]]) {control = false} : (memref<100xf32, 2>) -> memref<100xf32, 2>
|
||||
// CHECK: %[[VAL_16:.*]] = "handshake.branch"(%[[VAL_6]]) {control = false} : (memref<1xi32>) -> memref<1xi32>
|
||||
// CHECK: %[[VAL_17:.*]] = "handshake.branch"(%[[VAL_7]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_18:.*]] = "handshake.branch"(%[[VAL_8]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_19:.*]] = "handshake.branch"(%[[VAL_9]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_20:.*]] = "handshake.branch"(%[[VAL_10]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_21:.*]] = "handshake.branch"(%[[VAL_11]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb1] : () -> ()
|
||||
// CHECK: ^bb1:
|
||||
// CHECK: %[[VAL_22:.*]] = "handshake.mux"(%[[VAL_23:.*]]#8, %[[VAL_24:.*]], %[[VAL_20]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_25:.*]]:2 = "handshake.fork"(%[[VAL_22]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_26:.*]] = "handshake.mux"(%[[VAL_23]]#7, %[[VAL_27:.*]], %[[VAL_12]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_28:.*]] = "handshake.mux"(%[[VAL_23]]#6, %[[VAL_29:.*]], %[[VAL_14]]) : (index, memref<100xf32>, memref<100xf32>) -> memref<100xf32>
|
||||
// CHECK: %[[VAL_30:.*]] = "handshake.mux"(%[[VAL_23]]#5, %[[VAL_31:.*]], %[[VAL_15]]) : (index, memref<100xf32, 2>, memref<100xf32, 2>) -> memref<100xf32, 2>
|
||||
// CHECK: %[[VAL_32:.*]] = "handshake.mux"(%[[VAL_23]]#4, %[[VAL_33:.*]], %[[VAL_18]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_34:.*]] = "handshake.mux"(%[[VAL_23]]#3, %[[VAL_35:.*]], %[[VAL_16]]) : (index, memref<1xi32>, memref<1xi32>) -> memref<1xi32>
|
||||
// CHECK: %[[VAL_36:.*]] = "handshake.mux"(%[[VAL_23]]#2, %[[VAL_37:.*]], %[[VAL_17]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_38:.*]] = "handshake.mux"(%[[VAL_23]]#1, %[[VAL_39:.*]], %[[VAL_21]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_40:.*]]:2 = "handshake.control_merge"(%[[VAL_41:.*]], %[[VAL_13]]) {control = true} : (none, none) -> (none, index)
|
||||
// CHECK: %[[VAL_23]]:9 = "handshake.fork"(%[[VAL_40]]#1) {control = false} : (index) -> (index, index, index, index, index, index, index, index, index)
|
||||
// CHECK: %[[VAL_42:.*]] = "handshake.mux"(%[[VAL_23]]#0, %[[VAL_43:.*]], %[[VAL_19]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_44:.*]]:2 = "handshake.fork"(%[[VAL_42]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_45:.*]] = cmpi "slt", %[[VAL_44]]#1, %[[VAL_25]]#1 : index
|
||||
// CHECK: %[[VAL_46:.*]]:10 = "handshake.fork"(%[[VAL_45]]) {control = false} : (i1) -> (i1, i1, i1, i1, i1, i1, i1, i1, i1, i1)
|
||||
// CHECK: %[[VAL_47:.*]], %[[VAL_48:.*]] = "handshake.conditional_branch"(%[[VAL_46]]#9, %[[VAL_25]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_48]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_49:.*]], %[[VAL_50:.*]] = "handshake.conditional_branch"(%[[VAL_46]]#8, %[[VAL_26]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_50]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_51:.*]], %[[VAL_52:.*]] = "handshake.conditional_branch"(%[[VAL_46]]#7, %[[VAL_28]]) {control = false} : (i1, memref<100xf32>) -> (memref<100xf32>, memref<100xf32>)
|
||||
// CHECK: "handshake.sink"(%[[VAL_52]]) : (memref<100xf32>) -> ()
|
||||
// CHECK: %[[VAL_53:.*]], %[[VAL_54:.*]] = "handshake.conditional_branch"(%[[VAL_46]]#6, %[[VAL_30]]) {control = false} : (i1, memref<100xf32, 2>) -> (memref<100xf32, 2>, memref<100xf32, 2>)
|
||||
// CHECK: "handshake.sink"(%[[VAL_54]]) : (memref<100xf32, 2>) -> ()
|
||||
// CHECK: %[[VAL_55:.*]], %[[VAL_56:.*]] = "handshake.conditional_branch"(%[[VAL_46]]#5, %[[VAL_32]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_56]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_57:.*]], %[[VAL_58:.*]] = "handshake.conditional_branch"(%[[VAL_46]]#4, %[[VAL_34]]) {control = false} : (i1, memref<1xi32>) -> (memref<1xi32>, memref<1xi32>)
|
||||
// CHECK: "handshake.sink"(%[[VAL_58]]) : (memref<1xi32>) -> ()
|
||||
// CHECK: %[[VAL_59:.*]], %[[VAL_60:.*]] = "handshake.conditional_branch"(%[[VAL_46]]#3, %[[VAL_36]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_60]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_61:.*]], %[[VAL_62:.*]] = "handshake.conditional_branch"(%[[VAL_46]]#2, %[[VAL_38]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_62]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_63:.*]], %[[VAL_64:.*]] = "handshake.conditional_branch"(%[[VAL_46]]#1, %[[VAL_40]]#0) {control = true} : (i1, none) -> (none, none)
|
||||
// CHECK: %[[VAL_65:.*]], %[[VAL_66:.*]] = "handshake.conditional_branch"(%[[VAL_46]]#0, %[[VAL_44]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_66]]) : (index) -> ()
|
||||
// CHECK: "handshake.terminator"()[^bb2, ^bb3] : () -> ()
|
||||
// CHECK: ^bb2:
|
||||
// CHECK: %[[VAL_67:.*]] = "handshake.merge"(%[[VAL_65]]) : (index) -> index
|
||||
// CHECK: %[[VAL_68:.*]]:2 = "handshake.fork"(%[[VAL_67]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_69:.*]] = "handshake.merge"(%[[VAL_49]]) : (index) -> index
|
||||
// CHECK: %[[VAL_70:.*]]:2 = "handshake.fork"(%[[VAL_69]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_71:.*]] = "handshake.merge"(%[[VAL_51]]) : (memref<100xf32>) -> memref<100xf32>
|
||||
// CHECK: %[[VAL_72:.*]]:2 = "handshake.fork"(%[[VAL_71]]) {control = false} : (memref<100xf32>) -> (memref<100xf32>, memref<100xf32>)
|
||||
// CHECK: %[[VAL_73:.*]] = "handshake.merge"(%[[VAL_53]]) : (memref<100xf32, 2>) -> memref<100xf32, 2>
|
||||
// CHECK: %[[VAL_74:.*]]:2 = "handshake.fork"(%[[VAL_73]]) {control = false} : (memref<100xf32, 2>) -> (memref<100xf32, 2>, memref<100xf32, 2>)
|
||||
// CHECK: %[[VAL_75:.*]] = "handshake.merge"(%[[VAL_55]]) : (index) -> index
|
||||
// CHECK: %[[VAL_76:.*]]:2 = "handshake.fork"(%[[VAL_75]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_77:.*]] = "handshake.merge"(%[[VAL_57]]) : (memref<1xi32>) -> memref<1xi32>
|
||||
// CHECK: %[[VAL_78:.*]]:2 = "handshake.fork"(%[[VAL_77]]) {control = false} : (memref<1xi32>) -> (memref<1xi32>, memref<1xi32>)
|
||||
// CHECK: %[[VAL_79:.*]] = "handshake.merge"(%[[VAL_59]]) : (index) -> index
|
||||
// CHECK: %[[VAL_80:.*]]:2 = "handshake.fork"(%[[VAL_79]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_81:.*]] = "handshake.merge"(%[[VAL_61]]) : (index) -> index
|
||||
// CHECK: %[[VAL_82:.*]]:2 = "handshake.fork"(%[[VAL_81]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_83:.*]] = "handshake.merge"(%[[VAL_47]]) : (index) -> index
|
||||
// CHECK: %[[VAL_84:.*]]:2 = "handshake.control_merge"(%[[VAL_63]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: %[[VAL_85:.*]]:3 = "handshake.fork"(%[[VAL_84]]#0) {control = true} : (none) -> (none, none, none)
|
||||
// CHECK: "handshake.sink"(%[[VAL_84]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_86:.*]] = "handshake.constant"(%[[VAL_85]]#1) {value = 7 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_87:.*]] = addi %[[VAL_68]]#1, %[[VAL_86]] : index
|
||||
// CHECK: %[[VAL_88:.*]] = "handshake.constant"(%[[VAL_85]]#0) {value = 11 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_89:.*]] = addi %[[VAL_70]]#1, %[[VAL_88]] : index
|
||||
// CHECK: dma_start %[[VAL_72]]#1{{\[}}%[[VAL_87]]], %[[VAL_74]]#1{{\[}}%[[VAL_89]]], %[[VAL_76]]#1, %[[VAL_78]]#1{{\[}}%[[VAL_80]]#1] : memref<100xf32>, memref<100xf32, 2>, memref<1xi32>
|
||||
// CHECK: %[[VAL_90:.*]] = addi %[[VAL_68]]#0, %[[VAL_82]]#1 : index
|
||||
// CHECK: %[[VAL_27]] = "handshake.branch"(%[[VAL_70]]#0) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_29]] = "handshake.branch"(%[[VAL_72]]#0) {control = false} : (memref<100xf32>) -> memref<100xf32>
|
||||
// CHECK: %[[VAL_31]] = "handshake.branch"(%[[VAL_74]]#0) {control = false} : (memref<100xf32, 2>) -> memref<100xf32, 2>
|
||||
// CHECK: %[[VAL_33]] = "handshake.branch"(%[[VAL_76]]#0) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_35]] = "handshake.branch"(%[[VAL_78]]#0) {control = false} : (memref<1xi32>) -> memref<1xi32>
|
||||
// CHECK: %[[VAL_37]] = "handshake.branch"(%[[VAL_80]]#0) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_39]] = "handshake.branch"(%[[VAL_82]]#0) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_24]] = "handshake.branch"(%[[VAL_83]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_41]] = "handshake.branch"(%[[VAL_85]]#2) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_43]] = "handshake.branch"(%[[VAL_90]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb1] : () -> ()
|
||||
// CHECK: ^bb3:
|
||||
// CHECK: %[[VAL_91:.*]]:2 = "handshake.control_merge"(%[[VAL_64]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_91]]#1) : (index) -> ()
|
||||
// CHECK: handshake.return %[[VAL_91]]#0 : none
|
||||
// CHECK: }
|
||||
// CHECK: }
|
||||
%0 = alloc() : memref<100xf32>
|
||||
%1 = alloc() : memref<100xf32, 2>
|
||||
%2 = alloc() : memref<1xi32>
|
||||
%c0 = constant 0 : index
|
||||
%c64 = constant 64 : index
|
||||
%c0_0 = constant 0 : index
|
||||
%c10 = constant 10 : index
|
||||
%c1 = constant 1 : index
|
||||
br ^bb1(%c0_0 : index)
|
||||
^bb1(%3: index): // 2 preds: ^bb0, ^bb2
|
||||
%4 = cmpi "slt", %3, %c10 : index
|
||||
cond_br %4, ^bb2, ^bb3
|
||||
^bb2: // pred: ^bb1
|
||||
%c7 = constant 7 : index
|
||||
%5 = addi %3, %c7 : index
|
||||
%c11 = constant 11 : index
|
||||
%6 = addi %arg0, %c11 : index
|
||||
dma_start %0[%5], %1[%6], %c64, %2[%c0] : memref<100xf32>, memref<100xf32, 2>, memref<1xi32>
|
||||
%7 = addi %3, %c1 : index
|
||||
br ^bb1(%7 : index)
|
||||
^bb3: // pred: ^bb1
|
||||
return
|
||||
}
|
|
@ -0,0 +1,138 @@
|
|||
// NOTE: Assertions have been autogenerated by utils/update_mlir_test_checks.py
|
||||
// RUN: circt-opt -create-dataflow %s | FileCheck %s
|
||||
func @imperfectly_nested_loops() {
|
||||
// CHECK: module {
|
||||
|
||||
// CHECK-LABEL: handshake.func @imperfectly_nested_loops(
|
||||
// CHECK-SAME: %[[VAL_0:.*]]: none, ...) -> none {
|
||||
// CHECK: %[[VAL_1:.*]]:4 = "handshake.fork"(%[[VAL_0]]) {control = true} : (none) -> (none, none, none, none)
|
||||
// CHECK: %[[VAL_2:.*]] = "handshake.constant"(%[[VAL_1]]#2) {value = 0 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_3:.*]] = "handshake.constant"(%[[VAL_1]]#1) {value = 42 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_4:.*]] = "handshake.constant"(%[[VAL_1]]#0) {value = 1 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_5:.*]] = "handshake.branch"(%[[VAL_1]]#3) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_6:.*]] = "handshake.branch"(%[[VAL_2]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_7:.*]] = "handshake.branch"(%[[VAL_3]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_8:.*]] = "handshake.branch"(%[[VAL_4]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb1] : () -> ()
|
||||
// CHECK: ^bb1:
|
||||
// CHECK: %[[VAL_9:.*]] = "handshake.mux"(%[[VAL_10:.*]]#2, %[[VAL_11:.*]], %[[VAL_7]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_12:.*]]:2 = "handshake.fork"(%[[VAL_9]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_13:.*]] = "handshake.mux"(%[[VAL_10]]#1, %[[VAL_14:.*]], %[[VAL_8]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_15:.*]]:2 = "handshake.control_merge"(%[[VAL_16:.*]], %[[VAL_5]]) {control = true} : (none, none) -> (none, index)
|
||||
// CHECK: %[[VAL_10]]:3 = "handshake.fork"(%[[VAL_15]]#1) {control = false} : (index) -> (index, index, index)
|
||||
// CHECK: %[[VAL_17:.*]] = "handshake.mux"(%[[VAL_10]]#0, %[[VAL_18:.*]], %[[VAL_6]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_19:.*]]:2 = "handshake.fork"(%[[VAL_17]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_20:.*]] = cmpi "slt", %[[VAL_19]]#1, %[[VAL_12]]#1 : index
|
||||
// CHECK: %[[VAL_21:.*]]:4 = "handshake.fork"(%[[VAL_20]]) {control = false} : (i1) -> (i1, i1, i1, i1)
|
||||
// CHECK: %[[VAL_22:.*]], %[[VAL_23:.*]] = "handshake.conditional_branch"(%[[VAL_21]]#3, %[[VAL_12]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_23]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_24:.*]], %[[VAL_25:.*]] = "handshake.conditional_branch"(%[[VAL_21]]#2, %[[VAL_13]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_25]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_26:.*]], %[[VAL_27:.*]] = "handshake.conditional_branch"(%[[VAL_21]]#1, %[[VAL_15]]#0) {control = true} : (i1, none) -> (none, none)
|
||||
// CHECK: %[[VAL_28:.*]], %[[VAL_29:.*]] = "handshake.conditional_branch"(%[[VAL_21]]#0, %[[VAL_19]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_29]]) : (index) -> ()
|
||||
// CHECK: "handshake.terminator"()[^bb2, ^bb6] : () -> ()
|
||||
// CHECK: ^bb2:
|
||||
// CHECK: %[[VAL_30:.*]] = "handshake.merge"(%[[VAL_28]]) : (index) -> index
|
||||
// CHECK: %[[VAL_31:.*]] = "handshake.merge"(%[[VAL_24]]) : (index) -> index
|
||||
// CHECK: %[[VAL_32:.*]] = "handshake.merge"(%[[VAL_22]]) : (index) -> index
|
||||
// CHECK: %[[VAL_33:.*]]:2 = "handshake.control_merge"(%[[VAL_26]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: %[[VAL_34:.*]]:4 = "handshake.fork"(%[[VAL_33]]#0) {control = true} : (none) -> (none, none, none, none)
|
||||
// CHECK: "handshake.sink"(%[[VAL_33]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_35:.*]] = "handshake.constant"(%[[VAL_34]]#2) {value = 7 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_36:.*]] = "handshake.constant"(%[[VAL_34]]#1) {value = 56 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_37:.*]] = "handshake.constant"(%[[VAL_34]]#0) {value = 2 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_38:.*]] = "handshake.branch"(%[[VAL_30]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_39:.*]] = "handshake.branch"(%[[VAL_31]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_40:.*]] = "handshake.branch"(%[[VAL_32]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_41:.*]] = "handshake.branch"(%[[VAL_34]]#3) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_42:.*]] = "handshake.branch"(%[[VAL_35]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_43:.*]] = "handshake.branch"(%[[VAL_36]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_44:.*]] = "handshake.branch"(%[[VAL_37]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb3] : () -> ()
|
||||
// CHECK: ^bb3:
|
||||
// CHECK: %[[VAL_45:.*]] = "handshake.mux"(%[[VAL_46:.*]]#5, %[[VAL_47:.*]], %[[VAL_43]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_48:.*]]:2 = "handshake.fork"(%[[VAL_45]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_49:.*]] = "handshake.mux"(%[[VAL_46]]#4, %[[VAL_50:.*]], %[[VAL_44]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_51:.*]] = "handshake.mux"(%[[VAL_46]]#3, %[[VAL_52:.*]], %[[VAL_38]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_53:.*]] = "handshake.mux"(%[[VAL_46]]#2, %[[VAL_54:.*]], %[[VAL_39]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_55:.*]] = "handshake.mux"(%[[VAL_46]]#1, %[[VAL_56:.*]], %[[VAL_40]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_57:.*]]:2 = "handshake.control_merge"(%[[VAL_58:.*]], %[[VAL_41]]) {control = true} : (none, none) -> (none, index)
|
||||
// CHECK: %[[VAL_46]]:6 = "handshake.fork"(%[[VAL_57]]#1) {control = false} : (index) -> (index, index, index, index, index, index)
|
||||
// CHECK: %[[VAL_59:.*]] = "handshake.mux"(%[[VAL_46]]#0, %[[VAL_60:.*]], %[[VAL_42]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_61:.*]]:2 = "handshake.fork"(%[[VAL_59]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_62:.*]] = cmpi "slt", %[[VAL_61]]#1, %[[VAL_48]]#1 : index
|
||||
// CHECK: %[[VAL_63:.*]]:7 = "handshake.fork"(%[[VAL_62]]) {control = false} : (i1) -> (i1, i1, i1, i1, i1, i1, i1)
|
||||
// CHECK: %[[VAL_64:.*]], %[[VAL_65:.*]] = "handshake.conditional_branch"(%[[VAL_63]]#6, %[[VAL_48]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_65]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_66:.*]], %[[VAL_67:.*]] = "handshake.conditional_branch"(%[[VAL_63]]#5, %[[VAL_49]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_67]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_68:.*]], %[[VAL_69:.*]] = "handshake.conditional_branch"(%[[VAL_63]]#4, %[[VAL_51]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: %[[VAL_70:.*]], %[[VAL_71:.*]] = "handshake.conditional_branch"(%[[VAL_63]]#3, %[[VAL_53]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: %[[VAL_72:.*]], %[[VAL_73:.*]] = "handshake.conditional_branch"(%[[VAL_63]]#2, %[[VAL_55]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: %[[VAL_74:.*]], %[[VAL_75:.*]] = "handshake.conditional_branch"(%[[VAL_63]]#1, %[[VAL_57]]#0) {control = true} : (i1, none) -> (none, none)
|
||||
// CHECK: %[[VAL_76:.*]], %[[VAL_77:.*]] = "handshake.conditional_branch"(%[[VAL_63]]#0, %[[VAL_61]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_77]]) : (index) -> ()
|
||||
// CHECK: "handshake.terminator"()[^bb4, ^bb5] : () -> ()
|
||||
// CHECK: ^bb4:
|
||||
// CHECK: %[[VAL_78:.*]] = "handshake.merge"(%[[VAL_76]]) : (index) -> index
|
||||
// CHECK: %[[VAL_79:.*]] = "handshake.merge"(%[[VAL_66]]) : (index) -> index
|
||||
// CHECK: %[[VAL_80:.*]]:2 = "handshake.fork"(%[[VAL_79]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_81:.*]] = "handshake.merge"(%[[VAL_64]]) : (index) -> index
|
||||
// CHECK: %[[VAL_82:.*]] = "handshake.merge"(%[[VAL_68]]) : (index) -> index
|
||||
// CHECK: %[[VAL_83:.*]] = "handshake.merge"(%[[VAL_70]]) : (index) -> index
|
||||
// CHECK: %[[VAL_84:.*]] = "handshake.merge"(%[[VAL_72]]) : (index) -> index
|
||||
// CHECK: %[[VAL_85:.*]]:2 = "handshake.control_merge"(%[[VAL_74]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_85]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_86:.*]] = addi %[[VAL_78]], %[[VAL_80]]#1 : index
|
||||
// CHECK: %[[VAL_50]] = "handshake.branch"(%[[VAL_80]]#0) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_47]] = "handshake.branch"(%[[VAL_81]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_52]] = "handshake.branch"(%[[VAL_82]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_54]] = "handshake.branch"(%[[VAL_83]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_56]] = "handshake.branch"(%[[VAL_84]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_58]] = "handshake.branch"(%[[VAL_85]]#0) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_60]] = "handshake.branch"(%[[VAL_86]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb3] : () -> ()
|
||||
// CHECK: ^bb5:
|
||||
// CHECK: %[[VAL_87:.*]] = "handshake.merge"(%[[VAL_69]]) : (index) -> index
|
||||
// CHECK: %[[VAL_88:.*]] = "handshake.merge"(%[[VAL_71]]) : (index) -> index
|
||||
// CHECK: %[[VAL_89:.*]]:2 = "handshake.fork"(%[[VAL_88]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_90:.*]] = "handshake.merge"(%[[VAL_73]]) : (index) -> index
|
||||
// CHECK: %[[VAL_91:.*]]:2 = "handshake.control_merge"(%[[VAL_75]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_91]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_92:.*]] = addi %[[VAL_87]], %[[VAL_89]]#1 : index
|
||||
// CHECK: %[[VAL_14]] = "handshake.branch"(%[[VAL_89]]#0) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_11]] = "handshake.branch"(%[[VAL_90]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_16]] = "handshake.branch"(%[[VAL_91]]#0) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_18]] = "handshake.branch"(%[[VAL_92]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb1] : () -> ()
|
||||
// CHECK: ^bb6:
|
||||
// CHECK: %[[VAL_93:.*]]:2 = "handshake.control_merge"(%[[VAL_27]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_93]]#1) : (index) -> ()
|
||||
// CHECK: handshake.return %[[VAL_93]]#0 : none
|
||||
// CHECK: }
|
||||
// CHECK: }
|
||||
%c0 = constant 0 : index
|
||||
%c42 = constant 42 : index
|
||||
%c1 = constant 1 : index
|
||||
br ^bb1(%c0 : index)
|
||||
^bb1(%0: index): // 2 preds: ^bb0, ^bb5
|
||||
%1 = cmpi "slt", %0, %c42 : index
|
||||
cond_br %1, ^bb2, ^bb6
|
||||
^bb2: // pred: ^bb1
|
||||
%c7 = constant 7 : index
|
||||
%c56 = constant 56 : index
|
||||
%c2 = constant 2 : index
|
||||
br ^bb3(%c7 : index)
|
||||
^bb3(%2: index): // 2 preds: ^bb2, ^bb4
|
||||
%3 = cmpi "slt", %2, %c56 : index
|
||||
cond_br %3, ^bb4, ^bb5
|
||||
^bb4: // pred: ^bb3
|
||||
%4 = addi %2, %c2 : index
|
||||
br ^bb3(%4 : index)
|
||||
^bb5: // pred: ^bb3
|
||||
%5 = addi %0, %c1 : index
|
||||
br ^bb1(%5 : index)
|
||||
^bb6: // pred: ^bb1
|
||||
return
|
||||
}
|
|
@ -0,0 +1,210 @@
|
|||
// NOTE: Assertions have been autogenerated by utils/update_mlir_test_checks.py
|
||||
// RUN: circt-opt -create-dataflow %s | FileCheck %s
|
||||
func @more_imperfectly_nested_loops() {
|
||||
// CHECK: module {
|
||||
|
||||
// CHECK-LABEL: handshake.func @more_imperfectly_nested_loops(
|
||||
// CHECK-SAME: %[[VAL_0:.*]]: none, ...) -> none {
|
||||
// CHECK: %[[VAL_1:.*]]:4 = "handshake.fork"(%[[VAL_0]]) {control = true} : (none) -> (none, none, none, none)
|
||||
// CHECK: %[[VAL_2:.*]] = "handshake.constant"(%[[VAL_1]]#2) {value = 0 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_3:.*]] = "handshake.constant"(%[[VAL_1]]#1) {value = 42 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_4:.*]] = "handshake.constant"(%[[VAL_1]]#0) {value = 1 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_5:.*]] = "handshake.branch"(%[[VAL_1]]#3) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_6:.*]] = "handshake.branch"(%[[VAL_2]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_7:.*]] = "handshake.branch"(%[[VAL_3]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_8:.*]] = "handshake.branch"(%[[VAL_4]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb1] : () -> ()
|
||||
// CHECK: ^bb1:
|
||||
// CHECK: %[[VAL_9:.*]] = "handshake.mux"(%[[VAL_10:.*]]#2, %[[VAL_11:.*]], %[[VAL_7]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_12:.*]]:2 = "handshake.fork"(%[[VAL_9]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_13:.*]] = "handshake.mux"(%[[VAL_10]]#1, %[[VAL_14:.*]], %[[VAL_8]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_15:.*]]:2 = "handshake.control_merge"(%[[VAL_16:.*]], %[[VAL_5]]) {control = true} : (none, none) -> (none, index)
|
||||
// CHECK: %[[VAL_10]]:3 = "handshake.fork"(%[[VAL_15]]#1) {control = false} : (index) -> (index, index, index)
|
||||
// CHECK: %[[VAL_17:.*]] = "handshake.mux"(%[[VAL_10]]#0, %[[VAL_18:.*]], %[[VAL_6]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_19:.*]]:2 = "handshake.fork"(%[[VAL_17]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_20:.*]] = cmpi "slt", %[[VAL_19]]#1, %[[VAL_12]]#1 : index
|
||||
// CHECK: %[[VAL_21:.*]]:4 = "handshake.fork"(%[[VAL_20]]) {control = false} : (i1) -> (i1, i1, i1, i1)
|
||||
// CHECK: %[[VAL_22:.*]], %[[VAL_23:.*]] = "handshake.conditional_branch"(%[[VAL_21]]#3, %[[VAL_12]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_23]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_24:.*]], %[[VAL_25:.*]] = "handshake.conditional_branch"(%[[VAL_21]]#2, %[[VAL_13]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_25]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_26:.*]], %[[VAL_27:.*]] = "handshake.conditional_branch"(%[[VAL_21]]#1, %[[VAL_15]]#0) {control = true} : (i1, none) -> (none, none)
|
||||
// CHECK: %[[VAL_28:.*]], %[[VAL_29:.*]] = "handshake.conditional_branch"(%[[VAL_21]]#0, %[[VAL_19]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_29]]) : (index) -> ()
|
||||
// CHECK: "handshake.terminator"()[^bb2, ^bb9] : () -> ()
|
||||
// CHECK: ^bb2:
|
||||
// CHECK: %[[VAL_30:.*]] = "handshake.merge"(%[[VAL_28]]) : (index) -> index
|
||||
// CHECK: %[[VAL_31:.*]] = "handshake.merge"(%[[VAL_24]]) : (index) -> index
|
||||
// CHECK: %[[VAL_32:.*]] = "handshake.merge"(%[[VAL_22]]) : (index) -> index
|
||||
// CHECK: %[[VAL_33:.*]]:2 = "handshake.control_merge"(%[[VAL_26]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: %[[VAL_34:.*]]:4 = "handshake.fork"(%[[VAL_33]]#0) {control = true} : (none) -> (none, none, none, none)
|
||||
// CHECK: "handshake.sink"(%[[VAL_33]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_35:.*]] = "handshake.constant"(%[[VAL_34]]#2) {value = 7 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_36:.*]] = "handshake.constant"(%[[VAL_34]]#1) {value = 56 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_37:.*]] = "handshake.constant"(%[[VAL_34]]#0) {value = 2 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_38:.*]] = "handshake.branch"(%[[VAL_30]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_39:.*]] = "handshake.branch"(%[[VAL_31]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_40:.*]] = "handshake.branch"(%[[VAL_32]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_41:.*]] = "handshake.branch"(%[[VAL_34]]#3) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_42:.*]] = "handshake.branch"(%[[VAL_35]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_43:.*]] = "handshake.branch"(%[[VAL_36]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_44:.*]] = "handshake.branch"(%[[VAL_37]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb3] : () -> ()
|
||||
// CHECK: ^bb3:
|
||||
// CHECK: %[[VAL_45:.*]] = "handshake.mux"(%[[VAL_46:.*]]#5, %[[VAL_47:.*]], %[[VAL_43]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_48:.*]]:2 = "handshake.fork"(%[[VAL_45]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_49:.*]] = "handshake.mux"(%[[VAL_46]]#4, %[[VAL_50:.*]], %[[VAL_44]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_51:.*]] = "handshake.mux"(%[[VAL_46]]#3, %[[VAL_52:.*]], %[[VAL_38]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_53:.*]] = "handshake.mux"(%[[VAL_46]]#2, %[[VAL_54:.*]], %[[VAL_39]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_55:.*]] = "handshake.mux"(%[[VAL_46]]#1, %[[VAL_56:.*]], %[[VAL_40]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_57:.*]]:2 = "handshake.control_merge"(%[[VAL_58:.*]], %[[VAL_41]]) {control = true} : (none, none) -> (none, index)
|
||||
// CHECK: %[[VAL_46]]:6 = "handshake.fork"(%[[VAL_57]]#1) {control = false} : (index) -> (index, index, index, index, index, index)
|
||||
// CHECK: %[[VAL_59:.*]] = "handshake.mux"(%[[VAL_46]]#0, %[[VAL_60:.*]], %[[VAL_42]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_61:.*]]:2 = "handshake.fork"(%[[VAL_59]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_62:.*]] = cmpi "slt", %[[VAL_61]]#1, %[[VAL_48]]#1 : index
|
||||
// CHECK: %[[VAL_63:.*]]:7 = "handshake.fork"(%[[VAL_62]]) {control = false} : (i1) -> (i1, i1, i1, i1, i1, i1, i1)
|
||||
// CHECK: %[[VAL_64:.*]], %[[VAL_65:.*]] = "handshake.conditional_branch"(%[[VAL_63]]#6, %[[VAL_48]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_65]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_66:.*]], %[[VAL_67:.*]] = "handshake.conditional_branch"(%[[VAL_63]]#5, %[[VAL_49]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_67]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_68:.*]], %[[VAL_69:.*]] = "handshake.conditional_branch"(%[[VAL_63]]#4, %[[VAL_51]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: %[[VAL_70:.*]], %[[VAL_71:.*]] = "handshake.conditional_branch"(%[[VAL_63]]#3, %[[VAL_53]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: %[[VAL_72:.*]], %[[VAL_73:.*]] = "handshake.conditional_branch"(%[[VAL_63]]#2, %[[VAL_55]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: %[[VAL_74:.*]], %[[VAL_75:.*]] = "handshake.conditional_branch"(%[[VAL_63]]#1, %[[VAL_57]]#0) {control = true} : (i1, none) -> (none, none)
|
||||
// CHECK: %[[VAL_76:.*]], %[[VAL_77:.*]] = "handshake.conditional_branch"(%[[VAL_63]]#0, %[[VAL_61]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_77]]) : (index) -> ()
|
||||
// CHECK: "handshake.terminator"()[^bb4, ^bb5] : () -> ()
|
||||
// CHECK: ^bb4:
|
||||
// CHECK: %[[VAL_78:.*]] = "handshake.merge"(%[[VAL_76]]) : (index) -> index
|
||||
// CHECK: %[[VAL_79:.*]] = "handshake.merge"(%[[VAL_66]]) : (index) -> index
|
||||
// CHECK: %[[VAL_80:.*]]:2 = "handshake.fork"(%[[VAL_79]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_81:.*]] = "handshake.merge"(%[[VAL_64]]) : (index) -> index
|
||||
// CHECK: %[[VAL_82:.*]] = "handshake.merge"(%[[VAL_68]]) : (index) -> index
|
||||
// CHECK: %[[VAL_83:.*]] = "handshake.merge"(%[[VAL_70]]) : (index) -> index
|
||||
// CHECK: %[[VAL_84:.*]] = "handshake.merge"(%[[VAL_72]]) : (index) -> index
|
||||
// CHECK: %[[VAL_85:.*]]:2 = "handshake.control_merge"(%[[VAL_74]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_85]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_86:.*]] = addi %[[VAL_78]], %[[VAL_80]]#1 : index
|
||||
// CHECK: %[[VAL_50]] = "handshake.branch"(%[[VAL_80]]#0) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_47]] = "handshake.branch"(%[[VAL_81]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_52]] = "handshake.branch"(%[[VAL_82]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_54]] = "handshake.branch"(%[[VAL_83]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_56]] = "handshake.branch"(%[[VAL_84]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_58]] = "handshake.branch"(%[[VAL_85]]#0) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_60]] = "handshake.branch"(%[[VAL_86]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb3] : () -> ()
|
||||
// CHECK: ^bb5:
|
||||
// CHECK: %[[VAL_87:.*]] = "handshake.merge"(%[[VAL_69]]) : (index) -> index
|
||||
// CHECK: %[[VAL_88:.*]] = "handshake.merge"(%[[VAL_71]]) : (index) -> index
|
||||
// CHECK: %[[VAL_89:.*]] = "handshake.merge"(%[[VAL_73]]) : (index) -> index
|
||||
// CHECK: %[[VAL_90:.*]]:2 = "handshake.control_merge"(%[[VAL_75]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: %[[VAL_91:.*]]:4 = "handshake.fork"(%[[VAL_90]]#0) {control = true} : (none) -> (none, none, none, none)
|
||||
// CHECK: "handshake.sink"(%[[VAL_90]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_92:.*]] = "handshake.constant"(%[[VAL_91]]#2) {value = 18 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_93:.*]] = "handshake.constant"(%[[VAL_91]]#1) {value = 37 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_94:.*]] = "handshake.constant"(%[[VAL_91]]#0) {value = 3 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_95:.*]] = "handshake.branch"(%[[VAL_87]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_96:.*]] = "handshake.branch"(%[[VAL_88]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_97:.*]] = "handshake.branch"(%[[VAL_89]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_98:.*]] = "handshake.branch"(%[[VAL_91]]#3) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_99:.*]] = "handshake.branch"(%[[VAL_92]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_100:.*]] = "handshake.branch"(%[[VAL_93]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_101:.*]] = "handshake.branch"(%[[VAL_94]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb6] : () -> ()
|
||||
// CHECK: ^bb6:
|
||||
// CHECK: %[[VAL_102:.*]] = "handshake.mux"(%[[VAL_103:.*]]#5, %[[VAL_104:.*]], %[[VAL_100]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_105:.*]]:2 = "handshake.fork"(%[[VAL_102]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_106:.*]] = "handshake.mux"(%[[VAL_103]]#4, %[[VAL_107:.*]], %[[VAL_101]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_108:.*]] = "handshake.mux"(%[[VAL_103]]#3, %[[VAL_109:.*]], %[[VAL_95]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_110:.*]] = "handshake.mux"(%[[VAL_103]]#2, %[[VAL_111:.*]], %[[VAL_96]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_112:.*]] = "handshake.mux"(%[[VAL_103]]#1, %[[VAL_113:.*]], %[[VAL_97]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_114:.*]]:2 = "handshake.control_merge"(%[[VAL_115:.*]], %[[VAL_98]]) {control = true} : (none, none) -> (none, index)
|
||||
// CHECK: %[[VAL_103]]:6 = "handshake.fork"(%[[VAL_114]]#1) {control = false} : (index) -> (index, index, index, index, index, index)
|
||||
// CHECK: %[[VAL_116:.*]] = "handshake.mux"(%[[VAL_103]]#0, %[[VAL_117:.*]], %[[VAL_99]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_118:.*]]:2 = "handshake.fork"(%[[VAL_116]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_119:.*]] = cmpi "slt", %[[VAL_118]]#1, %[[VAL_105]]#1 : index
|
||||
// CHECK: %[[VAL_120:.*]]:7 = "handshake.fork"(%[[VAL_119]]) {control = false} : (i1) -> (i1, i1, i1, i1, i1, i1, i1)
|
||||
// CHECK: %[[VAL_121:.*]], %[[VAL_122:.*]] = "handshake.conditional_branch"(%[[VAL_120]]#6, %[[VAL_105]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_122]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_123:.*]], %[[VAL_124:.*]] = "handshake.conditional_branch"(%[[VAL_120]]#5, %[[VAL_106]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_124]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_125:.*]], %[[VAL_126:.*]] = "handshake.conditional_branch"(%[[VAL_120]]#4, %[[VAL_108]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: %[[VAL_127:.*]], %[[VAL_128:.*]] = "handshake.conditional_branch"(%[[VAL_120]]#3, %[[VAL_110]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: %[[VAL_129:.*]], %[[VAL_130:.*]] = "handshake.conditional_branch"(%[[VAL_120]]#2, %[[VAL_112]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: %[[VAL_131:.*]], %[[VAL_132:.*]] = "handshake.conditional_branch"(%[[VAL_120]]#1, %[[VAL_114]]#0) {control = true} : (i1, none) -> (none, none)
|
||||
// CHECK: %[[VAL_133:.*]], %[[VAL_134:.*]] = "handshake.conditional_branch"(%[[VAL_120]]#0, %[[VAL_118]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_134]]) : (index) -> ()
|
||||
// CHECK: "handshake.terminator"()[^bb7, ^bb8] : () -> ()
|
||||
// CHECK: ^bb7:
|
||||
// CHECK: %[[VAL_135:.*]] = "handshake.merge"(%[[VAL_133]]) : (index) -> index
|
||||
// CHECK: %[[VAL_136:.*]] = "handshake.merge"(%[[VAL_123]]) : (index) -> index
|
||||
// CHECK: %[[VAL_137:.*]]:2 = "handshake.fork"(%[[VAL_136]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_138:.*]] = "handshake.merge"(%[[VAL_121]]) : (index) -> index
|
||||
// CHECK: %[[VAL_139:.*]] = "handshake.merge"(%[[VAL_125]]) : (index) -> index
|
||||
// CHECK: %[[VAL_140:.*]] = "handshake.merge"(%[[VAL_127]]) : (index) -> index
|
||||
// CHECK: %[[VAL_141:.*]] = "handshake.merge"(%[[VAL_129]]) : (index) -> index
|
||||
// CHECK: %[[VAL_142:.*]]:2 = "handshake.control_merge"(%[[VAL_131]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_142]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_143:.*]] = addi %[[VAL_135]], %[[VAL_137]]#1 : index
|
||||
// CHECK: %[[VAL_107]] = "handshake.branch"(%[[VAL_137]]#0) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_104]] = "handshake.branch"(%[[VAL_138]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_109]] = "handshake.branch"(%[[VAL_139]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_111]] = "handshake.branch"(%[[VAL_140]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_113]] = "handshake.branch"(%[[VAL_141]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_115]] = "handshake.branch"(%[[VAL_142]]#0) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_117]] = "handshake.branch"(%[[VAL_143]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb6] : () -> ()
|
||||
// CHECK: ^bb8:
|
||||
// CHECK: %[[VAL_144:.*]] = "handshake.merge"(%[[VAL_126]]) : (index) -> index
|
||||
// CHECK: %[[VAL_145:.*]] = "handshake.merge"(%[[VAL_128]]) : (index) -> index
|
||||
// CHECK: %[[VAL_146:.*]]:2 = "handshake.fork"(%[[VAL_145]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_147:.*]] = "handshake.merge"(%[[VAL_130]]) : (index) -> index
|
||||
// CHECK: %[[VAL_148:.*]]:2 = "handshake.control_merge"(%[[VAL_132]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_148]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_149:.*]] = addi %[[VAL_144]], %[[VAL_146]]#1 : index
|
||||
// CHECK: %[[VAL_14]] = "handshake.branch"(%[[VAL_146]]#0) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_11]] = "handshake.branch"(%[[VAL_147]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_16]] = "handshake.branch"(%[[VAL_148]]#0) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_18]] = "handshake.branch"(%[[VAL_149]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb1] : () -> ()
|
||||
// CHECK: ^bb9:
|
||||
// CHECK: %[[VAL_150:.*]]:2 = "handshake.control_merge"(%[[VAL_27]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_150]]#1) : (index) -> ()
|
||||
// CHECK: handshake.return %[[VAL_150]]#0 : none
|
||||
// CHECK: }
|
||||
// CHECK: }
|
||||
%c0 = constant 0 : index
|
||||
%c42 = constant 42 : index
|
||||
%c1 = constant 1 : index
|
||||
br ^bb1(%c0 : index)
|
||||
^bb1(%0: index): // 2 preds: ^bb0, ^bb8
|
||||
%1 = cmpi "slt", %0, %c42 : index
|
||||
cond_br %1, ^bb2, ^bb9
|
||||
^bb2: // pred: ^bb1
|
||||
%c7 = constant 7 : index
|
||||
%c56 = constant 56 : index
|
||||
%c2 = constant 2 : index
|
||||
br ^bb3(%c7 : index)
|
||||
^bb3(%2: index): // 2 preds: ^bb2, ^bb4
|
||||
%3 = cmpi "slt", %2, %c56 : index
|
||||
cond_br %3, ^bb4, ^bb5
|
||||
^bb4: // pred: ^bb3
|
||||
%4 = addi %2, %c2 : index
|
||||
br ^bb3(%4 : index)
|
||||
^bb5: // pred: ^bb3
|
||||
%c18 = constant 18 : index
|
||||
%c37 = constant 37 : index
|
||||
%c3 = constant 3 : index
|
||||
br ^bb6(%c18 : index)
|
||||
^bb6(%5: index): // 2 preds: ^bb5, ^bb7
|
||||
%6 = cmpi "slt", %5, %c37 : index
|
||||
cond_br %6, ^bb7, ^bb8
|
||||
^bb7: // pred: ^bb6
|
||||
%7 = addi %5, %c3 : index
|
||||
br ^bb6(%7 : index)
|
||||
^bb8: // pred: ^bb6
|
||||
%8 = addi %0, %c1 : index
|
||||
br ^bb1(%8 : index)
|
||||
^bb9: // pred: ^bb1
|
||||
return
|
||||
}
|
|
@ -0,0 +1,136 @@
|
|||
// NOTE: Assertions have been autogenerated by utils/update_mlir_test_checks.py
|
||||
// RUN: circt-opt -create-dataflow %s | FileCheck %s
|
||||
func @affine_apply_loops_shorthand(%arg0: index) {
|
||||
// CHECK: module {
|
||||
|
||||
// CHECK-LABEL: handshake.func @affine_apply_loops_shorthand(
|
||||
// CHECK-SAME: %[[VAL_0:.*]]: index, %[[VAL_1:.*]]: none, ...) -> none {
|
||||
// CHECK: %[[VAL_2:.*]] = "handshake.merge"(%[[VAL_0]]) : (index) -> index
|
||||
// CHECK: %[[VAL_3:.*]]:3 = "handshake.fork"(%[[VAL_1]]) {control = true} : (none) -> (none, none, none)
|
||||
// CHECK: %[[VAL_4:.*]] = "handshake.constant"(%[[VAL_3]]#1) {value = 0 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_5:.*]] = "handshake.constant"(%[[VAL_3]]#0) {value = 1 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_6:.*]] = "handshake.branch"(%[[VAL_2]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_7:.*]] = "handshake.branch"(%[[VAL_3]]#2) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_8:.*]] = "handshake.branch"(%[[VAL_4]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_9:.*]] = "handshake.branch"(%[[VAL_5]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb1] : () -> ()
|
||||
// CHECK: ^bb1:
|
||||
// CHECK: %[[VAL_10:.*]] = "handshake.mux"(%[[VAL_11:.*]]#2, %[[VAL_12:.*]], %[[VAL_6]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_13:.*]]:2 = "handshake.fork"(%[[VAL_10]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_14:.*]] = "handshake.mux"(%[[VAL_11]]#1, %[[VAL_15:.*]], %[[VAL_9]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_16:.*]]:2 = "handshake.control_merge"(%[[VAL_17:.*]], %[[VAL_7]]) {control = true} : (none, none) -> (none, index)
|
||||
// CHECK: %[[VAL_11]]:3 = "handshake.fork"(%[[VAL_16]]#1) {control = false} : (index) -> (index, index, index)
|
||||
// CHECK: %[[VAL_18:.*]] = "handshake.mux"(%[[VAL_11]]#0, %[[VAL_19:.*]], %[[VAL_8]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_20:.*]]:2 = "handshake.fork"(%[[VAL_18]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_21:.*]] = cmpi "slt", %[[VAL_20]]#1, %[[VAL_13]]#1 : index
|
||||
// CHECK: %[[VAL_22:.*]]:4 = "handshake.fork"(%[[VAL_21]]) {control = false} : (i1) -> (i1, i1, i1, i1)
|
||||
// CHECK: %[[VAL_23:.*]], %[[VAL_24:.*]] = "handshake.conditional_branch"(%[[VAL_22]]#3, %[[VAL_13]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_24]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_25:.*]], %[[VAL_26:.*]] = "handshake.conditional_branch"(%[[VAL_22]]#2, %[[VAL_14]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_26]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_27:.*]], %[[VAL_28:.*]] = "handshake.conditional_branch"(%[[VAL_22]]#1, %[[VAL_16]]#0) {control = true} : (i1, none) -> (none, none)
|
||||
// CHECK: %[[VAL_29:.*]], %[[VAL_30:.*]] = "handshake.conditional_branch"(%[[VAL_22]]#0, %[[VAL_20]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_30]]) : (index) -> ()
|
||||
// CHECK: "handshake.terminator"()[^bb2, ^bb6] : () -> ()
|
||||
// CHECK: ^bb2:
|
||||
// CHECK: %[[VAL_31:.*]] = "handshake.merge"(%[[VAL_29]]) : (index) -> index
|
||||
// CHECK: %[[VAL_32:.*]]:2 = "handshake.fork"(%[[VAL_31]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_33:.*]] = "handshake.merge"(%[[VAL_25]]) : (index) -> index
|
||||
// CHECK: %[[VAL_34:.*]] = "handshake.merge"(%[[VAL_23]]) : (index) -> index
|
||||
// CHECK: %[[VAL_35:.*]]:2 = "handshake.control_merge"(%[[VAL_27]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: %[[VAL_36:.*]]:3 = "handshake.fork"(%[[VAL_35]]#0) {control = true} : (none) -> (none, none, none)
|
||||
// CHECK: "handshake.sink"(%[[VAL_35]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_37:.*]] = "handshake.constant"(%[[VAL_36]]#1) {value = 42 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_38:.*]] = "handshake.constant"(%[[VAL_36]]#0) {value = 1 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_39:.*]] = "handshake.branch"(%[[VAL_32]]#1) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_40:.*]] = "handshake.branch"(%[[VAL_32]]#0) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_41:.*]] = "handshake.branch"(%[[VAL_33]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_42:.*]] = "handshake.branch"(%[[VAL_34]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_43:.*]] = "handshake.branch"(%[[VAL_36]]#2) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_44:.*]] = "handshake.branch"(%[[VAL_37]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_45:.*]] = "handshake.branch"(%[[VAL_38]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb3] : () -> ()
|
||||
// CHECK: ^bb3:
|
||||
// CHECK: %[[VAL_46:.*]] = "handshake.mux"(%[[VAL_47:.*]]#5, %[[VAL_48:.*]], %[[VAL_44]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_49:.*]]:2 = "handshake.fork"(%[[VAL_46]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_50:.*]] = "handshake.mux"(%[[VAL_47]]#4, %[[VAL_51:.*]], %[[VAL_45]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_52:.*]] = "handshake.mux"(%[[VAL_47]]#3, %[[VAL_53:.*]], %[[VAL_40]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_54:.*]] = "handshake.mux"(%[[VAL_47]]#2, %[[VAL_55:.*]], %[[VAL_41]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_56:.*]] = "handshake.mux"(%[[VAL_47]]#1, %[[VAL_57:.*]], %[[VAL_42]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_58:.*]]:2 = "handshake.control_merge"(%[[VAL_59:.*]], %[[VAL_43]]) {control = true} : (none, none) -> (none, index)
|
||||
// CHECK: %[[VAL_47]]:6 = "handshake.fork"(%[[VAL_58]]#1) {control = false} : (index) -> (index, index, index, index, index, index)
|
||||
// CHECK: %[[VAL_60:.*]] = "handshake.mux"(%[[VAL_47]]#0, %[[VAL_61:.*]], %[[VAL_39]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_62:.*]]:2 = "handshake.fork"(%[[VAL_60]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_63:.*]] = cmpi "slt", %[[VAL_62]]#1, %[[VAL_49]]#1 : index
|
||||
// CHECK: %[[VAL_64:.*]]:7 = "handshake.fork"(%[[VAL_63]]) {control = false} : (i1) -> (i1, i1, i1, i1, i1, i1, i1)
|
||||
// CHECK: %[[VAL_65:.*]], %[[VAL_66:.*]] = "handshake.conditional_branch"(%[[VAL_64]]#6, %[[VAL_49]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_66]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_67:.*]], %[[VAL_68:.*]] = "handshake.conditional_branch"(%[[VAL_64]]#5, %[[VAL_50]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_68]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_69:.*]], %[[VAL_70:.*]] = "handshake.conditional_branch"(%[[VAL_64]]#4, %[[VAL_52]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: %[[VAL_71:.*]], %[[VAL_72:.*]] = "handshake.conditional_branch"(%[[VAL_64]]#3, %[[VAL_54]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: %[[VAL_73:.*]], %[[VAL_74:.*]] = "handshake.conditional_branch"(%[[VAL_64]]#2, %[[VAL_56]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: %[[VAL_75:.*]], %[[VAL_76:.*]] = "handshake.conditional_branch"(%[[VAL_64]]#1, %[[VAL_58]]#0) {control = true} : (i1, none) -> (none, none)
|
||||
// CHECK: %[[VAL_77:.*]], %[[VAL_78:.*]] = "handshake.conditional_branch"(%[[VAL_64]]#0, %[[VAL_62]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_78]]) : (index) -> ()
|
||||
// CHECK: "handshake.terminator"()[^bb4, ^bb5] : () -> ()
|
||||
// CHECK: ^bb4:
|
||||
// CHECK: %[[VAL_79:.*]] = "handshake.merge"(%[[VAL_77]]) : (index) -> index
|
||||
// CHECK: %[[VAL_80:.*]] = "handshake.merge"(%[[VAL_67]]) : (index) -> index
|
||||
// CHECK: %[[VAL_81:.*]]:2 = "handshake.fork"(%[[VAL_80]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_82:.*]] = "handshake.merge"(%[[VAL_65]]) : (index) -> index
|
||||
// CHECK: %[[VAL_83:.*]] = "handshake.merge"(%[[VAL_69]]) : (index) -> index
|
||||
// CHECK: %[[VAL_84:.*]] = "handshake.merge"(%[[VAL_71]]) : (index) -> index
|
||||
// CHECK: %[[VAL_85:.*]] = "handshake.merge"(%[[VAL_73]]) : (index) -> index
|
||||
// CHECK: %[[VAL_86:.*]]:2 = "handshake.control_merge"(%[[VAL_75]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_86]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_87:.*]] = addi %[[VAL_79]], %[[VAL_81]]#1 : index
|
||||
// CHECK: %[[VAL_51]] = "handshake.branch"(%[[VAL_81]]#0) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_48]] = "handshake.branch"(%[[VAL_82]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_53]] = "handshake.branch"(%[[VAL_83]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_55]] = "handshake.branch"(%[[VAL_84]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_57]] = "handshake.branch"(%[[VAL_85]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_59]] = "handshake.branch"(%[[VAL_86]]#0) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_61]] = "handshake.branch"(%[[VAL_87]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb3] : () -> ()
|
||||
// CHECK: ^bb5:
|
||||
// CHECK: %[[VAL_88:.*]] = "handshake.merge"(%[[VAL_70]]) : (index) -> index
|
||||
// CHECK: %[[VAL_89:.*]] = "handshake.merge"(%[[VAL_72]]) : (index) -> index
|
||||
// CHECK: %[[VAL_90:.*]]:2 = "handshake.fork"(%[[VAL_89]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_91:.*]] = "handshake.merge"(%[[VAL_74]]) : (index) -> index
|
||||
// CHECK: %[[VAL_92:.*]]:2 = "handshake.control_merge"(%[[VAL_76]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_92]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_93:.*]] = addi %[[VAL_88]], %[[VAL_90]]#1 : index
|
||||
// CHECK: %[[VAL_15]] = "handshake.branch"(%[[VAL_90]]#0) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_12]] = "handshake.branch"(%[[VAL_91]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_17]] = "handshake.branch"(%[[VAL_92]]#0) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_19]] = "handshake.branch"(%[[VAL_93]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb1] : () -> ()
|
||||
// CHECK: ^bb6:
|
||||
// CHECK: %[[VAL_94:.*]]:2 = "handshake.control_merge"(%[[VAL_28]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_94]]#1) : (index) -> ()
|
||||
// CHECK: handshake.return %[[VAL_94]]#0 : none
|
||||
// CHECK: }
|
||||
// CHECK: }
|
||||
%c0 = constant 0 : index
|
||||
%c1 = constant 1 : index
|
||||
br ^bb1(%c0 : index)
|
||||
^bb1(%0: index): // 2 preds: ^bb0, ^bb5
|
||||
%1 = cmpi "slt", %0, %arg0 : index
|
||||
cond_br %1, ^bb2, ^bb6
|
||||
^bb2: // pred: ^bb1
|
||||
%c42 = constant 42 : index
|
||||
%c1_0 = constant 1 : index
|
||||
br ^bb3(%0 : index)
|
||||
^bb3(%2: index): // 2 preds: ^bb2, ^bb4
|
||||
%3 = cmpi "slt", %2, %c42 : index
|
||||
cond_br %3, ^bb4, ^bb5
|
||||
^bb4: // pred: ^bb3
|
||||
%4 = addi %2, %c1_0 : index
|
||||
br ^bb3(%4 : index)
|
||||
^bb5: // pred: ^bb3
|
||||
%5 = addi %0, %c1 : index
|
||||
br ^bb1(%5 : index)
|
||||
^bb6: // pred: ^bb1
|
||||
return
|
||||
}
|
|
@ -0,0 +1,101 @@
|
|||
// NOTE: Assertions have been autogenerated by utils/update_mlir_test_checks.py
|
||||
// RUN: circt-opt -create-dataflow %s | FileCheck %s
|
||||
func @affine_store(%arg0: index) {
|
||||
// CHECK: module {
|
||||
|
||||
// CHECK-LABEL: handshake.func @affine_store(
|
||||
// CHECK-SAME: %[[VAL_0:.*]]: index, %[[VAL_1:.*]]: none, ...) -> none {
|
||||
// CHECK: %[[VAL_2:.*]] = "handshake.memory"(%[[VAL_3:.*]]#0, %[[VAL_3]]#1) {id = 0 : i32, ld_count = 0 : i32, lsq = false, st_count = 1 : i32, type = memref<10xf32>} : (f32, index) -> none
|
||||
// CHECK: %[[VAL_4:.*]] = "handshake.merge"(%[[VAL_0]]) : (index) -> index
|
||||
// CHECK: %[[VAL_5:.*]]:5 = "handshake.fork"(%[[VAL_1]]) {control = true} : (none) -> (none, none, none, none, none)
|
||||
// CHECK: %[[VAL_6:.*]] = "handshake.constant"(%[[VAL_5]]#3) {value = 1.100000e+01 : f32} : (none) -> f32
|
||||
// CHECK: %[[VAL_7:.*]] = "handshake.constant"(%[[VAL_5]]#2) {value = 0 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_8:.*]] = "handshake.constant"(%[[VAL_5]]#1) {value = 10 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_9:.*]] = "handshake.constant"(%[[VAL_5]]#0) {value = 1 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_10:.*]] = "handshake.branch"(%[[VAL_4]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_11:.*]] = "handshake.branch"(%[[VAL_5]]#4) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_12:.*]] = "handshake.branch"(%[[VAL_6]]) {control = false} : (f32) -> f32
|
||||
// CHECK: %[[VAL_13:.*]] = "handshake.branch"(%[[VAL_7]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_14:.*]] = "handshake.branch"(%[[VAL_8]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_15:.*]] = "handshake.branch"(%[[VAL_9]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb1] : () -> ()
|
||||
// CHECK: ^bb1:
|
||||
// CHECK: %[[VAL_16:.*]] = "handshake.mux"(%[[VAL_17:.*]]#4, %[[VAL_18:.*]], %[[VAL_14]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_19:.*]]:2 = "handshake.fork"(%[[VAL_16]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_20:.*]] = "handshake.mux"(%[[VAL_17]]#3, %[[VAL_21:.*]], %[[VAL_10]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_22:.*]] = "handshake.mux"(%[[VAL_17]]#2, %[[VAL_23:.*]], %[[VAL_12]]) : (index, f32, f32) -> f32
|
||||
// CHECK: %[[VAL_24:.*]] = "handshake.mux"(%[[VAL_17]]#1, %[[VAL_25:.*]], %[[VAL_15]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_26:.*]]:2 = "handshake.control_merge"(%[[VAL_27:.*]], %[[VAL_11]]) {control = true} : (none, none) -> (none, index)
|
||||
// CHECK: %[[VAL_17]]:5 = "handshake.fork"(%[[VAL_26]]#1) {control = false} : (index) -> (index, index, index, index, index)
|
||||
// CHECK: %[[VAL_28:.*]] = "handshake.mux"(%[[VAL_17]]#0, %[[VAL_29:.*]], %[[VAL_13]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_30:.*]]:2 = "handshake.fork"(%[[VAL_28]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_31:.*]] = cmpi "slt", %[[VAL_30]]#1, %[[VAL_19]]#1 : index
|
||||
// CHECK: %[[VAL_32:.*]]:6 = "handshake.fork"(%[[VAL_31]]) {control = false} : (i1) -> (i1, i1, i1, i1, i1, i1)
|
||||
// CHECK: %[[VAL_33:.*]], %[[VAL_34:.*]] = "handshake.conditional_branch"(%[[VAL_32]]#5, %[[VAL_19]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_34]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_35:.*]], %[[VAL_36:.*]] = "handshake.conditional_branch"(%[[VAL_32]]#4, %[[VAL_20]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_36]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_37:.*]], %[[VAL_38:.*]] = "handshake.conditional_branch"(%[[VAL_32]]#3, %[[VAL_22]]) {control = false} : (i1, f32) -> (f32, f32)
|
||||
// CHECK: "handshake.sink"(%[[VAL_38]]) : (f32) -> ()
|
||||
// CHECK: %[[VAL_39:.*]], %[[VAL_40:.*]] = "handshake.conditional_branch"(%[[VAL_32]]#2, %[[VAL_24]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_40]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_41:.*]], %[[VAL_42:.*]] = "handshake.conditional_branch"(%[[VAL_32]]#1, %[[VAL_26]]#0) {control = true} : (i1, none) -> (none, none)
|
||||
// CHECK: %[[VAL_43:.*]], %[[VAL_44:.*]] = "handshake.conditional_branch"(%[[VAL_32]]#0, %[[VAL_30]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_44]]) : (index) -> ()
|
||||
// CHECK: "handshake.terminator"()[^bb2, ^bb3] : () -> ()
|
||||
// CHECK: ^bb2:
|
||||
// CHECK: %[[VAL_45:.*]] = "handshake.merge"(%[[VAL_35]]) : (index) -> index
|
||||
// CHECK: %[[VAL_46:.*]]:2 = "handshake.fork"(%[[VAL_45]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_47:.*]] = "handshake.merge"(%[[VAL_43]]) : (index) -> index
|
||||
// CHECK: %[[VAL_48:.*]]:2 = "handshake.fork"(%[[VAL_47]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_49:.*]] = "handshake.merge"(%[[VAL_37]]) : (f32) -> f32
|
||||
// CHECK: %[[VAL_50:.*]]:2 = "handshake.fork"(%[[VAL_49]]) {control = false} : (f32) -> (f32, f32)
|
||||
// CHECK: %[[VAL_51:.*]] = "handshake.merge"(%[[VAL_39]]) : (index) -> index
|
||||
// CHECK: %[[VAL_52:.*]]:2 = "handshake.fork"(%[[VAL_51]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_53:.*]] = "handshake.merge"(%[[VAL_33]]) : (index) -> index
|
||||
// CHECK: %[[VAL_54:.*]]:2 = "handshake.control_merge"(%[[VAL_41]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: %[[VAL_55:.*]]:2 = "handshake.fork"(%[[VAL_54]]#0) {control = true} : (none) -> (none, none)
|
||||
// CHECK: %[[VAL_56:.*]]:3 = "handshake.fork"(%[[VAL_55]]#1) {control = true} : (none) -> (none, none, none)
|
||||
// CHECK: %[[VAL_57:.*]] = "handshake.join"(%[[VAL_56]]#2, %[[VAL_2]]) {control = true} : (none, none) -> none
|
||||
// CHECK: "handshake.sink"(%[[VAL_54]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_58:.*]] = "handshake.constant"(%[[VAL_56]]#1) {value = -1 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_59:.*]] = muli %[[VAL_46]]#1, %[[VAL_58]] : index
|
||||
// CHECK: %[[VAL_60:.*]] = addi %[[VAL_48]]#1, %[[VAL_59]] : index
|
||||
// CHECK: %[[VAL_61:.*]] = "handshake.constant"(%[[VAL_56]]#0) {value = 7 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_62:.*]] = addi %[[VAL_60]], %[[VAL_61]] : index
|
||||
// CHECK: %[[VAL_3]]:2 = "handshake.store"(%[[VAL_50]]#1, %[[VAL_62]], %[[VAL_55]]#0) : (f32, index, none) -> (f32, index)
|
||||
// CHECK: %[[VAL_63:.*]] = addi %[[VAL_48]]#0, %[[VAL_52]]#1 : index
|
||||
// CHECK: %[[VAL_21]] = "handshake.branch"(%[[VAL_46]]#0) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_23]] = "handshake.branch"(%[[VAL_50]]#0) {control = false} : (f32) -> f32
|
||||
// CHECK: %[[VAL_25]] = "handshake.branch"(%[[VAL_52]]#0) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_18]] = "handshake.branch"(%[[VAL_53]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_27]] = "handshake.branch"(%[[VAL_57]]) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_29]] = "handshake.branch"(%[[VAL_63]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb1] : () -> ()
|
||||
// CHECK: ^bb3:
|
||||
// CHECK: %[[VAL_64:.*]]:2 = "handshake.control_merge"(%[[VAL_42]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_64]]#1) : (index) -> ()
|
||||
// CHECK: handshake.return %[[VAL_64]]#0 : none
|
||||
// CHECK: }
|
||||
// CHECK: }
|
||||
%0 = alloc() : memref<10xf32>
|
||||
%cst = constant 1.100000e+01 : f32
|
||||
%c0 = constant 0 : index
|
||||
%c10 = constant 10 : index
|
||||
%c1 = constant 1 : index
|
||||
br ^bb1(%c0 : index)
|
||||
^bb1(%1: index): // 2 preds: ^bb0, ^bb2
|
||||
%2 = cmpi "slt", %1, %c10 : index
|
||||
cond_br %2, ^bb2, ^bb3
|
||||
^bb2: // pred: ^bb1
|
||||
%c-1 = constant -1 : index
|
||||
%3 = muli %arg0, %c-1 : index
|
||||
%4 = addi %1, %3 : index
|
||||
%c7 = constant 7 : index
|
||||
%5 = addi %4, %c7 : index
|
||||
store %cst, %0[%5] : memref<10xf32>
|
||||
%6 = addi %1, %c1 : index
|
||||
br ^bb1(%6 : index)
|
||||
^bb3: // pred: ^bb1
|
||||
return
|
||||
}
|
|
@ -0,0 +1,89 @@
|
|||
// NOTE: Assertions have been autogenerated by utils/update_mlir_test_checks.py
|
||||
// RUN: circt-opt -create-dataflow %s | FileCheck %s
|
||||
func @affine_load(%arg0: index) {
|
||||
// CHECK: module {
|
||||
|
||||
// CHECK-LABEL: handshake.func @affine_load(
|
||||
// CHECK-SAME: %[[VAL_0:.*]]: index, %[[VAL_1:.*]]: none, ...) -> none {
|
||||
// CHECK: %[[VAL_2:.*]]:2 = "handshake.memory"(%[[VAL_3:.*]]) {id = 0 : i32, ld_count = 1 : i32, lsq = false, st_count = 0 : i32, type = memref<10xf32>} : (index) -> (f32, none)
|
||||
// CHECK: %[[VAL_4:.*]] = "handshake.merge"(%[[VAL_0]]) : (index) -> index
|
||||
// CHECK: %[[VAL_5:.*]]:4 = "handshake.fork"(%[[VAL_1]]) {control = true} : (none) -> (none, none, none, none)
|
||||
// CHECK: %[[VAL_6:.*]] = "handshake.constant"(%[[VAL_5]]#2) {value = 0 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_7:.*]] = "handshake.constant"(%[[VAL_5]]#1) {value = 10 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_8:.*]] = "handshake.constant"(%[[VAL_5]]#0) {value = 1 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_9:.*]] = "handshake.branch"(%[[VAL_4]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_10:.*]] = "handshake.branch"(%[[VAL_5]]#3) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_11:.*]] = "handshake.branch"(%[[VAL_6]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_12:.*]] = "handshake.branch"(%[[VAL_7]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_13:.*]] = "handshake.branch"(%[[VAL_8]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb1] : () -> ()
|
||||
// CHECK: ^bb1:
|
||||
// CHECK: %[[VAL_14:.*]] = "handshake.mux"(%[[VAL_15:.*]]#3, %[[VAL_16:.*]], %[[VAL_12]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_17:.*]]:2 = "handshake.fork"(%[[VAL_14]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_18:.*]] = "handshake.mux"(%[[VAL_15]]#2, %[[VAL_19:.*]], %[[VAL_9]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_20:.*]] = "handshake.mux"(%[[VAL_15]]#1, %[[VAL_21:.*]], %[[VAL_13]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_22:.*]]:2 = "handshake.control_merge"(%[[VAL_23:.*]], %[[VAL_10]]) {control = true} : (none, none) -> (none, index)
|
||||
// CHECK: %[[VAL_15]]:4 = "handshake.fork"(%[[VAL_22]]#1) {control = false} : (index) -> (index, index, index, index)
|
||||
// CHECK: %[[VAL_24:.*]] = "handshake.mux"(%[[VAL_15]]#0, %[[VAL_25:.*]], %[[VAL_11]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_26:.*]]:2 = "handshake.fork"(%[[VAL_24]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_27:.*]] = cmpi "slt", %[[VAL_26]]#1, %[[VAL_17]]#1 : index
|
||||
// CHECK: %[[VAL_28:.*]]:5 = "handshake.fork"(%[[VAL_27]]) {control = false} : (i1) -> (i1, i1, i1, i1, i1)
|
||||
// CHECK: %[[VAL_29:.*]], %[[VAL_30:.*]] = "handshake.conditional_branch"(%[[VAL_28]]#4, %[[VAL_17]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_30]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_31:.*]], %[[VAL_32:.*]] = "handshake.conditional_branch"(%[[VAL_28]]#3, %[[VAL_18]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_32]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_33:.*]], %[[VAL_34:.*]] = "handshake.conditional_branch"(%[[VAL_28]]#2, %[[VAL_20]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_34]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_35:.*]], %[[VAL_36:.*]] = "handshake.conditional_branch"(%[[VAL_28]]#1, %[[VAL_22]]#0) {control = true} : (i1, none) -> (none, none)
|
||||
// CHECK: %[[VAL_37:.*]], %[[VAL_38:.*]] = "handshake.conditional_branch"(%[[VAL_28]]#0, %[[VAL_26]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_38]]) : (index) -> ()
|
||||
// CHECK: "handshake.terminator"()[^bb2, ^bb3] : () -> ()
|
||||
// CHECK: ^bb2:
|
||||
// CHECK: %[[VAL_39:.*]] = "handshake.merge"(%[[VAL_37]]) : (index) -> index
|
||||
// CHECK: %[[VAL_40:.*]]:2 = "handshake.fork"(%[[VAL_39]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_41:.*]] = "handshake.merge"(%[[VAL_31]]) : (index) -> index
|
||||
// CHECK: %[[VAL_42:.*]]:2 = "handshake.fork"(%[[VAL_41]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_43:.*]] = "handshake.merge"(%[[VAL_33]]) : (index) -> index
|
||||
// CHECK: %[[VAL_44:.*]]:2 = "handshake.fork"(%[[VAL_43]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_45:.*]] = "handshake.merge"(%[[VAL_29]]) : (index) -> index
|
||||
// CHECK: %[[VAL_46:.*]]:2 = "handshake.control_merge"(%[[VAL_35]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: %[[VAL_47:.*]]:2 = "handshake.fork"(%[[VAL_46]]#0) {control = true} : (none) -> (none, none)
|
||||
// CHECK: %[[VAL_48:.*]]:2 = "handshake.fork"(%[[VAL_47]]#1) {control = true} : (none) -> (none, none)
|
||||
// CHECK: %[[VAL_49:.*]] = "handshake.join"(%[[VAL_48]]#1, %[[VAL_2]]#1) {control = true} : (none, none) -> none
|
||||
// CHECK: "handshake.sink"(%[[VAL_46]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_50:.*]] = addi %[[VAL_40]]#1, %[[VAL_42]]#1 : index
|
||||
// CHECK: %[[VAL_51:.*]] = "handshake.constant"(%[[VAL_48]]#0) {value = 7 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_52:.*]] = addi %[[VAL_50]], %[[VAL_51]] : index
|
||||
// CHECK: %[[VAL_53:.*]], %[[VAL_3]] = "handshake.load"(%[[VAL_52]], %[[VAL_2]]#0, %[[VAL_47]]#0) : (index, f32, none) -> (f32, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_53]]) : (f32) -> ()
|
||||
// CHECK: %[[VAL_54:.*]] = addi %[[VAL_40]]#0, %[[VAL_44]]#1 : index
|
||||
// CHECK: %[[VAL_19]] = "handshake.branch"(%[[VAL_42]]#0) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_21]] = "handshake.branch"(%[[VAL_44]]#0) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_16]] = "handshake.branch"(%[[VAL_45]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_23]] = "handshake.branch"(%[[VAL_49]]) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_25]] = "handshake.branch"(%[[VAL_54]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb1] : () -> ()
|
||||
// CHECK: ^bb3:
|
||||
// CHECK: %[[VAL_55:.*]]:2 = "handshake.control_merge"(%[[VAL_36]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_55]]#1) : (index) -> ()
|
||||
// CHECK: handshake.return %[[VAL_55]]#0 : none
|
||||
// CHECK: }
|
||||
// CHECK: }
|
||||
%0 = alloc() : memref<10xf32>
|
||||
%c0 = constant 0 : index
|
||||
%c10 = constant 10 : index
|
||||
%c1 = constant 1 : index
|
||||
br ^bb1(%c0 : index)
|
||||
^bb1(%1: index): // 2 preds: ^bb0, ^bb2
|
||||
%2 = cmpi "slt", %1, %c10 : index
|
||||
cond_br %2, ^bb2, ^bb3
|
||||
^bb2: // pred: ^bb1
|
||||
%3 = addi %1, %arg0 : index
|
||||
%c7 = constant 7 : index
|
||||
%4 = addi %3, %c7 : index
|
||||
%5 = load %0[%4] : memref<10xf32>
|
||||
%6 = addi %1, %c1 : index
|
||||
br ^bb1(%6 : index)
|
||||
^bb3: // pred: ^bb1
|
||||
return
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
// NOTE: Assertions have been autogenerated by utils/update_mlir_test_checks.py
|
||||
// RUN: circt-opt -create-dataflow %s | FileCheck %s
|
||||
func @affine_apply_ceildiv(%arg0: index) -> index {
|
||||
// CHECK: module {
|
||||
|
||||
// CHECK-LABEL: handshake.func @affine_apply_ceildiv(
|
||||
// CHECK-SAME: %[[VAL_0:.*]]: index, %[[VAL_1:.*]]: none, ...) -> (index, none) {
|
||||
// CHECK: %[[VAL_2:.*]] = "handshake.merge"(%[[VAL_0]]) : (index) -> index
|
||||
// CHECK: %[[VAL_3:.*]]:3 = "handshake.fork"(%[[VAL_2]]) {control = false} : (index) -> (index, index, index)
|
||||
// CHECK: %[[VAL_4:.*]]:4 = "handshake.fork"(%[[VAL_1]]) {control = true} : (none) -> (none, none, none, none)
|
||||
// CHECK: %[[VAL_5:.*]] = "handshake.constant"(%[[VAL_4]]#2) {value = 42 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_6:.*]] = "handshake.constant"(%[[VAL_4]]#1) {value = 0 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_7:.*]]:3 = "handshake.fork"(%[[VAL_6]]) {control = false} : (index) -> (index, index, index)
|
||||
// CHECK: %[[VAL_8:.*]] = "handshake.constant"(%[[VAL_4]]#0) {value = 1 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_9:.*]]:2 = "handshake.fork"(%[[VAL_8]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_10:.*]] = cmpi "sle", %[[VAL_3]]#2, %[[VAL_7]]#0 : index
|
||||
// CHECK: %[[VAL_11:.*]]:2 = "handshake.fork"(%[[VAL_10]]) {control = false} : (i1) -> (i1, i1)
|
||||
// CHECK: %[[VAL_12:.*]] = subi %[[VAL_7]]#1, %[[VAL_3]]#1 : index
|
||||
// CHECK: %[[VAL_13:.*]] = subi %[[VAL_3]]#0, %[[VAL_9]]#0 : index
|
||||
// CHECK: %[[VAL_14:.*]] = select %[[VAL_11]]#1, %[[VAL_12]], %[[VAL_13]] : index
|
||||
// CHECK: %[[VAL_15:.*]] = divi_signed %[[VAL_14]], %[[VAL_5]] : index
|
||||
// CHECK: %[[VAL_16:.*]]:2 = "handshake.fork"(%[[VAL_15]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_17:.*]] = subi %[[VAL_7]]#2, %[[VAL_16]]#1 : index
|
||||
// CHECK: %[[VAL_18:.*]] = addi %[[VAL_16]]#0, %[[VAL_9]]#1 : index
|
||||
// CHECK: %[[VAL_19:.*]] = select %[[VAL_11]]#0, %[[VAL_17]], %[[VAL_18]] : index
|
||||
// CHECK: handshake.return %[[VAL_19]], %[[VAL_4]]#3 : index, none
|
||||
// CHECK: }
|
||||
// CHECK: }
|
||||
%c42 = constant 42 : index
|
||||
%c0 = constant 0 : index
|
||||
%c1 = constant 1 : index
|
||||
%0 = cmpi "sle", %arg0, %c0 : index
|
||||
%1 = subi %c0, %arg0 : index
|
||||
%2 = subi %arg0, %c1 : index
|
||||
%3 = select %0, %1, %2 : index
|
||||
%4 = divi_signed %3, %c42 : index
|
||||
%5 = subi %c0, %4 : index
|
||||
%6 = addi %4, %c1 : index
|
||||
%7 = select %0, %5, %6 : index
|
||||
return %7 : index
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
// NOTE: Assertions have been autogenerated by utils/update_mlir_test_checks.py
|
||||
// RUN: circt-opt -create-dataflow %s | FileCheck %s
|
||||
func @affine_apply_floordiv(%arg0: index) -> index {
|
||||
// CHECK: module {
|
||||
|
||||
// CHECK-LABEL: handshake.func @affine_apply_floordiv(
|
||||
// CHECK-SAME: %[[VAL_0:.*]]: index, %[[VAL_1:.*]]: none, ...) -> (index, none) {
|
||||
// CHECK: %[[VAL_2:.*]] = "handshake.merge"(%[[VAL_0]]) : (index) -> index
|
||||
// CHECK: %[[VAL_3:.*]]:3 = "handshake.fork"(%[[VAL_2]]) {control = false} : (index) -> (index, index, index)
|
||||
// CHECK: %[[VAL_4:.*]]:4 = "handshake.fork"(%[[VAL_1]]) {control = true} : (none) -> (none, none, none, none)
|
||||
// CHECK: %[[VAL_5:.*]] = "handshake.constant"(%[[VAL_4]]#2) {value = 42 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_6:.*]] = "handshake.constant"(%[[VAL_4]]#1) {value = 0 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_7:.*]] = "handshake.constant"(%[[VAL_4]]#0) {value = -1 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_8:.*]]:2 = "handshake.fork"(%[[VAL_7]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_9:.*]] = cmpi "slt", %[[VAL_3]]#2, %[[VAL_6]] : index
|
||||
// CHECK: %[[VAL_10:.*]]:2 = "handshake.fork"(%[[VAL_9]]) {control = false} : (i1) -> (i1, i1)
|
||||
// CHECK: %[[VAL_11:.*]] = subi %[[VAL_8]]#0, %[[VAL_3]]#1 : index
|
||||
// CHECK: %[[VAL_12:.*]] = select %[[VAL_10]]#1, %[[VAL_11]], %[[VAL_3]]#0 : index
|
||||
// CHECK: %[[VAL_13:.*]] = divi_signed %[[VAL_12]], %[[VAL_5]] : index
|
||||
// CHECK: %[[VAL_14:.*]]:2 = "handshake.fork"(%[[VAL_13]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_15:.*]] = subi %[[VAL_8]]#1, %[[VAL_14]]#1 : index
|
||||
// CHECK: %[[VAL_16:.*]] = select %[[VAL_10]]#0, %[[VAL_15]], %[[VAL_14]]#0 : index
|
||||
// CHECK: handshake.return %[[VAL_16]], %[[VAL_4]]#3 : index, none
|
||||
// CHECK: }
|
||||
// CHECK: }
|
||||
%c42 = constant 42 : index
|
||||
%c0 = constant 0 : index
|
||||
%c-1 = constant -1 : index
|
||||
%0 = cmpi "slt", %arg0, %c0 : index
|
||||
%1 = subi %c-1, %arg0 : index
|
||||
%2 = select %0, %1, %arg0 : index
|
||||
%3 = divi_signed %2, %c42 : index
|
||||
%4 = subi %c-1, %3 : index
|
||||
%5 = select %0, %4, %3 : index
|
||||
return %5 : index
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
// NOTE: Assertions have been autogenerated by utils/update_mlir_test_checks.py
|
||||
// RUN: circt-opt -create-dataflow %s | FileCheck %s
|
||||
func @affine_apply_mod(%arg0: index) -> index {
|
||||
// CHECK: module {
|
||||
|
||||
// CHECK-LABEL: handshake.func @affine_apply_mod(
|
||||
// CHECK-SAME: %[[VAL_0:.*]]: index, %[[VAL_1:.*]]: none, ...) -> (index, none) {
|
||||
// CHECK: %[[VAL_2:.*]] = "handshake.merge"(%[[VAL_0]]) : (index) -> index
|
||||
// CHECK: %[[VAL_3:.*]]:3 = "handshake.fork"(%[[VAL_1]]) {control = true} : (none) -> (none, none, none)
|
||||
// CHECK: %[[VAL_4:.*]] = "handshake.constant"(%[[VAL_3]]#1) {value = 42 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_5:.*]]:2 = "handshake.fork"(%[[VAL_4]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_6:.*]] = remi_signed %[[VAL_2]], %[[VAL_5]]#0 : index
|
||||
// CHECK: %[[VAL_7:.*]]:3 = "handshake.fork"(%[[VAL_6]]) {control = false} : (index) -> (index, index, index)
|
||||
// CHECK: %[[VAL_8:.*]] = "handshake.constant"(%[[VAL_3]]#0) {value = 0 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_9:.*]] = cmpi "slt", %[[VAL_7]]#2, %[[VAL_8]] : index
|
||||
// CHECK: %[[VAL_10:.*]] = addi %[[VAL_7]]#1, %[[VAL_5]]#1 : index
|
||||
// CHECK: %[[VAL_11:.*]] = select %[[VAL_9]], %[[VAL_10]], %[[VAL_7]]#0 : index
|
||||
// CHECK: handshake.return %[[VAL_11]], %[[VAL_3]]#2 : index, none
|
||||
// CHECK: }
|
||||
// CHECK: }
|
||||
%c42 = constant 42 : index
|
||||
%0 = remi_signed %arg0, %c42 : index
|
||||
%c0 = constant 0 : index
|
||||
%1 = cmpi "slt", %0, %c0 : index
|
||||
%2 = addi %0, %c42 : index
|
||||
%3 = select %1, %2, %0 : index
|
||||
return %3 : index
|
||||
}
|
|
@ -0,0 +1,80 @@
|
|||
// NOTE: Assertions have been autogenerated by utils/update_mlir_test_checks.py
|
||||
// RUN: circt-opt -create-dataflow %s | FileCheck %s
|
||||
func @affine_applies() {
|
||||
// CHECK: module {
|
||||
|
||||
// CHECK-LABEL: handshake.func @affine_applies(
|
||||
// CHECK-SAME: %[[VAL_0:.*]]: none, ...) -> none {
|
||||
// CHECK: %[[VAL_1:.*]]:18 = "handshake.fork"(%[[VAL_0]]) {control = true} : (none) -> (none, none, none, none, none, none, none, none, none, none, none, none, none, none, none, none, none, none)
|
||||
// CHECK: %[[VAL_2:.*]] = "handshake.constant"(%[[VAL_1]]#16) {value = 0 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_3:.*]]:2 = "handshake.fork"(%[[VAL_2]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_4:.*]] = "handshake.constant"(%[[VAL_1]]#15) {value = 101 : index} : (none) -> index
|
||||
// CHECK: "handshake.sink"(%[[VAL_4]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_5:.*]] = "handshake.constant"(%[[VAL_1]]#14) {value = 102 : index} : (none) -> index
|
||||
// CHECK: "handshake.sink"(%[[VAL_5]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_6:.*]] = addi %[[VAL_3]]#0, %[[VAL_3]]#1 : index
|
||||
// CHECK: %[[VAL_7:.*]] = "handshake.constant"(%[[VAL_1]]#13) {value = 1 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_8:.*]] = addi %[[VAL_6]], %[[VAL_7]] : index
|
||||
// CHECK: "handshake.sink"(%[[VAL_8]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_9:.*]] = "handshake.constant"(%[[VAL_1]]#12) {value = 103 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_10:.*]] = "handshake.constant"(%[[VAL_1]]#11) {value = 104 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_11:.*]] = "handshake.constant"(%[[VAL_1]]#10) {value = 105 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_12:.*]] = "handshake.constant"(%[[VAL_1]]#9) {value = 106 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_13:.*]] = "handshake.constant"(%[[VAL_1]]#8) {value = 107 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_14:.*]] = "handshake.constant"(%[[VAL_1]]#7) {value = 108 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_15:.*]] = "handshake.constant"(%[[VAL_1]]#6) {value = 109 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_16:.*]] = "handshake.constant"(%[[VAL_1]]#5) {value = 2 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_17:.*]] = muli %[[VAL_10]], %[[VAL_16]] : index
|
||||
// CHECK: %[[VAL_18:.*]] = addi %[[VAL_9]], %[[VAL_17]] : index
|
||||
// CHECK: %[[VAL_19:.*]] = "handshake.constant"(%[[VAL_1]]#4) {value = 3 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_20:.*]] = muli %[[VAL_11]], %[[VAL_19]] : index
|
||||
// CHECK: %[[VAL_21:.*]] = addi %[[VAL_18]], %[[VAL_20]] : index
|
||||
// CHECK: %[[VAL_22:.*]] = "handshake.constant"(%[[VAL_1]]#3) {value = 4 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_23:.*]] = muli %[[VAL_12]], %[[VAL_22]] : index
|
||||
// CHECK: %[[VAL_24:.*]] = addi %[[VAL_21]], %[[VAL_23]] : index
|
||||
// CHECK: %[[VAL_25:.*]] = "handshake.constant"(%[[VAL_1]]#2) {value = 5 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_26:.*]] = muli %[[VAL_13]], %[[VAL_25]] : index
|
||||
// CHECK: %[[VAL_27:.*]] = addi %[[VAL_24]], %[[VAL_26]] : index
|
||||
// CHECK: %[[VAL_28:.*]] = "handshake.constant"(%[[VAL_1]]#1) {value = 6 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_29:.*]] = muli %[[VAL_14]], %[[VAL_28]] : index
|
||||
// CHECK: %[[VAL_30:.*]] = addi %[[VAL_27]], %[[VAL_29]] : index
|
||||
// CHECK: %[[VAL_31:.*]] = "handshake.constant"(%[[VAL_1]]#0) {value = 7 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_32:.*]] = muli %[[VAL_15]], %[[VAL_31]] : index
|
||||
// CHECK: %[[VAL_33:.*]] = addi %[[VAL_30]], %[[VAL_32]] : index
|
||||
// CHECK: "handshake.sink"(%[[VAL_33]]) : (index) -> ()
|
||||
// CHECK: handshake.return %[[VAL_1]]#17 : none
|
||||
// CHECK: }
|
||||
// CHECK: }
|
||||
%c0 = constant 0 : index
|
||||
%c101 = constant 101 : index
|
||||
%c102 = constant 102 : index
|
||||
%0 = addi %c0, %c0 : index
|
||||
%c1 = constant 1 : index
|
||||
%1 = addi %0, %c1 : index
|
||||
%c103 = constant 103 : index
|
||||
%c104 = constant 104 : index
|
||||
%c105 = constant 105 : index
|
||||
%c106 = constant 106 : index
|
||||
%c107 = constant 107 : index
|
||||
%c108 = constant 108 : index
|
||||
%c109 = constant 109 : index
|
||||
%c2 = constant 2 : index
|
||||
%2 = muli %c104, %c2 : index
|
||||
%3 = addi %c103, %2 : index
|
||||
%c3 = constant 3 : index
|
||||
%4 = muli %c105, %c3 : index
|
||||
%5 = addi %3, %4 : index
|
||||
%c4 = constant 4 : index
|
||||
%6 = muli %c106, %c4 : index
|
||||
%7 = addi %5, %6 : index
|
||||
%c5 = constant 5 : index
|
||||
%8 = muli %c107, %c5 : index
|
||||
%9 = addi %7, %8 : index
|
||||
%c6 = constant 6 : index
|
||||
%10 = muli %c108, %c6 : index
|
||||
%11 = addi %9, %10 : index
|
||||
%c7 = constant 7 : index
|
||||
%12 = muli %c109, %c7 : index
|
||||
%13 = addi %11, %12 : index
|
||||
return
|
||||
}
|
|
@ -0,0 +1,139 @@
|
|||
// NOTE: Assertions have been autogenerated by utils/update_mlir_test_checks.py
|
||||
// RUN: circt-opt -create-dataflow %s | FileCheck %s
|
||||
func @imperfectly_nested_loops() {
|
||||
// CHECK: module {
|
||||
|
||||
// CHECK-LABEL: handshake.func @imperfectly_nested_loops(
|
||||
// CHECK-SAME: %[[VAL_0:.*]]: none, ...) -> none {
|
||||
// CHECK: %[[VAL_1:.*]] = "handshake.branch"(%[[VAL_0]]) {control = true} : (none) -> none
|
||||
// CHECK: "handshake.terminator"()[^bb1] : () -> ()
|
||||
// CHECK: ^bb1:
|
||||
// CHECK: %[[VAL_2:.*]]:2 = "handshake.control_merge"(%[[VAL_1]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: %[[VAL_3:.*]]:3 = "handshake.fork"(%[[VAL_2]]#0) {control = true} : (none) -> (none, none, none)
|
||||
// CHECK: "handshake.sink"(%[[VAL_2]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_4:.*]] = "handshake.constant"(%[[VAL_3]]#1) {value = 0 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_5:.*]] = "handshake.constant"(%[[VAL_3]]#0) {value = 42 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_6:.*]] = "handshake.branch"(%[[VAL_3]]#2) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_7:.*]] = "handshake.branch"(%[[VAL_4]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_8:.*]] = "handshake.branch"(%[[VAL_5]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb2] : () -> ()
|
||||
// CHECK: ^bb2:
|
||||
// CHECK: %[[VAL_9:.*]] = "handshake.mux"(%[[VAL_10:.*]]#1, %[[VAL_11:.*]], %[[VAL_8]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_12:.*]]:2 = "handshake.fork"(%[[VAL_9]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_13:.*]]:2 = "handshake.control_merge"(%[[VAL_14:.*]], %[[VAL_6]]) {control = true} : (none, none) -> (none, index)
|
||||
// CHECK: %[[VAL_10]]:2 = "handshake.fork"(%[[VAL_13]]#1) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_15:.*]] = "handshake.mux"(%[[VAL_10]]#0, %[[VAL_16:.*]], %[[VAL_7]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_17:.*]]:2 = "handshake.fork"(%[[VAL_15]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_18:.*]] = cmpi "slt", %[[VAL_17]]#1, %[[VAL_12]]#1 : index
|
||||
// CHECK: %[[VAL_19:.*]]:3 = "handshake.fork"(%[[VAL_18]]) {control = false} : (i1) -> (i1, i1, i1)
|
||||
// CHECK: %[[VAL_20:.*]], %[[VAL_21:.*]] = "handshake.conditional_branch"(%[[VAL_19]]#2, %[[VAL_12]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_21]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_22:.*]], %[[VAL_23:.*]] = "handshake.conditional_branch"(%[[VAL_19]]#1, %[[VAL_13]]#0) {control = true} : (i1, none) -> (none, none)
|
||||
// CHECK: %[[VAL_24:.*]], %[[VAL_25:.*]] = "handshake.conditional_branch"(%[[VAL_19]]#0, %[[VAL_17]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_25]]) : (index) -> ()
|
||||
// CHECK: "handshake.terminator"()[^bb3, ^bb8] : () -> ()
|
||||
// CHECK: ^bb3:
|
||||
// CHECK: %[[VAL_26:.*]] = "handshake.merge"(%[[VAL_24]]) : (index) -> index
|
||||
// CHECK: %[[VAL_27:.*]] = "handshake.merge"(%[[VAL_20]]) : (index) -> index
|
||||
// CHECK: %[[VAL_28:.*]]:2 = "handshake.control_merge"(%[[VAL_22]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_28]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_29:.*]] = "handshake.branch"(%[[VAL_26]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_30:.*]] = "handshake.branch"(%[[VAL_27]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_31:.*]] = "handshake.branch"(%[[VAL_28]]#0) {control = true} : (none) -> none
|
||||
// CHECK: "handshake.terminator"()[^bb4] : () -> ()
|
||||
// CHECK: ^bb4:
|
||||
// CHECK: %[[VAL_32:.*]] = "handshake.merge"(%[[VAL_29]]) : (index) -> index
|
||||
// CHECK: %[[VAL_33:.*]] = "handshake.merge"(%[[VAL_30]]) : (index) -> index
|
||||
// CHECK: %[[VAL_34:.*]]:2 = "handshake.control_merge"(%[[VAL_31]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: %[[VAL_35:.*]]:3 = "handshake.fork"(%[[VAL_34]]#0) {control = true} : (none) -> (none, none, none)
|
||||
// CHECK: "handshake.sink"(%[[VAL_34]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_36:.*]] = "handshake.constant"(%[[VAL_35]]#1) {value = 7 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_37:.*]] = "handshake.constant"(%[[VAL_35]]#0) {value = 56 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_38:.*]] = "handshake.branch"(%[[VAL_32]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_39:.*]] = "handshake.branch"(%[[VAL_33]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_40:.*]] = "handshake.branch"(%[[VAL_35]]#2) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_41:.*]] = "handshake.branch"(%[[VAL_36]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_42:.*]] = "handshake.branch"(%[[VAL_37]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb5] : () -> ()
|
||||
// CHECK: ^bb5:
|
||||
// CHECK: %[[VAL_43:.*]] = "handshake.mux"(%[[VAL_44:.*]]#3, %[[VAL_45:.*]], %[[VAL_42]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_46:.*]]:2 = "handshake.fork"(%[[VAL_43]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_47:.*]] = "handshake.mux"(%[[VAL_44]]#2, %[[VAL_48:.*]], %[[VAL_38]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_49:.*]] = "handshake.mux"(%[[VAL_44]]#1, %[[VAL_50:.*]], %[[VAL_39]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_51:.*]]:2 = "handshake.control_merge"(%[[VAL_52:.*]], %[[VAL_40]]) {control = true} : (none, none) -> (none, index)
|
||||
// CHECK: %[[VAL_44]]:4 = "handshake.fork"(%[[VAL_51]]#1) {control = false} : (index) -> (index, index, index, index)
|
||||
// CHECK: %[[VAL_53:.*]] = "handshake.mux"(%[[VAL_44]]#0, %[[VAL_54:.*]], %[[VAL_41]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_55:.*]]:2 = "handshake.fork"(%[[VAL_53]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_56:.*]] = cmpi "slt", %[[VAL_55]]#1, %[[VAL_46]]#1 : index
|
||||
// CHECK: %[[VAL_57:.*]]:5 = "handshake.fork"(%[[VAL_56]]) {control = false} : (i1) -> (i1, i1, i1, i1, i1)
|
||||
// CHECK: %[[VAL_58:.*]], %[[VAL_59:.*]] = "handshake.conditional_branch"(%[[VAL_57]]#4, %[[VAL_46]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_59]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_60:.*]], %[[VAL_61:.*]] = "handshake.conditional_branch"(%[[VAL_57]]#3, %[[VAL_47]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: %[[VAL_62:.*]], %[[VAL_63:.*]] = "handshake.conditional_branch"(%[[VAL_57]]#2, %[[VAL_49]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: %[[VAL_64:.*]], %[[VAL_65:.*]] = "handshake.conditional_branch"(%[[VAL_57]]#1, %[[VAL_51]]#0) {control = true} : (i1, none) -> (none, none)
|
||||
// CHECK: %[[VAL_66:.*]], %[[VAL_67:.*]] = "handshake.conditional_branch"(%[[VAL_57]]#0, %[[VAL_55]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_67]]) : (index) -> ()
|
||||
// CHECK: "handshake.terminator"()[^bb6, ^bb7] : () -> ()
|
||||
// CHECK: ^bb6:
|
||||
// CHECK: %[[VAL_68:.*]] = "handshake.merge"(%[[VAL_66]]) : (index) -> index
|
||||
// CHECK: %[[VAL_69:.*]] = "handshake.merge"(%[[VAL_58]]) : (index) -> index
|
||||
// CHECK: %[[VAL_70:.*]] = "handshake.merge"(%[[VAL_60]]) : (index) -> index
|
||||
// CHECK: %[[VAL_71:.*]] = "handshake.merge"(%[[VAL_62]]) : (index) -> index
|
||||
// CHECK: %[[VAL_72:.*]]:2 = "handshake.control_merge"(%[[VAL_64]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: %[[VAL_73:.*]]:2 = "handshake.fork"(%[[VAL_72]]#0) {control = true} : (none) -> (none, none)
|
||||
// CHECK: "handshake.sink"(%[[VAL_72]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_74:.*]] = "handshake.constant"(%[[VAL_73]]#0) {value = 2 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_75:.*]] = addi %[[VAL_68]], %[[VAL_74]] : index
|
||||
// CHECK: %[[VAL_45]] = "handshake.branch"(%[[VAL_69]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_48]] = "handshake.branch"(%[[VAL_70]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_50]] = "handshake.branch"(%[[VAL_71]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_52]] = "handshake.branch"(%[[VAL_73]]#1) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_54]] = "handshake.branch"(%[[VAL_75]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb5] : () -> ()
|
||||
// CHECK: ^bb7:
|
||||
// CHECK: %[[VAL_76:.*]] = "handshake.merge"(%[[VAL_61]]) : (index) -> index
|
||||
// CHECK: %[[VAL_77:.*]] = "handshake.merge"(%[[VAL_63]]) : (index) -> index
|
||||
// CHECK: %[[VAL_78:.*]]:2 = "handshake.control_merge"(%[[VAL_65]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: %[[VAL_79:.*]]:2 = "handshake.fork"(%[[VAL_78]]#0) {control = true} : (none) -> (none, none)
|
||||
// CHECK: "handshake.sink"(%[[VAL_78]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_80:.*]] = "handshake.constant"(%[[VAL_79]]#0) {value = 1 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_81:.*]] = addi %[[VAL_76]], %[[VAL_80]] : index
|
||||
// CHECK: %[[VAL_11]] = "handshake.branch"(%[[VAL_77]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_14]] = "handshake.branch"(%[[VAL_79]]#1) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_16]] = "handshake.branch"(%[[VAL_81]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb2] : () -> ()
|
||||
// CHECK: ^bb8:
|
||||
// CHECK: %[[VAL_82:.*]]:2 = "handshake.control_merge"(%[[VAL_23]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_82]]#1) : (index) -> ()
|
||||
// CHECK: handshake.return %[[VAL_82]]#0 : none
|
||||
// CHECK: }
|
||||
// CHECK: }
|
||||
^bb0:
|
||||
br ^bb1
|
||||
^bb1: // pred: ^bb0
|
||||
%c0 = constant 0 : index
|
||||
%c42 = constant 42 : index
|
||||
br ^bb2(%c0 : index)
|
||||
^bb2(%0: index): // 2 preds: ^bb1, ^bb7
|
||||
%1 = cmpi "slt", %0, %c42 : index
|
||||
cond_br %1, ^bb3, ^bb8
|
||||
^bb3: // pred: ^bb2
|
||||
br ^bb4
|
||||
^bb4: // pred: ^bb3
|
||||
%c7 = constant 7 : index
|
||||
%c56 = constant 56 : index
|
||||
br ^bb5(%c7 : index)
|
||||
^bb5(%2: index): // 2 preds: ^bb4, ^bb6
|
||||
%3 = cmpi "slt", %2, %c56 : index
|
||||
cond_br %3, ^bb6, ^bb7
|
||||
^bb6: // pred: ^bb5
|
||||
%c2 = constant 2 : index
|
||||
%4 = addi %2, %c2 : index
|
||||
br ^bb5(%4 : index)
|
||||
^bb7: // pred: ^bb5
|
||||
%c1 = constant 1 : index
|
||||
%5 = addi %0, %c1 : index
|
||||
br ^bb2(%5 : index)
|
||||
^bb8: // pred: ^bb2
|
||||
return
|
||||
}
|
|
@ -0,0 +1,95 @@
|
|||
// NOTE: Assertions have been autogenerated by utils/update_mlir_test_checks.py
|
||||
// RUN: circt-opt -create-dataflow %s | FileCheck %s
|
||||
func @min_reduction_tree(%arg0: index) {
|
||||
// CHECK: module {
|
||||
|
||||
// CHECK-LABEL: handshake.func @min_reduction_tree(
|
||||
// CHECK-SAME: %[[VAL_0:.*]]: index, %[[VAL_1:.*]]: none, ...) -> none {
|
||||
// CHECK: %[[VAL_2:.*]] = "handshake.merge"(%[[VAL_0]]) : (index) -> index
|
||||
// CHECK: %[[VAL_3:.*]]:14 = "handshake.fork"(%[[VAL_2]]) {control = false} : (index) -> (index, index, index, index, index, index, index, index, index, index, index, index, index, index)
|
||||
// CHECK: %[[VAL_4:.*]]:3 = "handshake.fork"(%[[VAL_1]]) {control = true} : (none) -> (none, none, none)
|
||||
// CHECK: %[[VAL_5:.*]] = "handshake.constant"(%[[VAL_4]]#1) {value = 0 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_6:.*]] = cmpi "slt", %[[VAL_3]]#12, %[[VAL_3]]#13 : index
|
||||
// CHECK: %[[VAL_7:.*]] = select %[[VAL_6]], %[[VAL_3]]#10, %[[VAL_3]]#11 : index
|
||||
// CHECK: %[[VAL_8:.*]]:2 = "handshake.fork"(%[[VAL_7]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_9:.*]] = cmpi "slt", %[[VAL_8]]#1, %[[VAL_3]]#9 : index
|
||||
// CHECK: %[[VAL_10:.*]] = select %[[VAL_9]], %[[VAL_8]]#0, %[[VAL_3]]#8 : index
|
||||
// CHECK: %[[VAL_11:.*]]:2 = "handshake.fork"(%[[VAL_10]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_12:.*]] = cmpi "slt", %[[VAL_11]]#1, %[[VAL_3]]#7 : index
|
||||
// CHECK: %[[VAL_13:.*]] = select %[[VAL_12]], %[[VAL_11]]#0, %[[VAL_3]]#6 : index
|
||||
// CHECK: %[[VAL_14:.*]]:2 = "handshake.fork"(%[[VAL_13]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_15:.*]] = cmpi "slt", %[[VAL_14]]#1, %[[VAL_3]]#5 : index
|
||||
// CHECK: %[[VAL_16:.*]] = select %[[VAL_15]], %[[VAL_14]]#0, %[[VAL_3]]#4 : index
|
||||
// CHECK: %[[VAL_17:.*]]:2 = "handshake.fork"(%[[VAL_16]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_18:.*]] = cmpi "slt", %[[VAL_17]]#1, %[[VAL_3]]#3 : index
|
||||
// CHECK: %[[VAL_19:.*]] = select %[[VAL_18]], %[[VAL_17]]#0, %[[VAL_3]]#2 : index
|
||||
// CHECK: %[[VAL_20:.*]]:2 = "handshake.fork"(%[[VAL_19]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_21:.*]] = cmpi "slt", %[[VAL_20]]#1, %[[VAL_3]]#1 : index
|
||||
// CHECK: %[[VAL_22:.*]] = select %[[VAL_21]], %[[VAL_20]]#0, %[[VAL_3]]#0 : index
|
||||
// CHECK: %[[VAL_23:.*]] = "handshake.constant"(%[[VAL_4]]#0) {value = 1 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_24:.*]] = "handshake.branch"(%[[VAL_4]]#2) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_25:.*]] = "handshake.branch"(%[[VAL_5]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_26:.*]] = "handshake.branch"(%[[VAL_22]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_27:.*]] = "handshake.branch"(%[[VAL_23]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb1] : () -> ()
|
||||
// CHECK: ^bb1:
|
||||
// CHECK: %[[VAL_28:.*]] = "handshake.mux"(%[[VAL_29:.*]]#2, %[[VAL_30:.*]], %[[VAL_26]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_31:.*]]:2 = "handshake.fork"(%[[VAL_28]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_32:.*]] = "handshake.mux"(%[[VAL_29]]#1, %[[VAL_33:.*]], %[[VAL_27]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_34:.*]]:2 = "handshake.control_merge"(%[[VAL_35:.*]], %[[VAL_24]]) {control = true} : (none, none) -> (none, index)
|
||||
// CHECK: %[[VAL_29]]:3 = "handshake.fork"(%[[VAL_34]]#1) {control = false} : (index) -> (index, index, index)
|
||||
// CHECK: %[[VAL_36:.*]] = "handshake.mux"(%[[VAL_29]]#0, %[[VAL_37:.*]], %[[VAL_25]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_38:.*]]:2 = "handshake.fork"(%[[VAL_36]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_39:.*]] = cmpi "slt", %[[VAL_38]]#1, %[[VAL_31]]#1 : index
|
||||
// CHECK: %[[VAL_40:.*]]:4 = "handshake.fork"(%[[VAL_39]]) {control = false} : (i1) -> (i1, i1, i1, i1)
|
||||
// CHECK: %[[VAL_41:.*]], %[[VAL_42:.*]] = "handshake.conditional_branch"(%[[VAL_40]]#3, %[[VAL_31]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_42]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_43:.*]], %[[VAL_44:.*]] = "handshake.conditional_branch"(%[[VAL_40]]#2, %[[VAL_32]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_44]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_45:.*]], %[[VAL_46:.*]] = "handshake.conditional_branch"(%[[VAL_40]]#1, %[[VAL_34]]#0) {control = true} : (i1, none) -> (none, none)
|
||||
// CHECK: %[[VAL_47:.*]], %[[VAL_48:.*]] = "handshake.conditional_branch"(%[[VAL_40]]#0, %[[VAL_38]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_48]]) : (index) -> ()
|
||||
// CHECK: "handshake.terminator"()[^bb2, ^bb3] : () -> ()
|
||||
// CHECK: ^bb2:
|
||||
// CHECK: %[[VAL_49:.*]] = "handshake.merge"(%[[VAL_47]]) : (index) -> index
|
||||
// CHECK: %[[VAL_50:.*]] = "handshake.merge"(%[[VAL_43]]) : (index) -> index
|
||||
// CHECK: %[[VAL_51:.*]]:2 = "handshake.fork"(%[[VAL_50]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_52:.*]] = "handshake.merge"(%[[VAL_41]]) : (index) -> index
|
||||
// CHECK: %[[VAL_53:.*]]:2 = "handshake.control_merge"(%[[VAL_45]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_53]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_54:.*]] = addi %[[VAL_49]], %[[VAL_51]]#1 : index
|
||||
// CHECK: %[[VAL_33]] = "handshake.branch"(%[[VAL_51]]#0) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_30]] = "handshake.branch"(%[[VAL_52]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_35]] = "handshake.branch"(%[[VAL_53]]#0) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_37]] = "handshake.branch"(%[[VAL_54]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb1] : () -> ()
|
||||
// CHECK: ^bb3:
|
||||
// CHECK: %[[VAL_55:.*]]:2 = "handshake.control_merge"(%[[VAL_46]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_55]]#1) : (index) -> ()
|
||||
// CHECK: handshake.return %[[VAL_55]]#0 : none
|
||||
// CHECK: }
|
||||
// CHECK: }
|
||||
%c0 = constant 0 : index
|
||||
%0 = cmpi "slt", %arg0, %arg0 : index
|
||||
%1 = select %0, %arg0, %arg0 : index
|
||||
%2 = cmpi "slt", %1, %arg0 : index
|
||||
%3 = select %2, %1, %arg0 : index
|
||||
%4 = cmpi "slt", %3, %arg0 : index
|
||||
%5 = select %4, %3, %arg0 : index
|
||||
%6 = cmpi "slt", %5, %arg0 : index
|
||||
%7 = select %6, %5, %arg0 : index
|
||||
%8 = cmpi "slt", %7, %arg0 : index
|
||||
%9 = select %8, %7, %arg0 : index
|
||||
%10 = cmpi "slt", %9, %arg0 : index
|
||||
%11 = select %10, %9, %arg0 : index
|
||||
%c1 = constant 1 : index
|
||||
br ^bb1(%c0 : index)
|
||||
^bb1(%12: index): // 2 preds: ^bb0, ^bb2
|
||||
%13 = cmpi "slt", %12, %11 : index
|
||||
cond_br %13, ^bb2, ^bb3
|
||||
^bb2: // pred: ^bb1
|
||||
%14 = addi %12, %c1 : index
|
||||
br ^bb1(%14 : index)
|
||||
^bb3: // pred: ^bb1
|
||||
return
|
||||
}
|
|
@ -0,0 +1,169 @@
|
|||
// NOTE: Assertions have been autogenerated by utils/update_mlir_test_checks.py
|
||||
// RUN: circt-opt -create-dataflow %s | FileCheck %s
|
||||
func @loop_min_max(%arg0: index) {
|
||||
// CHECK: module {
|
||||
|
||||
// CHECK-LABEL: handshake.func @loop_min_max(
|
||||
// CHECK-SAME: %[[VAL_0:.*]]: index, %[[VAL_1:.*]]: none, ...) -> none {
|
||||
// CHECK: %[[VAL_2:.*]] = "handshake.merge"(%[[VAL_0]]) : (index) -> index
|
||||
// CHECK: %[[VAL_3:.*]]:4 = "handshake.fork"(%[[VAL_1]]) {control = true} : (none) -> (none, none, none, none)
|
||||
// CHECK: %[[VAL_4:.*]] = "handshake.constant"(%[[VAL_3]]#2) {value = 0 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_5:.*]] = "handshake.constant"(%[[VAL_3]]#1) {value = 42 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_6:.*]] = "handshake.constant"(%[[VAL_3]]#0) {value = 1 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_7:.*]] = "handshake.branch"(%[[VAL_2]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_8:.*]] = "handshake.branch"(%[[VAL_3]]#3) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_9:.*]] = "handshake.branch"(%[[VAL_4]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_10:.*]] = "handshake.branch"(%[[VAL_5]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_11:.*]] = "handshake.branch"(%[[VAL_6]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb1] : () -> ()
|
||||
// CHECK: ^bb1:
|
||||
// CHECK: %[[VAL_12:.*]] = "handshake.mux"(%[[VAL_13:.*]]#3, %[[VAL_14:.*]], %[[VAL_10]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_15:.*]]:2 = "handshake.fork"(%[[VAL_12]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_16:.*]] = "handshake.mux"(%[[VAL_13]]#2, %[[VAL_17:.*]], %[[VAL_7]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_18:.*]] = "handshake.mux"(%[[VAL_13]]#1, %[[VAL_19:.*]], %[[VAL_11]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_20:.*]]:2 = "handshake.control_merge"(%[[VAL_21:.*]], %[[VAL_8]]) {control = true} : (none, none) -> (none, index)
|
||||
// CHECK: %[[VAL_13]]:4 = "handshake.fork"(%[[VAL_20]]#1) {control = false} : (index) -> (index, index, index, index)
|
||||
// CHECK: %[[VAL_22:.*]] = "handshake.mux"(%[[VAL_13]]#0, %[[VAL_23:.*]], %[[VAL_9]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_24:.*]]:2 = "handshake.fork"(%[[VAL_22]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_25:.*]] = cmpi "slt", %[[VAL_24]]#1, %[[VAL_15]]#1 : index
|
||||
// CHECK: %[[VAL_26:.*]]:5 = "handshake.fork"(%[[VAL_25]]) {control = false} : (i1) -> (i1, i1, i1, i1, i1)
|
||||
// CHECK: %[[VAL_27:.*]], %[[VAL_28:.*]] = "handshake.conditional_branch"(%[[VAL_26]]#4, %[[VAL_15]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_28]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_29:.*]], %[[VAL_30:.*]] = "handshake.conditional_branch"(%[[VAL_26]]#3, %[[VAL_16]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_30]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_31:.*]], %[[VAL_32:.*]] = "handshake.conditional_branch"(%[[VAL_26]]#2, %[[VAL_18]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_32]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_33:.*]], %[[VAL_34:.*]] = "handshake.conditional_branch"(%[[VAL_26]]#1, %[[VAL_20]]#0) {control = true} : (i1, none) -> (none, none)
|
||||
// CHECK: %[[VAL_35:.*]], %[[VAL_36:.*]] = "handshake.conditional_branch"(%[[VAL_26]]#0, %[[VAL_24]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_36]]) : (index) -> ()
|
||||
// CHECK: "handshake.terminator"()[^bb2, ^bb6] : () -> ()
|
||||
// CHECK: ^bb2:
|
||||
// CHECK: %[[VAL_37:.*]] = "handshake.merge"(%[[VAL_35]]) : (index) -> index
|
||||
// CHECK: %[[VAL_38:.*]]:5 = "handshake.fork"(%[[VAL_37]]) {control = false} : (index) -> (index, index, index, index, index)
|
||||
// CHECK: %[[VAL_39:.*]] = "handshake.merge"(%[[VAL_29]]) : (index) -> index
|
||||
// CHECK: %[[VAL_40:.*]]:4 = "handshake.fork"(%[[VAL_39]]) {control = false} : (index) -> (index, index, index, index)
|
||||
// CHECK: %[[VAL_41:.*]] = "handshake.merge"(%[[VAL_31]]) : (index) -> index
|
||||
// CHECK: %[[VAL_42:.*]] = "handshake.merge"(%[[VAL_27]]) : (index) -> index
|
||||
// CHECK: %[[VAL_43:.*]]:2 = "handshake.control_merge"(%[[VAL_33]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: %[[VAL_44:.*]]:4 = "handshake.fork"(%[[VAL_43]]#0) {control = true} : (none) -> (none, none, none, none)
|
||||
// CHECK: "handshake.sink"(%[[VAL_43]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_45:.*]] = "handshake.constant"(%[[VAL_44]]#2) {value = -1 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_46:.*]] = muli %[[VAL_38]]#4, %[[VAL_45]] : index
|
||||
// CHECK: %[[VAL_47:.*]] = addi %[[VAL_46]], %[[VAL_40]]#3 : index
|
||||
// CHECK: %[[VAL_48:.*]]:2 = "handshake.fork"(%[[VAL_47]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_49:.*]] = cmpi "sgt", %[[VAL_38]]#3, %[[VAL_48]]#1 : index
|
||||
// CHECK: %[[VAL_50:.*]] = select %[[VAL_49]], %[[VAL_38]]#2, %[[VAL_48]]#0 : index
|
||||
// CHECK: %[[VAL_51:.*]] = "handshake.constant"(%[[VAL_44]]#1) {value = 10 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_52:.*]] = addi %[[VAL_38]]#1, %[[VAL_51]] : index
|
||||
// CHECK: %[[VAL_53:.*]]:2 = "handshake.fork"(%[[VAL_52]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_54:.*]] = cmpi "slt", %[[VAL_40]]#2, %[[VAL_53]]#1 : index
|
||||
// CHECK: %[[VAL_55:.*]] = select %[[VAL_54]], %[[VAL_40]]#1, %[[VAL_53]]#0 : index
|
||||
// CHECK: %[[VAL_56:.*]] = "handshake.constant"(%[[VAL_44]]#0) {value = 1 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_57:.*]] = "handshake.branch"(%[[VAL_38]]#0) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_58:.*]] = "handshake.branch"(%[[VAL_40]]#0) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_59:.*]] = "handshake.branch"(%[[VAL_41]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_60:.*]] = "handshake.branch"(%[[VAL_42]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_61:.*]] = "handshake.branch"(%[[VAL_44]]#3) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_62:.*]] = "handshake.branch"(%[[VAL_50]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_63:.*]] = "handshake.branch"(%[[VAL_55]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_64:.*]] = "handshake.branch"(%[[VAL_56]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb3] : () -> ()
|
||||
// CHECK: ^bb3:
|
||||
// CHECK: %[[VAL_65:.*]] = "handshake.mux"(%[[VAL_66:.*]]#6, %[[VAL_67:.*]], %[[VAL_63]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_68:.*]]:2 = "handshake.fork"(%[[VAL_65]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_69:.*]] = "handshake.mux"(%[[VAL_66]]#5, %[[VAL_70:.*]], %[[VAL_64]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_71:.*]] = "handshake.mux"(%[[VAL_66]]#4, %[[VAL_72:.*]], %[[VAL_57]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_73:.*]] = "handshake.mux"(%[[VAL_66]]#3, %[[VAL_74:.*]], %[[VAL_59]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_75:.*]] = "handshake.mux"(%[[VAL_66]]#2, %[[VAL_76:.*]], %[[VAL_60]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_77:.*]] = "handshake.mux"(%[[VAL_66]]#1, %[[VAL_78:.*]], %[[VAL_58]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_79:.*]]:2 = "handshake.control_merge"(%[[VAL_80:.*]], %[[VAL_61]]) {control = true} : (none, none) -> (none, index)
|
||||
// CHECK: %[[VAL_66]]:7 = "handshake.fork"(%[[VAL_79]]#1) {control = false} : (index) -> (index, index, index, index, index, index, index)
|
||||
// CHECK: %[[VAL_81:.*]] = "handshake.mux"(%[[VAL_66]]#0, %[[VAL_82:.*]], %[[VAL_62]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_83:.*]]:2 = "handshake.fork"(%[[VAL_81]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_84:.*]] = cmpi "slt", %[[VAL_83]]#1, %[[VAL_68]]#1 : index
|
||||
// CHECK: %[[VAL_85:.*]]:8 = "handshake.fork"(%[[VAL_84]]) {control = false} : (i1) -> (i1, i1, i1, i1, i1, i1, i1, i1)
|
||||
// CHECK: %[[VAL_86:.*]], %[[VAL_87:.*]] = "handshake.conditional_branch"(%[[VAL_85]]#7, %[[VAL_68]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_87]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_88:.*]], %[[VAL_89:.*]] = "handshake.conditional_branch"(%[[VAL_85]]#6, %[[VAL_69]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_89]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_90:.*]], %[[VAL_91:.*]] = "handshake.conditional_branch"(%[[VAL_85]]#5, %[[VAL_71]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: %[[VAL_92:.*]], %[[VAL_93:.*]] = "handshake.conditional_branch"(%[[VAL_85]]#4, %[[VAL_73]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: %[[VAL_94:.*]], %[[VAL_95:.*]] = "handshake.conditional_branch"(%[[VAL_85]]#3, %[[VAL_75]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: %[[VAL_96:.*]], %[[VAL_97:.*]] = "handshake.conditional_branch"(%[[VAL_85]]#2, %[[VAL_77]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: %[[VAL_98:.*]], %[[VAL_99:.*]] = "handshake.conditional_branch"(%[[VAL_85]]#1, %[[VAL_79]]#0) {control = true} : (i1, none) -> (none, none)
|
||||
// CHECK: %[[VAL_100:.*]], %[[VAL_101:.*]] = "handshake.conditional_branch"(%[[VAL_85]]#0, %[[VAL_83]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_101]]) : (index) -> ()
|
||||
// CHECK: "handshake.terminator"()[^bb4, ^bb5] : () -> ()
|
||||
// CHECK: ^bb4:
|
||||
// CHECK: %[[VAL_102:.*]] = "handshake.merge"(%[[VAL_100]]) : (index) -> index
|
||||
// CHECK: %[[VAL_103:.*]] = "handshake.merge"(%[[VAL_88]]) : (index) -> index
|
||||
// CHECK: %[[VAL_104:.*]]:2 = "handshake.fork"(%[[VAL_103]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_105:.*]] = "handshake.merge"(%[[VAL_86]]) : (index) -> index
|
||||
// CHECK: %[[VAL_106:.*]] = "handshake.merge"(%[[VAL_90]]) : (index) -> index
|
||||
// CHECK: %[[VAL_107:.*]] = "handshake.merge"(%[[VAL_92]]) : (index) -> index
|
||||
// CHECK: %[[VAL_108:.*]] = "handshake.merge"(%[[VAL_94]]) : (index) -> index
|
||||
// CHECK: %[[VAL_109:.*]] = "handshake.merge"(%[[VAL_96]]) : (index) -> index
|
||||
// CHECK: %[[VAL_110:.*]]:2 = "handshake.control_merge"(%[[VAL_98]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_110]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_111:.*]] = addi %[[VAL_102]], %[[VAL_104]]#1 : index
|
||||
// CHECK: %[[VAL_70]] = "handshake.branch"(%[[VAL_104]]#0) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_67]] = "handshake.branch"(%[[VAL_105]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_72]] = "handshake.branch"(%[[VAL_106]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_74]] = "handshake.branch"(%[[VAL_107]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_76]] = "handshake.branch"(%[[VAL_108]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_78]] = "handshake.branch"(%[[VAL_109]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_80]] = "handshake.branch"(%[[VAL_110]]#0) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_82]] = "handshake.branch"(%[[VAL_111]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb3] : () -> ()
|
||||
// CHECK: ^bb5:
|
||||
// CHECK: %[[VAL_112:.*]] = "handshake.merge"(%[[VAL_91]]) : (index) -> index
|
||||
// CHECK: %[[VAL_113:.*]] = "handshake.merge"(%[[VAL_93]]) : (index) -> index
|
||||
// CHECK: %[[VAL_114:.*]]:2 = "handshake.fork"(%[[VAL_113]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_115:.*]] = "handshake.merge"(%[[VAL_95]]) : (index) -> index
|
||||
// CHECK: %[[VAL_116:.*]] = "handshake.merge"(%[[VAL_97]]) : (index) -> index
|
||||
// CHECK: %[[VAL_117:.*]]:2 = "handshake.control_merge"(%[[VAL_99]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_117]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_118:.*]] = addi %[[VAL_112]], %[[VAL_114]]#1 : index
|
||||
// CHECK: %[[VAL_19]] = "handshake.branch"(%[[VAL_114]]#0) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_14]] = "handshake.branch"(%[[VAL_115]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_17]] = "handshake.branch"(%[[VAL_116]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_21]] = "handshake.branch"(%[[VAL_117]]#0) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_23]] = "handshake.branch"(%[[VAL_118]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb1] : () -> ()
|
||||
// CHECK: ^bb6:
|
||||
// CHECK: %[[VAL_119:.*]]:2 = "handshake.control_merge"(%[[VAL_34]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_119]]#1) : (index) -> ()
|
||||
// CHECK: handshake.return %[[VAL_119]]#0 : none
|
||||
// CHECK: }
|
||||
// CHECK: }
|
||||
%c0 = constant 0 : index
|
||||
%c42 = constant 42 : index
|
||||
%c1 = constant 1 : index
|
||||
br ^bb1(%c0 : index)
|
||||
^bb1(%0: index): // 2 preds: ^bb0, ^bb5
|
||||
%1 = cmpi "slt", %0, %c42 : index
|
||||
cond_br %1, ^bb2, ^bb6
|
||||
^bb2: // pred: ^bb1
|
||||
%c-1 = constant -1 : index
|
||||
%2 = muli %0, %c-1 : index
|
||||
%3 = addi %2, %arg0 : index
|
||||
%4 = cmpi "sgt", %0, %3 : index
|
||||
%5 = select %4, %0, %3 : index
|
||||
%c10 = constant 10 : index
|
||||
%6 = addi %0, %c10 : index
|
||||
%7 = cmpi "slt", %arg0, %6 : index
|
||||
%8 = select %7, %arg0, %6 : index
|
||||
%c1_0 = constant 1 : index
|
||||
br ^bb3(%5 : index)
|
||||
^bb3(%9: index): // 2 preds: ^bb2, ^bb4
|
||||
%10 = cmpi "slt", %9, %8 : index
|
||||
cond_br %10, ^bb4, ^bb5
|
||||
^bb4: // pred: ^bb3
|
||||
%11 = addi %9, %c1_0 : index
|
||||
br ^bb3(%11 : index)
|
||||
^bb5: // pred: ^bb3
|
||||
%12 = addi %0, %c1 : index
|
||||
br ^bb1(%12 : index)
|
||||
^bb6: // pred: ^bb1
|
||||
return
|
||||
}
|
|
@ -0,0 +1,294 @@
|
|||
// NOTE: Assertions have been autogenerated by utils/update_mlir_test_checks.py
|
||||
// RUN: circt-opt -create-dataflow %s | FileCheck %s
|
||||
func @if_for() {
|
||||
// CHECK: module {
|
||||
|
||||
// CHECK-LABEL: handshake.func @if_for(
|
||||
// CHECK-SAME: %[[VAL_0:.*]]: none, ...) -> none {
|
||||
// CHECK: %[[VAL_1:.*]]:4 = "handshake.fork"(%[[VAL_0]]) {control = true} : (none) -> (none, none, none, none)
|
||||
// CHECK: %[[VAL_2:.*]] = "handshake.constant"(%[[VAL_1]]#2) {value = 0 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_3:.*]] = "handshake.constant"(%[[VAL_1]]#1) {value = -1 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_4:.*]]:2 = "handshake.fork"(%[[VAL_3]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_5:.*]] = muli %[[VAL_4]]#0, %[[VAL_4]]#1 : index
|
||||
// CHECK: %[[VAL_6:.*]] = "handshake.constant"(%[[VAL_1]]#0) {value = 20 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_7:.*]] = addi %[[VAL_5]], %[[VAL_6]] : index
|
||||
// CHECK: %[[VAL_8:.*]] = cmpi "sge", %[[VAL_7]], %[[VAL_2]] : index
|
||||
// CHECK: %[[VAL_9:.*]], %[[VAL_10:.*]] = "handshake.conditional_branch"(%[[VAL_8]], %[[VAL_1]]#3) {control = true} : (i1, none) -> (none, none)
|
||||
// CHECK: "handshake.terminator"()[^bb1, ^bb7] : () -> ()
|
||||
// CHECK: ^bb1:
|
||||
// CHECK: %[[VAL_11:.*]]:2 = "handshake.control_merge"(%[[VAL_9]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: %[[VAL_12:.*]]:4 = "handshake.fork"(%[[VAL_11]]#0) {control = true} : (none) -> (none, none, none, none)
|
||||
// CHECK: "handshake.sink"(%[[VAL_11]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_13:.*]] = "handshake.constant"(%[[VAL_12]]#2) {value = 0 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_14:.*]] = "handshake.constant"(%[[VAL_12]]#1) {value = 42 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_15:.*]] = "handshake.constant"(%[[VAL_12]]#0) {value = 1 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_16:.*]] = "handshake.branch"(%[[VAL_12]]#3) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_17:.*]] = "handshake.branch"(%[[VAL_13]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_18:.*]] = "handshake.branch"(%[[VAL_14]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_19:.*]] = "handshake.branch"(%[[VAL_15]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb2] : () -> ()
|
||||
// CHECK: ^bb2:
|
||||
// CHECK: %[[VAL_20:.*]] = "handshake.mux"(%[[VAL_21:.*]]#2, %[[VAL_22:.*]], %[[VAL_18]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_23:.*]]:2 = "handshake.fork"(%[[VAL_20]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_24:.*]] = "handshake.mux"(%[[VAL_21]]#1, %[[VAL_25:.*]], %[[VAL_19]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_26:.*]]:2 = "handshake.control_merge"(%[[VAL_27:.*]], %[[VAL_16]]) {control = true} : (none, none) -> (none, index)
|
||||
// CHECK: %[[VAL_21]]:3 = "handshake.fork"(%[[VAL_26]]#1) {control = false} : (index) -> (index, index, index)
|
||||
// CHECK: %[[VAL_28:.*]] = "handshake.mux"(%[[VAL_21]]#0, %[[VAL_29:.*]], %[[VAL_17]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_30:.*]]:2 = "handshake.fork"(%[[VAL_28]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_31:.*]] = cmpi "slt", %[[VAL_30]]#1, %[[VAL_23]]#1 : index
|
||||
// CHECK: %[[VAL_32:.*]]:4 = "handshake.fork"(%[[VAL_31]]) {control = false} : (i1) -> (i1, i1, i1, i1)
|
||||
// CHECK: %[[VAL_33:.*]], %[[VAL_34:.*]] = "handshake.conditional_branch"(%[[VAL_32]]#3, %[[VAL_23]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_34]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_35:.*]], %[[VAL_36:.*]] = "handshake.conditional_branch"(%[[VAL_32]]#2, %[[VAL_24]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_36]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_37:.*]], %[[VAL_38:.*]] = "handshake.conditional_branch"(%[[VAL_32]]#1, %[[VAL_26]]#0) {control = true} : (i1, none) -> (none, none)
|
||||
// CHECK: %[[VAL_39:.*]], %[[VAL_40:.*]] = "handshake.conditional_branch"(%[[VAL_32]]#0, %[[VAL_30]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_40]]) : (index) -> ()
|
||||
// CHECK: "handshake.terminator"()[^bb3, ^bb6] : () -> ()
|
||||
// CHECK: ^bb3:
|
||||
// CHECK: %[[VAL_41:.*]] = "handshake.merge"(%[[VAL_39]]) : (index) -> index
|
||||
// CHECK: %[[VAL_42:.*]]:2 = "handshake.fork"(%[[VAL_41]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_43:.*]] = "handshake.merge"(%[[VAL_35]]) : (index) -> index
|
||||
// CHECK: %[[VAL_44:.*]] = "handshake.merge"(%[[VAL_33]]) : (index) -> index
|
||||
// CHECK: %[[VAL_45:.*]]:2 = "handshake.control_merge"(%[[VAL_37]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: %[[VAL_46:.*]]:3 = "handshake.fork"(%[[VAL_45]]#0) {control = true} : (none) -> (none, none, none)
|
||||
// CHECK: "handshake.sink"(%[[VAL_45]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_47:.*]] = "handshake.constant"(%[[VAL_46]]#1) {value = 0 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_48:.*]] = "handshake.constant"(%[[VAL_46]]#0) {value = -10 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_49:.*]] = addi %[[VAL_42]]#1, %[[VAL_48]] : index
|
||||
// CHECK: %[[VAL_50:.*]] = cmpi "sge", %[[VAL_49]], %[[VAL_47]] : index
|
||||
// CHECK: %[[VAL_51:.*]]:4 = "handshake.fork"(%[[VAL_50]]) {control = false} : (i1) -> (i1, i1, i1, i1)
|
||||
// CHECK: %[[VAL_52:.*]], %[[VAL_53:.*]] = "handshake.conditional_branch"(%[[VAL_51]]#3, %[[VAL_42]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: %[[VAL_54:.*]], %[[VAL_55:.*]] = "handshake.conditional_branch"(%[[VAL_51]]#2, %[[VAL_43]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: %[[VAL_56:.*]], %[[VAL_57:.*]] = "handshake.conditional_branch"(%[[VAL_51]]#1, %[[VAL_44]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: %[[VAL_58:.*]], %[[VAL_59:.*]] = "handshake.conditional_branch"(%[[VAL_51]]#0, %[[VAL_46]]#2) {control = true} : (i1, none) -> (none, none)
|
||||
// CHECK: "handshake.terminator"()[^bb4, ^bb5] : () -> ()
|
||||
// CHECK: ^bb4:
|
||||
// CHECK: %[[VAL_60:.*]] = "handshake.merge"(%[[VAL_52]]) : (index) -> index
|
||||
// CHECK: %[[VAL_61:.*]] = "handshake.merge"(%[[VAL_54]]) : (index) -> index
|
||||
// CHECK: %[[VAL_62:.*]] = "handshake.merge"(%[[VAL_56]]) : (index) -> index
|
||||
// CHECK: %[[VAL_63:.*]]:2 = "handshake.control_merge"(%[[VAL_58]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_63]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_64:.*]] = "handshake.branch"(%[[VAL_60]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_65:.*]] = "handshake.branch"(%[[VAL_61]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_66:.*]] = "handshake.branch"(%[[VAL_62]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_67:.*]] = "handshake.branch"(%[[VAL_63]]#0) {control = true} : (none) -> none
|
||||
// CHECK: "handshake.terminator"()[^bb5] : () -> ()
|
||||
// CHECK: ^bb5:
|
||||
// CHECK: %[[VAL_68:.*]] = "handshake.mux"(%[[VAL_69:.*]]#2, %[[VAL_64]], %[[VAL_53]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_70:.*]] = "handshake.mux"(%[[VAL_69]]#1, %[[VAL_65]], %[[VAL_55]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_71:.*]]:2 = "handshake.fork"(%[[VAL_70]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_72:.*]] = "handshake.mux"(%[[VAL_69]]#0, %[[VAL_66]], %[[VAL_57]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_73:.*]]:2 = "handshake.control_merge"(%[[VAL_67]], %[[VAL_59]]) {control = true} : (none, none) -> (none, index)
|
||||
// CHECK: %[[VAL_69]]:3 = "handshake.fork"(%[[VAL_73]]#1) {control = false} : (index) -> (index, index, index)
|
||||
// CHECK: %[[VAL_74:.*]] = addi %[[VAL_68]], %[[VAL_71]]#1 : index
|
||||
// CHECK: %[[VAL_25]] = "handshake.branch"(%[[VAL_71]]#0) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_22]] = "handshake.branch"(%[[VAL_72]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_27]] = "handshake.branch"(%[[VAL_73]]#0) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_29]] = "handshake.branch"(%[[VAL_74]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb2] : () -> ()
|
||||
// CHECK: ^bb6:
|
||||
// CHECK: %[[VAL_75:.*]]:2 = "handshake.control_merge"(%[[VAL_38]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_75]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_76:.*]] = "handshake.branch"(%[[VAL_75]]#0) {control = true} : (none) -> none
|
||||
// CHECK: "handshake.terminator"()[^bb7] : () -> ()
|
||||
// CHECK: ^bb7:
|
||||
// CHECK: %[[VAL_77:.*]]:2 = "handshake.control_merge"(%[[VAL_76]], %[[VAL_10]]) {control = true} : (none, none) -> (none, index)
|
||||
// CHECK: %[[VAL_78:.*]]:4 = "handshake.fork"(%[[VAL_77]]#0) {control = true} : (none) -> (none, none, none, none)
|
||||
// CHECK: "handshake.sink"(%[[VAL_77]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_79:.*]] = "handshake.constant"(%[[VAL_78]]#2) {value = 0 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_80:.*]] = "handshake.constant"(%[[VAL_78]]#1) {value = 42 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_81:.*]] = "handshake.constant"(%[[VAL_78]]#0) {value = 1 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_82:.*]] = "handshake.branch"(%[[VAL_78]]#3) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_83:.*]] = "handshake.branch"(%[[VAL_79]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_84:.*]] = "handshake.branch"(%[[VAL_80]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_85:.*]] = "handshake.branch"(%[[VAL_81]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb8] : () -> ()
|
||||
// CHECK: ^bb8:
|
||||
// CHECK: %[[VAL_86:.*]] = "handshake.mux"(%[[VAL_87:.*]]#2, %[[VAL_88:.*]], %[[VAL_84]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_89:.*]]:2 = "handshake.fork"(%[[VAL_86]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_90:.*]] = "handshake.mux"(%[[VAL_87]]#1, %[[VAL_91:.*]], %[[VAL_85]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_92:.*]]:2 = "handshake.control_merge"(%[[VAL_93:.*]], %[[VAL_82]]) {control = true} : (none, none) -> (none, index)
|
||||
// CHECK: %[[VAL_87]]:3 = "handshake.fork"(%[[VAL_92]]#1) {control = false} : (index) -> (index, index, index)
|
||||
// CHECK: %[[VAL_94:.*]] = "handshake.mux"(%[[VAL_87]]#0, %[[VAL_95:.*]], %[[VAL_83]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_96:.*]]:2 = "handshake.fork"(%[[VAL_94]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_97:.*]] = cmpi "slt", %[[VAL_96]]#1, %[[VAL_89]]#1 : index
|
||||
// CHECK: %[[VAL_98:.*]]:4 = "handshake.fork"(%[[VAL_97]]) {control = false} : (i1) -> (i1, i1, i1, i1)
|
||||
// CHECK: %[[VAL_99:.*]], %[[VAL_100:.*]] = "handshake.conditional_branch"(%[[VAL_98]]#3, %[[VAL_89]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_100]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_101:.*]], %[[VAL_102:.*]] = "handshake.conditional_branch"(%[[VAL_98]]#2, %[[VAL_90]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_102]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_103:.*]], %[[VAL_104:.*]] = "handshake.conditional_branch"(%[[VAL_98]]#1, %[[VAL_92]]#0) {control = true} : (i1, none) -> (none, none)
|
||||
// CHECK: %[[VAL_105:.*]], %[[VAL_106:.*]] = "handshake.conditional_branch"(%[[VAL_98]]#0, %[[VAL_96]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_106]]) : (index) -> ()
|
||||
// CHECK: "handshake.terminator"()[^bb9, ^bb15] : () -> ()
|
||||
// CHECK: ^bb9:
|
||||
// CHECK: %[[VAL_107:.*]] = "handshake.merge"(%[[VAL_105]]) : (index) -> index
|
||||
// CHECK: %[[VAL_108:.*]]:2 = "handshake.fork"(%[[VAL_107]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_109:.*]] = "handshake.merge"(%[[VAL_101]]) : (index) -> index
|
||||
// CHECK: %[[VAL_110:.*]] = "handshake.merge"(%[[VAL_99]]) : (index) -> index
|
||||
// CHECK: %[[VAL_111:.*]]:2 = "handshake.control_merge"(%[[VAL_103]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: %[[VAL_112:.*]]:3 = "handshake.fork"(%[[VAL_111]]#0) {control = true} : (none) -> (none, none, none)
|
||||
// CHECK: "handshake.sink"(%[[VAL_111]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_113:.*]] = "handshake.constant"(%[[VAL_112]]#1) {value = 0 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_114:.*]] = "handshake.constant"(%[[VAL_112]]#0) {value = -10 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_115:.*]] = addi %[[VAL_108]]#1, %[[VAL_114]] : index
|
||||
// CHECK: %[[VAL_116:.*]] = cmpi "sge", %[[VAL_115]], %[[VAL_113]] : index
|
||||
// CHECK: %[[VAL_117:.*]]:4 = "handshake.fork"(%[[VAL_116]]) {control = false} : (i1) -> (i1, i1, i1, i1)
|
||||
// CHECK: %[[VAL_118:.*]], %[[VAL_119:.*]] = "handshake.conditional_branch"(%[[VAL_117]]#3, %[[VAL_108]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: %[[VAL_120:.*]], %[[VAL_121:.*]] = "handshake.conditional_branch"(%[[VAL_117]]#2, %[[VAL_109]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: %[[VAL_122:.*]], %[[VAL_123:.*]] = "handshake.conditional_branch"(%[[VAL_117]]#1, %[[VAL_110]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: %[[VAL_124:.*]], %[[VAL_125:.*]] = "handshake.conditional_branch"(%[[VAL_117]]#0, %[[VAL_112]]#2) {control = true} : (i1, none) -> (none, none)
|
||||
// CHECK: "handshake.terminator"()[^bb10, ^bb14] : () -> ()
|
||||
// CHECK: ^bb10:
|
||||
// CHECK: %[[VAL_126:.*]] = "handshake.merge"(%[[VAL_118]]) : (index) -> index
|
||||
// CHECK: %[[VAL_127:.*]] = "handshake.merge"(%[[VAL_120]]) : (index) -> index
|
||||
// CHECK: %[[VAL_128:.*]] = "handshake.merge"(%[[VAL_122]]) : (index) -> index
|
||||
// CHECK: %[[VAL_129:.*]]:2 = "handshake.control_merge"(%[[VAL_124]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: %[[VAL_130:.*]]:4 = "handshake.fork"(%[[VAL_129]]#0) {control = true} : (none) -> (none, none, none, none)
|
||||
// CHECK: "handshake.sink"(%[[VAL_129]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_131:.*]] = "handshake.constant"(%[[VAL_130]]#2) {value = 0 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_132:.*]] = "handshake.constant"(%[[VAL_130]]#1) {value = 42 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_133:.*]] = "handshake.constant"(%[[VAL_130]]#0) {value = 1 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_134:.*]] = "handshake.branch"(%[[VAL_126]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_135:.*]] = "handshake.branch"(%[[VAL_127]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_136:.*]] = "handshake.branch"(%[[VAL_128]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_137:.*]] = "handshake.branch"(%[[VAL_130]]#3) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_138:.*]] = "handshake.branch"(%[[VAL_131]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_139:.*]] = "handshake.branch"(%[[VAL_132]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_140:.*]] = "handshake.branch"(%[[VAL_133]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb11] : () -> ()
|
||||
// CHECK: ^bb11:
|
||||
// CHECK: %[[VAL_141:.*]] = "handshake.mux"(%[[VAL_142:.*]]#5, %[[VAL_143:.*]], %[[VAL_139]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_144:.*]]:2 = "handshake.fork"(%[[VAL_141]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_145:.*]] = "handshake.mux"(%[[VAL_142]]#4, %[[VAL_146:.*]], %[[VAL_140]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_147:.*]] = "handshake.mux"(%[[VAL_142]]#3, %[[VAL_148:.*]], %[[VAL_134]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_149:.*]] = "handshake.mux"(%[[VAL_142]]#2, %[[VAL_150:.*]], %[[VAL_135]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_151:.*]] = "handshake.mux"(%[[VAL_142]]#1, %[[VAL_152:.*]], %[[VAL_136]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_153:.*]]:2 = "handshake.control_merge"(%[[VAL_154:.*]], %[[VAL_137]]) {control = true} : (none, none) -> (none, index)
|
||||
// CHECK: %[[VAL_142]]:6 = "handshake.fork"(%[[VAL_153]]#1) {control = false} : (index) -> (index, index, index, index, index, index)
|
||||
// CHECK: %[[VAL_155:.*]] = "handshake.mux"(%[[VAL_142]]#0, %[[VAL_156:.*]], %[[VAL_138]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_157:.*]]:2 = "handshake.fork"(%[[VAL_155]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_158:.*]] = cmpi "slt", %[[VAL_157]]#1, %[[VAL_144]]#1 : index
|
||||
// CHECK: %[[VAL_159:.*]]:7 = "handshake.fork"(%[[VAL_158]]) {control = false} : (i1) -> (i1, i1, i1, i1, i1, i1, i1)
|
||||
// CHECK: %[[VAL_160:.*]], %[[VAL_161:.*]] = "handshake.conditional_branch"(%[[VAL_159]]#6, %[[VAL_144]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_161]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_162:.*]], %[[VAL_163:.*]] = "handshake.conditional_branch"(%[[VAL_159]]#5, %[[VAL_145]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_163]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_164:.*]], %[[VAL_165:.*]] = "handshake.conditional_branch"(%[[VAL_159]]#4, %[[VAL_147]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: %[[VAL_166:.*]], %[[VAL_167:.*]] = "handshake.conditional_branch"(%[[VAL_159]]#3, %[[VAL_149]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: %[[VAL_168:.*]], %[[VAL_169:.*]] = "handshake.conditional_branch"(%[[VAL_159]]#2, %[[VAL_151]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: %[[VAL_170:.*]], %[[VAL_171:.*]] = "handshake.conditional_branch"(%[[VAL_159]]#1, %[[VAL_153]]#0) {control = true} : (i1, none) -> (none, none)
|
||||
// CHECK: %[[VAL_172:.*]], %[[VAL_173:.*]] = "handshake.conditional_branch"(%[[VAL_159]]#0, %[[VAL_157]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_173]]) : (index) -> ()
|
||||
// CHECK: "handshake.terminator"()[^bb12, ^bb13] : () -> ()
|
||||
// CHECK: ^bb12:
|
||||
// CHECK: %[[VAL_174:.*]] = "handshake.merge"(%[[VAL_172]]) : (index) -> index
|
||||
// CHECK: %[[VAL_175:.*]] = "handshake.merge"(%[[VAL_162]]) : (index) -> index
|
||||
// CHECK: %[[VAL_176:.*]]:2 = "handshake.fork"(%[[VAL_175]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_177:.*]] = "handshake.merge"(%[[VAL_160]]) : (index) -> index
|
||||
// CHECK: %[[VAL_178:.*]] = "handshake.merge"(%[[VAL_164]]) : (index) -> index
|
||||
// CHECK: %[[VAL_179:.*]] = "handshake.merge"(%[[VAL_166]]) : (index) -> index
|
||||
// CHECK: %[[VAL_180:.*]] = "handshake.merge"(%[[VAL_168]]) : (index) -> index
|
||||
// CHECK: %[[VAL_181:.*]]:2 = "handshake.control_merge"(%[[VAL_170]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_181]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_182:.*]] = addi %[[VAL_174]], %[[VAL_176]]#1 : index
|
||||
// CHECK: %[[VAL_146]] = "handshake.branch"(%[[VAL_176]]#0) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_143]] = "handshake.branch"(%[[VAL_177]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_148]] = "handshake.branch"(%[[VAL_178]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_150]] = "handshake.branch"(%[[VAL_179]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_152]] = "handshake.branch"(%[[VAL_180]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_154]] = "handshake.branch"(%[[VAL_181]]#0) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_156]] = "handshake.branch"(%[[VAL_182]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb11] : () -> ()
|
||||
// CHECK: ^bb13:
|
||||
// CHECK: %[[VAL_183:.*]] = "handshake.merge"(%[[VAL_165]]) : (index) -> index
|
||||
// CHECK: %[[VAL_184:.*]] = "handshake.merge"(%[[VAL_167]]) : (index) -> index
|
||||
// CHECK: %[[VAL_185:.*]] = "handshake.merge"(%[[VAL_169]]) : (index) -> index
|
||||
// CHECK: %[[VAL_186:.*]]:2 = "handshake.control_merge"(%[[VAL_171]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_186]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_187:.*]] = "handshake.branch"(%[[VAL_183]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_188:.*]] = "handshake.branch"(%[[VAL_184]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_189:.*]] = "handshake.branch"(%[[VAL_185]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_190:.*]] = "handshake.branch"(%[[VAL_186]]#0) {control = true} : (none) -> none
|
||||
// CHECK: "handshake.terminator"()[^bb14] : () -> ()
|
||||
// CHECK: ^bb14:
|
||||
// CHECK: %[[VAL_191:.*]] = "handshake.mux"(%[[VAL_192:.*]]#2, %[[VAL_187]], %[[VAL_119]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_193:.*]] = "handshake.mux"(%[[VAL_192]]#1, %[[VAL_188]], %[[VAL_121]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_194:.*]]:2 = "handshake.fork"(%[[VAL_193]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_195:.*]] = "handshake.mux"(%[[VAL_192]]#0, %[[VAL_189]], %[[VAL_123]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_196:.*]]:2 = "handshake.control_merge"(%[[VAL_190]], %[[VAL_125]]) {control = true} : (none, none) -> (none, index)
|
||||
// CHECK: %[[VAL_192]]:3 = "handshake.fork"(%[[VAL_196]]#1) {control = false} : (index) -> (index, index, index)
|
||||
// CHECK: %[[VAL_197:.*]] = addi %[[VAL_191]], %[[VAL_194]]#1 : index
|
||||
// CHECK: %[[VAL_91]] = "handshake.branch"(%[[VAL_194]]#0) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_88]] = "handshake.branch"(%[[VAL_195]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_93]] = "handshake.branch"(%[[VAL_196]]#0) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_95]] = "handshake.branch"(%[[VAL_197]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb8] : () -> ()
|
||||
// CHECK: ^bb15:
|
||||
// CHECK: %[[VAL_198:.*]]:2 = "handshake.control_merge"(%[[VAL_104]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_198]]#1) : (index) -> ()
|
||||
// CHECK: handshake.return %[[VAL_198]]#0 : none
|
||||
// CHECK: }
|
||||
// CHECK: }
|
||||
%c0 = constant 0 : index
|
||||
%c-1 = constant -1 : index
|
||||
%1 = muli %c-1, %c-1 : index
|
||||
%c20 = constant 20 : index
|
||||
%2 = addi %1, %c20 : index
|
||||
%3 = cmpi "sge", %2, %c0 : index
|
||||
cond_br %3, ^bb1, ^bb7
|
||||
^bb1: // pred: ^bb0
|
||||
%c0_0 = constant 0 : index
|
||||
%c42 = constant 42 : index
|
||||
%c1 = constant 1 : index
|
||||
br ^bb2(%c0_0 : index)
|
||||
^bb2(%4: index): // 2 preds: ^bb1, ^bb5
|
||||
%5 = cmpi "slt", %4, %c42 : index
|
||||
cond_br %5, ^bb3, ^bb6
|
||||
^bb3: // pred: ^bb2
|
||||
%c0_1 = constant 0 : index
|
||||
%c-10 = constant -10 : index
|
||||
%6 = addi %4, %c-10 : index
|
||||
%7 = cmpi "sge", %6, %c0_1 : index
|
||||
cond_br %7, ^bb4, ^bb5
|
||||
^bb4: // pred: ^bb3
|
||||
br ^bb5
|
||||
^bb5: // 2 preds: ^bb3, ^bb4
|
||||
%8 = addi %4, %c1 : index
|
||||
br ^bb2(%8 : index)
|
||||
^bb6: // pred: ^bb2
|
||||
br ^bb7
|
||||
^bb7: // 2 preds: ^bb0, ^bb6
|
||||
%c0_2 = constant 0 : index
|
||||
%c42_3 = constant 42 : index
|
||||
%c1_4 = constant 1 : index
|
||||
br ^bb8(%c0_2 : index)
|
||||
^bb8(%9: index): // 2 preds: ^bb7, ^bb14
|
||||
%10 = cmpi "slt", %9, %c42_3 : index
|
||||
cond_br %10, ^bb9, ^bb15
|
||||
^bb9: // pred: ^bb8
|
||||
%c0_5 = constant 0 : index
|
||||
%c-10_6 = constant -10 : index
|
||||
%11 = addi %9, %c-10_6 : index
|
||||
%12 = cmpi "sge", %11, %c0_5 : index
|
||||
cond_br %12, ^bb10, ^bb14
|
||||
^bb10: // pred: ^bb9
|
||||
%c0_7 = constant 0 : index
|
||||
%c42_8 = constant 42 : index
|
||||
%c1_9 = constant 1 : index
|
||||
br ^bb11(%c0_7 : index)
|
||||
^bb11(%13: index): // 2 preds: ^bb10, ^bb12
|
||||
%14 = cmpi "slt", %13, %c42_8 : index
|
||||
cond_br %14, ^bb12, ^bb13
|
||||
^bb12: // pred: ^bb11
|
||||
%15 = addi %13, %c1_9 : index
|
||||
br ^bb11(%15 : index)
|
||||
^bb13: // pred: ^bb11
|
||||
br ^bb14
|
||||
^bb14: // 2 preds: ^bb9, ^bb13
|
||||
%16 = addi %9, %c1_4 : index
|
||||
br ^bb8(%16 : index)
|
||||
^bb15: // pred: ^bb8
|
||||
return
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
// NOTE: Assertions have been autogenerated by utils/update_mlir_test_checks.py
|
||||
// RUN: circt-opt -create-dataflow %s | FileCheck %s
|
||||
func @multi_cond(%arg0: index, %arg1: index, %arg2: index, %arg3: index) {
|
||||
// CHECK: module {
|
||||
|
||||
// CHECK-LABEL: handshake.func @multi_cond(
|
||||
// CHECK-SAME: %[[VAL_0:.*]]: index, %[[VAL_1:.*]]: index, %[[VAL_2:.*]]: index, %[[VAL_3:.*]]: index, %[[VAL_4:.*]]: none, ...) -> none {
|
||||
// CHECK: %[[VAL_5:.*]] = "handshake.merge"(%[[VAL_0]]) : (index) -> index
|
||||
// CHECK: %[[VAL_6:.*]]:2 = "handshake.fork"(%[[VAL_5]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_7:.*]] = "handshake.merge"(%[[VAL_1]]) : (index) -> index
|
||||
// CHECK: %[[VAL_8:.*]] = "handshake.merge"(%[[VAL_2]]) : (index) -> index
|
||||
// CHECK: %[[VAL_9:.*]] = "handshake.merge"(%[[VAL_3]]) : (index) -> index
|
||||
// CHECK: %[[VAL_10:.*]]:8 = "handshake.fork"(%[[VAL_4]]) {control = true} : (none) -> (none, none, none, none, none, none, none, none)
|
||||
// CHECK: %[[VAL_11:.*]] = "handshake.constant"(%[[VAL_10]]#6) {value = 0 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_12:.*]]:6 = "handshake.fork"(%[[VAL_11]]) {control = false} : (index) -> (index, index, index, index, index, index)
|
||||
// CHECK: %[[VAL_13:.*]] = "handshake.constant"(%[[VAL_10]]#5) {value = -1 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_14:.*]] = muli %[[VAL_12]]#0, %[[VAL_13]] : index
|
||||
// CHECK: %[[VAL_15:.*]] = addi %[[VAL_14]], %[[VAL_6]]#1 : index
|
||||
// CHECK: %[[VAL_16:.*]] = "handshake.constant"(%[[VAL_10]]#4) {value = 1 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_17:.*]] = addi %[[VAL_15]], %[[VAL_16]] : index
|
||||
// CHECK: %[[VAL_18:.*]] = cmpi "sge", %[[VAL_17]], %[[VAL_12]]#1 : index
|
||||
// CHECK: %[[VAL_19:.*]] = "handshake.constant"(%[[VAL_10]]#3) {value = -1 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_20:.*]] = addi %[[VAL_6]]#0, %[[VAL_19]] : index
|
||||
// CHECK: %[[VAL_21:.*]] = cmpi "sge", %[[VAL_20]], %[[VAL_12]]#2 : index
|
||||
// CHECK: %[[VAL_22:.*]] = and %[[VAL_18]], %[[VAL_21]] : i1
|
||||
// CHECK: %[[VAL_23:.*]] = "handshake.constant"(%[[VAL_10]]#2) {value = -1 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_24:.*]] = addi %[[VAL_7]], %[[VAL_23]] : index
|
||||
// CHECK: %[[VAL_25:.*]] = cmpi "sge", %[[VAL_24]], %[[VAL_12]]#3 : index
|
||||
// CHECK: %[[VAL_26:.*]] = and %[[VAL_22]], %[[VAL_25]] : i1
|
||||
// CHECK: %[[VAL_27:.*]] = "handshake.constant"(%[[VAL_10]]#1) {value = -1 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_28:.*]] = addi %[[VAL_8]], %[[VAL_27]] : index
|
||||
// CHECK: %[[VAL_29:.*]] = cmpi "sge", %[[VAL_28]], %[[VAL_12]]#4 : index
|
||||
// CHECK: %[[VAL_30:.*]] = and %[[VAL_26]], %[[VAL_29]] : i1
|
||||
// CHECK: %[[VAL_31:.*]] = "handshake.constant"(%[[VAL_10]]#0) {value = -42 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_32:.*]] = addi %[[VAL_9]], %[[VAL_31]] : index
|
||||
// CHECK: %[[VAL_33:.*]] = cmpi "eq", %[[VAL_32]], %[[VAL_12]]#5 : index
|
||||
// CHECK: %[[VAL_34:.*]] = and %[[VAL_30]], %[[VAL_33]] : i1
|
||||
// CHECK: %[[VAL_35:.*]], %[[VAL_36:.*]] = "handshake.conditional_branch"(%[[VAL_34]], %[[VAL_10]]#7) {control = true} : (i1, none) -> (none, none)
|
||||
// CHECK: "handshake.terminator"()[^bb1, ^bb2] : () -> ()
|
||||
// CHECK: ^bb1:
|
||||
// CHECK: %[[VAL_37:.*]]:2 = "handshake.control_merge"(%[[VAL_35]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_37]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_38:.*]] = "handshake.branch"(%[[VAL_37]]#0) {control = true} : (none) -> none
|
||||
// CHECK: "handshake.terminator"()[^bb3] : () -> ()
|
||||
// CHECK: ^bb2:
|
||||
// CHECK: %[[VAL_39:.*]]:2 = "handshake.control_merge"(%[[VAL_36]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_39]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_40:.*]] = "handshake.branch"(%[[VAL_39]]#0) {control = true} : (none) -> none
|
||||
// CHECK: "handshake.terminator"()[^bb3] : () -> ()
|
||||
// CHECK: ^bb3:
|
||||
// CHECK: %[[VAL_41:.*]]:2 = "handshake.control_merge"(%[[VAL_40]], %[[VAL_38]]) {control = true} : (none, none) -> (none, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_41]]#1) : (index) -> ()
|
||||
// CHECK: handshake.return %[[VAL_41]]#0 : none
|
||||
// CHECK: }
|
||||
// CHECK: }
|
||||
%c0 = constant 0 : index
|
||||
%c-1 = constant -1 : index
|
||||
%1 = muli %c0, %c-1 : index
|
||||
%2 = addi %1, %arg0 : index
|
||||
%c1 = constant 1 : index
|
||||
%3 = addi %2, %c1 : index
|
||||
%4 = cmpi "sge", %3, %c0 : index
|
||||
%c-1_0 = constant -1 : index
|
||||
%5 = addi %arg0, %c-1_0 : index
|
||||
%6 = cmpi "sge", %5, %c0 : index
|
||||
%7 = and %4, %6 : i1
|
||||
%c-1_1 = constant -1 : index
|
||||
%8 = addi %arg1, %c-1_1 : index
|
||||
%9 = cmpi "sge", %8, %c0 : index
|
||||
%10 = and %7, %9 : i1
|
||||
%c-1_2 = constant -1 : index
|
||||
%11 = addi %arg2, %c-1_2 : index
|
||||
%12 = cmpi "sge", %11, %c0 : index
|
||||
%13 = and %10, %12 : i1
|
||||
%c-42 = constant -42 : index
|
||||
%14 = addi %arg3, %c-42 : index
|
||||
%15 = cmpi "eq", %14, %c0 : index
|
||||
%16 = and %13, %15 : i1
|
||||
cond_br %16, ^bb1, ^bb2
|
||||
^bb1: // pred: ^bb0
|
||||
br ^bb3
|
||||
^bb2: // pred: ^bb0
|
||||
br ^bb3
|
||||
^bb3: // 2 preds: ^bb1, ^bb2
|
||||
return
|
||||
}
|
|
@ -0,0 +1,98 @@
|
|||
// NOTE: Assertions have been autogenerated by utils/update_mlir_test_checks.py
|
||||
// RUN: circt-opt -create-dataflow %s | FileCheck %s
|
||||
func @nested_ifs() {
|
||||
// CHECK: module {
|
||||
|
||||
// CHECK-LABEL: handshake.func @nested_ifs(
|
||||
// CHECK-SAME: %[[VAL_0:.*]]: none, ...) -> none {
|
||||
// CHECK: %[[VAL_1:.*]]:4 = "handshake.fork"(%[[VAL_0]]) {control = true} : (none) -> (none, none, none, none)
|
||||
// CHECK: %[[VAL_2:.*]] = "handshake.constant"(%[[VAL_1]]#2) {value = 0 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_3:.*]]:2 = "handshake.fork"(%[[VAL_2]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_4:.*]] = "handshake.constant"(%[[VAL_1]]#1) {value = -1 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_5:.*]] = muli %[[VAL_3]]#0, %[[VAL_4]] : index
|
||||
// CHECK: %[[VAL_6:.*]]:2 = "handshake.fork"(%[[VAL_5]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_7:.*]] = "handshake.constant"(%[[VAL_1]]#0) {value = 20 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_8:.*]] = addi %[[VAL_6]]#1, %[[VAL_7]] : index
|
||||
// CHECK: %[[VAL_9:.*]] = cmpi "sge", %[[VAL_8]], %[[VAL_3]]#1 : index
|
||||
// CHECK: %[[VAL_10:.*]]:2 = "handshake.fork"(%[[VAL_9]]) {control = false} : (i1) -> (i1, i1)
|
||||
// CHECK: %[[VAL_11:.*]], %[[VAL_12:.*]] = "handshake.conditional_branch"(%[[VAL_10]]#1, %[[VAL_1]]#3) {control = true} : (i1, none) -> (none, none)
|
||||
// CHECK: %[[VAL_13:.*]], %[[VAL_14:.*]] = "handshake.conditional_branch"(%[[VAL_10]]#0, %[[VAL_6]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.terminator"()[^bb1, ^bb4] : () -> ()
|
||||
// CHECK: ^bb1:
|
||||
// CHECK: %[[VAL_15:.*]] = "handshake.merge"(%[[VAL_13]]) : (index) -> index
|
||||
// CHECK: %[[VAL_16:.*]]:2 = "handshake.control_merge"(%[[VAL_11]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: %[[VAL_17:.*]]:3 = "handshake.fork"(%[[VAL_16]]#0) {control = true} : (none) -> (none, none, none)
|
||||
// CHECK: "handshake.sink"(%[[VAL_16]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_18:.*]] = "handshake.constant"(%[[VAL_17]]#1) {value = 0 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_19:.*]] = "handshake.constant"(%[[VAL_17]]#0) {value = -10 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_20:.*]] = addi %[[VAL_15]], %[[VAL_19]] : index
|
||||
// CHECK: %[[VAL_21:.*]] = cmpi "sge", %[[VAL_20]], %[[VAL_18]] : index
|
||||
// CHECK: %[[VAL_22:.*]], %[[VAL_23:.*]] = "handshake.conditional_branch"(%[[VAL_21]], %[[VAL_17]]#2) {control = true} : (i1, none) -> (none, none)
|
||||
// CHECK: "handshake.terminator"()[^bb2, ^bb3] : () -> ()
|
||||
// CHECK: ^bb2:
|
||||
// CHECK: %[[VAL_24:.*]]:2 = "handshake.control_merge"(%[[VAL_22]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_24]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_25:.*]] = "handshake.branch"(%[[VAL_24]]#0) {control = true} : (none) -> none
|
||||
// CHECK: "handshake.terminator"()[^bb3] : () -> ()
|
||||
// CHECK: ^bb3:
|
||||
// CHECK: %[[VAL_26:.*]]:2 = "handshake.control_merge"(%[[VAL_25]], %[[VAL_23]]) {control = true} : (none, none) -> (none, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_26]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_27:.*]] = "handshake.branch"(%[[VAL_26]]#0) {control = true} : (none) -> none
|
||||
// CHECK: "handshake.terminator"()[^bb7] : () -> ()
|
||||
// CHECK: ^bb4:
|
||||
// CHECK: %[[VAL_28:.*]] = "handshake.merge"(%[[VAL_14]]) : (index) -> index
|
||||
// CHECK: %[[VAL_29:.*]]:2 = "handshake.control_merge"(%[[VAL_12]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: %[[VAL_30:.*]]:3 = "handshake.fork"(%[[VAL_29]]#0) {control = true} : (none) -> (none, none, none)
|
||||
// CHECK: "handshake.sink"(%[[VAL_29]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_31:.*]] = "handshake.constant"(%[[VAL_30]]#1) {value = 0 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_32:.*]] = "handshake.constant"(%[[VAL_30]]#0) {value = -10 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_33:.*]] = addi %[[VAL_28]], %[[VAL_32]] : index
|
||||
// CHECK: %[[VAL_34:.*]] = cmpi "sge", %[[VAL_33]], %[[VAL_31]] : index
|
||||
// CHECK: %[[VAL_35:.*]], %[[VAL_36:.*]] = "handshake.conditional_branch"(%[[VAL_34]], %[[VAL_30]]#2) {control = true} : (i1, none) -> (none, none)
|
||||
// CHECK: "handshake.terminator"()[^bb5, ^bb6] : () -> ()
|
||||
// CHECK: ^bb5:
|
||||
// CHECK: %[[VAL_37:.*]]:2 = "handshake.control_merge"(%[[VAL_35]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_37]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_38:.*]] = "handshake.branch"(%[[VAL_37]]#0) {control = true} : (none) -> none
|
||||
// CHECK: "handshake.terminator"()[^bb6] : () -> ()
|
||||
// CHECK: ^bb6:
|
||||
// CHECK: %[[VAL_39:.*]]:2 = "handshake.control_merge"(%[[VAL_38]], %[[VAL_36]]) {control = true} : (none, none) -> (none, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_39]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_40:.*]] = "handshake.branch"(%[[VAL_39]]#0) {control = true} : (none) -> none
|
||||
// CHECK: "handshake.terminator"()[^bb7] : () -> ()
|
||||
// CHECK: ^bb7:
|
||||
// CHECK: %[[VAL_41:.*]]:2 = "handshake.control_merge"(%[[VAL_40]], %[[VAL_27]]) {control = true} : (none, none) -> (none, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_41]]#1) : (index) -> ()
|
||||
// CHECK: handshake.return %[[VAL_41]]#0 : none
|
||||
// CHECK: }
|
||||
// CHECK: }
|
||||
%c0 = constant 0 : index
|
||||
%c-1 = constant -1 : index
|
||||
%1 = muli %c0, %c-1 : index
|
||||
%c20 = constant 20 : index
|
||||
%2 = addi %1, %c20 : index
|
||||
%3 = cmpi "sge", %2, %c0 : index
|
||||
cond_br %3, ^bb1, ^bb4
|
||||
^bb1: // pred: ^bb0
|
||||
%c0_0 = constant 0 : index
|
||||
%c-10 = constant -10 : index
|
||||
%4 = addi %1, %c-10 : index
|
||||
%5 = cmpi "sge", %4, %c0_0 : index
|
||||
cond_br %5, ^bb2, ^bb3
|
||||
^bb2: // pred: ^bb1
|
||||
br ^bb3
|
||||
^bb3: // 2 preds: ^bb1, ^bb2
|
||||
br ^bb7
|
||||
^bb4: // pred: ^bb0
|
||||
%c0_1 = constant 0 : index
|
||||
%c-10_2 = constant -10 : index
|
||||
%6 = addi %1, %c-10_2 : index
|
||||
%7 = cmpi "sge", %6, %c0_1 : index
|
||||
cond_br %7, ^bb5, ^bb6
|
||||
^bb5: // pred: ^bb4
|
||||
br ^bb6
|
||||
^bb6: // 2 preds: ^bb4, ^bb5
|
||||
br ^bb7
|
||||
^bb7: // 2 preds: ^bb3, ^bb6
|
||||
return
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
// NOTE: Assertions have been autogenerated by utils/update_mlir_test_checks.py
|
||||
// RUN: circt-opt -create-dataflow %s | FileCheck %s
|
||||
func @if_else() {
|
||||
// CHECK: module {
|
||||
|
||||
// CHECK-LABEL: handshake.func @if_else(
|
||||
// CHECK-SAME: %[[VAL_0:.*]]: none, ...) -> none {
|
||||
// CHECK: %[[VAL_1:.*]]:4 = "handshake.fork"(%[[VAL_0]]) {control = true} : (none) -> (none, none, none, none)
|
||||
// CHECK: %[[VAL_2:.*]] = "handshake.constant"(%[[VAL_1]]#2) {value = 0 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_3:.*]]:2 = "handshake.fork"(%[[VAL_2]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_4:.*]] = "handshake.constant"(%[[VAL_1]]#1) {value = -1 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_5:.*]] = muli %[[VAL_3]]#0, %[[VAL_4]] : index
|
||||
// CHECK: %[[VAL_6:.*]] = "handshake.constant"(%[[VAL_1]]#0) {value = 20 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_7:.*]] = addi %[[VAL_5]], %[[VAL_6]] : index
|
||||
// CHECK: %[[VAL_8:.*]] = cmpi "sge", %[[VAL_7]], %[[VAL_3]]#1 : index
|
||||
// CHECK: %[[VAL_9:.*]], %[[VAL_10:.*]] = "handshake.conditional_branch"(%[[VAL_8]], %[[VAL_1]]#3) {control = true} : (i1, none) -> (none, none)
|
||||
// CHECK: "handshake.terminator"()[^bb1, ^bb2] : () -> ()
|
||||
// CHECK: ^bb1:
|
||||
// CHECK: %[[VAL_11:.*]]:2 = "handshake.control_merge"(%[[VAL_9]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_11]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_12:.*]] = "handshake.branch"(%[[VAL_11]]#0) {control = true} : (none) -> none
|
||||
// CHECK: "handshake.terminator"()[^bb3] : () -> ()
|
||||
// CHECK: ^bb2:
|
||||
// CHECK: %[[VAL_13:.*]]:2 = "handshake.control_merge"(%[[VAL_10]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_13]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_14:.*]] = "handshake.branch"(%[[VAL_13]]#0) {control = true} : (none) -> none
|
||||
// CHECK: "handshake.terminator"()[^bb3] : () -> ()
|
||||
// CHECK: ^bb3:
|
||||
// CHECK: %[[VAL_15:.*]]:2 = "handshake.control_merge"(%[[VAL_14]], %[[VAL_12]]) {control = true} : (none, none) -> (none, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_15]]#1) : (index) -> ()
|
||||
// CHECK: handshake.return %[[VAL_15]]#0 : none
|
||||
// CHECK: }
|
||||
// CHECK: }
|
||||
%c0 = constant 0 : index
|
||||
%c-1 = constant -1 : index
|
||||
%1 = muli %c0, %c-1 : index
|
||||
%c20 = constant 20 : index
|
||||
%2 = addi %1, %c20 : index
|
||||
%3 = cmpi "sge", %2, %c0 : index
|
||||
cond_br %3, ^bb1, ^bb2
|
||||
^bb1: // pred: ^bb0
|
||||
br ^bb3
|
||||
^bb2: // pred: ^bb0
|
||||
br ^bb3
|
||||
^bb3: // 2 preds: ^bb1, ^bb2
|
||||
return
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
// NOTE: Assertions have been autogenerated by utils/update_mlir_test_checks.py
|
||||
// RUN: circt-opt -create-dataflow %s | FileCheck %s
|
||||
func @if_only() {
|
||||
// CHECK: module {
|
||||
|
||||
// CHECK-LABEL: handshake.func @if_only(
|
||||
// CHECK-SAME: %[[VAL_0:.*]]: none, ...) -> none {
|
||||
// CHECK: %[[VAL_1:.*]]:4 = "handshake.fork"(%[[VAL_0]]) {control = true} : (none) -> (none, none, none, none)
|
||||
// CHECK: %[[VAL_2:.*]] = "handshake.constant"(%[[VAL_1]]#2) {value = 0 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_3:.*]]:2 = "handshake.fork"(%[[VAL_2]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_4:.*]] = "handshake.constant"(%[[VAL_1]]#1) {value = -1 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_5:.*]] = muli %[[VAL_3]]#0, %[[VAL_4]] : index
|
||||
// CHECK: %[[VAL_6:.*]] = "handshake.constant"(%[[VAL_1]]#0) {value = 20 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_7:.*]] = addi %[[VAL_5]], %[[VAL_6]] : index
|
||||
// CHECK: %[[VAL_8:.*]] = cmpi "sge", %[[VAL_7]], %[[VAL_3]]#1 : index
|
||||
// CHECK: %[[VAL_9:.*]], %[[VAL_10:.*]] = "handshake.conditional_branch"(%[[VAL_8]], %[[VAL_1]]#3) {control = true} : (i1, none) -> (none, none)
|
||||
// CHECK: "handshake.terminator"()[^bb1, ^bb2] : () -> ()
|
||||
// CHECK: ^bb1:
|
||||
// CHECK: %[[VAL_11:.*]]:2 = "handshake.control_merge"(%[[VAL_9]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_11]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_12:.*]] = "handshake.branch"(%[[VAL_11]]#0) {control = true} : (none) -> none
|
||||
// CHECK: "handshake.terminator"()[^bb2] : () -> ()
|
||||
// CHECK: ^bb2:
|
||||
// CHECK: %[[VAL_13:.*]]:2 = "handshake.control_merge"(%[[VAL_12]], %[[VAL_10]]) {control = true} : (none, none) -> (none, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_13]]#1) : (index) -> ()
|
||||
// CHECK: handshake.return %[[VAL_13]]#0 : none
|
||||
// CHECK: }
|
||||
// CHECK: }
|
||||
%c0 = constant 0 : index
|
||||
%c-1 = constant -1 : index
|
||||
%1 = muli %c0, %c-1 : index
|
||||
%c20 = constant 20 : index
|
||||
%2 = addi %1, %c20 : index
|
||||
%3 = cmpi "sge", %2, %c0 : index
|
||||
cond_br %3, ^bb1, ^bb2
|
||||
^bb1: // pred: ^bb0
|
||||
br ^bb2
|
||||
^bb2: // 2 preds: ^bb0, ^bb1
|
||||
return
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
// NOTE: Assertions have been autogenerated by utils/update_mlir_test_checks.py
|
||||
// RUN: circt-opt -create-dataflow %s | FileCheck %s
|
||||
func @simple_loop() {
|
||||
// CHECK: module {
|
||||
|
||||
// CHECK-LABEL: handshake.func @simple_loop(
|
||||
// CHECK-SAME: %[[VAL_0:.*]]: none, ...) -> none {
|
||||
// CHECK: %[[VAL_1:.*]] = "handshake.branch"(%[[VAL_0]]) {control = true} : (none) -> none
|
||||
// CHECK: "handshake.terminator"()[^bb1] : () -> ()
|
||||
// CHECK: ^bb1:
|
||||
// CHECK: %[[VAL_2:.*]]:2 = "handshake.control_merge"(%[[VAL_1]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: %[[VAL_3:.*]]:2 = "handshake.fork"(%[[VAL_2]]#0) {control = true} : (none) -> (none, none)
|
||||
// CHECK: "handshake.sink"(%[[VAL_2]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_4:.*]] = "handshake.constant"(%[[VAL_3]]#0) {value = 1 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_5:.*]]:2 = "handshake.fork"(%[[VAL_4]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_6:.*]] = "handshake.branch"(%[[VAL_3]]#1) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_7:.*]] = "handshake.branch"(%[[VAL_5]]#0) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_8:.*]] = "handshake.branch"(%[[VAL_5]]#1) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb2] : () -> ()
|
||||
// CHECK: ^bb2:
|
||||
// CHECK: %[[VAL_9:.*]] = "handshake.mux"(%[[VAL_10:.*]]#1, %[[VAL_11:.*]], %[[VAL_8]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_12:.*]]:2 = "handshake.fork"(%[[VAL_9]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_13:.*]]:2 = "handshake.control_merge"(%[[VAL_14:.*]], %[[VAL_6]]) {control = true} : (none, none) -> (none, index)
|
||||
// CHECK: %[[VAL_10]]:2 = "handshake.fork"(%[[VAL_13]]#1) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_15:.*]] = "handshake.mux"(%[[VAL_10]]#0, %[[VAL_16:.*]], %[[VAL_7]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_17:.*]]:2 = "handshake.fork"(%[[VAL_15]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_18:.*]] = cmpi "slt", %[[VAL_17]]#1, %[[VAL_12]]#1 : index
|
||||
// CHECK: %[[VAL_19:.*]]:3 = "handshake.fork"(%[[VAL_18]]) {control = false} : (i1) -> (i1, i1, i1)
|
||||
// CHECK: %[[VAL_20:.*]], %[[VAL_21:.*]] = "handshake.conditional_branch"(%[[VAL_19]]#2, %[[VAL_12]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_21]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_22:.*]], %[[VAL_23:.*]] = "handshake.conditional_branch"(%[[VAL_19]]#1, %[[VAL_13]]#0) {control = true} : (i1, none) -> (none, none)
|
||||
// CHECK: %[[VAL_24:.*]], %[[VAL_25:.*]] = "handshake.conditional_branch"(%[[VAL_19]]#0, %[[VAL_17]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_25]]) : (index) -> ()
|
||||
// CHECK: "handshake.terminator"()[^bb3, ^bb4] : () -> ()
|
||||
// CHECK: ^bb3:
|
||||
// CHECK: %[[VAL_26:.*]] = "handshake.merge"(%[[VAL_24]]) : (index) -> index
|
||||
// CHECK: %[[VAL_27:.*]] = "handshake.merge"(%[[VAL_20]]) : (index) -> index
|
||||
// CHECK: %[[VAL_28:.*]]:2 = "handshake.control_merge"(%[[VAL_22]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: %[[VAL_29:.*]]:2 = "handshake.fork"(%[[VAL_28]]#0) {control = true} : (none) -> (none, none)
|
||||
// CHECK: "handshake.sink"(%[[VAL_28]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_30:.*]] = "handshake.constant"(%[[VAL_29]]#0) {value = 1 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_31:.*]] = addi %[[VAL_26]], %[[VAL_30]] : index
|
||||
// CHECK: %[[VAL_11]] = "handshake.branch"(%[[VAL_27]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_14]] = "handshake.branch"(%[[VAL_29]]#1) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_16]] = "handshake.branch"(%[[VAL_31]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb2] : () -> ()
|
||||
// CHECK: ^bb4:
|
||||
// CHECK: %[[VAL_32:.*]]:2 = "handshake.control_merge"(%[[VAL_23]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_32]]#1) : (index) -> ()
|
||||
// CHECK: handshake.return %[[VAL_32]]#0 : none
|
||||
// CHECK: }
|
||||
// CHECK: }
|
||||
^bb0:
|
||||
br ^bb1
|
||||
^bb1: // pred: ^bb0
|
||||
%c1 = constant 1 : index
|
||||
br ^bb2(%c1 : index)
|
||||
^bb2(%0: index): // 2 preds: ^bb1, ^bb3
|
||||
%1 = cmpi "slt", %0, %c1 : index
|
||||
cond_br %1, ^bb3, ^bb4
|
||||
^bb3: // pred: ^bb2
|
||||
%c1_0 = constant 1 : index
|
||||
%2 = addi %0, %c1_0 : index
|
||||
br ^bb2(%2 : index)
|
||||
^bb4: // pred: ^bb2
|
||||
return
|
||||
}
|
|
@ -0,0 +1,99 @@
|
|||
// NOTE: Assertions have been autogenerated by utils/update_mlir_test_checks.py
|
||||
// RUN: circt-opt -create-dataflow %s | FileCheck %s
|
||||
func @affine_load(%arg0: index) {
|
||||
// CHECK: module {
|
||||
|
||||
// CHECK-LABEL: handshake.func @affine_load(
|
||||
// CHECK-SAME: %[[VAL_0:.*]]: index, %[[VAL_1:.*]]: none, ...) -> none {
|
||||
// CHECK: %[[VAL_2:.*]]:3 = "handshake.memory"(%[[VAL_3:.*]]#0, %[[VAL_3]]#1, %[[VAL_4:.*]]) {id = 1 : i32, ld_count = 1 : i32, lsq = false, st_count = 1 : i32, type = memref<10xf32>} : (f32, index, index) -> (f32, none, none)
|
||||
// CHECK: %[[VAL_5:.*]]:2 = "handshake.fork"(%[[VAL_2]]#2) {control = false} : (none) -> (none, none)
|
||||
// CHECK: %[[VAL_6:.*]]:2 = "handshake.memory"(%[[VAL_7:.*]]) {id = 0 : i32, ld_count = 1 : i32, lsq = false, st_count = 0 : i32, type = memref<10xf32>} : (index) -> (f32, none)
|
||||
// CHECK: %[[VAL_8:.*]] = "handshake.merge"(%[[VAL_0]]) : (index) -> index
|
||||
// CHECK: %[[VAL_9:.*]]:4 = "handshake.fork"(%[[VAL_1]]) {control = true} : (none) -> (none, none, none, none)
|
||||
// CHECK: %[[VAL_10:.*]] = "handshake.constant"(%[[VAL_9]]#2) {value = 0 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_11:.*]] = "handshake.constant"(%[[VAL_9]]#1) {value = 10 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_12:.*]] = "handshake.constant"(%[[VAL_9]]#0) {value = 1 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_13:.*]] = "handshake.branch"(%[[VAL_8]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_14:.*]] = "handshake.branch"(%[[VAL_9]]#3) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_15:.*]] = "handshake.branch"(%[[VAL_10]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_16:.*]] = "handshake.branch"(%[[VAL_11]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_17:.*]] = "handshake.branch"(%[[VAL_12]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb1] : () -> ()
|
||||
// CHECK: ^bb1:
|
||||
// CHECK: %[[VAL_18:.*]] = "handshake.mux"(%[[VAL_19:.*]]#3, %[[VAL_20:.*]], %[[VAL_16]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_21:.*]]:2 = "handshake.fork"(%[[VAL_18]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_22:.*]] = "handshake.mux"(%[[VAL_19]]#2, %[[VAL_23:.*]], %[[VAL_13]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_24:.*]] = "handshake.mux"(%[[VAL_19]]#1, %[[VAL_25:.*]], %[[VAL_17]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_26:.*]]:2 = "handshake.control_merge"(%[[VAL_27:.*]], %[[VAL_14]]) {control = true} : (none, none) -> (none, index)
|
||||
// CHECK: %[[VAL_19]]:4 = "handshake.fork"(%[[VAL_26]]#1) {control = false} : (index) -> (index, index, index, index)
|
||||
// CHECK: %[[VAL_28:.*]] = "handshake.mux"(%[[VAL_19]]#0, %[[VAL_29:.*]], %[[VAL_15]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_30:.*]]:2 = "handshake.fork"(%[[VAL_28]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_31:.*]] = cmpi "slt", %[[VAL_30]]#1, %[[VAL_21]]#1 : index
|
||||
// CHECK: %[[VAL_32:.*]]:5 = "handshake.fork"(%[[VAL_31]]) {control = false} : (i1) -> (i1, i1, i1, i1, i1)
|
||||
// CHECK: %[[VAL_33:.*]], %[[VAL_34:.*]] = "handshake.conditional_branch"(%[[VAL_32]]#4, %[[VAL_21]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_34]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_35:.*]], %[[VAL_36:.*]] = "handshake.conditional_branch"(%[[VAL_32]]#3, %[[VAL_22]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_36]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_37:.*]], %[[VAL_38:.*]] = "handshake.conditional_branch"(%[[VAL_32]]#2, %[[VAL_24]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_38]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_39:.*]], %[[VAL_40:.*]] = "handshake.conditional_branch"(%[[VAL_32]]#1, %[[VAL_26]]#0) {control = true} : (i1, none) -> (none, none)
|
||||
// CHECK: %[[VAL_41:.*]], %[[VAL_42:.*]] = "handshake.conditional_branch"(%[[VAL_32]]#0, %[[VAL_30]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_42]]) : (index) -> ()
|
||||
// CHECK: "handshake.terminator"()[^bb2, ^bb3] : () -> ()
|
||||
// CHECK: ^bb2:
|
||||
// CHECK: %[[VAL_43:.*]] = "handshake.merge"(%[[VAL_41]]) : (index) -> index
|
||||
// CHECK: %[[VAL_44:.*]]:2 = "handshake.fork"(%[[VAL_43]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_45:.*]] = "handshake.merge"(%[[VAL_35]]) : (index) -> index
|
||||
// CHECK: %[[VAL_46:.*]]:2 = "handshake.fork"(%[[VAL_45]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_47:.*]] = "handshake.merge"(%[[VAL_37]]) : (index) -> index
|
||||
// CHECK: %[[VAL_48:.*]]:2 = "handshake.fork"(%[[VAL_47]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_49:.*]] = "handshake.merge"(%[[VAL_33]]) : (index) -> index
|
||||
// CHECK: %[[VAL_50:.*]]:2 = "handshake.control_merge"(%[[VAL_39]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: %[[VAL_51:.*]]:4 = "handshake.fork"(%[[VAL_50]]#0) {control = true} : (none) -> (none, none, none, none)
|
||||
// CHECK: %[[VAL_52:.*]]:2 = "handshake.fork"(%[[VAL_51]]#3) {control = true} : (none) -> (none, none)
|
||||
// CHECK: %[[VAL_53:.*]] = "handshake.join"(%[[VAL_52]]#1, %[[VAL_6]]#1, %[[VAL_5]]#1, %[[VAL_2]]#1) {control = true} : (none, none, none, none) -> none
|
||||
// CHECK: "handshake.sink"(%[[VAL_50]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_54:.*]] = addi %[[VAL_44]]#1, %[[VAL_46]]#1 : index
|
||||
// CHECK: %[[VAL_55:.*]] = "handshake.constant"(%[[VAL_52]]#0) {value = 7 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_56:.*]] = addi %[[VAL_54]], %[[VAL_55]] : index
|
||||
// CHECK: %[[VAL_57:.*]]:3 = "handshake.fork"(%[[VAL_56]]) {control = false} : (index) -> (index, index, index)
|
||||
// CHECK: %[[VAL_58:.*]], %[[VAL_7]] = "handshake.load"(%[[VAL_57]]#2, %[[VAL_6]]#0, %[[VAL_51]]#2) : (index, f32, none) -> (f32, index)
|
||||
// CHECK: %[[VAL_59:.*]] = addi %[[VAL_44]]#0, %[[VAL_48]]#1 : index
|
||||
// CHECK: %[[VAL_60:.*]], %[[VAL_4]] = "handshake.load"(%[[VAL_57]]#1, %[[VAL_2]]#0, %[[VAL_51]]#1) : (index, f32, none) -> (f32, index)
|
||||
// CHECK: %[[VAL_61:.*]] = addf %[[VAL_58]], %[[VAL_60]] : f32
|
||||
// CHECK: %[[VAL_62:.*]] = "handshake.join"(%[[VAL_51]]#0, %[[VAL_5]]#0) {control = true} : (none, none) -> none
|
||||
// CHECK: %[[VAL_3]]:2 = "handshake.store"(%[[VAL_61]], %[[VAL_57]]#0, %[[VAL_62]]) : (f32, index, none) -> (f32, index)
|
||||
// CHECK: %[[VAL_23]] = "handshake.branch"(%[[VAL_46]]#0) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_25]] = "handshake.branch"(%[[VAL_48]]#0) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_20]] = "handshake.branch"(%[[VAL_49]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_27]] = "handshake.branch"(%[[VAL_53]]) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_29]] = "handshake.branch"(%[[VAL_59]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb1] : () -> ()
|
||||
// CHECK: ^bb3:
|
||||
// CHECK: %[[VAL_63:.*]]:2 = "handshake.control_merge"(%[[VAL_40]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_63]]#1) : (index) -> ()
|
||||
// CHECK: handshake.return %[[VAL_63]]#0 : none
|
||||
// CHECK: }
|
||||
// CHECK: }
|
||||
%0 = alloc() : memref<10xf32>
|
||||
%10 = alloc() : memref<10xf32>
|
||||
%c0 = constant 0 : index
|
||||
%c10 = constant 10 : index
|
||||
%c1 = constant 1 : index
|
||||
br ^bb1(%c0 : index)
|
||||
^bb1(%1: index): // 2 preds: ^bb0, ^bb2
|
||||
%2 = cmpi "slt", %1, %c10 : index
|
||||
cond_br %2, ^bb2, ^bb3
|
||||
^bb2: // pred: ^bb1
|
||||
%3 = addi %1, %arg0 : index
|
||||
%c7 = constant 7 : index
|
||||
%4 = addi %3, %c7 : index
|
||||
%5 = load %0[%4] : memref<10xf32>
|
||||
%6 = addi %1, %c1 : index
|
||||
%7 = load %10[%4] : memref<10xf32>
|
||||
%8 = addf %5, %7 : f32
|
||||
store %8, %10[%4] : memref<10xf32>
|
||||
br ^bb1(%6 : index)
|
||||
^bb3: // pred: ^bb1
|
||||
return
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
// NOTE: Assertions have been autogenerated by utils/update_mlir_test_checks.py
|
||||
// RUN: circt-opt -create-dataflow %s | FileCheck %s
|
||||
func @load_store(memref<4x4xi32>, index) {
|
||||
// CHECK: module {
|
||||
|
||||
// CHECK-LABEL: handshake.func @load_store(
|
||||
// CHECK-SAME: %[[VAL_0:.*]]: memref<4x4xi32>, %[[VAL_1:.*]]: index, %[[VAL_2:.*]]: none, ...) -> none {
|
||||
// CHECK: %[[VAL_3:.*]]:4 = "handshake.memory"(%[[VAL_4:.*]]#0, %[[VAL_4]]#1, %[[VAL_5:.*]]#0, %[[VAL_5]]#1) {id = 0 : i32, ld_count = 2 : i32, lsq = false, st_count = 0 : i32, type = memref<4x4xi32>} : (index, index, index, index) -> (i32, i32, none, none)
|
||||
// CHECK: %[[VAL_6:.*]] = "handshake.merge"(%[[VAL_0]]) : (memref<4x4xi32>) -> memref<4x4xi32>
|
||||
// CHECK: "handshake.sink"(%[[VAL_6]]) : (memref<4x4xi32>) -> ()
|
||||
// CHECK: %[[VAL_7:.*]] = "handshake.merge"(%[[VAL_1]]) : (index) -> index
|
||||
// CHECK: %[[VAL_8:.*]]:4 = "handshake.fork"(%[[VAL_7]]) {control = false} : (index) -> (index, index, index, index)
|
||||
// CHECK: %[[VAL_9:.*]]:3 = "handshake.fork"(%[[VAL_2]]) {control = true} : (none) -> (none, none, none)
|
||||
// CHECK: %[[VAL_10:.*]] = "handshake.join"(%[[VAL_9]]#2, %[[VAL_3]]#2, %[[VAL_3]]#3) {control = true} : (none, none, none) -> none
|
||||
// CHECK: %[[VAL_11:.*]], %[[VAL_4]]:2 = "handshake.load"(%[[VAL_8]]#2, %[[VAL_8]]#3, %[[VAL_3]]#0, %[[VAL_9]]#1) : (index, index, i32, none) -> (i32, index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_11]]) : (i32) -> ()
|
||||
// CHECK: %[[VAL_12:.*]], %[[VAL_5]]:2 = "handshake.load"(%[[VAL_8]]#0, %[[VAL_8]]#1, %[[VAL_3]]#1, %[[VAL_9]]#0) : (index, index, i32, none) -> (i32, index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_12]]) : (i32) -> ()
|
||||
// CHECK: handshake.return %[[VAL_10]] : none
|
||||
// CHECK: }
|
||||
// CHECK: }
|
||||
^bb0(%0: memref<4x4xi32>, %1: index):
|
||||
%2 = "std.load"(%0, %1, %1) : (memref<4x4xi32>, index, index)->i32
|
||||
%3 = load %0[%1, %1] : memref<4x4xi32>
|
||||
return
|
||||
}
|
|
@ -0,0 +1,210 @@
|
|||
// NOTE: Assertions have been autogenerated by utils/update_mlir_test_checks.py
|
||||
// RUN: circt-opt -create-dataflow %s | FileCheck %s
|
||||
func @more_imperfectly_nested_loops() {
|
||||
// CHECK: module {
|
||||
|
||||
// CHECK-LABEL: handshake.func @more_imperfectly_nested_loops(
|
||||
// CHECK-SAME: %[[VAL_0:.*]]: none, ...) -> none {
|
||||
// CHECK: %[[VAL_1:.*]] = "handshake.branch"(%[[VAL_0]]) {control = true} : (none) -> none
|
||||
// CHECK: "handshake.terminator"()[^bb1] : () -> ()
|
||||
// CHECK: ^bb1:
|
||||
// CHECK: %[[VAL_2:.*]]:2 = "handshake.control_merge"(%[[VAL_1]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: %[[VAL_3:.*]]:3 = "handshake.fork"(%[[VAL_2]]#0) {control = true} : (none) -> (none, none, none)
|
||||
// CHECK: "handshake.sink"(%[[VAL_2]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_4:.*]] = "handshake.constant"(%[[VAL_3]]#1) {value = 0 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_5:.*]] = "handshake.constant"(%[[VAL_3]]#0) {value = 42 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_6:.*]] = "handshake.branch"(%[[VAL_3]]#2) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_7:.*]] = "handshake.branch"(%[[VAL_4]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_8:.*]] = "handshake.branch"(%[[VAL_5]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb2] : () -> ()
|
||||
// CHECK: ^bb2:
|
||||
// CHECK: %[[VAL_9:.*]] = "handshake.mux"(%[[VAL_10:.*]]#1, %[[VAL_11:.*]], %[[VAL_8]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_12:.*]]:2 = "handshake.fork"(%[[VAL_9]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_13:.*]]:2 = "handshake.control_merge"(%[[VAL_14:.*]], %[[VAL_6]]) {control = true} : (none, none) -> (none, index)
|
||||
// CHECK: %[[VAL_10]]:2 = "handshake.fork"(%[[VAL_13]]#1) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_15:.*]] = "handshake.mux"(%[[VAL_10]]#0, %[[VAL_16:.*]], %[[VAL_7]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_17:.*]]:2 = "handshake.fork"(%[[VAL_15]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_18:.*]] = cmpi "slt", %[[VAL_17]]#1, %[[VAL_12]]#1 : index
|
||||
// CHECK: %[[VAL_19:.*]]:3 = "handshake.fork"(%[[VAL_18]]) {control = false} : (i1) -> (i1, i1, i1)
|
||||
// CHECK: %[[VAL_20:.*]], %[[VAL_21:.*]] = "handshake.conditional_branch"(%[[VAL_19]]#2, %[[VAL_12]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_21]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_22:.*]], %[[VAL_23:.*]] = "handshake.conditional_branch"(%[[VAL_19]]#1, %[[VAL_13]]#0) {control = true} : (i1, none) -> (none, none)
|
||||
// CHECK: %[[VAL_24:.*]], %[[VAL_25:.*]] = "handshake.conditional_branch"(%[[VAL_19]]#0, %[[VAL_17]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_25]]) : (index) -> ()
|
||||
// CHECK: "handshake.terminator"()[^bb3, ^bb12] : () -> ()
|
||||
// CHECK: ^bb3:
|
||||
// CHECK: %[[VAL_26:.*]] = "handshake.merge"(%[[VAL_24]]) : (index) -> index
|
||||
// CHECK: %[[VAL_27:.*]] = "handshake.merge"(%[[VAL_20]]) : (index) -> index
|
||||
// CHECK: %[[VAL_28:.*]]:2 = "handshake.control_merge"(%[[VAL_22]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_28]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_29:.*]] = "handshake.branch"(%[[VAL_26]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_30:.*]] = "handshake.branch"(%[[VAL_27]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_31:.*]] = "handshake.branch"(%[[VAL_28]]#0) {control = true} : (none) -> none
|
||||
// CHECK: "handshake.terminator"()[^bb4] : () -> ()
|
||||
// CHECK: ^bb4:
|
||||
// CHECK: %[[VAL_32:.*]] = "handshake.merge"(%[[VAL_29]]) : (index) -> index
|
||||
// CHECK: %[[VAL_33:.*]] = "handshake.merge"(%[[VAL_30]]) : (index) -> index
|
||||
// CHECK: %[[VAL_34:.*]]:2 = "handshake.control_merge"(%[[VAL_31]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: %[[VAL_35:.*]]:3 = "handshake.fork"(%[[VAL_34]]#0) {control = true} : (none) -> (none, none, none)
|
||||
// CHECK: "handshake.sink"(%[[VAL_34]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_36:.*]] = "handshake.constant"(%[[VAL_35]]#1) {value = 7 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_37:.*]] = "handshake.constant"(%[[VAL_35]]#0) {value = 56 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_38:.*]] = "handshake.branch"(%[[VAL_32]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_39:.*]] = "handshake.branch"(%[[VAL_33]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_40:.*]] = "handshake.branch"(%[[VAL_35]]#2) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_41:.*]] = "handshake.branch"(%[[VAL_36]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_42:.*]] = "handshake.branch"(%[[VAL_37]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb5] : () -> ()
|
||||
// CHECK: ^bb5:
|
||||
// CHECK: %[[VAL_43:.*]] = "handshake.mux"(%[[VAL_44:.*]]#3, %[[VAL_45:.*]], %[[VAL_42]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_46:.*]]:2 = "handshake.fork"(%[[VAL_43]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_47:.*]] = "handshake.mux"(%[[VAL_44]]#2, %[[VAL_48:.*]], %[[VAL_38]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_49:.*]] = "handshake.mux"(%[[VAL_44]]#1, %[[VAL_50:.*]], %[[VAL_39]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_51:.*]]:2 = "handshake.control_merge"(%[[VAL_52:.*]], %[[VAL_40]]) {control = true} : (none, none) -> (none, index)
|
||||
// CHECK: %[[VAL_44]]:4 = "handshake.fork"(%[[VAL_51]]#1) {control = false} : (index) -> (index, index, index, index)
|
||||
// CHECK: %[[VAL_53:.*]] = "handshake.mux"(%[[VAL_44]]#0, %[[VAL_54:.*]], %[[VAL_41]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_55:.*]]:2 = "handshake.fork"(%[[VAL_53]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_56:.*]] = cmpi "slt", %[[VAL_55]]#1, %[[VAL_46]]#1 : index
|
||||
// CHECK: %[[VAL_57:.*]]:5 = "handshake.fork"(%[[VAL_56]]) {control = false} : (i1) -> (i1, i1, i1, i1, i1)
|
||||
// CHECK: %[[VAL_58:.*]], %[[VAL_59:.*]] = "handshake.conditional_branch"(%[[VAL_57]]#4, %[[VAL_46]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_59]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_60:.*]], %[[VAL_61:.*]] = "handshake.conditional_branch"(%[[VAL_57]]#3, %[[VAL_47]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: %[[VAL_62:.*]], %[[VAL_63:.*]] = "handshake.conditional_branch"(%[[VAL_57]]#2, %[[VAL_49]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: %[[VAL_64:.*]], %[[VAL_65:.*]] = "handshake.conditional_branch"(%[[VAL_57]]#1, %[[VAL_51]]#0) {control = true} : (i1, none) -> (none, none)
|
||||
// CHECK: %[[VAL_66:.*]], %[[VAL_67:.*]] = "handshake.conditional_branch"(%[[VAL_57]]#0, %[[VAL_55]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_67]]) : (index) -> ()
|
||||
// CHECK: "handshake.terminator"()[^bb6, ^bb7] : () -> ()
|
||||
// CHECK: ^bb6:
|
||||
// CHECK: %[[VAL_68:.*]] = "handshake.merge"(%[[VAL_66]]) : (index) -> index
|
||||
// CHECK: %[[VAL_69:.*]] = "handshake.merge"(%[[VAL_58]]) : (index) -> index
|
||||
// CHECK: %[[VAL_70:.*]] = "handshake.merge"(%[[VAL_60]]) : (index) -> index
|
||||
// CHECK: %[[VAL_71:.*]] = "handshake.merge"(%[[VAL_62]]) : (index) -> index
|
||||
// CHECK: %[[VAL_72:.*]]:2 = "handshake.control_merge"(%[[VAL_64]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: %[[VAL_73:.*]]:2 = "handshake.fork"(%[[VAL_72]]#0) {control = true} : (none) -> (none, none)
|
||||
// CHECK: "handshake.sink"(%[[VAL_72]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_74:.*]] = "handshake.constant"(%[[VAL_73]]#0) {value = 2 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_75:.*]] = addi %[[VAL_68]], %[[VAL_74]] : index
|
||||
// CHECK: %[[VAL_45]] = "handshake.branch"(%[[VAL_69]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_48]] = "handshake.branch"(%[[VAL_70]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_50]] = "handshake.branch"(%[[VAL_71]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_52]] = "handshake.branch"(%[[VAL_73]]#1) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_54]] = "handshake.branch"(%[[VAL_75]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb5] : () -> ()
|
||||
// CHECK: ^bb7:
|
||||
// CHECK: %[[VAL_76:.*]] = "handshake.merge"(%[[VAL_61]]) : (index) -> index
|
||||
// CHECK: %[[VAL_77:.*]] = "handshake.merge"(%[[VAL_63]]) : (index) -> index
|
||||
// CHECK: %[[VAL_78:.*]]:2 = "handshake.control_merge"(%[[VAL_65]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_78]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_79:.*]] = "handshake.branch"(%[[VAL_76]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_80:.*]] = "handshake.branch"(%[[VAL_77]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_81:.*]] = "handshake.branch"(%[[VAL_78]]#0) {control = true} : (none) -> none
|
||||
// CHECK: "handshake.terminator"()[^bb8] : () -> ()
|
||||
// CHECK: ^bb8:
|
||||
// CHECK: %[[VAL_82:.*]] = "handshake.merge"(%[[VAL_79]]) : (index) -> index
|
||||
// CHECK: %[[VAL_83:.*]] = "handshake.merge"(%[[VAL_80]]) : (index) -> index
|
||||
// CHECK: %[[VAL_84:.*]]:2 = "handshake.control_merge"(%[[VAL_81]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: %[[VAL_85:.*]]:3 = "handshake.fork"(%[[VAL_84]]#0) {control = true} : (none) -> (none, none, none)
|
||||
// CHECK: "handshake.sink"(%[[VAL_84]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_86:.*]] = "handshake.constant"(%[[VAL_85]]#1) {value = 18 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_87:.*]] = "handshake.constant"(%[[VAL_85]]#0) {value = 37 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_88:.*]] = "handshake.branch"(%[[VAL_82]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_89:.*]] = "handshake.branch"(%[[VAL_83]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_90:.*]] = "handshake.branch"(%[[VAL_85]]#2) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_91:.*]] = "handshake.branch"(%[[VAL_86]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_92:.*]] = "handshake.branch"(%[[VAL_87]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb9] : () -> ()
|
||||
// CHECK: ^bb9:
|
||||
// CHECK: %[[VAL_93:.*]] = "handshake.mux"(%[[VAL_94:.*]]#3, %[[VAL_95:.*]], %[[VAL_92]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_96:.*]]:2 = "handshake.fork"(%[[VAL_93]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_97:.*]] = "handshake.mux"(%[[VAL_94]]#2, %[[VAL_98:.*]], %[[VAL_88]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_99:.*]] = "handshake.mux"(%[[VAL_94]]#1, %[[VAL_100:.*]], %[[VAL_89]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_101:.*]]:2 = "handshake.control_merge"(%[[VAL_102:.*]], %[[VAL_90]]) {control = true} : (none, none) -> (none, index)
|
||||
// CHECK: %[[VAL_94]]:4 = "handshake.fork"(%[[VAL_101]]#1) {control = false} : (index) -> (index, index, index, index)
|
||||
// CHECK: %[[VAL_103:.*]] = "handshake.mux"(%[[VAL_94]]#0, %[[VAL_104:.*]], %[[VAL_91]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_105:.*]]:2 = "handshake.fork"(%[[VAL_103]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_106:.*]] = cmpi "slt", %[[VAL_105]]#1, %[[VAL_96]]#1 : index
|
||||
// CHECK: %[[VAL_107:.*]]:5 = "handshake.fork"(%[[VAL_106]]) {control = false} : (i1) -> (i1, i1, i1, i1, i1)
|
||||
// CHECK: %[[VAL_108:.*]], %[[VAL_109:.*]] = "handshake.conditional_branch"(%[[VAL_107]]#4, %[[VAL_96]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_109]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_110:.*]], %[[VAL_111:.*]] = "handshake.conditional_branch"(%[[VAL_107]]#3, %[[VAL_97]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: %[[VAL_112:.*]], %[[VAL_113:.*]] = "handshake.conditional_branch"(%[[VAL_107]]#2, %[[VAL_99]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: %[[VAL_114:.*]], %[[VAL_115:.*]] = "handshake.conditional_branch"(%[[VAL_107]]#1, %[[VAL_101]]#0) {control = true} : (i1, none) -> (none, none)
|
||||
// CHECK: %[[VAL_116:.*]], %[[VAL_117:.*]] = "handshake.conditional_branch"(%[[VAL_107]]#0, %[[VAL_105]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_117]]) : (index) -> ()
|
||||
// CHECK: "handshake.terminator"()[^bb10, ^bb11] : () -> ()
|
||||
// CHECK: ^bb10:
|
||||
// CHECK: %[[VAL_118:.*]] = "handshake.merge"(%[[VAL_116]]) : (index) -> index
|
||||
// CHECK: %[[VAL_119:.*]] = "handshake.merge"(%[[VAL_108]]) : (index) -> index
|
||||
// CHECK: %[[VAL_120:.*]] = "handshake.merge"(%[[VAL_110]]) : (index) -> index
|
||||
// CHECK: %[[VAL_121:.*]] = "handshake.merge"(%[[VAL_112]]) : (index) -> index
|
||||
// CHECK: %[[VAL_122:.*]]:2 = "handshake.control_merge"(%[[VAL_114]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: %[[VAL_123:.*]]:2 = "handshake.fork"(%[[VAL_122]]#0) {control = true} : (none) -> (none, none)
|
||||
// CHECK: "handshake.sink"(%[[VAL_122]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_124:.*]] = "handshake.constant"(%[[VAL_123]]#0) {value = 3 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_125:.*]] = addi %[[VAL_118]], %[[VAL_124]] : index
|
||||
// CHECK: %[[VAL_95]] = "handshake.branch"(%[[VAL_119]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_98]] = "handshake.branch"(%[[VAL_120]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_100]] = "handshake.branch"(%[[VAL_121]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_102]] = "handshake.branch"(%[[VAL_123]]#1) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_104]] = "handshake.branch"(%[[VAL_125]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb9] : () -> ()
|
||||
// CHECK: ^bb11:
|
||||
// CHECK: %[[VAL_126:.*]] = "handshake.merge"(%[[VAL_111]]) : (index) -> index
|
||||
// CHECK: %[[VAL_127:.*]] = "handshake.merge"(%[[VAL_113]]) : (index) -> index
|
||||
// CHECK: %[[VAL_128:.*]]:2 = "handshake.control_merge"(%[[VAL_115]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: %[[VAL_129:.*]]:2 = "handshake.fork"(%[[VAL_128]]#0) {control = true} : (none) -> (none, none)
|
||||
// CHECK: "handshake.sink"(%[[VAL_128]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_130:.*]] = "handshake.constant"(%[[VAL_129]]#0) {value = 1 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_131:.*]] = addi %[[VAL_126]], %[[VAL_130]] : index
|
||||
// CHECK: %[[VAL_11]] = "handshake.branch"(%[[VAL_127]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_14]] = "handshake.branch"(%[[VAL_129]]#1) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_16]] = "handshake.branch"(%[[VAL_131]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb2] : () -> ()
|
||||
// CHECK: ^bb12:
|
||||
// CHECK: %[[VAL_132:.*]]:2 = "handshake.control_merge"(%[[VAL_23]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_132]]#1) : (index) -> ()
|
||||
// CHECK: handshake.return %[[VAL_132]]#0 : none
|
||||
// CHECK: }
|
||||
// CHECK: }
|
||||
^bb0:
|
||||
br ^bb1
|
||||
^bb1: // pred: ^bb0
|
||||
%c0 = constant 0 : index
|
||||
%c42 = constant 42 : index
|
||||
br ^bb2(%c0 : index)
|
||||
^bb2(%0: index): // 2 preds: ^bb1, ^bb11
|
||||
%1 = cmpi "slt", %0, %c42 : index
|
||||
cond_br %1, ^bb3, ^bb12
|
||||
^bb3: // pred: ^bb2
|
||||
br ^bb4
|
||||
^bb4: // pred: ^bb3
|
||||
%c7 = constant 7 : index
|
||||
%c56 = constant 56 : index
|
||||
br ^bb5(%c7 : index)
|
||||
^bb5(%2: index): // 2 preds: ^bb4, ^bb6
|
||||
%3 = cmpi "slt", %2, %c56 : index
|
||||
cond_br %3, ^bb6, ^bb7
|
||||
^bb6: // pred: ^bb5
|
||||
%c2 = constant 2 : index
|
||||
%4 = addi %2, %c2 : index
|
||||
br ^bb5(%4 : index)
|
||||
^bb7: // pred: ^bb5
|
||||
br ^bb8
|
||||
^bb8: // pred: ^bb7
|
||||
%c18 = constant 18 : index
|
||||
%c37 = constant 37 : index
|
||||
br ^bb9(%c18 : index)
|
||||
^bb9(%5: index): // 2 preds: ^bb8, ^bb10
|
||||
%6 = cmpi "slt", %5, %c37 : index
|
||||
cond_br %6, ^bb10, ^bb11
|
||||
^bb10: // pred: ^bb9
|
||||
%c3 = constant 3 : index
|
||||
%7 = addi %5, %c3 : index
|
||||
br ^bb9(%7 : index)
|
||||
^bb11: // pred: ^bb9
|
||||
%c1 = constant 1 : index
|
||||
%8 = addi %0, %c1 : index
|
||||
br ^bb2(%8 : index)
|
||||
^bb12: // pred: ^bb2
|
||||
return
|
||||
}
|
|
@ -0,0 +1,113 @@
|
|||
// NOTE: Assertions have been autogenerated by utils/update_mlir_test_checks.py
|
||||
// RUN: circt-opt -create-dataflow %s | FileCheck %s
|
||||
func @affine_load(%arg0: index) {
|
||||
// CHECK: module {
|
||||
|
||||
// CHECK-LABEL: handshake.func @affine_load(
|
||||
// CHECK-SAME: %[[VAL_0:.*]]: index, %[[VAL_1:.*]]: none, ...) -> none {
|
||||
// CHECK: %[[VAL_2:.*]]:7 = "handshake.memory"(%[[VAL_3:.*]]#0, %[[VAL_3]]#1, %[[VAL_4:.*]], %[[VAL_5:.*]], %[[VAL_6:.*]]) {id = 0 : i32, ld_count = 3 : i32, lsq = false, st_count = 1 : i32, type = memref<10xf32>} : (f32, index, index, index, index) -> (f32, f32, f32, none, none, none, none)
|
||||
// CHECK: %[[VAL_7:.*]]:2 = "handshake.fork"(%[[VAL_2]]#6) {control = false} : (none) -> (none, none)
|
||||
// CHECK: %[[VAL_8:.*]]:2 = "handshake.fork"(%[[VAL_2]]#5) {control = false} : (none) -> (none, none)
|
||||
// CHECK: %[[VAL_9:.*]] = "handshake.merge"(%[[VAL_0]]) : (index) -> index
|
||||
// CHECK: %[[VAL_10:.*]]:2 = "handshake.fork"(%[[VAL_1]]) {control = true} : (none) -> (none, none)
|
||||
// CHECK: %[[VAL_11:.*]]:4 = "handshake.fork"(%[[VAL_10]]#1) {control = true} : (none) -> (none, none, none, none)
|
||||
// CHECK: %[[VAL_12:.*]] = "handshake.join"(%[[VAL_11]]#3, %[[VAL_2]]#4) {control = true} : (none, none) -> none
|
||||
// CHECK: %[[VAL_13:.*]] = "handshake.constant"(%[[VAL_11]]#2) {value = 0 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_14:.*]]:2 = "handshake.fork"(%[[VAL_13]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_15:.*]] = "handshake.constant"(%[[VAL_11]]#1) {value = 10 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_16:.*]], %[[VAL_4]] = "handshake.load"(%[[VAL_14]]#0, %[[VAL_2]]#0, %[[VAL_10]]#0) : (index, f32, none) -> (f32, index)
|
||||
// CHECK: %[[VAL_17:.*]] = "handshake.constant"(%[[VAL_11]]#0) {value = 1 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_18:.*]] = "handshake.branch"(%[[VAL_9]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_19:.*]] = "handshake.branch"(%[[VAL_12]]) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_20:.*]] = "handshake.branch"(%[[VAL_14]]#1) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_21:.*]] = "handshake.branch"(%[[VAL_15]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_22:.*]] = "handshake.branch"(%[[VAL_16]]) {control = false} : (f32) -> f32
|
||||
// CHECK: %[[VAL_23:.*]] = "handshake.branch"(%[[VAL_17]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb1] : () -> ()
|
||||
// CHECK: ^bb1:
|
||||
// CHECK: %[[VAL_24:.*]] = "handshake.mux"(%[[VAL_25:.*]]#4, %[[VAL_26:.*]], %[[VAL_21]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_27:.*]]:2 = "handshake.fork"(%[[VAL_24]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_28:.*]] = "handshake.mux"(%[[VAL_25]]#3, %[[VAL_29:.*]], %[[VAL_18]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_30:.*]] = "handshake.mux"(%[[VAL_25]]#2, %[[VAL_31:.*]], %[[VAL_23]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_32:.*]] = "handshake.mux"(%[[VAL_25]]#1, %[[VAL_33:.*]], %[[VAL_22]]) : (index, f32, f32) -> f32
|
||||
// CHECK: %[[VAL_34:.*]]:2 = "handshake.control_merge"(%[[VAL_35:.*]], %[[VAL_19]]) {control = true} : (none, none) -> (none, index)
|
||||
// CHECK: %[[VAL_25]]:5 = "handshake.fork"(%[[VAL_34]]#1) {control = false} : (index) -> (index, index, index, index, index)
|
||||
// CHECK: %[[VAL_36:.*]] = "handshake.mux"(%[[VAL_25]]#0, %[[VAL_37:.*]], %[[VAL_20]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_38:.*]]:2 = "handshake.fork"(%[[VAL_36]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_39:.*]] = cmpi "slt", %[[VAL_38]]#1, %[[VAL_27]]#1 : index
|
||||
// CHECK: %[[VAL_40:.*]]:6 = "handshake.fork"(%[[VAL_39]]) {control = false} : (i1) -> (i1, i1, i1, i1, i1, i1)
|
||||
// CHECK: %[[VAL_41:.*]], %[[VAL_42:.*]] = "handshake.conditional_branch"(%[[VAL_40]]#5, %[[VAL_27]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_42]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_43:.*]], %[[VAL_44:.*]] = "handshake.conditional_branch"(%[[VAL_40]]#4, %[[VAL_28]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_44]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_45:.*]], %[[VAL_46:.*]] = "handshake.conditional_branch"(%[[VAL_40]]#3, %[[VAL_30]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_46]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_47:.*]], %[[VAL_48:.*]] = "handshake.conditional_branch"(%[[VAL_40]]#2, %[[VAL_32]]) {control = false} : (i1, f32) -> (f32, f32)
|
||||
// CHECK: "handshake.sink"(%[[VAL_48]]) : (f32) -> ()
|
||||
// CHECK: %[[VAL_49:.*]], %[[VAL_50:.*]] = "handshake.conditional_branch"(%[[VAL_40]]#1, %[[VAL_34]]#0) {control = true} : (i1, none) -> (none, none)
|
||||
// CHECK: %[[VAL_51:.*]], %[[VAL_52:.*]] = "handshake.conditional_branch"(%[[VAL_40]]#0, %[[VAL_38]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_52]]) : (index) -> ()
|
||||
// CHECK: "handshake.terminator"()[^bb2, ^bb3] : () -> ()
|
||||
// CHECK: ^bb2:
|
||||
// CHECK: %[[VAL_53:.*]] = "handshake.merge"(%[[VAL_51]]) : (index) -> index
|
||||
// CHECK: %[[VAL_54:.*]]:2 = "handshake.fork"(%[[VAL_53]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_55:.*]] = "handshake.merge"(%[[VAL_43]]) : (index) -> index
|
||||
// CHECK: %[[VAL_56:.*]]:2 = "handshake.fork"(%[[VAL_55]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_57:.*]] = "handshake.merge"(%[[VAL_45]]) : (index) -> index
|
||||
// CHECK: %[[VAL_58:.*]]:2 = "handshake.fork"(%[[VAL_57]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_59:.*]] = "handshake.merge"(%[[VAL_47]]) : (f32) -> f32
|
||||
// CHECK: %[[VAL_60:.*]]:3 = "handshake.fork"(%[[VAL_59]]) {control = false} : (f32) -> (f32, f32, f32)
|
||||
// CHECK: %[[VAL_61:.*]] = "handshake.merge"(%[[VAL_41]]) : (index) -> index
|
||||
// CHECK: %[[VAL_62:.*]]:2 = "handshake.control_merge"(%[[VAL_49]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: %[[VAL_63:.*]]:4 = "handshake.fork"(%[[VAL_62]]#0) {control = true} : (none) -> (none, none, none, none)
|
||||
// CHECK: %[[VAL_64:.*]]:2 = "handshake.fork"(%[[VAL_63]]#3) {control = true} : (none) -> (none, none)
|
||||
// CHECK: %[[VAL_65:.*]] = "handshake.join"(%[[VAL_64]]#1, %[[VAL_8]]#1, %[[VAL_7]]#1, %[[VAL_2]]#3) {control = true} : (none, none, none, none) -> none
|
||||
// CHECK: "handshake.sink"(%[[VAL_62]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_66:.*]] = addi %[[VAL_54]]#1, %[[VAL_56]]#1 : index
|
||||
// CHECK: %[[VAL_67:.*]] = "handshake.constant"(%[[VAL_64]]#0) {value = 7 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_68:.*]] = addi %[[VAL_66]], %[[VAL_67]] : index
|
||||
// CHECK: %[[VAL_69:.*]]:3 = "handshake.fork"(%[[VAL_68]]) {control = false} : (index) -> (index, index, index)
|
||||
// CHECK: %[[VAL_70:.*]], %[[VAL_5]] = "handshake.load"(%[[VAL_69]]#2, %[[VAL_2]]#1, %[[VAL_63]]#2) : (index, f32, none) -> (f32, index)
|
||||
// CHECK: %[[VAL_71:.*]] = addi %[[VAL_54]]#0, %[[VAL_58]]#1 : index
|
||||
// CHECK: %[[VAL_72:.*]], %[[VAL_6]] = "handshake.load"(%[[VAL_69]]#1, %[[VAL_2]]#2, %[[VAL_63]]#1) : (index, f32, none) -> (f32, index)
|
||||
// CHECK: %[[VAL_73:.*]] = addf %[[VAL_70]], %[[VAL_72]] : f32
|
||||
// CHECK: %[[VAL_74:.*]] = addf %[[VAL_60]]#1, %[[VAL_60]]#2 : f32
|
||||
// CHECK: "handshake.sink"(%[[VAL_74]]) : (f32) -> ()
|
||||
// CHECK: %[[VAL_75:.*]] = "handshake.join"(%[[VAL_63]]#0, %[[VAL_8]]#0, %[[VAL_7]]#0) {control = true} : (none, none, none) -> none
|
||||
// CHECK: %[[VAL_3]]:2 = "handshake.store"(%[[VAL_73]], %[[VAL_69]]#0, %[[VAL_75]]) : (f32, index, none) -> (f32, index)
|
||||
// CHECK: %[[VAL_29]] = "handshake.branch"(%[[VAL_56]]#0) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_31]] = "handshake.branch"(%[[VAL_58]]#0) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_33]] = "handshake.branch"(%[[VAL_60]]#0) {control = false} : (f32) -> f32
|
||||
// CHECK: %[[VAL_26]] = "handshake.branch"(%[[VAL_61]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_35]] = "handshake.branch"(%[[VAL_65]]) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_37]] = "handshake.branch"(%[[VAL_71]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb1] : () -> ()
|
||||
// CHECK: ^bb3:
|
||||
// CHECK: %[[VAL_76:.*]]:2 = "handshake.control_merge"(%[[VAL_50]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_76]]#1) : (index) -> ()
|
||||
// CHECK: handshake.return %[[VAL_76]]#0 : none
|
||||
// CHECK: }
|
||||
// CHECK: }
|
||||
%0 = alloc() : memref<10xf32>
|
||||
%c0 = constant 0 : index
|
||||
%c10 = constant 10 : index
|
||||
%9 = load %0[%c0] : memref<10xf32>
|
||||
%c1 = constant 1 : index
|
||||
br ^bb1(%c0 : index)
|
||||
^bb1(%1: index): // 2 preds: ^bb0, ^bb2
|
||||
%2 = cmpi "slt", %1, %c10 : index
|
||||
cond_br %2, ^bb2, ^bb3
|
||||
^bb2: // pred: ^bb1
|
||||
%3 = addi %1, %arg0 : index
|
||||
%c7 = constant 7 : index
|
||||
%4 = addi %3, %c7 : index
|
||||
%5 = load %0[%4] : memref<10xf32>
|
||||
%6 = addi %1, %c1 : index
|
||||
%7 = load %0[%4] : memref<10xf32>
|
||||
%8 = addf %5, %7 : f32
|
||||
%11 = addf %9, %9 : f32
|
||||
store %8, %0[%4] : memref<10xf32>
|
||||
br ^bb1(%6 : index)
|
||||
^bb3: // pred: ^bb1
|
||||
return
|
||||
}
|
|
@ -0,0 +1,114 @@
|
|||
// NOTE: Assertions have been autogenerated by utils/update_mlir_test_checks.py
|
||||
// RUN: circt-opt -create-dataflow %s | FileCheck %s
|
||||
func @affine_load(%arg0: index) {
|
||||
// CHECK: module {
|
||||
|
||||
// CHECK-LABEL: handshake.func @affine_load(
|
||||
// CHECK-SAME: %[[VAL_0:.*]]: index, %[[VAL_1:.*]]: none, ...) -> none {
|
||||
// CHECK: %[[VAL_2:.*]]:3 = "handshake.memory"(%[[VAL_3:.*]]#0, %[[VAL_3]]#1, %[[VAL_4:.*]]) {id = 1 : i32, ld_count = 1 : i32, lsq = false, st_count = 1 : i32, type = memref<10xf32>} : (f32, index, index) -> (f32, none, none)
|
||||
// CHECK: %[[VAL_5:.*]]:2 = "handshake.fork"(%[[VAL_2]]#2) {control = false} : (none) -> (none, none)
|
||||
// CHECK: %[[VAL_6:.*]]:4 = "handshake.memory"(%[[VAL_7:.*]], %[[VAL_8:.*]]) {id = 0 : i32, ld_count = 2 : i32, lsq = false, st_count = 0 : i32, type = memref<10xf32>} : (index, index) -> (f32, f32, none, none)
|
||||
// CHECK: %[[VAL_9:.*]] = "handshake.merge"(%[[VAL_0]]) : (index) -> index
|
||||
// CHECK: %[[VAL_10:.*]]:2 = "handshake.fork"(%[[VAL_1]]) {control = true} : (none) -> (none, none)
|
||||
// CHECK: %[[VAL_11:.*]]:4 = "handshake.fork"(%[[VAL_10]]#1) {control = true} : (none) -> (none, none, none, none)
|
||||
// CHECK: %[[VAL_12:.*]] = "handshake.join"(%[[VAL_11]]#3, %[[VAL_6]]#2) {control = true} : (none, none) -> none
|
||||
// CHECK: %[[VAL_13:.*]] = "handshake.constant"(%[[VAL_11]]#2) {value = 0 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_14:.*]]:2 = "handshake.fork"(%[[VAL_13]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_15:.*]] = "handshake.constant"(%[[VAL_11]]#1) {value = 10 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_16:.*]], %[[VAL_7]] = "handshake.load"(%[[VAL_14]]#0, %[[VAL_6]]#0, %[[VAL_10]]#0) : (index, f32, none) -> (f32, index)
|
||||
// CHECK: %[[VAL_17:.*]] = "handshake.constant"(%[[VAL_11]]#0) {value = 1 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_18:.*]] = "handshake.branch"(%[[VAL_9]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_19:.*]] = "handshake.branch"(%[[VAL_12]]) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_20:.*]] = "handshake.branch"(%[[VAL_14]]#1) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_21:.*]] = "handshake.branch"(%[[VAL_15]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_22:.*]] = "handshake.branch"(%[[VAL_16]]) {control = false} : (f32) -> f32
|
||||
// CHECK: %[[VAL_23:.*]] = "handshake.branch"(%[[VAL_17]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb1] : () -> ()
|
||||
// CHECK: ^bb1:
|
||||
// CHECK: %[[VAL_24:.*]] = "handshake.mux"(%[[VAL_25:.*]]#4, %[[VAL_26:.*]], %[[VAL_21]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_27:.*]]:2 = "handshake.fork"(%[[VAL_24]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_28:.*]] = "handshake.mux"(%[[VAL_25]]#3, %[[VAL_29:.*]], %[[VAL_18]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_30:.*]] = "handshake.mux"(%[[VAL_25]]#2, %[[VAL_31:.*]], %[[VAL_23]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_32:.*]] = "handshake.mux"(%[[VAL_25]]#1, %[[VAL_33:.*]], %[[VAL_22]]) : (index, f32, f32) -> f32
|
||||
// CHECK: %[[VAL_34:.*]]:2 = "handshake.control_merge"(%[[VAL_35:.*]], %[[VAL_19]]) {control = true} : (none, none) -> (none, index)
|
||||
// CHECK: %[[VAL_25]]:5 = "handshake.fork"(%[[VAL_34]]#1) {control = false} : (index) -> (index, index, index, index, index)
|
||||
// CHECK: %[[VAL_36:.*]] = "handshake.mux"(%[[VAL_25]]#0, %[[VAL_37:.*]], %[[VAL_20]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_38:.*]]:2 = "handshake.fork"(%[[VAL_36]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_39:.*]] = cmpi "slt", %[[VAL_38]]#1, %[[VAL_27]]#1 : index
|
||||
// CHECK: %[[VAL_40:.*]]:6 = "handshake.fork"(%[[VAL_39]]) {control = false} : (i1) -> (i1, i1, i1, i1, i1, i1)
|
||||
// CHECK: %[[VAL_41:.*]], %[[VAL_42:.*]] = "handshake.conditional_branch"(%[[VAL_40]]#5, %[[VAL_27]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_42]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_43:.*]], %[[VAL_44:.*]] = "handshake.conditional_branch"(%[[VAL_40]]#4, %[[VAL_28]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_44]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_45:.*]], %[[VAL_46:.*]] = "handshake.conditional_branch"(%[[VAL_40]]#3, %[[VAL_30]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_46]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_47:.*]], %[[VAL_48:.*]] = "handshake.conditional_branch"(%[[VAL_40]]#2, %[[VAL_32]]) {control = false} : (i1, f32) -> (f32, f32)
|
||||
// CHECK: "handshake.sink"(%[[VAL_48]]) : (f32) -> ()
|
||||
// CHECK: %[[VAL_49:.*]], %[[VAL_50:.*]] = "handshake.conditional_branch"(%[[VAL_40]]#1, %[[VAL_34]]#0) {control = true} : (i1, none) -> (none, none)
|
||||
// CHECK: %[[VAL_51:.*]], %[[VAL_52:.*]] = "handshake.conditional_branch"(%[[VAL_40]]#0, %[[VAL_38]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_52]]) : (index) -> ()
|
||||
// CHECK: "handshake.terminator"()[^bb2, ^bb3] : () -> ()
|
||||
// CHECK: ^bb2:
|
||||
// CHECK: %[[VAL_53:.*]] = "handshake.merge"(%[[VAL_51]]) : (index) -> index
|
||||
// CHECK: %[[VAL_54:.*]]:2 = "handshake.fork"(%[[VAL_53]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_55:.*]] = "handshake.merge"(%[[VAL_43]]) : (index) -> index
|
||||
// CHECK: %[[VAL_56:.*]]:2 = "handshake.fork"(%[[VAL_55]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_57:.*]] = "handshake.merge"(%[[VAL_45]]) : (index) -> index
|
||||
// CHECK: %[[VAL_58:.*]]:2 = "handshake.fork"(%[[VAL_57]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_59:.*]] = "handshake.merge"(%[[VAL_47]]) : (f32) -> f32
|
||||
// CHECK: %[[VAL_60:.*]]:3 = "handshake.fork"(%[[VAL_59]]) {control = false} : (f32) -> (f32, f32, f32)
|
||||
// CHECK: %[[VAL_61:.*]] = "handshake.merge"(%[[VAL_41]]) : (index) -> index
|
||||
// CHECK: %[[VAL_62:.*]]:2 = "handshake.control_merge"(%[[VAL_49]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: %[[VAL_63:.*]]:4 = "handshake.fork"(%[[VAL_62]]#0) {control = true} : (none) -> (none, none, none, none)
|
||||
// CHECK: %[[VAL_64:.*]]:2 = "handshake.fork"(%[[VAL_63]]#3) {control = true} : (none) -> (none, none)
|
||||
// CHECK: %[[VAL_65:.*]] = "handshake.join"(%[[VAL_64]]#1, %[[VAL_6]]#3, %[[VAL_5]]#1, %[[VAL_2]]#1) {control = true} : (none, none, none, none) -> none
|
||||
// CHECK: "handshake.sink"(%[[VAL_62]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_66:.*]] = addi %[[VAL_54]]#1, %[[VAL_56]]#1 : index
|
||||
// CHECK: %[[VAL_67:.*]] = "handshake.constant"(%[[VAL_64]]#0) {value = 7 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_68:.*]] = addi %[[VAL_66]], %[[VAL_67]] : index
|
||||
// CHECK: %[[VAL_69:.*]]:3 = "handshake.fork"(%[[VAL_68]]) {control = false} : (index) -> (index, index, index)
|
||||
// CHECK: %[[VAL_70:.*]], %[[VAL_8]] = "handshake.load"(%[[VAL_69]]#2, %[[VAL_6]]#1, %[[VAL_63]]#2) : (index, f32, none) -> (f32, index)
|
||||
// CHECK: %[[VAL_71:.*]] = addi %[[VAL_54]]#0, %[[VAL_58]]#1 : index
|
||||
// CHECK: %[[VAL_72:.*]], %[[VAL_4]] = "handshake.load"(%[[VAL_69]]#1, %[[VAL_2]]#0, %[[VAL_63]]#1) : (index, f32, none) -> (f32, index)
|
||||
// CHECK: %[[VAL_73:.*]] = addf %[[VAL_70]], %[[VAL_72]] : f32
|
||||
// CHECK: %[[VAL_74:.*]] = addf %[[VAL_60]]#1, %[[VAL_60]]#2 : f32
|
||||
// CHECK: "handshake.sink"(%[[VAL_74]]) : (f32) -> ()
|
||||
// CHECK: %[[VAL_75:.*]] = "handshake.join"(%[[VAL_63]]#0, %[[VAL_5]]#0) {control = true} : (none, none) -> none
|
||||
// CHECK: %[[VAL_3]]:2 = "handshake.store"(%[[VAL_73]], %[[VAL_69]]#0, %[[VAL_75]]) : (f32, index, none) -> (f32, index)
|
||||
// CHECK: %[[VAL_29]] = "handshake.branch"(%[[VAL_56]]#0) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_31]] = "handshake.branch"(%[[VAL_58]]#0) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_33]] = "handshake.branch"(%[[VAL_60]]#0) {control = false} : (f32) -> f32
|
||||
// CHECK: %[[VAL_26]] = "handshake.branch"(%[[VAL_61]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_35]] = "handshake.branch"(%[[VAL_65]]) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_37]] = "handshake.branch"(%[[VAL_71]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb1] : () -> ()
|
||||
// CHECK: ^bb3:
|
||||
// CHECK: %[[VAL_76:.*]]:2 = "handshake.control_merge"(%[[VAL_50]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_76]]#1) : (index) -> ()
|
||||
// CHECK: handshake.return %[[VAL_76]]#0 : none
|
||||
// CHECK: }
|
||||
// CHECK: }
|
||||
%0 = alloc() : memref<10xf32>
|
||||
%10 = alloc() : memref<10xf32>
|
||||
%c0 = constant 0 : index
|
||||
%c10 = constant 10 : index
|
||||
%9 = load %0[%c0] : memref<10xf32>
|
||||
%c1 = constant 1 : index
|
||||
br ^bb1(%c0 : index)
|
||||
^bb1(%1: index): // 2 preds: ^bb0, ^bb2
|
||||
%2 = cmpi "slt", %1, %c10 : index
|
||||
cond_br %2, ^bb2, ^bb3
|
||||
^bb2: // pred: ^bb1
|
||||
%3 = addi %1, %arg0 : index
|
||||
%c7 = constant 7 : index
|
||||
%4 = addi %3, %c7 : index
|
||||
%5 = load %0[%4] : memref<10xf32>
|
||||
%6 = addi %1, %c1 : index
|
||||
%7 = load %10[%4] : memref<10xf32>
|
||||
%8 = addf %5, %7 : f32
|
||||
%11 = addf %9, %9 : f32
|
||||
store %8, %10[%4] : memref<10xf32>
|
||||
br ^bb1(%6 : index)
|
||||
^bb3: // pred: ^bb1
|
||||
return
|
||||
}
|
|
@ -0,0 +1,85 @@
|
|||
// NOTE: Assertions have been autogenerated by utils/update_mlir_test_checks.py
|
||||
// RUN: circt-opt -create-dataflow %s | FileCheck %s
|
||||
func @test() {
|
||||
// CHECK: module {
|
||||
|
||||
// CHECK-LABEL: handshake.func @test(
|
||||
// CHECK-SAME: %[[VAL_0:.*]]: none, ...) -> none {
|
||||
// CHECK: %[[VAL_1:.*]]:5 = "handshake.memory"(%[[VAL_2:.*]]#0, %[[VAL_2]]#1, %[[VAL_3:.*]], %[[VAL_4:.*]]) {id = 0 : i32, ld_count = 2 : i32, lsq = false, st_count = 1 : i32, type = memref<10xf32>} : (f32, index, index, index) -> (f32, f32, none, none, none)
|
||||
// CHECK: %[[VAL_5:.*]]:2 = "handshake.fork"(%[[VAL_1]]#4) {control = false} : (none) -> (none, none)
|
||||
// CHECK: %[[VAL_6:.*]]:2 = "handshake.fork"(%[[VAL_0]]) {control = true} : (none) -> (none, none)
|
||||
// CHECK: %[[VAL_7:.*]]:3 = "handshake.fork"(%[[VAL_6]]#1) {control = true} : (none) -> (none, none, none)
|
||||
// CHECK: %[[VAL_8:.*]] = "handshake.join"(%[[VAL_7]]#2, %[[VAL_1]]#3) {control = true} : (none, none) -> none
|
||||
// CHECK: %[[VAL_9:.*]] = "handshake.constant"(%[[VAL_7]]#1) {value = 0 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_10:.*]] = "handshake.constant"(%[[VAL_7]]#0) {value = 10 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_11:.*]]:2 = "handshake.fork"(%[[VAL_10]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_12:.*]], %[[VAL_3]] = "handshake.load"(%[[VAL_11]]#0, %[[VAL_1]]#0, %[[VAL_6]]#0) : (index, f32, none) -> (f32, index)
|
||||
// CHECK: %[[VAL_13:.*]] = "handshake.branch"(%[[VAL_8]]) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_14:.*]] = "handshake.branch"(%[[VAL_9]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_15:.*]] = "handshake.branch"(%[[VAL_11]]#1) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_16:.*]] = "handshake.branch"(%[[VAL_12]]) {control = false} : (f32) -> f32
|
||||
// CHECK: "handshake.terminator"()[^bb1] : () -> ()
|
||||
// CHECK: ^bb1:
|
||||
// CHECK: %[[VAL_17:.*]] = "handshake.mux"(%[[VAL_18:.*]]#2, %[[VAL_19:.*]], %[[VAL_15]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_20:.*]]:2 = "handshake.fork"(%[[VAL_17]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_21:.*]] = "handshake.mux"(%[[VAL_18]]#1, %[[VAL_22:.*]], %[[VAL_16]]) : (index, f32, f32) -> f32
|
||||
// CHECK: %[[VAL_23:.*]]:2 = "handshake.control_merge"(%[[VAL_24:.*]], %[[VAL_13]]) {control = true} : (none, none) -> (none, index)
|
||||
// CHECK: %[[VAL_18]]:3 = "handshake.fork"(%[[VAL_23]]#1) {control = false} : (index) -> (index, index, index)
|
||||
// CHECK: %[[VAL_25:.*]] = "handshake.mux"(%[[VAL_18]]#0, %[[VAL_26:.*]], %[[VAL_14]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_27:.*]]:2 = "handshake.fork"(%[[VAL_25]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_28:.*]] = cmpi "slt", %[[VAL_27]]#1, %[[VAL_20]]#1 : index
|
||||
// CHECK: %[[VAL_29:.*]]:4 = "handshake.fork"(%[[VAL_28]]) {control = false} : (i1) -> (i1, i1, i1, i1)
|
||||
// CHECK: %[[VAL_30:.*]], %[[VAL_31:.*]] = "handshake.conditional_branch"(%[[VAL_29]]#3, %[[VAL_20]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_31]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_32:.*]], %[[VAL_33:.*]] = "handshake.conditional_branch"(%[[VAL_29]]#2, %[[VAL_21]]) {control = false} : (i1, f32) -> (f32, f32)
|
||||
// CHECK: "handshake.sink"(%[[VAL_33]]) : (f32) -> ()
|
||||
// CHECK: %[[VAL_34:.*]], %[[VAL_35:.*]] = "handshake.conditional_branch"(%[[VAL_29]]#1, %[[VAL_23]]#0) {control = true} : (i1, none) -> (none, none)
|
||||
// CHECK: %[[VAL_36:.*]], %[[VAL_37:.*]] = "handshake.conditional_branch"(%[[VAL_29]]#0, %[[VAL_27]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_37]]) : (index) -> ()
|
||||
// CHECK: "handshake.terminator"()[^bb2, ^bb3] : () -> ()
|
||||
// CHECK: ^bb2:
|
||||
// CHECK: %[[VAL_38:.*]] = "handshake.merge"(%[[VAL_36]]) : (index) -> index
|
||||
// CHECK: %[[VAL_39:.*]] = "handshake.merge"(%[[VAL_32]]) : (f32) -> f32
|
||||
// CHECK: %[[VAL_40:.*]]:2 = "handshake.fork"(%[[VAL_39]]) {control = false} : (f32) -> (f32, f32)
|
||||
// CHECK: %[[VAL_41:.*]] = "handshake.merge"(%[[VAL_30]]) : (index) -> index
|
||||
// CHECK: %[[VAL_42:.*]]:2 = "handshake.control_merge"(%[[VAL_34]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: %[[VAL_43:.*]]:3 = "handshake.fork"(%[[VAL_42]]#0) {control = true} : (none) -> (none, none, none)
|
||||
// CHECK: %[[VAL_44:.*]]:2 = "handshake.fork"(%[[VAL_43]]#2) {control = true} : (none) -> (none, none)
|
||||
// CHECK: %[[VAL_45:.*]] = "handshake.join"(%[[VAL_44]]#1, %[[VAL_5]]#1, %[[VAL_1]]#2) {control = true} : (none, none, none) -> none
|
||||
// CHECK: "handshake.sink"(%[[VAL_42]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_46:.*]] = "handshake.constant"(%[[VAL_44]]#0) {value = 1 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_47:.*]] = addi %[[VAL_38]], %[[VAL_46]] : index
|
||||
// CHECK: %[[VAL_48:.*]]:3 = "handshake.fork"(%[[VAL_47]]) {control = false} : (index) -> (index, index, index)
|
||||
// CHECK: %[[VAL_49:.*]], %[[VAL_4]] = "handshake.load"(%[[VAL_48]]#2, %[[VAL_1]]#1, %[[VAL_43]]#1) : (index, f32, none) -> (f32, index)
|
||||
// CHECK: %[[VAL_50:.*]] = addf %[[VAL_40]]#1, %[[VAL_49]] : f32
|
||||
// CHECK: %[[VAL_51:.*]] = "handshake.join"(%[[VAL_43]]#0, %[[VAL_5]]#0) {control = true} : (none, none) -> none
|
||||
// CHECK: %[[VAL_2]]:2 = "handshake.store"(%[[VAL_50]], %[[VAL_48]]#1, %[[VAL_51]]) : (f32, index, none) -> (f32, index)
|
||||
// CHECK: %[[VAL_22]] = "handshake.branch"(%[[VAL_40]]#0) {control = false} : (f32) -> f32
|
||||
// CHECK: %[[VAL_19]] = "handshake.branch"(%[[VAL_41]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_24]] = "handshake.branch"(%[[VAL_45]]) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_26]] = "handshake.branch"(%[[VAL_48]]#0) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb1] : () -> ()
|
||||
// CHECK: ^bb3:
|
||||
// CHECK: %[[VAL_52:.*]]:2 = "handshake.control_merge"(%[[VAL_35]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_52]]#1) : (index) -> ()
|
||||
// CHECK: handshake.return %[[VAL_52]]#0 : none
|
||||
// CHECK: }
|
||||
// CHECK: }
|
||||
%10 = alloc() : memref<10xf32>
|
||||
%c0 = constant 0 : index
|
||||
%c10 = constant 10 : index
|
||||
%5 = load %10[%c10] : memref<10xf32>
|
||||
br ^bb1(%c0 : index)
|
||||
^bb1(%1: index): // 2 preds: ^bb0, ^bb2
|
||||
%2 = cmpi "slt", %1, %c10 : index
|
||||
cond_br %2, ^bb2, ^bb3
|
||||
^bb2: // pred: ^bb1
|
||||
%c1 = constant 1 : index
|
||||
%3 = addi %1, %c1 : index
|
||||
%7 = load %10[%3] : memref<10xf32>
|
||||
%8 = addf %5, %7 : f32
|
||||
store %8, %10[%3] : memref<10xf32>
|
||||
br ^bb1(%3 : index)
|
||||
^bb3: // pred: ^bb1
|
||||
return
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
// NOTE: Assertions have been autogenerated by utils/update_mlir_test_checks.py
|
||||
// RUN: circt-opt -create-dataflow %s | FileCheck %s
|
||||
func @test() {
|
||||
// CHECK: module {
|
||||
|
||||
// CHECK-LABEL: handshake.func @test(
|
||||
// CHECK-SAME: %[[VAL_0:.*]]: none, ...) -> none {
|
||||
// CHECK: %[[VAL_1:.*]]:5 = "handshake.memory"(%[[VAL_2:.*]]#0, %[[VAL_2]]#1, %[[VAL_3:.*]], %[[VAL_4:.*]]) {id = 0 : i32, ld_count = 2 : i32, lsq = false, st_count = 1 : i32, type = memref<10xf32>} : (f32, index, index, index) -> (f32, f32, none, none, none)
|
||||
// CHECK: %[[VAL_5:.*]]:2 = "handshake.fork"(%[[VAL_1]]#4) {control = false} : (none) -> (none, none)
|
||||
// CHECK: %[[VAL_6:.*]]:2 = "handshake.fork"(%[[VAL_1]]#3) {control = false} : (none) -> (none, none)
|
||||
// CHECK: %[[VAL_7:.*]]:3 = "handshake.fork"(%[[VAL_0]]) {control = true} : (none) -> (none, none, none)
|
||||
// CHECK: %[[VAL_8:.*]] = "handshake.constant"(%[[VAL_7]]#1) {value = 0 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_9:.*]] = "handshake.constant"(%[[VAL_7]]#0) {value = 10 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_10:.*]] = "handshake.branch"(%[[VAL_7]]#2) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_11:.*]] = "handshake.branch"(%[[VAL_8]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_12:.*]] = "handshake.branch"(%[[VAL_9]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb1] : () -> ()
|
||||
// CHECK: ^bb1:
|
||||
// CHECK: %[[VAL_13:.*]] = "handshake.mux"(%[[VAL_14:.*]]#1, %[[VAL_15:.*]], %[[VAL_12]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_16:.*]]:2 = "handshake.fork"(%[[VAL_13]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_17:.*]]:2 = "handshake.control_merge"(%[[VAL_18:.*]], %[[VAL_10]]) {control = true} : (none, none) -> (none, index)
|
||||
// CHECK: %[[VAL_14]]:2 = "handshake.fork"(%[[VAL_17]]#1) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_19:.*]] = "handshake.mux"(%[[VAL_14]]#0, %[[VAL_20:.*]], %[[VAL_11]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_21:.*]]:2 = "handshake.fork"(%[[VAL_19]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_22:.*]] = cmpi "slt", %[[VAL_21]]#1, %[[VAL_16]]#1 : index
|
||||
// CHECK: %[[VAL_23:.*]]:3 = "handshake.fork"(%[[VAL_22]]) {control = false} : (i1) -> (i1, i1, i1)
|
||||
// CHECK: %[[VAL_24:.*]], %[[VAL_25:.*]] = "handshake.conditional_branch"(%[[VAL_23]]#2, %[[VAL_16]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_25]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_26:.*]], %[[VAL_27:.*]] = "handshake.conditional_branch"(%[[VAL_23]]#1, %[[VAL_17]]#0) {control = true} : (i1, none) -> (none, none)
|
||||
// CHECK: %[[VAL_28:.*]], %[[VAL_29:.*]] = "handshake.conditional_branch"(%[[VAL_23]]#0, %[[VAL_21]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_29]]) : (index) -> ()
|
||||
// CHECK: "handshake.terminator"()[^bb2, ^bb3] : () -> ()
|
||||
// CHECK: ^bb2:
|
||||
// CHECK: %[[VAL_30:.*]] = "handshake.merge"(%[[VAL_28]]) : (index) -> index
|
||||
// CHECK: %[[VAL_31:.*]] = "handshake.merge"(%[[VAL_24]]) : (index) -> index
|
||||
// CHECK: %[[VAL_32:.*]]:2 = "handshake.control_merge"(%[[VAL_26]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: %[[VAL_33:.*]]:4 = "handshake.fork"(%[[VAL_32]]#0) {control = true} : (none) -> (none, none, none, none)
|
||||
// CHECK: %[[VAL_34:.*]]:2 = "handshake.fork"(%[[VAL_33]]#3) {control = true} : (none) -> (none, none)
|
||||
// CHECK: %[[VAL_35:.*]] = "handshake.join"(%[[VAL_34]]#1, %[[VAL_6]]#1, %[[VAL_5]]#1, %[[VAL_1]]#2) {control = true} : (none, none, none, none) -> none
|
||||
// CHECK: "handshake.sink"(%[[VAL_32]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_36:.*]] = "handshake.constant"(%[[VAL_34]]#0) {value = 1 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_37:.*]]:2 = "handshake.fork"(%[[VAL_36]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_38:.*]], %[[VAL_3]] = "handshake.load"(%[[VAL_37]]#1, %[[VAL_1]]#0, %[[VAL_33]]#2) : (index, f32, none) -> (f32, index)
|
||||
// CHECK: %[[VAL_39:.*]] = addi %[[VAL_30]], %[[VAL_37]]#0 : index
|
||||
// CHECK: %[[VAL_40:.*]]:3 = "handshake.fork"(%[[VAL_39]]) {control = false} : (index) -> (index, index, index)
|
||||
// CHECK: %[[VAL_41:.*]], %[[VAL_4]] = "handshake.load"(%[[VAL_40]]#2, %[[VAL_1]]#1, %[[VAL_33]]#1) : (index, f32, none) -> (f32, index)
|
||||
// CHECK: %[[VAL_42:.*]] = addf %[[VAL_38]], %[[VAL_41]] : f32
|
||||
// CHECK: %[[VAL_43:.*]] = "handshake.join"(%[[VAL_33]]#0, %[[VAL_6]]#0, %[[VAL_5]]#0) {control = true} : (none, none, none) -> none
|
||||
// CHECK: %[[VAL_2]]:2 = "handshake.store"(%[[VAL_42]], %[[VAL_40]]#1, %[[VAL_43]]) : (f32, index, none) -> (f32, index)
|
||||
// CHECK: %[[VAL_15]] = "handshake.branch"(%[[VAL_31]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_18]] = "handshake.branch"(%[[VAL_35]]) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_20]] = "handshake.branch"(%[[VAL_40]]#0) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb1] : () -> ()
|
||||
// CHECK: ^bb3:
|
||||
// CHECK: %[[VAL_44:.*]]:2 = "handshake.control_merge"(%[[VAL_27]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_44]]#1) : (index) -> ()
|
||||
// CHECK: handshake.return %[[VAL_44]]#0 : none
|
||||
// CHECK: }
|
||||
// CHECK: }
|
||||
%10 = alloc() : memref<10xf32>
|
||||
%c0 = constant 0 : index
|
||||
%c10 = constant 10 : index
|
||||
br ^bb1(%c0 : index)
|
||||
^bb1(%1: index): // 2 preds: ^bb0, ^bb2
|
||||
%2 = cmpi "slt", %1, %c10 : index
|
||||
cond_br %2, ^bb2, ^bb3
|
||||
^bb2: // pred: ^bb1
|
||||
%c1 = constant 1 : index
|
||||
%5 = load %10[%c1] : memref<10xf32>
|
||||
%3 = addi %1, %c1 : index
|
||||
%7 = load %10[%3] : memref<10xf32>
|
||||
%8 = addf %5, %7 : f32
|
||||
store %8, %10[%3] : memref<10xf32>
|
||||
br ^bb1(%3 : index)
|
||||
^bb3: // pred: ^bb1
|
||||
return
|
||||
}
|
|
@ -0,0 +1,80 @@
|
|||
// NOTE: Assertions have been autogenerated by utils/update_mlir_test_checks.py
|
||||
// RUN: circt-opt -create-dataflow %s | FileCheck %s
|
||||
func @test() {
|
||||
// CHECK: module {
|
||||
|
||||
// CHECK-LABEL: handshake.func @test(
|
||||
// CHECK-SAME: %[[VAL_0:.*]]: none, ...) -> none {
|
||||
// CHECK: %[[VAL_1:.*]]:5 = "handshake.memory"(%[[VAL_2:.*]]#0, %[[VAL_2]]#1, %[[VAL_3:.*]], %[[VAL_4:.*]]) {id = 0 : i32, ld_count = 2 : i32, lsq = false, st_count = 1 : i32, type = memref<10xf32>} : (f32, index, index, index) -> (f32, f32, none, none, none)
|
||||
// CHECK: %[[VAL_5:.*]]:2 = "handshake.fork"(%[[VAL_1]]#3) {control = false} : (none) -> (none, none)
|
||||
// CHECK: %[[VAL_6:.*]]:2 = "handshake.fork"(%[[VAL_1]]#2) {control = false} : (none) -> (none, none)
|
||||
// CHECK: %[[VAL_7:.*]]:3 = "handshake.fork"(%[[VAL_0]]) {control = true} : (none) -> (none, none, none)
|
||||
// CHECK: %[[VAL_8:.*]] = "handshake.constant"(%[[VAL_7]]#1) {value = 0 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_9:.*]] = "handshake.constant"(%[[VAL_7]]#0) {value = 10 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_10:.*]] = "handshake.branch"(%[[VAL_7]]#2) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_11:.*]] = "handshake.branch"(%[[VAL_8]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_12:.*]] = "handshake.branch"(%[[VAL_9]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb1] : () -> ()
|
||||
// CHECK: ^bb1:
|
||||
// CHECK: %[[VAL_13:.*]] = "handshake.mux"(%[[VAL_14:.*]]#1, %[[VAL_15:.*]], %[[VAL_12]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_16:.*]]:2 = "handshake.fork"(%[[VAL_13]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_17:.*]]:2 = "handshake.control_merge"(%[[VAL_18:.*]], %[[VAL_10]]) {control = true} : (none, none) -> (none, index)
|
||||
// CHECK: %[[VAL_14]]:2 = "handshake.fork"(%[[VAL_17]]#1) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_19:.*]] = "handshake.mux"(%[[VAL_14]]#0, %[[VAL_20:.*]], %[[VAL_11]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_21:.*]]:2 = "handshake.fork"(%[[VAL_19]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_22:.*]] = cmpi "slt", %[[VAL_21]]#1, %[[VAL_16]]#1 : index
|
||||
// CHECK: %[[VAL_23:.*]]:3 = "handshake.fork"(%[[VAL_22]]) {control = false} : (i1) -> (i1, i1, i1)
|
||||
// CHECK: %[[VAL_24:.*]], %[[VAL_25:.*]] = "handshake.conditional_branch"(%[[VAL_23]]#2, %[[VAL_16]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_25]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_26:.*]], %[[VAL_27:.*]] = "handshake.conditional_branch"(%[[VAL_23]]#1, %[[VAL_17]]#0) {control = true} : (i1, none) -> (none, none)
|
||||
// CHECK: %[[VAL_28:.*]], %[[VAL_29:.*]] = "handshake.conditional_branch"(%[[VAL_23]]#0, %[[VAL_21]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_29]]) : (index) -> ()
|
||||
// CHECK: "handshake.terminator"()[^bb2, ^bb3] : () -> ()
|
||||
// CHECK: ^bb2:
|
||||
// CHECK: %[[VAL_30:.*]] = "handshake.merge"(%[[VAL_28]]) : (index) -> index
|
||||
// CHECK: %[[VAL_31:.*]] = "handshake.merge"(%[[VAL_24]]) : (index) -> index
|
||||
// CHECK: %[[VAL_32:.*]]:2 = "handshake.control_merge"(%[[VAL_26]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: %[[VAL_33:.*]]:4 = "handshake.fork"(%[[VAL_32]]#0) {control = true} : (none) -> (none, none, none, none)
|
||||
// CHECK: %[[VAL_34:.*]]:2 = "handshake.fork"(%[[VAL_33]]#3) {control = true} : (none) -> (none, none)
|
||||
// CHECK: %[[VAL_35:.*]] = "handshake.join"(%[[VAL_34]]#1, %[[VAL_5]]#1, %[[VAL_6]]#1, %[[VAL_1]]#4) {control = true} : (none, none, none, none) -> none
|
||||
// CHECK: "handshake.sink"(%[[VAL_32]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_36:.*]] = "handshake.constant"(%[[VAL_34]]#0) {value = 1 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_37:.*]]:2 = "handshake.fork"(%[[VAL_36]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_38:.*]] = addi %[[VAL_30]], %[[VAL_37]]#0 : index
|
||||
// CHECK: %[[VAL_39:.*]]:3 = "handshake.fork"(%[[VAL_38]]) {control = false} : (index) -> (index, index, index)
|
||||
// CHECK: %[[VAL_40:.*]], %[[VAL_3]] = "handshake.load"(%[[VAL_39]]#2, %[[VAL_1]]#0, %[[VAL_33]]#2) : (index, f32, none) -> (f32, index)
|
||||
// CHECK: %[[VAL_41:.*]]:2 = "handshake.fork"(%[[VAL_40]]) {control = false} : (f32) -> (f32, f32)
|
||||
// CHECK: %[[VAL_42:.*]] = addf %[[VAL_41]]#0, %[[VAL_41]]#1 : f32
|
||||
// CHECK: %[[VAL_43:.*]] = "handshake.join"(%[[VAL_33]]#1, %[[VAL_5]]#0) {control = true} : (none, none) -> none
|
||||
// CHECK: %[[VAL_2]]:2 = "handshake.store"(%[[VAL_42]], %[[VAL_39]]#1, %[[VAL_43]]) : (f32, index, none) -> (f32, index)
|
||||
// CHECK: %[[VAL_44:.*]] = "handshake.join"(%[[VAL_33]]#0, %[[VAL_6]]#0) {control = true} : (none, none) -> none
|
||||
// CHECK: %[[VAL_45:.*]], %[[VAL_4]] = "handshake.load"(%[[VAL_37]]#1, %[[VAL_1]]#1, %[[VAL_44]]) : (index, f32, none) -> (f32, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_45]]) : (f32) -> ()
|
||||
// CHECK: %[[VAL_15]] = "handshake.branch"(%[[VAL_31]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_18]] = "handshake.branch"(%[[VAL_35]]) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_20]] = "handshake.branch"(%[[VAL_39]]#0) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb1] : () -> ()
|
||||
// CHECK: ^bb3:
|
||||
// CHECK: %[[VAL_46:.*]]:2 = "handshake.control_merge"(%[[VAL_27]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_46]]#1) : (index) -> ()
|
||||
// CHECK: handshake.return %[[VAL_46]]#0 : none
|
||||
// CHECK: }
|
||||
// CHECK: }
|
||||
%10 = alloc() : memref<10xf32>
|
||||
%c0 = constant 0 : index
|
||||
%c10 = constant 10 : index
|
||||
br ^bb1(%c0 : index)
|
||||
^bb1(%1: index): // 2 preds: ^bb0, ^bb2
|
||||
%2 = cmpi "slt", %1, %c10 : index
|
||||
cond_br %2, ^bb2, ^bb3
|
||||
^bb2: // pred: ^bb1
|
||||
%c1 = constant 1 : index
|
||||
%3 = addi %1, %c1 : index
|
||||
%7 = load %10[%3] : memref<10xf32>
|
||||
%8 = addf %7, %7 : f32
|
||||
store %8, %10[%3] : memref<10xf32>
|
||||
%5 = load %10[%c1] : memref<10xf32>
|
||||
br ^bb1(%3 : index)
|
||||
^bb3: // pred: ^bb1
|
||||
return
|
||||
}
|
|
@ -0,0 +1,88 @@
|
|||
// NOTE: Assertions have been autogenerated by utils/update_mlir_test_checks.py
|
||||
// RUN: circt-opt -create-dataflow %s | FileCheck %s
|
||||
func @test() {
|
||||
// CHECK: module {
|
||||
|
||||
// CHECK-LABEL: handshake.func @test(
|
||||
// CHECK-SAME: %[[VAL_0:.*]]: none, ...) -> none {
|
||||
// CHECK: %[[VAL_1:.*]]:3 = "handshake.memory"(%[[VAL_2:.*]]#0, %[[VAL_2]]#1, %[[VAL_3:.*]]) {id = 1 : i32, ld_count = 1 : i32, lsq = false, st_count = 1 : i32, type = memref<10xf32>} : (f32, index, index) -> (f32, none, none)
|
||||
// CHECK: %[[VAL_4:.*]]:3 = "handshake.memory"(%[[VAL_5:.*]]#0, %[[VAL_5]]#1, %[[VAL_6:.*]]) {id = 0 : i32, ld_count = 1 : i32, lsq = false, st_count = 1 : i32, type = memref<10xf32>} : (f32, index, index) -> (f32, none, none)
|
||||
// CHECK: %[[VAL_7:.*]]:3 = "handshake.fork"(%[[VAL_0]]) {control = true} : (none) -> (none, none, none)
|
||||
// CHECK: %[[VAL_8:.*]]:3 = "handshake.fork"(%[[VAL_7]]#2) {control = true} : (none) -> (none, none, none)
|
||||
// CHECK: %[[VAL_9:.*]] = "handshake.join"(%[[VAL_8]]#2, %[[VAL_4]]#2, %[[VAL_1]]#1) {control = true} : (none, none, none) -> none
|
||||
// CHECK: %[[VAL_10:.*]] = "handshake.constant"(%[[VAL_8]]#1) {value = 0 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_11:.*]] = "handshake.constant"(%[[VAL_8]]#0) {value = 10 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_12:.*]]:3 = "handshake.fork"(%[[VAL_11]]) {control = false} : (index) -> (index, index, index)
|
||||
// CHECK: %[[VAL_13:.*]], %[[VAL_6]] = "handshake.load"(%[[VAL_12]]#0, %[[VAL_4]]#0, %[[VAL_7]]#1) : (index, f32, none) -> (f32, index)
|
||||
// CHECK: %[[VAL_14:.*]]:2 = "handshake.fork"(%[[VAL_13]]) {control = false} : (f32) -> (f32, f32)
|
||||
// CHECK: %[[VAL_2]]:2 = "handshake.store"(%[[VAL_14]]#1, %[[VAL_12]]#1, %[[VAL_7]]#0) : (f32, index, none) -> (f32, index)
|
||||
// CHECK: %[[VAL_15:.*]] = "handshake.branch"(%[[VAL_9]]) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_16:.*]] = "handshake.branch"(%[[VAL_10]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_17:.*]] = "handshake.branch"(%[[VAL_12]]#2) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_18:.*]] = "handshake.branch"(%[[VAL_14]]#0) {control = false} : (f32) -> f32
|
||||
// CHECK: "handshake.terminator"()[^bb1] : () -> ()
|
||||
// CHECK: ^bb1:
|
||||
// CHECK: %[[VAL_19:.*]] = "handshake.mux"(%[[VAL_20:.*]]#2, %[[VAL_21:.*]], %[[VAL_17]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_22:.*]]:2 = "handshake.fork"(%[[VAL_19]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_23:.*]] = "handshake.mux"(%[[VAL_20]]#1, %[[VAL_24:.*]], %[[VAL_18]]) : (index, f32, f32) -> f32
|
||||
// CHECK: %[[VAL_25:.*]]:2 = "handshake.control_merge"(%[[VAL_26:.*]], %[[VAL_15]]) {control = true} : (none, none) -> (none, index)
|
||||
// CHECK: %[[VAL_20]]:3 = "handshake.fork"(%[[VAL_25]]#1) {control = false} : (index) -> (index, index, index)
|
||||
// CHECK: %[[VAL_27:.*]] = "handshake.mux"(%[[VAL_20]]#0, %[[VAL_28:.*]], %[[VAL_16]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_29:.*]]:2 = "handshake.fork"(%[[VAL_27]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_30:.*]] = cmpi "slt", %[[VAL_29]]#1, %[[VAL_22]]#1 : index
|
||||
// CHECK: %[[VAL_31:.*]]:4 = "handshake.fork"(%[[VAL_30]]) {control = false} : (i1) -> (i1, i1, i1, i1)
|
||||
// CHECK: %[[VAL_32:.*]], %[[VAL_33:.*]] = "handshake.conditional_branch"(%[[VAL_31]]#3, %[[VAL_22]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_33]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_34:.*]], %[[VAL_35:.*]] = "handshake.conditional_branch"(%[[VAL_31]]#2, %[[VAL_23]]) {control = false} : (i1, f32) -> (f32, f32)
|
||||
// CHECK: "handshake.sink"(%[[VAL_35]]) : (f32) -> ()
|
||||
// CHECK: %[[VAL_36:.*]], %[[VAL_37:.*]] = "handshake.conditional_branch"(%[[VAL_31]]#1, %[[VAL_25]]#0) {control = true} : (i1, none) -> (none, none)
|
||||
// CHECK: %[[VAL_38:.*]], %[[VAL_39:.*]] = "handshake.conditional_branch"(%[[VAL_31]]#0, %[[VAL_29]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_39]]) : (index) -> ()
|
||||
// CHECK: "handshake.terminator"()[^bb2, ^bb3] : () -> ()
|
||||
// CHECK: ^bb2:
|
||||
// CHECK: %[[VAL_40:.*]] = "handshake.merge"(%[[VAL_38]]) : (index) -> index
|
||||
// CHECK: %[[VAL_41:.*]] = "handshake.merge"(%[[VAL_34]]) : (f32) -> f32
|
||||
// CHECK: %[[VAL_42:.*]]:2 = "handshake.fork"(%[[VAL_41]]) {control = false} : (f32) -> (f32, f32)
|
||||
// CHECK: %[[VAL_43:.*]] = "handshake.merge"(%[[VAL_32]]) : (index) -> index
|
||||
// CHECK: %[[VAL_44:.*]]:2 = "handshake.control_merge"(%[[VAL_36]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: %[[VAL_45:.*]]:3 = "handshake.fork"(%[[VAL_44]]#0) {control = true} : (none) -> (none, none, none)
|
||||
// CHECK: %[[VAL_46:.*]]:2 = "handshake.fork"(%[[VAL_45]]#2) {control = true} : (none) -> (none, none)
|
||||
// CHECK: %[[VAL_47:.*]] = "handshake.join"(%[[VAL_46]]#1, %[[VAL_4]]#1, %[[VAL_1]]#2) {control = true} : (none, none, none) -> none
|
||||
// CHECK: "handshake.sink"(%[[VAL_44]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_48:.*]] = "handshake.constant"(%[[VAL_46]]#0) {value = 1 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_49:.*]] = addi %[[VAL_40]], %[[VAL_48]] : index
|
||||
// CHECK: %[[VAL_50:.*]]:3 = "handshake.fork"(%[[VAL_49]]) {control = false} : (index) -> (index, index, index)
|
||||
// CHECK: %[[VAL_51:.*]], %[[VAL_3]] = "handshake.load"(%[[VAL_50]]#2, %[[VAL_1]]#0, %[[VAL_45]]#0) : (index, f32, none) -> (f32, index)
|
||||
// CHECK: %[[VAL_52:.*]] = addf %[[VAL_42]]#1, %[[VAL_51]] : f32
|
||||
// CHECK: %[[VAL_5]]:2 = "handshake.store"(%[[VAL_52]], %[[VAL_50]]#1, %[[VAL_45]]#1) : (f32, index, none) -> (f32, index)
|
||||
// CHECK: %[[VAL_24]] = "handshake.branch"(%[[VAL_42]]#0) {control = false} : (f32) -> f32
|
||||
// CHECK: %[[VAL_21]] = "handshake.branch"(%[[VAL_43]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_26]] = "handshake.branch"(%[[VAL_47]]) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_28]] = "handshake.branch"(%[[VAL_50]]#0) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb1] : () -> ()
|
||||
// CHECK: ^bb3:
|
||||
// CHECK: %[[VAL_53:.*]]:2 = "handshake.control_merge"(%[[VAL_37]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_53]]#1) : (index) -> ()
|
||||
// CHECK: handshake.return %[[VAL_53]]#0 : none
|
||||
// CHECK: }
|
||||
// CHECK: }
|
||||
%10 = alloc() : memref<10xf32>
|
||||
%11 = alloc() : memref<10xf32>
|
||||
%c0 = constant 0 : index
|
||||
%c10 = constant 10 : index
|
||||
%5 = load %10[%c10] : memref<10xf32>
|
||||
store %5, %11[%c10] : memref<10xf32>
|
||||
br ^bb1(%c0 : index)
|
||||
^bb1(%1: index): // 2 preds: ^bb0, ^bb2
|
||||
%2 = cmpi "slt", %1, %c10 : index
|
||||
cond_br %2, ^bb2, ^bb3
|
||||
^bb2: // pred: ^bb1
|
||||
%c1 = constant 1 : index
|
||||
%3 = addi %1, %c1 : index
|
||||
%7 = load %11[%3] : memref<10xf32>
|
||||
%8 = addf %5, %7 : f32
|
||||
store %8, %10[%3] : memref<10xf32>
|
||||
br ^bb1(%3 : index)
|
||||
^bb3: // pred: ^bb1
|
||||
return
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
// NOTE: Assertions have been autogenerated by utils/update_mlir_test_checks.py
|
||||
// RUN: circt-opt -create-dataflow %s | FileCheck %s
|
||||
func @ops(f32, f32, i32, i32) -> (f32, i32) {
|
||||
// CHECK: module {
|
||||
|
||||
// CHECK-LABEL: handshake.func @ops(
|
||||
// CHECK-SAME: %[[VAL_0:.*]]: f32, %[[VAL_1:.*]]: f32, %[[VAL_2:.*]]: i32, %[[VAL_3:.*]]: i32, %[[VAL_4:.*]]: none, ...) -> (f32, i32, none) {
|
||||
// CHECK: %[[VAL_5:.*]] = "handshake.merge"(%[[VAL_0]]) : (f32) -> f32
|
||||
// CHECK: %[[VAL_6:.*]]:3 = "handshake.fork"(%[[VAL_5]]) {control = false} : (f32) -> (f32, f32, f32)
|
||||
// CHECK: %[[VAL_7:.*]] = "handshake.merge"(%[[VAL_1]]) : (f32) -> f32
|
||||
// CHECK: %[[VAL_8:.*]]:3 = "handshake.fork"(%[[VAL_7]]) {control = false} : (f32) -> (f32, f32, f32)
|
||||
// CHECK: %[[VAL_9:.*]] = "handshake.merge"(%[[VAL_2]]) : (i32) -> i32
|
||||
// CHECK: %[[VAL_10:.*]]:10 = "handshake.fork"(%[[VAL_9]]) {control = false} : (i32) -> (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32)
|
||||
// CHECK: %[[VAL_11:.*]] = "handshake.merge"(%[[VAL_3]]) : (i32) -> i32
|
||||
// CHECK: %[[VAL_12:.*]]:9 = "handshake.fork"(%[[VAL_11]]) {control = false} : (i32) -> (i32, i32, i32, i32, i32, i32, i32, i32, i32)
|
||||
// CHECK: %[[VAL_13:.*]] = subf %[[VAL_6]]#2, %[[VAL_8]]#2 : f32
|
||||
// CHECK: %[[VAL_14:.*]] = subi %[[VAL_10]]#9, %[[VAL_12]]#8 : i32
|
||||
// CHECK: %[[VAL_15:.*]] = cmpi "slt", %[[VAL_10]]#8, %[[VAL_14]] : i32
|
||||
// CHECK: %[[VAL_16:.*]] = divi_signed %[[VAL_10]]#7, %[[VAL_12]]#7 : i32
|
||||
// CHECK: %[[VAL_17:.*]] = divi_unsigned %[[VAL_10]]#6, %[[VAL_12]]#6 : i32
|
||||
// CHECK: "handshake.sink"(%[[VAL_17]]) : (i32) -> ()
|
||||
// CHECK: %[[VAL_18:.*]] = remi_signed %[[VAL_10]]#5, %[[VAL_12]]#5 : i32
|
||||
// CHECK: "handshake.sink"(%[[VAL_18]]) : (i32) -> ()
|
||||
// CHECK: %[[VAL_19:.*]] = remi_unsigned %[[VAL_10]]#4, %[[VAL_12]]#4 : i32
|
||||
// CHECK: "handshake.sink"(%[[VAL_19]]) : (i32) -> ()
|
||||
// CHECK: %[[VAL_20:.*]] = select %[[VAL_15]], %[[VAL_10]]#3, %[[VAL_12]]#3 : i32
|
||||
// CHECK: "handshake.sink"(%[[VAL_20]]) : (i32) -> ()
|
||||
// CHECK: %[[VAL_21:.*]] = divf %[[VAL_6]]#1, %[[VAL_8]]#1 : f32
|
||||
// CHECK: "handshake.sink"(%[[VAL_21]]) : (f32) -> ()
|
||||
// CHECK: %[[VAL_22:.*]] = remf %[[VAL_6]]#0, %[[VAL_8]]#0 : f32
|
||||
// CHECK: "handshake.sink"(%[[VAL_22]]) : (f32) -> ()
|
||||
// CHECK: %[[VAL_23:.*]] = and %[[VAL_10]]#2, %[[VAL_12]]#2 : i32
|
||||
// CHECK: "handshake.sink"(%[[VAL_23]]) : (i32) -> ()
|
||||
// CHECK: %[[VAL_24:.*]] = or %[[VAL_10]]#1, %[[VAL_12]]#1 : i32
|
||||
// CHECK: "handshake.sink"(%[[VAL_24]]) : (i32) -> ()
|
||||
// CHECK: %[[VAL_25:.*]] = xor %[[VAL_10]]#0, %[[VAL_12]]#0 : i32
|
||||
// CHECK: "handshake.sink"(%[[VAL_25]]) : (i32) -> ()
|
||||
// CHECK: handshake.return %[[VAL_13]], %[[VAL_16]], %[[VAL_4]] : f32, i32, none
|
||||
// CHECK: }
|
||||
// CHECK: }
|
||||
^bb0(%arg0: f32, %arg1: f32, %arg2: i32, %arg3: i32):
|
||||
%0 = subf %arg0, %arg1: f32
|
||||
%1 = subi %arg2, %arg3: i32
|
||||
%2 = cmpi "slt", %arg2, %1 : i32
|
||||
%4 = divi_signed %arg2, %arg3 : i32
|
||||
%5 = divi_unsigned %arg2, %arg3 : i32
|
||||
%6 = remi_signed %arg2, %arg3 : i32
|
||||
%7 = remi_unsigned %arg2, %arg3 : i32
|
||||
%8 = select %2, %arg2, %arg3 : i32
|
||||
%9 = divf %arg0, %arg1 : f32
|
||||
%10 = remf %arg0, %arg1 : f32
|
||||
%11 = and %arg2, %arg3 : i32
|
||||
%12 = or %arg2, %arg3 : i32
|
||||
%13 = xor %arg2, %arg3 : i32
|
||||
return %0, %4 : f32, i32
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
// NOTE: Assertions have been autogenerated by utils/update_mlir_test_checks.py
|
||||
// RUN: circt-opt -create-dataflow %s | FileCheck %s
|
||||
func @dfs_block_order() -> (i32) {
|
||||
// CHECK: module {
|
||||
|
||||
// CHECK-LABEL: handshake.func @dfs_block_order(
|
||||
// CHECK-SAME: %[[VAL_0:.*]]: none, ...) -> (i32, none) {
|
||||
// CHECK: %[[VAL_1:.*]]:2 = "handshake.fork"(%[[VAL_0]]) {control = true} : (none) -> (none, none)
|
||||
// CHECK: %[[VAL_2:.*]] = "handshake.constant"(%[[VAL_1]]#0) {value = 42 : i32} : (none) -> i32
|
||||
// CHECK: %[[VAL_3:.*]] = "handshake.branch"(%[[VAL_1]]#1) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_4:.*]] = "handshake.branch"(%[[VAL_2]]) {control = false} : (i32) -> i32
|
||||
// CHECK: "handshake.terminator"()[^bb2] : () -> ()
|
||||
// CHECK: ^bb1:
|
||||
// CHECK: %[[VAL_5:.*]] = "handshake.merge"(%[[VAL_6:.*]]) : (i32) -> i32
|
||||
// CHECK: %[[VAL_7:.*]] = "handshake.merge"(%[[VAL_8:.*]]) : (i32) -> i32
|
||||
// CHECK: %[[VAL_9:.*]]:2 = "handshake.control_merge"(%[[VAL_10:.*]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_9]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_11:.*]] = addi %[[VAL_5]], %[[VAL_7]] : i32
|
||||
// CHECK: handshake.return %[[VAL_11]], %[[VAL_9]]#0 : i32, none
|
||||
// CHECK: ^bb2:
|
||||
// CHECK: %[[VAL_12:.*]] = "handshake.merge"(%[[VAL_4]]) : (i32) -> i32
|
||||
// CHECK: %[[VAL_13:.*]]:2 = "handshake.control_merge"(%[[VAL_3]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: %[[VAL_14:.*]]:2 = "handshake.fork"(%[[VAL_13]]#0) {control = true} : (none) -> (none, none)
|
||||
// CHECK: "handshake.sink"(%[[VAL_13]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_15:.*]] = "handshake.constant"(%[[VAL_14]]#0) {value = 55 : i32} : (none) -> i32
|
||||
// CHECK: %[[VAL_6]] = "handshake.branch"(%[[VAL_12]]) {control = false} : (i32) -> i32
|
||||
// CHECK: %[[VAL_10]] = "handshake.branch"(%[[VAL_14]]#1) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_8]] = "handshake.branch"(%[[VAL_15]]) {control = false} : (i32) -> i32
|
||||
// CHECK: "handshake.terminator"()[^bb1] : () -> ()
|
||||
// CHECK: }
|
||||
// CHECK: }
|
||||
%0 = constant 42 : i32
|
||||
br ^bb2
|
||||
^bb1:
|
||||
%2 = addi %0, %1 : i32
|
||||
return %2 : i32
|
||||
^bb2:
|
||||
%1 = constant 55 : i32
|
||||
br ^bb1
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
// NOTE: Assertions have been autogenerated by utils/update_mlir_test_checks.py
|
||||
// RUN: circt-opt -create-dataflow %s | FileCheck %s
|
||||
func @ops(f32, f32, i32, i32) -> (f32, i32) {
|
||||
// CHECK: module {
|
||||
|
||||
// CHECK-LABEL: handshake.func @ops(
|
||||
// CHECK-SAME: %[[VAL_0:.*]]: f32, %[[VAL_1:.*]]: f32, %[[VAL_2:.*]]: i32, %[[VAL_3:.*]]: i32, %[[VAL_4:.*]]: none, ...) -> (f32, i32, none) {
|
||||
// CHECK: %[[VAL_5:.*]] = "handshake.merge"(%[[VAL_0]]) : (f32) -> f32
|
||||
// CHECK: %[[VAL_6:.*]] = "handshake.merge"(%[[VAL_1]]) : (f32) -> f32
|
||||
// CHECK: %[[VAL_7:.*]]:3 = "handshake.fork"(%[[VAL_6]]) {control = false} : (f32) -> (f32, f32, f32)
|
||||
// CHECK: %[[VAL_8:.*]] = "handshake.merge"(%[[VAL_2]]) : (i32) -> i32
|
||||
// CHECK: %[[VAL_9:.*]]:9 = "handshake.fork"(%[[VAL_8]]) {control = false} : (i32) -> (i32, i32, i32, i32, i32, i32, i32, i32, i32)
|
||||
// CHECK: %[[VAL_10:.*]] = "handshake.merge"(%[[VAL_3]]) : (i32) -> i32
|
||||
// CHECK: %[[VAL_11:.*]]:8 = "handshake.fork"(%[[VAL_10]]) {control = false} : (i32) -> (i32, i32, i32, i32, i32, i32, i32, i32)
|
||||
// CHECK: %[[VAL_12:.*]] = subf %[[VAL_5]], %[[VAL_7]]#2 : f32
|
||||
// CHECK: %[[VAL_13:.*]]:3 = "handshake.fork"(%[[VAL_12]]) {control = false} : (f32) -> (f32, f32, f32)
|
||||
// CHECK: %[[VAL_14:.*]] = subi %[[VAL_9]]#8, %[[VAL_11]]#7 : i32
|
||||
// CHECK: %[[VAL_15:.*]]:2 = "handshake.fork"(%[[VAL_14]]) {control = false} : (i32) -> (i32, i32)
|
||||
// CHECK: %[[VAL_16:.*]] = cmpi "slt", %[[VAL_9]]#7, %[[VAL_15]]#1 : i32
|
||||
// CHECK: %[[VAL_17:.*]] = subi %[[VAL_9]]#6, %[[VAL_11]]#6 : i32
|
||||
// CHECK: %[[VAL_18:.*]]:2 = "handshake.fork"(%[[VAL_17]]) {control = false} : (i32) -> (i32, i32)
|
||||
// CHECK: %[[VAL_19:.*]] = addi %[[VAL_15]]#0, %[[VAL_18]]#1 : i32
|
||||
// CHECK: "handshake.sink"(%[[VAL_19]]) : (i32) -> ()
|
||||
// CHECK: %[[VAL_20:.*]] = addi %[[VAL_9]]#5, %[[VAL_11]]#5 : i32
|
||||
// CHECK: "handshake.sink"(%[[VAL_20]]) : (i32) -> ()
|
||||
// CHECK: %[[VAL_21:.*]] = remi_unsigned %[[VAL_9]]#4, %[[VAL_11]]#4 : i32
|
||||
// CHECK: "handshake.sink"(%[[VAL_21]]) : (i32) -> ()
|
||||
// CHECK: %[[VAL_22:.*]] = select %[[VAL_16]], %[[VAL_9]]#3, %[[VAL_11]]#3 : i32
|
||||
// CHECK: "handshake.sink"(%[[VAL_22]]) : (i32) -> ()
|
||||
// CHECK: %[[VAL_23:.*]] = divf %[[VAL_13]]#2, %[[VAL_7]]#1 : f32
|
||||
// CHECK: "handshake.sink"(%[[VAL_23]]) : (f32) -> ()
|
||||
// CHECK: %[[VAL_24:.*]] = remf %[[VAL_13]]#1, %[[VAL_7]]#0 : f32
|
||||
// CHECK: "handshake.sink"(%[[VAL_24]]) : (f32) -> ()
|
||||
// CHECK: %[[VAL_25:.*]] = and %[[VAL_9]]#2, %[[VAL_11]]#2 : i32
|
||||
// CHECK: "handshake.sink"(%[[VAL_25]]) : (i32) -> ()
|
||||
// CHECK: %[[VAL_26:.*]] = or %[[VAL_9]]#1, %[[VAL_11]]#1 : i32
|
||||
// CHECK: "handshake.sink"(%[[VAL_26]]) : (i32) -> ()
|
||||
// CHECK: %[[VAL_27:.*]] = xor %[[VAL_9]]#0, %[[VAL_11]]#0 : i32
|
||||
// CHECK: "handshake.sink"(%[[VAL_27]]) : (i32) -> ()
|
||||
// CHECK: handshake.return %[[VAL_13]]#0, %[[VAL_18]]#0, %[[VAL_4]] : f32, i32, none
|
||||
// CHECK: }
|
||||
// CHECK: }
|
||||
^bb0(%arg0: f32, %arg1: f32, %arg2: i32, %arg3: i32):
|
||||
%0 = subf %arg0, %arg1: f32
|
||||
%1 = subi %arg2, %arg3: i32
|
||||
%2 = cmpi "slt", %arg2, %1 : i32
|
||||
%4 = subi %arg2, %arg3 : i32
|
||||
%5 = addi %1, %4 : i32
|
||||
%6 = addi %arg2, %arg3 : i32
|
||||
%7 = remi_unsigned %arg2, %arg3 : i32
|
||||
%8 = select %2, %arg2, %arg3 : i32
|
||||
%9 = divf %0, %arg1 : f32
|
||||
%10 = remf %0, %arg1 : f32
|
||||
%11 = and %arg2, %arg3 : i32
|
||||
%12 = or %arg2, %arg3 : i32
|
||||
%13 = xor %arg2, %arg3 : i32
|
||||
return %0, %4 : f32, i32
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
// NOTE: Assertions have been autogenerated by utils/update_mlir_test_checks.py
|
||||
// RUN: circt-opt -create-dataflow %s | FileCheck %s
|
||||
func @simple_loop() {
|
||||
// CHECK: module {
|
||||
|
||||
// CHECK-LABEL: handshake.func @simple_loop(
|
||||
// CHECK-SAME: %[[VAL_0:.*]]: none, ...) -> none {
|
||||
// CHECK: %[[VAL_1:.*]] = "handshake.branch"(%[[VAL_0]]) {control = true} : (none) -> none
|
||||
// CHECK: "handshake.terminator"()[^bb1] : () -> ()
|
||||
// CHECK: ^bb1:
|
||||
// CHECK: %[[VAL_2:.*]]:2 = "handshake.control_merge"(%[[VAL_1]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: %[[VAL_3:.*]]:2 = "handshake.fork"(%[[VAL_2]]#0) {control = true} : (none) -> (none, none)
|
||||
// CHECK: "handshake.sink"(%[[VAL_2]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_4:.*]] = "handshake.constant"(%[[VAL_3]]#0) {value = 1 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_5:.*]] = "handshake.branch"(%[[VAL_3]]#1) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_6:.*]] = "handshake.branch"(%[[VAL_4]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb2] : () -> ()
|
||||
// CHECK: ^bb2:
|
||||
// CHECK: %[[VAL_7:.*]]:2 = "handshake.control_merge"(%[[VAL_8:.*]], %[[VAL_5]]) {control = true} : (none, none) -> (none, index)
|
||||
// CHECK: %[[VAL_9:.*]]:2 = "handshake.fork"(%[[VAL_7]]#0) {control = true} : (none) -> (none, none)
|
||||
// CHECK: %[[VAL_10:.*]] = "handshake.mux"(%[[VAL_7]]#1, %[[VAL_11:.*]], %[[VAL_6]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_12:.*]]:2 = "handshake.fork"(%[[VAL_10]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_13:.*]] = "handshake.constant"(%[[VAL_9]]#0) {value = 42 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_14:.*]] = cmpi "slt", %[[VAL_12]]#1, %[[VAL_13]] : index
|
||||
// CHECK: %[[VAL_15:.*]]:2 = "handshake.fork"(%[[VAL_14]]) {control = false} : (i1) -> (i1, i1)
|
||||
// CHECK: %[[VAL_16:.*]], %[[VAL_17:.*]] = "handshake.conditional_branch"(%[[VAL_15]]#1, %[[VAL_9]]#1) {control = true} : (i1, none) -> (none, none)
|
||||
// CHECK: %[[VAL_18:.*]], %[[VAL_19:.*]] = "handshake.conditional_branch"(%[[VAL_15]]#0, %[[VAL_12]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_19]]) : (index) -> ()
|
||||
// CHECK: "handshake.terminator"()[^bb3, ^bb4] : () -> ()
|
||||
// CHECK: ^bb3:
|
||||
// CHECK: %[[VAL_20:.*]] = "handshake.merge"(%[[VAL_18]]) : (index) -> index
|
||||
// CHECK: %[[VAL_21:.*]]:2 = "handshake.control_merge"(%[[VAL_16]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: %[[VAL_22:.*]]:2 = "handshake.fork"(%[[VAL_21]]#0) {control = true} : (none) -> (none, none)
|
||||
// CHECK: "handshake.sink"(%[[VAL_21]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_23:.*]] = "handshake.constant"(%[[VAL_22]]#0) {value = 1 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_24:.*]] = addi %[[VAL_20]], %[[VAL_23]] : index
|
||||
// CHECK: %[[VAL_8]] = "handshake.branch"(%[[VAL_22]]#1) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_11]] = "handshake.branch"(%[[VAL_24]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb2] : () -> ()
|
||||
// CHECK: ^bb4:
|
||||
// CHECK: %[[VAL_25:.*]]:2 = "handshake.control_merge"(%[[VAL_17]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_25]]#1) : (index) -> ()
|
||||
// CHECK: handshake.return %[[VAL_25]]#0 : none
|
||||
// CHECK: }
|
||||
// CHECK: }
|
||||
^bb0:
|
||||
br ^bb1
|
||||
^bb1: // pred: ^bb0
|
||||
%c1 = constant 1 : index
|
||||
br ^bb2(%c1 : index)
|
||||
^bb2(%0: index): // 2 preds: ^bb1, ^bb3
|
||||
%c42 = constant 42 : index
|
||||
%1 = cmpi "slt", %0, %c42 : index
|
||||
cond_br %1, ^bb3, ^bb4
|
||||
^bb3: // pred: ^bb2
|
||||
%c1_0 = constant 1 : index
|
||||
%2 = addi %0, %c1_0 : index
|
||||
br ^bb2(%2 : index)
|
||||
^bb4: // pred: ^bb2
|
||||
return
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
// NOTE: Assertions have been autogenerated by utils/update_mlir_test_checks.py
|
||||
// RUN: circt-opt -create-dataflow %s | FileCheck %s
|
||||
func @simple_loop() {
|
||||
// CHECK: module {
|
||||
|
||||
// CHECK-LABEL: handshake.func @simple_loop(
|
||||
// CHECK-SAME: %[[VAL_0:.*]]: none, ...) -> none {
|
||||
// CHECK: %[[VAL_1:.*]] = "handshake.branch"(%[[VAL_0]]) {control = true} : (none) -> none
|
||||
// CHECK: "handshake.terminator"()[^bb1] : () -> ()
|
||||
// CHECK: ^bb1:
|
||||
// CHECK: %[[VAL_2:.*]]:2 = "handshake.control_merge"(%[[VAL_1]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: %[[VAL_3:.*]]:2 = "handshake.fork"(%[[VAL_2]]#0) {control = true} : (none) -> (none, none)
|
||||
// CHECK: "handshake.sink"(%[[VAL_2]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_4:.*]] = "handshake.constant"(%[[VAL_3]]#0) {value = 42 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_5:.*]] = "handshake.branch"(%[[VAL_3]]#1) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_6:.*]] = "handshake.branch"(%[[VAL_4]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb2] : () -> ()
|
||||
// CHECK: ^bb2:
|
||||
// CHECK: %[[VAL_7:.*]] = "handshake.mux"(%[[VAL_8:.*]]#1, %[[VAL_9:.*]], %[[VAL_6]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_10:.*]]:3 = "handshake.fork"(%[[VAL_7]]) {control = false} : (index) -> (index, index, index)
|
||||
// CHECK: %[[VAL_8]]:2 = "handshake.control_merge"(%[[VAL_11:.*]], %[[VAL_5]]) {control = true} : (none, none) -> (none, index)
|
||||
// CHECK: %[[VAL_12:.*]] = cmpi "slt", %[[VAL_10]]#1, %[[VAL_10]]#2 : index
|
||||
// CHECK: %[[VAL_13:.*]]:2 = "handshake.fork"(%[[VAL_12]]) {control = false} : (i1) -> (i1, i1)
|
||||
// CHECK: %[[VAL_14:.*]], %[[VAL_15:.*]] = "handshake.conditional_branch"(%[[VAL_13]]#1, %[[VAL_10]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_15]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_16:.*]], %[[VAL_17:.*]] = "handshake.conditional_branch"(%[[VAL_13]]#0, %[[VAL_8]]#0) {control = true} : (i1, none) -> (none, none)
|
||||
// CHECK: "handshake.terminator"()[^bb3, ^bb4] : () -> ()
|
||||
// CHECK: ^bb3:
|
||||
// CHECK: %[[VAL_18:.*]] = "handshake.merge"(%[[VAL_14]]) : (index) -> index
|
||||
// CHECK: %[[VAL_19:.*]]:2 = "handshake.control_merge"(%[[VAL_16]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: %[[VAL_20:.*]]:3 = "handshake.fork"(%[[VAL_19]]#0) {control = true} : (none) -> (none, none, none)
|
||||
// CHECK: "handshake.sink"(%[[VAL_19]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_21:.*]] = "handshake.constant"(%[[VAL_20]]#1) {value = 52 : index} : (none) -> index
|
||||
// CHECK: "handshake.sink"(%[[VAL_21]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_22:.*]] = "handshake.constant"(%[[VAL_20]]#0) {value = 62 : index} : (none) -> index
|
||||
// CHECK: "handshake.sink"(%[[VAL_22]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_9]] = "handshake.branch"(%[[VAL_18]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_11]] = "handshake.branch"(%[[VAL_20]]#2) {control = true} : (none) -> none
|
||||
// CHECK: "handshake.terminator"()[^bb2] : () -> ()
|
||||
// CHECK: ^bb4:
|
||||
// CHECK: %[[VAL_23:.*]]:2 = "handshake.control_merge"(%[[VAL_17]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_23]]#1) : (index) -> ()
|
||||
// CHECK: handshake.return %[[VAL_23]]#0 : none
|
||||
// CHECK: }
|
||||
// CHECK: }
|
||||
^bb0:
|
||||
br ^bb1
|
||||
^bb1: // pred: ^bb0
|
||||
%c42 = constant 42 : index
|
||||
br ^bb2
|
||||
^bb2: // 2 preds: ^bb1, ^bb3
|
||||
%1 = cmpi "slt", %c42, %c42 : index
|
||||
cond_br %1, ^bb3, ^bb4
|
||||
^bb3: // pred: ^bb2
|
||||
%c52 = constant 52 : index
|
||||
%c62 = constant 62 : index
|
||||
br ^bb2
|
||||
^bb4: // pred: ^bb2
|
||||
return
|
||||
}
|
|
@ -0,0 +1,102 @@
|
|||
// NOTE: Assertions have been autogenerated by utils/update_mlir_test_checks.py
|
||||
// RUN: circt-opt -create-dataflow %s | FileCheck %s
|
||||
func @affine_dma_wait(%arg0: index) {
|
||||
// CHECK: module {
|
||||
|
||||
// CHECK-LABEL: handshake.func @affine_dma_wait(
|
||||
// CHECK-SAME: %[[VAL_0:.*]]: index, %[[VAL_1:.*]]: none, ...) -> none {
|
||||
// CHECK: %[[VAL_2:.*]] = "handshake.merge"(%[[VAL_0]]) : (index) -> index
|
||||
// CHECK: %[[VAL_3:.*]]:5 = "handshake.fork"(%[[VAL_1]]) {control = true} : (none) -> (none, none, none, none, none)
|
||||
// CHECK: %[[VAL_4:.*]] = alloc() : memref<1xi32>
|
||||
// CHECK: %[[VAL_5:.*]] = "handshake.constant"(%[[VAL_3]]#3) {value = 64 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_6:.*]] = "handshake.constant"(%[[VAL_3]]#2) {value = 0 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_7:.*]] = "handshake.constant"(%[[VAL_3]]#1) {value = 10 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_8:.*]] = "handshake.constant"(%[[VAL_3]]#0) {value = 1 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_9:.*]] = "handshake.branch"(%[[VAL_2]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_10:.*]] = "handshake.branch"(%[[VAL_3]]#4) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_11:.*]] = "handshake.branch"(%[[VAL_4]]) {control = false} : (memref<1xi32>) -> memref<1xi32>
|
||||
// CHECK: %[[VAL_12:.*]] = "handshake.branch"(%[[VAL_5]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_13:.*]] = "handshake.branch"(%[[VAL_6]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_14:.*]] = "handshake.branch"(%[[VAL_7]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_15:.*]] = "handshake.branch"(%[[VAL_8]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb1] : () -> ()
|
||||
// CHECK: ^bb1:
|
||||
// CHECK: %[[VAL_16:.*]] = "handshake.mux"(%[[VAL_17:.*]]#5, %[[VAL_18:.*]], %[[VAL_14]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_19:.*]]:2 = "handshake.fork"(%[[VAL_16]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_20:.*]] = "handshake.mux"(%[[VAL_17]]#4, %[[VAL_21:.*]], %[[VAL_9]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_22:.*]] = "handshake.mux"(%[[VAL_17]]#3, %[[VAL_23:.*]], %[[VAL_11]]) : (index, memref<1xi32>, memref<1xi32>) -> memref<1xi32>
|
||||
// CHECK: %[[VAL_24:.*]] = "handshake.mux"(%[[VAL_17]]#2, %[[VAL_25:.*]], %[[VAL_12]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_26:.*]] = "handshake.mux"(%[[VAL_17]]#1, %[[VAL_27:.*]], %[[VAL_15]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_28:.*]]:2 = "handshake.control_merge"(%[[VAL_29:.*]], %[[VAL_10]]) {control = true} : (none, none) -> (none, index)
|
||||
// CHECK: %[[VAL_17]]:6 = "handshake.fork"(%[[VAL_28]]#1) {control = false} : (index) -> (index, index, index, index, index, index)
|
||||
// CHECK: %[[VAL_30:.*]] = "handshake.mux"(%[[VAL_17]]#0, %[[VAL_31:.*]], %[[VAL_13]]) : (index, index, index) -> index
|
||||
// CHECK: %[[VAL_32:.*]]:2 = "handshake.fork"(%[[VAL_30]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_33:.*]] = cmpi "slt", %[[VAL_32]]#1, %[[VAL_19]]#1 : index
|
||||
// CHECK: %[[VAL_34:.*]]:7 = "handshake.fork"(%[[VAL_33]]) {control = false} : (i1) -> (i1, i1, i1, i1, i1, i1, i1)
|
||||
// CHECK: %[[VAL_35:.*]], %[[VAL_36:.*]] = "handshake.conditional_branch"(%[[VAL_34]]#6, %[[VAL_19]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_36]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_37:.*]], %[[VAL_38:.*]] = "handshake.conditional_branch"(%[[VAL_34]]#5, %[[VAL_20]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_38]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_39:.*]], %[[VAL_40:.*]] = "handshake.conditional_branch"(%[[VAL_34]]#4, %[[VAL_22]]) {control = false} : (i1, memref<1xi32>) -> (memref<1xi32>, memref<1xi32>)
|
||||
// CHECK: "handshake.sink"(%[[VAL_40]]) : (memref<1xi32>) -> ()
|
||||
// CHECK: %[[VAL_41:.*]], %[[VAL_42:.*]] = "handshake.conditional_branch"(%[[VAL_34]]#3, %[[VAL_24]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_42]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_43:.*]], %[[VAL_44:.*]] = "handshake.conditional_branch"(%[[VAL_34]]#2, %[[VAL_26]]) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_44]]) : (index) -> ()
|
||||
// CHECK: %[[VAL_45:.*]], %[[VAL_46:.*]] = "handshake.conditional_branch"(%[[VAL_34]]#1, %[[VAL_28]]#0) {control = true} : (i1, none) -> (none, none)
|
||||
// CHECK: %[[VAL_47:.*]], %[[VAL_48:.*]] = "handshake.conditional_branch"(%[[VAL_34]]#0, %[[VAL_32]]#0) {control = false} : (i1, index) -> (index, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_48]]) : (index) -> ()
|
||||
// CHECK: "handshake.terminator"()[^bb2, ^bb3] : () -> ()
|
||||
// CHECK: ^bb2:
|
||||
// CHECK: %[[VAL_49:.*]] = "handshake.merge"(%[[VAL_47]]) : (index) -> index
|
||||
// CHECK: %[[VAL_50:.*]]:2 = "handshake.fork"(%[[VAL_49]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_51:.*]] = "handshake.merge"(%[[VAL_37]]) : (index) -> index
|
||||
// CHECK: %[[VAL_52:.*]]:2 = "handshake.fork"(%[[VAL_51]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_53:.*]] = "handshake.merge"(%[[VAL_39]]) : (memref<1xi32>) -> memref<1xi32>
|
||||
// CHECK: %[[VAL_54:.*]]:2 = "handshake.fork"(%[[VAL_53]]) {control = false} : (memref<1xi32>) -> (memref<1xi32>, memref<1xi32>)
|
||||
// CHECK: %[[VAL_55:.*]] = "handshake.merge"(%[[VAL_41]]) : (index) -> index
|
||||
// CHECK: %[[VAL_56:.*]]:2 = "handshake.fork"(%[[VAL_55]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_57:.*]] = "handshake.merge"(%[[VAL_43]]) : (index) -> index
|
||||
// CHECK: %[[VAL_58:.*]]:2 = "handshake.fork"(%[[VAL_57]]) {control = false} : (index) -> (index, index)
|
||||
// CHECK: %[[VAL_59:.*]] = "handshake.merge"(%[[VAL_35]]) : (index) -> index
|
||||
// CHECK: %[[VAL_60:.*]]:2 = "handshake.control_merge"(%[[VAL_45]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: %[[VAL_61:.*]]:2 = "handshake.fork"(%[[VAL_60]]#0) {control = true} : (none) -> (none, none)
|
||||
// CHECK: "handshake.sink"(%[[VAL_60]]#1) : (index) -> ()
|
||||
// CHECK: %[[VAL_62:.*]] = addi %[[VAL_50]]#1, %[[VAL_52]]#1 : index
|
||||
// CHECK: %[[VAL_63:.*]] = "handshake.constant"(%[[VAL_61]]#0) {value = 17 : index} : (none) -> index
|
||||
// CHECK: %[[VAL_64:.*]] = addi %[[VAL_62]], %[[VAL_63]] : index
|
||||
// CHECK: dma_wait %[[VAL_54]]#1{{\[}}%[[VAL_64]]], %[[VAL_56]]#1 : memref<1xi32>
|
||||
// CHECK: %[[VAL_65:.*]] = addi %[[VAL_50]]#0, %[[VAL_58]]#1 : index
|
||||
// CHECK: %[[VAL_21]] = "handshake.branch"(%[[VAL_52]]#0) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_23]] = "handshake.branch"(%[[VAL_54]]#0) {control = false} : (memref<1xi32>) -> memref<1xi32>
|
||||
// CHECK: %[[VAL_25]] = "handshake.branch"(%[[VAL_56]]#0) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_27]] = "handshake.branch"(%[[VAL_58]]#0) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_18]] = "handshake.branch"(%[[VAL_59]]) {control = false} : (index) -> index
|
||||
// CHECK: %[[VAL_29]] = "handshake.branch"(%[[VAL_61]]#1) {control = true} : (none) -> none
|
||||
// CHECK: %[[VAL_31]] = "handshake.branch"(%[[VAL_65]]) {control = false} : (index) -> index
|
||||
// CHECK: "handshake.terminator"()[^bb1] : () -> ()
|
||||
// CHECK: ^bb3:
|
||||
// CHECK: %[[VAL_66:.*]]:2 = "handshake.control_merge"(%[[VAL_46]]) {control = true} : (none) -> (none, index)
|
||||
// CHECK: "handshake.sink"(%[[VAL_66]]#1) : (index) -> ()
|
||||
// CHECK: handshake.return %[[VAL_66]]#0 : none
|
||||
// CHECK: }
|
||||
// CHECK: }
|
||||
%0 = alloc() : memref<1xi32>
|
||||
%c64 = constant 64 : index
|
||||
%c0 = constant 0 : index
|
||||
%c10 = constant 10 : index
|
||||
%c1 = constant 1 : index
|
||||
br ^bb1(%c0 : index)
|
||||
^bb1(%1: index): // 2 preds: ^bb0, ^bb2
|
||||
%2 = cmpi "slt", %1, %c10 : index
|
||||
cond_br %2, ^bb2, ^bb3
|
||||
^bb2: // pred: ^bb1
|
||||
%3 = addi %1, %arg0 : index
|
||||
%c17 = constant 17 : index
|
||||
%4 = addi %3, %c17 : index
|
||||
dma_wait %0[%4], %c64 : memref<1xi32>
|
||||
%5 = addi %1, %c1 : index
|
||||
br ^bb1(%5 : index)
|
||||
^bb3: // pred: ^bb1
|
||||
return
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
// RUN: handshake-runner %s | FileCheck %s
|
||||
// BROKEN: circt-opt -create-dataflow %s | handshake-runner | FileCheck %s
|
||||
// CHECK: 763 2996
|
||||
module {
|
||||
func @muladd(%1:index, %2:index, %3:index) -> (index) {
|
||||
%i2 = muli %1, %2 : index
|
||||
%i3 = addi %3, %i2 : index
|
||||
return %i3 : index
|
||||
}
|
||||
|
||||
func @main() -> (index, index) {
|
||||
%c0 = constant 0 : index
|
||||
%c101 = constant 101 : index
|
||||
%c102 = constant 102 : index
|
||||
%0 = addi %c0, %c0 : index
|
||||
%c1 = constant 1 : index
|
||||
%1 = addi %0, %c102 : index
|
||||
%c103 = constant 103 : index
|
||||
%c104 = constant 104 : index
|
||||
%c105 = constant 105 : index
|
||||
%c106 = constant 106 : index
|
||||
%c107 = constant 107 : index
|
||||
%c108 = constant 108 : index
|
||||
%c109 = constant 109 : index
|
||||
%c2 = constant 2 : index
|
||||
%3 = call @muladd(%c104, %c2, %c103) : (index, index, index) -> index
|
||||
%c3 = constant 3 : index
|
||||
%4 = muli %c105, %c3 : index
|
||||
%5 = addi %3, %4 : index
|
||||
%c4 = constant 4 : index
|
||||
%6 = muli %c106, %c4 : index
|
||||
%7 = addi %5, %6 : index
|
||||
%c5 = constant 5 : index
|
||||
%8 = muli %c107, %c5 : index
|
||||
%9 = addi %7, %8 : index
|
||||
%c6 = constant 6 : index
|
||||
%10 = muli %c108, %c6 : index
|
||||
%11 = addi %9, %10 : index
|
||||
%c7 = constant 7 : index
|
||||
%12 = muli %c109, %c7 : index
|
||||
%13 = addi %11, %12 : index
|
||||
return %12, %13 : index, index
|
||||
}
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
// RUN: handshake-runner %s 2,3,4,5 2,3,4,5 2,3,4,5 2,3,4,5 2,3,4,5 2,3,4,5 2,3,4,5 2,3,4,5 1,0,1,0 | FileCheck %s
|
||||
// BROKEN: circt-opt -create-dataflow %s | handshake-runner - 2,3,4,5 2,3,4,5 2,3,4,5 2,3,4,5 2,3,4,5 2,3,4,5 2,3,4,5 2,3,4,5 1,0,1,0 | FileCheck %s
|
||||
// CHECK: 0 2,3,4,5 2,3,4,5 1,1431655763,3,858993455 3,4,5,6 2,3,4,5 2,3,4,5 2,3,4,5 2,3,4,5 0,-1,0,-1
|
||||
|
||||
module {
|
||||
func @main(%0: memref<4xi32>,
|
||||
%2: memref<4xi32>,
|
||||
%4: memref<4xi32>,
|
||||
%5: memref<4xi32>,
|
||||
%6: memref<4xi32>,
|
||||
%7: memref<4xi32>,
|
||||
%8: memref<4xi32>,
|
||||
%9: memref<4xi32>,
|
||||
%10: memref<4xi1>) -> index {
|
||||
%c0 = constant 0 : index
|
||||
%c1 = constant 1 : index
|
||||
%c4 = constant 4 : index
|
||||
br ^bb1(%c0 : index)
|
||||
^bb1(%11: index): // 2 preds: ^bb0, ^bb5
|
||||
%12 = cmpi "slt", %11, %c4 : index
|
||||
cond_br %12, ^bb2, ^bb6
|
||||
^bb2: // pred: ^bb1
|
||||
%13 = load %0[%11] : memref<4xi32>
|
||||
%14 = load %2[%11] : memref<4xi32>
|
||||
%15 = load %0[%11] : memref<4xi32>
|
||||
%16 = load %2[%11] : memref<4xi32>
|
||||
%17 = load %10[%11] : memref<4xi1>
|
||||
cond_br %17, ^bb3, ^bb4
|
||||
^bb3: // pred: ^bb2
|
||||
%18 = load %6[%11] : memref<4xi32>
|
||||
%19 = load %9[%11] : memref<4xi32>
|
||||
%20 = muli %13, %18 : i32
|
||||
%21 = muli %15, %18 : i32
|
||||
%22 = addi %20, %15 : i32
|
||||
%23 = subi %13, %21 : i32
|
||||
%24 = divi_unsigned %22, %19 : i32
|
||||
%25 = divi_unsigned %23, %19 : i32
|
||||
store %24, %5[%11] : memref<4xi32>
|
||||
store %25, %4[%11] : memref<4xi32>
|
||||
br ^bb5
|
||||
^bb4: // pred: ^bb2
|
||||
%26 = load %7[%11] : memref<4xi32>
|
||||
%27 = load %8[%11] : memref<4xi32>
|
||||
%28 = muli %13, %26 : i32
|
||||
%29 = muli %15, %26 : i32
|
||||
%30 = addi %29, %13 : i32
|
||||
%31 = subi %28, %15 : i32
|
||||
%32 = divi_unsigned %30, %27 : i32
|
||||
%33 = divi_unsigned %31, %27 : i32
|
||||
store %32, %5[%11] : memref<4xi32>
|
||||
store %33, %4[%11] : memref<4xi32>
|
||||
br ^bb5
|
||||
^bb5: // 2 preds: ^bb3, ^bb4
|
||||
%34 = addi %11, %c1 : index
|
||||
br ^bb1(%34 : index)
|
||||
^bb6: // pred: ^bb1
|
||||
return %c0 : index
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
// RUN: handshake-runner %s | FileCheck %s
|
||||
// RUN: circt-opt -create-dataflow %s | handshake-runner | FileCheck %s
|
||||
// CHECK: 0
|
||||
|
||||
module {
|
||||
func @main() -> index {
|
||||
%c0 = constant 0 : index
|
||||
%c1 = constant 1 : index
|
||||
%c10 = constant 10 : index
|
||||
%0 = alloc() : memref<100xi32>
|
||||
%1 = alloc() : memref<100xi32>
|
||||
%2 = alloc() : memref<100xi32>
|
||||
%3 = alloc() : memref<100xi32>
|
||||
%4 = alloc() : memref<100xi32>
|
||||
%5 = alloc() : memref<100xi32>
|
||||
%6 = alloc() : memref<100xi32>
|
||||
%7 = alloc() : memref<100xi32>
|
||||
%8 = alloc() : memref<100xi32>
|
||||
%9 = alloc() : memref<100xi32>
|
||||
%10 = alloc() : memref<100xi1>
|
||||
br ^bb1(%c0 : index)
|
||||
^bb1(%11: index): // 2 preds: ^bb0, ^bb5
|
||||
%12 = cmpi "slt", %11, %c10 : index
|
||||
cond_br %12, ^bb2, ^bb6
|
||||
^bb2: // pred: ^bb1
|
||||
%13 = load %0[%11] : memref<100xi32>
|
||||
%14 = load %2[%11] : memref<100xi32>
|
||||
%15 = load %0[%11] : memref<100xi32>
|
||||
%16 = load %2[%11] : memref<100xi32>
|
||||
%17 = load %10[%11] : memref<100xi1>
|
||||
cond_br %17, ^bb3, ^bb4
|
||||
^bb3: // pred: ^bb2
|
||||
%18 = load %6[%11] : memref<100xi32>
|
||||
%19 = load %9[%11] : memref<100xi32>
|
||||
%20 = muli %13, %18 : i32
|
||||
%21 = muli %15, %18 : i32
|
||||
%22 = addi %20, %15 : i32
|
||||
%23 = subi %13, %21 : i32
|
||||
%24 = muli %22, %19 : i32
|
||||
%25 = muli %23, %19 : i32
|
||||
store %24, %5[%11] : memref<100xi32>
|
||||
store %25, %4[%11] : memref<100xi32>
|
||||
br ^bb5
|
||||
^bb4: // pred: ^bb2
|
||||
%26 = load %7[%11] : memref<100xi32>
|
||||
%27 = load %8[%11] : memref<100xi32>
|
||||
%28 = muli %13, %26 : i32
|
||||
%29 = muli %15, %26 : i32
|
||||
%30 = addi %29, %13 : i32
|
||||
%31 = subi %28, %15 : i32
|
||||
%32 = muli %30, %27 : i32
|
||||
%33 = muli %31, %27 : i32
|
||||
store %32, %5[%11] : memref<100xi32>
|
||||
store %33, %4[%11] : memref<100xi32>
|
||||
br ^bb5
|
||||
^bb5: // 2 preds: ^bb3, ^bb4
|
||||
%34 = addi %11, %c1 : index
|
||||
br ^bb1(%34 : index)
|
||||
^bb6: // pred: ^bb1
|
||||
return %c0 : index
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
// RUN: handshake-runner %s | FileCheck %s
|
||||
// RUN: circt-opt -create-dataflow %s | handshake-runner | FileCheck %s
|
||||
// CHECK: 763 2996
|
||||
module {
|
||||
func @main() -> (index, index) {
|
||||
%c0 = constant 0 : index
|
||||
%c101 = constant 101 : index
|
||||
%c102 = constant 102 : index
|
||||
%0 = addi %c0, %c0 : index
|
||||
%c1 = constant 1 : index
|
||||
%1 = addi %0, %c102 : index
|
||||
%c103 = constant 103 : index
|
||||
%c104 = constant 104 : index
|
||||
%c105 = constant 105 : index
|
||||
%c106 = constant 106 : index
|
||||
%c107 = constant 107 : index
|
||||
%c108 = constant 108 : index
|
||||
%c109 = constant 109 : index
|
||||
%c2 = constant 2 : index
|
||||
%2 = muli %c104, %c2 : index
|
||||
%3 = addi %c103, %2 : index
|
||||
%c3 = constant 3 : index
|
||||
%4 = muli %c105, %c3 : index
|
||||
%5 = addi %3, %4 : index
|
||||
%c4 = constant 4 : index
|
||||
%6 = muli %c106, %c4 : index
|
||||
%7 = addi %5, %6 : index
|
||||
%c5 = constant 5 : index
|
||||
%8 = muli %c107, %c5 : index
|
||||
%9 = addi %7, %8 : index
|
||||
%c6 = constant 6 : index
|
||||
%10 = muli %c108, %c6 : index
|
||||
%11 = addi %9, %10 : index
|
||||
%c7 = constant 7 : index
|
||||
%12 = muli %c109, %c7 : index
|
||||
%13 = addi %11, %12 : index
|
||||
return %12, %13 : index, index
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
// RUN: handshake-runner %s | FileCheck %s
|
||||
// RUN: circt-opt -create-dataflow %s | handshake-runner | FileCheck %s
|
||||
// CHECK: 0
|
||||
|
||||
module {
|
||||
func @main() -> index {
|
||||
%c0 = constant 0 : index
|
||||
%c1 = constant 1 : index
|
||||
%c4 = constant 4 : index
|
||||
%0 = alloc() : memref<256xi32>
|
||||
br ^bb1(%c0 : index)
|
||||
^bb1(%1: index): // 2 preds: ^bb0, ^bb11
|
||||
%2 = cmpi "slt", %1, %c4 : index
|
||||
cond_br %2, ^bb2, ^bb12
|
||||
^bb2: // pred: ^bb1
|
||||
br ^bb3(%c0 : index)
|
||||
^bb3(%3: index): // 2 preds: ^bb2, ^bb10
|
||||
%4 = cmpi "slt", %3, %c4 : index
|
||||
cond_br %4, ^bb4, ^bb11
|
||||
^bb4: // pred: ^bb3
|
||||
br ^bb5(%c0 : index)
|
||||
^bb5(%5: index): // 2 preds: ^bb4, ^bb9
|
||||
%6 = cmpi "slt", %5, %c4 : index
|
||||
cond_br %6, ^bb6, ^bb10
|
||||
^bb6: // pred: ^bb5
|
||||
%7 = muli %3, %c4 : index
|
||||
%8 = muli %1, %c4 : index
|
||||
%9 = addi %7, %5 : index
|
||||
%10 = addi %7, %1 : index
|
||||
%11 = addi %8, %5 : index
|
||||
%12 = load %0[%9] : memref<256xi32>
|
||||
%13 = load %0[%10] : memref<256xi32>
|
||||
%14 = load %0[%11] : memref<256xi32>
|
||||
%15 = addi %13, %14 : i32
|
||||
%16 = cmpi "ult", %12, %15 : i32
|
||||
cond_br %16, ^bb7, ^bb8
|
||||
^bb7: // pred: ^bb6
|
||||
store %12, %0[%9] : memref<256xi32>
|
||||
br ^bb9
|
||||
^bb8: // pred: ^bb6
|
||||
store %15, %0[%9] : memref<256xi32>
|
||||
br ^bb9
|
||||
^bb9: // 2 preds: ^bb7, ^bb8
|
||||
%17 = addi %5, %c1 : index
|
||||
br ^bb5(%17 : index)
|
||||
^bb10: // pred: ^bb5
|
||||
%18 = addi %3, %c1 : index
|
||||
br ^bb3(%18 : index)
|
||||
^bb11: // pred: ^bb3
|
||||
%19 = addi %1, %c1 : index
|
||||
br ^bb1(%19 : index)
|
||||
^bb12: // pred: ^bb1
|
||||
return %c0 : index
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
// RUN: handshake-runner %s | FileCheck %s
|
||||
// RUN: circt-opt -create-dataflow %s | handshake-runner | FileCheck %s
|
||||
// CHECK: 0
|
||||
|
||||
module {
|
||||
func @main() -> index {
|
||||
%c0 = constant 0 : index
|
||||
%c1 = constant 1 : index
|
||||
%c10 = constant 10 : index
|
||||
%0 = alloc() : memref<100xi32>
|
||||
%1 = alloc() : memref<100xi32>
|
||||
%2 = alloc() : memref<100xi32>
|
||||
br ^bb1(%c0 : index)
|
||||
^bb1(%3: index): // 2 preds: ^bb0, ^bb2
|
||||
%4 = cmpi "slt", %3, %c10 : index
|
||||
cond_br %4, ^bb2, ^bb3
|
||||
^bb2: // pred: ^bb1
|
||||
%5 = load %0[%3] : memref<100xi32>
|
||||
%6 = load %1[%3] : memref<100xi32>
|
||||
%7 = index_cast %5 : i32 to index
|
||||
%8 = load %2[%7] : memref<100xi32>
|
||||
%9 = addi %8, %6 : i32
|
||||
store %9, %2[%7] : memref<100xi32>
|
||||
%10 = addi %3, %c1 : index
|
||||
br ^bb1(%10 : index)
|
||||
^bb3: // pred: ^bb1
|
||||
return %c0 : index
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
// RUN: handshake-runner %s 2 | FileCheck %s
|
||||
// RUN: circt-opt -create-dataflow %s | handshake-runner - 2 | FileCheck %s
|
||||
// CHECK: 1
|
||||
|
||||
module {
|
||||
func @main(%arg0: index) -> (i8) {
|
||||
%0 = alloc() : memref<10xi8>
|
||||
%c1 = constant 1 : i8
|
||||
store %c1, %0[%arg0] : memref<10xi8>
|
||||
%1 = load %0[%arg0] : memref<10xi8>
|
||||
return %1 : i8
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
// RUN: handshake-runner %s | FileCheck %s
|
||||
// RUN: circt-opt -create-dataflow %s | handshake-runner | FileCheck %s
|
||||
// CHECK: 10
|
||||
|
||||
module {
|
||||
func @main() -> i32 {
|
||||
%c0 = constant 0 : index
|
||||
%c1 = constant 1 : index
|
||||
%c4 = constant 4 : index
|
||||
%c5_i32 = constant 5 : i32
|
||||
%0 = alloc() : memref<64xi32>
|
||||
%1 = alloc() : memref<64xi32>
|
||||
br ^bb1(%c0 : index)
|
||||
^bb1(%2: index): // 2 preds: ^bb0, ^bb2
|
||||
%3 = cmpi "slt", %2, %c4 : index
|
||||
cond_br %3, ^bb2, ^bb3
|
||||
^bb2: // pred: ^bb1
|
||||
store %c5_i32, %0[%2] : memref<64xi32>
|
||||
%4 = addi %2, %c1 : index
|
||||
br ^bb1(%4 : index)
|
||||
^bb3: // pred: ^bb1
|
||||
br ^bb4(%c0 : index)
|
||||
^bb4(%5: index): // 2 preds: ^bb3, ^bb5
|
||||
%6 = cmpi "slt", %5, %c4 : index
|
||||
cond_br %6, ^bb5, ^bb6
|
||||
^bb5: // pred: ^bb4
|
||||
%7 = load %0[%5] : memref<64xi32>
|
||||
%8 = addi %7, %7 : i32
|
||||
store %8, %1[%5] : memref<64xi32>
|
||||
%9 = addi %5, %c1 : index
|
||||
br ^bb4(%9 : index)
|
||||
^bb6: // pred: ^bb4
|
||||
%10 = load %1[%c0] : memref<64xi32>
|
||||
return %10 : i32
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
// RUN: handshake-runner %s | FileCheck %s
|
||||
// RUN: circt-opt -create-dataflow %s | handshake-runner | FileCheck %s
|
||||
// CHECK: 10
|
||||
|
||||
module {
|
||||
func @main() -> i32 {
|
||||
%c0 = constant 0 : index
|
||||
%c1 = constant 1 : index
|
||||
%c3 = constant 3 : index
|
||||
%c4 = constant 4 : index
|
||||
%c5_i32 = constant 5 : i32
|
||||
%0 = alloc() : memref<64xi32>
|
||||
%1 = alloc() : memref<64xi32>
|
||||
br ^bb1(%c0 : index)
|
||||
^bb1(%2: index): // 2 preds: ^bb0, ^bb2
|
||||
%3 = cmpi "slt", %2, %c4 : index
|
||||
cond_br %3, ^bb2, ^bb3
|
||||
^bb2: // pred: ^bb1
|
||||
store %c5_i32, %0[%2] : memref<64xi32>
|
||||
%4 = addi %2, %c1 : index
|
||||
br ^bb1(%4 : index)
|
||||
^bb3: // pred: ^bb1
|
||||
br ^bb4(%c0 : index)
|
||||
^bb4(%5: index): // 2 preds: ^bb3, ^bb5
|
||||
%6 = cmpi "slt", %5, %c4 : index
|
||||
cond_br %6, ^bb5, ^bb6
|
||||
^bb5: // pred: ^bb4
|
||||
%7 = load %0[%5] : memref<64xi32>
|
||||
%8 = addi %7, %7 : i32
|
||||
store %8, %1[%5] : memref<64xi32>
|
||||
%9 = addi %5, %c1 : index
|
||||
br ^bb4(%9 : index)
|
||||
^bb6: // pred: ^bb4
|
||||
%10 = load %1[%c3] : memref<64xi32>
|
||||
return %10 : i32
|
||||
}
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
// RUN: handshake-runner %s | FileCheck %s
|
||||
// RUN: circt-opt -create-dataflow %s | handshake-runner | FileCheck %s
|
||||
// CHECK: 200
|
||||
|
||||
|
||||
|
||||
module {
|
||||
func @main() -> i32 {
|
||||
%c0 = constant 0 : index
|
||||
%c1 = constant 1 : index
|
||||
%c8 = constant 8 : index
|
||||
%c63 = constant 63 : index
|
||||
%c64 = constant 64 : index
|
||||
%c0_i32 = constant 0 : i32
|
||||
%c5_i32 = constant 5 : i32
|
||||
%0 = alloc() : memref<64xi32>
|
||||
%1 = alloc() : memref<64xi32>
|
||||
%2 = alloc() : memref<64xi32>
|
||||
%3 = alloc() : memref<1xi32>
|
||||
br ^bb1(%c0 : index)
|
||||
^bb1(%4: index): // 2 preds: ^bb0, ^bb2
|
||||
%5 = cmpi "slt", %4, %c64 : index
|
||||
cond_br %5, ^bb2, ^bb3
|
||||
^bb2: // pred: ^bb1
|
||||
store %c5_i32, %0[%4] : memref<64xi32>
|
||||
store %c5_i32, %1[%4] : memref<64xi32>
|
||||
%6 = addi %4, %c1 : index
|
||||
br ^bb1(%6 : index)
|
||||
^bb3: // pred: ^bb1
|
||||
br ^bb4(%c0 : index)
|
||||
^bb4(%7: index): // 2 preds: ^bb3, ^bb11
|
||||
%8 = cmpi "slt", %7, %c8 : index
|
||||
cond_br %8, ^bb5, ^bb12
|
||||
^bb5: // pred: ^bb4
|
||||
br ^bb6(%c0 : index)
|
||||
^bb6(%9: index): // 2 preds: ^bb5, ^bb10
|
||||
%10 = cmpi "slt", %9, %c8 : index
|
||||
cond_br %10, ^bb7, ^bb11
|
||||
^bb7: // pred: ^bb6
|
||||
store %c0_i32, %3[%c0] : memref<1xi32>
|
||||
%11 = muli %7, %c8 : index
|
||||
br ^bb8(%c0 : index)
|
||||
^bb8(%12: index): // 2 preds: ^bb7, ^bb9
|
||||
%13 = cmpi "slt", %12, %c8 : index
|
||||
cond_br %13, ^bb9, ^bb10
|
||||
^bb9: // pred: ^bb8
|
||||
%14 = addi %11, %12 : index
|
||||
%15 = load %0[%14] : memref<64xi32>
|
||||
%16 = muli %12, %c8 : index
|
||||
%17 = addi %16, %9 : index
|
||||
%18 = load %1[%17] : memref<64xi32>
|
||||
%19 = load %3[%c0] : memref<1xi32>
|
||||
%20 = muli %15, %18 : i32
|
||||
%21 = addi %19, %20 : i32
|
||||
store %21, %3[%c0] : memref<1xi32>
|
||||
%22 = addi %12, %c1 : index
|
||||
br ^bb8(%22 : index)
|
||||
^bb10: // pred: ^bb8
|
||||
%23 = addi %11, %9 : index
|
||||
%24 = load %3[%c0] : memref<1xi32>
|
||||
store %24, %2[%23] : memref<64xi32>
|
||||
%25 = addi %9, %c1 : index
|
||||
br ^bb6(%25 : index)
|
||||
^bb11: // pred: ^bb6
|
||||
%26 = addi %7, %c1 : index
|
||||
br ^bb4(%26 : index)
|
||||
^bb12: // pred: ^bb4
|
||||
%27 = load %2[%c63] : memref<64xi32>
|
||||
return %27 : i32
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
// RUN: handshake-runner %s | FileCheck %s
|
||||
// RUN: circt-opt -create-dataflow %s | handshake-runner | FileCheck %s
|
||||
// CHECK: 0
|
||||
|
||||
module {
|
||||
func @main() -> index {
|
||||
%c0 = constant 0 : index
|
||||
%c1 = constant 1 : index
|
||||
%c4 = constant 4 : index
|
||||
%c0_i32 = constant 0 : i32
|
||||
%0 = alloc() : memref<256xi32>
|
||||
%1 = alloc() : memref<256xi32>
|
||||
%2 = alloc() : memref<256xi32>
|
||||
%3 = alloc() : memref<1xi32>
|
||||
br ^bb1(%c0 : index)
|
||||
^bb1(%4: index): // 2 preds: ^bb0, ^bb8
|
||||
%5 = cmpi "slt", %4, %c4 : index
|
||||
cond_br %5, ^bb2, ^bb9
|
||||
^bb2: // pred: ^bb1
|
||||
br ^bb3(%c0 : index)
|
||||
^bb3(%6: index): // 2 preds: ^bb2, ^bb7
|
||||
%7 = cmpi "slt", %6, %c4 : index
|
||||
cond_br %7, ^bb4, ^bb8
|
||||
^bb4: // pred: ^bb3
|
||||
store %c0_i32, %3[%c0] : memref<1xi32>
|
||||
%8 = muli %4, %c4 : index
|
||||
br ^bb5(%c0 : index)
|
||||
^bb5(%9: index): // 2 preds: ^bb4, ^bb6
|
||||
%10 = cmpi "slt", %9, %c4 : index
|
||||
cond_br %10, ^bb6, ^bb7
|
||||
^bb6: // pred: ^bb5
|
||||
%11 = muli %9, %c4 : index
|
||||
%12 = addi %8, %9 : index
|
||||
%13 = addi %11, %6 : index
|
||||
%14 = load %0[%12] : memref<256xi32>
|
||||
%15 = load %1[%13] : memref<256xi32>
|
||||
%16 = load %3[%c0] : memref<1xi32>
|
||||
%17 = muli %14, %15 : i32
|
||||
%18 = addi %16, %17 : i32
|
||||
store %18, %3[%c0] : memref<1xi32>
|
||||
%19 = addi %9, %c1 : index
|
||||
br ^bb5(%19 : index)
|
||||
^bb7: // pred: ^bb5
|
||||
%20 = addi %8, %6 : index
|
||||
%21 = load %3[%c0] : memref<1xi32>
|
||||
store %21, %2[%20] : memref<256xi32>
|
||||
%22 = addi %6, %c1 : index
|
||||
br ^bb3(%22 : index)
|
||||
^bb8: // pred: ^bb3
|
||||
%23 = addi %4, %c1 : index
|
||||
br ^bb1(%23 : index)
|
||||
^bb9: // pred: ^bb1
|
||||
return %c0 : index
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
// RUN: handshake-runner %s 2,3,4,5 | FileCheck %s
|
||||
// BROKEN: circt-opt -create-dataflow %s | handshake-runner - 2,3,4,5 | FileCheck %s
|
||||
// CHECK: 5 5,3,4,5
|
||||
|
||||
module {
|
||||
func @main(%0: memref<4xi32>) -> i32{
|
||||
%c0 = constant 0 : index
|
||||
%c5 = constant 5 : i32
|
||||
store %c5, %0[%c0] : memref<4xi32>
|
||||
return %c5 : i32
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
// RUN: handshake-runner %s 2,3,4,5 | FileCheck %s
|
||||
// BROKEN: circt-opt -create-dataflow %s | handshake-runner - 2,3,4,5 | FileCheck %s
|
||||
// CHECK: 2 2,3,4,5
|
||||
|
||||
module {
|
||||
func @main(%0 : memref<4xi32>) -> i32{
|
||||
%c0 = constant 0 : index
|
||||
%1 = load %0[%c0] : memref<4xi32>
|
||||
return %1 : i32
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
// RUN: mlir-opt --convert-std-to-llvm %s | mlir-cpu-runner --entry-point-result=i64 | FileCheck %s
|
||||
// RUN: circt-opt -create-dataflow %s | handshake-runner | FileCheck %s
|
||||
// RUN: handshake-runner %s | FileCheck %s
|
||||
// CHECK: 42
|
||||
module {
|
||||
func @main() -> index {
|
||||
%c1 = constant 1 : index
|
||||
%c42 = constant 42 : index
|
||||
%c1_0 = constant 1 : index
|
||||
br ^bb1(%c1 : index)
|
||||
^bb1(%0: index): // 2 preds: ^bb0, ^bb2
|
||||
%1 = cmpi "slt", %0, %c42 : index
|
||||
cond_br %1, ^bb2, ^bb3
|
||||
^bb2: // pred: ^bb1
|
||||
// call @body(%0) : (index) -> ()
|
||||
%2 = addi %0, %c1_0 : index
|
||||
br ^bb1(%2 : index)
|
||||
^bb3: // pred: ^bb1
|
||||
return %0 : index
|
||||
}
|
||||
}
|
|
@ -54,6 +54,7 @@ llvm_config.with_environment('PATH', config.llvm_tools_dir, append_path=True)
|
|||
tool_dirs = [config.circt_tools_dir, config.mlir_tools_dir, config.llvm_tools_dir]
|
||||
tools = [
|
||||
'firtool',
|
||||
'handshake-runner',
|
||||
'circt-opt',
|
||||
'circt-translate',
|
||||
]
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
|
||||
add_subdirectory(circt-opt)
|
||||
add_subdirectory(circt-translate)
|
||||
add_subdirectory(handshake-runner)
|
||||
add_subdirectory(firtool)
|
||||
|
|
|
@ -6,9 +6,12 @@ add_llvm_tool(circt-opt
|
|||
circt-opt.cpp
|
||||
)
|
||||
llvm_update_compile_flags(circt-opt)
|
||||
target_link_libraries(circt-opt PRIVATE
|
||||
target_link_libraries(circt-opt
|
||||
PRIVATE
|
||||
MLIRFIRRTL
|
||||
MLIRHandshakeOps
|
||||
MLIRRTL
|
||||
MLIRStandardToHandshake
|
||||
|
||||
MLIRParser
|
||||
MLIRSupport
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
//===- circt-opt.cpp - The circt-opt driver
|
||||
//---------------------------------===//
|
||||
//===- circt-opt.cpp - The circt-opt driver -------------------------------===//
|
||||
//
|
||||
// This file implements the 'circt-opt' tool, which is the circt analog of
|
||||
// mlir-opt, used to drive compiler passes, e.g. for testing.
|
||||
|
@ -8,6 +7,8 @@
|
|||
|
||||
#include "circt/Dialect/FIRRTL/Dialect.h"
|
||||
#include "circt/Dialect/RTL/Dialect.h"
|
||||
#include "circt/Dialect/Handshake/HandshakeOps.h"
|
||||
#include "circt/Conversion/StandardToHandshake/StandardToHandshake.h"
|
||||
#include "mlir/Dialect/StandardOps/IR/Ops.h"
|
||||
#include "mlir/Pass/Pass.h"
|
||||
#include "mlir/Pass/PassManager.h"
|
||||
|
@ -75,6 +76,9 @@ int main(int argc, char **argv) {
|
|||
registerDialect<firrtl::FIRRTLDialect>();
|
||||
firrtl::registerFIRRTLPasses();
|
||||
|
||||
registerDialect<handshake::HandshakeOpsDialect>();
|
||||
handshake::registerStandardToHandshakePasses();
|
||||
|
||||
registerDialect<rtl::RTLDialect>();
|
||||
|
||||
PassPipelineCLParser passPipeline("", "Compiler passes to run");
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
|
||||
get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS)
|
||||
|
||||
add_llvm_executable(handshake-runner handshake-runner.cpp)
|
||||
|
||||
llvm_update_compile_flags(handshake-runner)
|
||||
target_link_libraries(handshake-runner PRIVATE
|
||||
${dialect_libs}
|
||||
${conversion_libs}
|
||||
MLIRHandshakeOps
|
||||
MLIRStandardToHandshake
|
||||
)
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue