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-exception
6//
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(RISCVII::LMUL_1,
18 RISCVVType::getSameRatioLMUL(16, RISCVII::LMUL_2, 8));
19 EXPECT_EQ(RISCVII::LMUL_F2,
20 RISCVVType::getSameRatioLMUL(16, RISCVII::LMUL_1, 8));
21 // Smaller fractional LMUL.
22 EXPECT_EQ(RISCVII::LMUL_F8,
23 RISCVVType::getSameRatioLMUL(16, RISCVII::LMUL_F4, 8));
24 // Bigger LMUL.
25 EXPECT_EQ(RISCVII::LMUL_2,
26 RISCVVType::getSameRatioLMUL(8, RISCVII::LMUL_1, 16));
27 EXPECT_EQ(RISCVII::LMUL_1,
28 RISCVVType::getSameRatioLMUL(8, RISCVII::LMUL_F2, 16));
29 // Bigger fractional LMUL.
30 EXPECT_EQ(RISCVII::LMUL_F2,
31 RISCVVType::getSameRatioLMUL(8, RISCVII::LMUL_F4, 16));
32}
33} // namespace
34

source code of llvm/unittests/TargetParser/RISCVTargetParserTest.cpp