62 lines · cpp
1//===----------------------------------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8//9// This file implements functions associated with NVVM Intrinsics.10//11//===----------------------------------------------------------------------===//12 13#include "llvm/IR/NVVMIntrinsicUtils.h"14 15using namespace llvm;16using namespace nvvm;17 18void nvvm::printTcgen05MMAKind(raw_ostream &OS, const Constant *ImmArgVal) {19 if (const auto *CI = dyn_cast<ConstantInt>(ImmArgVal)) {20 uint64_t Val = CI->getZExtValue();21 switch (static_cast<Tcgen05MMAKind>(Val)) {22 case Tcgen05MMAKind::F16:23 OS << "f16";24 return;25 case Tcgen05MMAKind::TF32:26 OS << "tf32";27 return;28 case Tcgen05MMAKind::F8F6F4:29 OS << "f8f6f4";30 return;31 case Tcgen05MMAKind::I8:32 OS << "i8";33 return;34 }35 }36 llvm_unreachable(37 "printTcgen05MMAKind called with invalid value for immediate argument");38}39 40void nvvm::printTcgen05CollectorUsageOp(raw_ostream &OS,41 const Constant *ImmArgVal) {42 if (const auto *CI = dyn_cast<ConstantInt>(ImmArgVal)) {43 uint64_t Val = CI->getZExtValue();44 switch (static_cast<Tcgen05CollectorUsageOp>(Val)) {45 case Tcgen05CollectorUsageOp::DISCARD:46 OS << "discard";47 return;48 case Tcgen05CollectorUsageOp::LASTUSE:49 OS << "lastuse";50 return;51 case Tcgen05CollectorUsageOp::FILL:52 OS << "fill";53 return;54 case Tcgen05CollectorUsageOp::USE:55 OS << "use";56 return;57 }58 }59 llvm_unreachable("printTcgen05CollectorUsageOp called with invalid value for "60 "immediate argument");61}62