brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · 63ac8f9 Raw
34 lines · cpp
1//===---- RISCVTargetParserTest.cpp - RISCVTargetParser unit tests --------===//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#include "llvm/TargetParser/RISCVTargetParser.h"10#include "gtest/gtest.h"11 12using namespace llvm;13 14namespace {15TEST(RISCVVType, CheckSameRatioLMUL) {16  // Smaller LMUL.17  EXPECT_EQ(RISCVVType::LMUL_1,18            RISCVVType::getSameRatioLMUL(16, RISCVVType::LMUL_2, 8));19  EXPECT_EQ(RISCVVType::LMUL_F2,20            RISCVVType::getSameRatioLMUL(16, RISCVVType::LMUL_1, 8));21  // Smaller fractional LMUL.22  EXPECT_EQ(RISCVVType::LMUL_F8,23            RISCVVType::getSameRatioLMUL(16, RISCVVType::LMUL_F4, 8));24  // Bigger LMUL.25  EXPECT_EQ(RISCVVType::LMUL_2,26            RISCVVType::getSameRatioLMUL(8, RISCVVType::LMUL_1, 16));27  EXPECT_EQ(RISCVVType::LMUL_1,28            RISCVVType::getSameRatioLMUL(8, RISCVVType::LMUL_F2, 16));29  // Bigger fractional LMUL.30  EXPECT_EQ(RISCVVType::LMUL_F2,31            RISCVVType::getSameRatioLMUL(8, RISCVVType::LMUL_F4, 16));32}33} // namespace34