|
48 | 48 | #include "mlir/Dialect/Complex/IR/Complex.h" |
49 | 49 | #include "mlir/Dialect/LLVMIR/LLVMDialect.h" |
50 | 50 | #include "mlir/Dialect/LLVMIR/LLVMTypes.h" |
| 51 | +#include "mlir/Dialect/LLVMIR/NVVMDialect.h" |
51 | 52 | #include "mlir/Dialect/Math/IR/Math.h" |
52 | 53 | #include "mlir/Dialect/Vector/IR/VectorOps.h" |
53 | 54 | #include "llvm/Support/CommandLine.h" |
@@ -6552,23 +6553,15 @@ IntrinsicLibrary::genMatchAnySync(mlir::Type resultType, |
6552 | 6553 | assert(args.size() == 2); |
6553 | 6554 | bool is32 = args[1].getType().isInteger(32) || args[1].getType().isF32(); |
6554 | 6555 |
|
6555 | | - llvm::StringRef funcName = |
6556 | | - is32 ? "llvm.nvvm.match.any.sync.i32p" : "llvm.nvvm.match.any.sync.i64p"; |
6557 | | - mlir::MLIRContext *context = builder.getContext(); |
6558 | | - mlir::Type i32Ty = builder.getI32Type(); |
6559 | | - mlir::Type i64Ty = builder.getI64Type(); |
6560 | | - mlir::Type valTy = is32 ? i32Ty : i64Ty; |
| 6556 | + mlir::Value arg1 = args[1]; |
| 6557 | + if (arg1.getType().isF32() || arg1.getType().isF64()) |
| 6558 | + arg1 = builder.create<fir::ConvertOp>( |
| 6559 | + loc, is32 ? builder.getI32Type() : builder.getI64Type(), arg1); |
6561 | 6560 |
|
6562 | | - mlir::FunctionType ftype = |
6563 | | - mlir::FunctionType::get(context, {i32Ty, valTy}, {i32Ty}); |
6564 | | - auto funcOp = builder.createFunction(loc, funcName, ftype); |
6565 | | - llvm::SmallVector<mlir::Value> filteredArgs; |
6566 | | - filteredArgs.push_back(args[0]); |
6567 | | - if (args[1].getType().isF32() || args[1].getType().isF64()) |
6568 | | - filteredArgs.push_back(builder.create<fir::ConvertOp>(loc, valTy, args[1])); |
6569 | | - else |
6570 | | - filteredArgs.push_back(args[1]); |
6571 | | - return builder.create<fir::CallOp>(loc, funcOp, filteredArgs).getResult(0); |
| 6561 | + return builder |
| 6562 | + .create<mlir::NVVM::MatchSyncOp>(loc, resultType, args[0], arg1, |
| 6563 | + mlir::NVVM::MatchSyncKind::any) |
| 6564 | + .getResult(); |
6572 | 6565 | } |
6573 | 6566 |
|
6574 | 6567 | // MATMUL |
|
0 commit comments