llvm/clang/lib/Support/RISCVVIntrinsicUtils.cpp

//===- RISCVVIntrinsicUtils.cpp - RISC-V Vector Intrinsic Utils -*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "clang/Support/RISCVVIntrinsicUtils.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include <numeric>
#include <optional>

usingnamespacellvm;

namespace clang {
namespace RISCV {

const PrototypeDescriptor PrototypeDescriptor::Mask =;
const PrototypeDescriptor PrototypeDescriptor::VL =;
const PrototypeDescriptor PrototypeDescriptor::Vector =;

//===----------------------------------------------------------------------===//
// Type implementation
//===----------------------------------------------------------------------===//

LMULType::LMULType(int NewLog2LMUL) {}

std::string LMULType::str() const {}

VScaleVal LMULType::getScale(unsigned ElementBitwidth) const {}

void LMULType::MulLog2LMUL(int log2LMUL) {}

RVVType::RVVType(BasicType BT, int Log2LMUL,
                 const PrototypeDescriptor &prototype)
    :{}

// clang-format off
// boolean type are encoded the ratio of n (SEW/LMUL)
// SEW/LMUL | 1         | 2         | 4         | 8        | 16        | 32        | 64
// c type   | vbool64_t | vbool32_t | vbool16_t | vbool8_t | vbool4_t  | vbool2_t  | vbool1_t
// IR type  | nxv1i1    | nxv2i1    | nxv4i1    | nxv8i1   | nxv16i1   | nxv32i1   | nxv64i1

// type\lmul | 1/8    | 1/4      | 1/2     | 1       | 2        | 4        | 8
// --------  |------  | -------- | ------- | ------- | -------- | -------- | --------
// i64       | N/A    | N/A      | N/A     | nxv1i64 | nxv2i64  | nxv4i64  | nxv8i64
// i32       | N/A    | N/A      | nxv1i32 | nxv2i32 | nxv4i32  | nxv8i32  | nxv16i32
// i16       | N/A    | nxv1i16  | nxv2i16 | nxv4i16 | nxv8i16  | nxv16i16 | nxv32i16
// i8        | nxv1i8 | nxv2i8   | nxv4i8  | nxv8i8  | nxv16i8  | nxv32i8  | nxv64i8
// double    | N/A    | N/A      | N/A     | nxv1f64 | nxv2f64  | nxv4f64  | nxv8f64
// float     | N/A    | N/A      | nxv1f32 | nxv2f32 | nxv4f32  | nxv8f32  | nxv16f32
// half      | N/A    | nxv1f16  | nxv2f16 | nxv4f16 | nxv8f16  | nxv16f16 | nxv32f16
// bfloat16  | N/A    | nxv1bf16 | nxv2bf16| nxv4bf16| nxv8bf16 | nxv16bf16| nxv32bf16
// clang-format on

bool RVVType::verifyType() const {}

void RVVType::initBuiltinStr() {}

void RVVType::initClangBuiltinStr() {}

void RVVType::initTypeStr() {}

void RVVType::initShortStr() {}

static VectorTypeModifier getTupleVTM(unsigned NF) {}

void RVVType::applyBasicType() {}

std::optional<PrototypeDescriptor>
PrototypeDescriptor::parsePrototypeDescriptor(
    llvm::StringRef PrototypeDescriptorStr) {}

void RVVType::applyModifier(const PrototypeDescriptor &Transformer) {}

void RVVType::applyLog2EEW(unsigned Log2EEW) {}

void RVVType::applyFixedSEW(unsigned NewSEW) {}

void RVVType::applyFixedLog2LMUL(int Log2LMUL, enum FixedLMULType Type) {}

std::optional<RVVTypes>
RVVTypeCache::computeTypes(BasicType BT, int Log2LMUL, unsigned NF,
                           ArrayRef<PrototypeDescriptor> Prototype) {}

// Compute the hash value of RVVType, used for cache the result of computeType.
static uint64_t computeRVVTypeHashValue(BasicType BT, int Log2LMUL,
                                        PrototypeDescriptor Proto) {}

std::optional<RVVTypePtr> RVVTypeCache::computeType(BasicType BT, int Log2LMUL,
                                                    PrototypeDescriptor Proto) {}

//===----------------------------------------------------------------------===//
// RVVIntrinsic implementation
//===----------------------------------------------------------------------===//
RVVIntrinsic::RVVIntrinsic(
    StringRef NewName, StringRef Suffix, StringRef NewOverloadedName,
    StringRef OverloadedSuffix, StringRef IRName, bool IsMasked,
    bool HasMaskedOffOperand, bool HasVL, PolicyScheme Scheme,
    bool SupportOverloading, bool HasBuiltinAlias, StringRef ManualCodegen,
    const RVVTypes &OutInTypes, const std::vector<int64_t> &NewIntrinsicTypes,
    unsigned NF, Policy NewPolicyAttrs, bool HasFRMRoundModeOp)
    :{}

std::string RVVIntrinsic::getBuiltinTypeStr() const {}

std::string RVVIntrinsic::getSuffixStr(
    RVVTypeCache &TypeCache, BasicType Type, int Log2LMUL,
    llvm::ArrayRef<PrototypeDescriptor> PrototypeDescriptors) {}

llvm::SmallVector<PrototypeDescriptor> RVVIntrinsic::computeBuiltinTypes(
    llvm::ArrayRef<PrototypeDescriptor> Prototype, bool IsMasked,
    bool HasMaskedOffOperand, bool HasVL, unsigned NF,
    PolicyScheme DefaultScheme, Policy PolicyAttrs, bool IsTuple) {}

llvm::SmallVector<Policy> RVVIntrinsic::getSupportedUnMaskedPolicies() {}

llvm::SmallVector<Policy>
RVVIntrinsic::getSupportedMaskedPolicies(bool HasTailPolicy,
                                         bool HasMaskPolicy) {}

void RVVIntrinsic::updateNamesAndPolicy(
    bool IsMasked, bool HasPolicy, std::string &Name, std::string &BuiltinName,
    std::string &OverloadedName, Policy &PolicyAttrs, bool HasFRMRoundModeOp) {}

SmallVector<PrototypeDescriptor> parsePrototypes(StringRef Prototypes) {}

raw_ostream &operator<<(raw_ostream &OS, const RVVIntrinsicRecord &Record) {}

} // end namespace RISCV
} // end namespace clang