1 //===---- RISCVTargetParserTest.cpp - RISCVTargetParser 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 "llvm/TargetParser/RISCVTargetParser.h"
10 #include "gtest/gtest.h"
15 TEST(RISCVVType
, CheckSameRatioLMUL
) {
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));
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));