1 //===- RISCVBaseInfoTest.cpp - RISCVBaseInfo unit tests ----------===//
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
7 //===----------------------------------------------------------------------===//
9 #include "MCTargetDesc/RISCVBaseInfo.h"
11 #include "gtest/gtest.h"
16 TEST(RISCVBaseInfo
, CheckSameRatioLMUL
) {
18 EXPECT_EQ(RISCVII::LMUL_1
,
19 RISCVVType::getSameRatioLMUL(16, RISCVII::LMUL_2
, 8));
20 EXPECT_EQ(RISCVII::LMUL_F2
,
21 RISCVVType::getSameRatioLMUL(16, RISCVII::LMUL_1
, 8));
22 // Smaller fractional LMUL.
23 EXPECT_EQ(RISCVII::LMUL_F8
,
24 RISCVVType::getSameRatioLMUL(16, RISCVII::LMUL_F4
, 8));
26 EXPECT_EQ(RISCVII::LMUL_2
,
27 RISCVVType::getSameRatioLMUL(8, RISCVII::LMUL_1
, 16));
28 EXPECT_EQ(RISCVII::LMUL_1
,
29 RISCVVType::getSameRatioLMUL(8, RISCVII::LMUL_F2
, 16));
30 // Bigger fractional LMUL.
31 EXPECT_EQ(RISCVII::LMUL_F2
,
32 RISCVVType::getSameRatioLMUL(8, RISCVII::LMUL_F4
, 16));