aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/unittests')
-rw-r--r--llvm/unittests/ADT/TypeSwitchTest.cpp41
-rw-r--r--llvm/unittests/CodeGen/InstrRefLDVTest.cpp2
-rw-r--r--llvm/unittests/CodeGen/SelectionDAGPatternMatchTest.cpp70
-rw-r--r--llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp82
-rw-r--r--llvm/unittests/Object/ELFObjectFileTest.cpp89
-rw-r--r--llvm/unittests/Object/ELFTypesTest.cpp38
6 files changed, 261 insertions, 61 deletions
diff --git a/llvm/unittests/ADT/TypeSwitchTest.cpp b/llvm/unittests/ADT/TypeSwitchTest.cpp
index a7d9342..b801228 100644
--- a/llvm/unittests/ADT/TypeSwitchTest.cpp
+++ b/llvm/unittests/ADT/TypeSwitchTest.cpp
@@ -142,3 +142,44 @@ TEST(TypeSwitchTest, DefaultUnreachableWithVoid) {
EXPECT_DEATH((void)translate(DerivedD()), "Unhandled type");
#endif
}
+
+TEST(TypeSwitchTest, DefaultNullopt) {
+ auto translate = [](auto value) {
+ return TypeSwitch<Base *, std::optional<int>>(&value)
+ .Case([](DerivedA *) { return 0; })
+ .Default(std::nullopt);
+ };
+ EXPECT_EQ(0, translate(DerivedA()));
+ EXPECT_EQ(std::nullopt, translate(DerivedD()));
+}
+
+TEST(TypeSwitchTest, DefaultNullptr) {
+ float foo = 0.0f;
+ auto translate = [&](auto value) {
+ return TypeSwitch<Base *, float *>(&value)
+ .Case([&](DerivedA *) { return &foo; })
+ .Default(nullptr);
+ };
+ EXPECT_EQ(&foo, translate(DerivedA()));
+ EXPECT_EQ(nullptr, translate(DerivedD()));
+}
+
+TEST(TypeSwitchTest, DefaultNullptrForPointerLike) {
+ struct Value {
+ void *ptr;
+ Value(const Value &other) : ptr(other.ptr) {}
+ Value(std::nullptr_t) : ptr(nullptr) {}
+ Value() : Value(nullptr) {}
+ };
+
+ float foo = 0.0f;
+ Value fooVal;
+ fooVal.ptr = &foo;
+ auto translate = [&](auto value) {
+ return TypeSwitch<Base *, Value>(&value)
+ .Case([&](DerivedA *) { return fooVal; })
+ .Default(nullptr);
+ };
+ EXPECT_EQ(&foo, translate(DerivedA()).ptr);
+ EXPECT_EQ(nullptr, translate(DerivedD()).ptr);
+}
diff --git a/llvm/unittests/CodeGen/InstrRefLDVTest.cpp b/llvm/unittests/CodeGen/InstrRefLDVTest.cpp
index ff87e7b..235a53d 100644
--- a/llvm/unittests/CodeGen/InstrRefLDVTest.cpp
+++ b/llvm/unittests/CodeGen/InstrRefLDVTest.cpp
@@ -1113,7 +1113,7 @@ TEST_F(InstrRefLDVTest, MLocDiamondSpills) {
// Create a stack location and ensure it's tracked.
SpillLoc SL = {getRegByName("RSP"), StackOffset::getFixed(-8)};
SpillLocationNo SpillNo = *MTracker->getOrTrackSpillLoc(SL);
- ASSERT_EQ(MTracker->getNumLocs(), 13u); // Tracks all possible stack locs.
+ ASSERT_EQ(MTracker->getNumLocs(), 11u); // Tracks all possible stack locs.
// Locations are: RSP, stack slots from 2^3 bits wide up to 2^9 for zmm regs,
// then slots for sub_8bit_hi and sub_16bit_hi ({8, 8} and {16, 16}).
// Finally, one for spilt fp80 registers.
diff --git a/llvm/unittests/CodeGen/SelectionDAGPatternMatchTest.cpp b/llvm/unittests/CodeGen/SelectionDAGPatternMatchTest.cpp
index aa56aaf..ceaee52 100644
--- a/llvm/unittests/CodeGen/SelectionDAGPatternMatchTest.cpp
+++ b/llvm/unittests/CodeGen/SelectionDAGPatternMatchTest.cpp
@@ -354,6 +354,76 @@ TEST_F(SelectionDAGPatternMatchTest, matchBinaryOp) {
sd_match(InsertELT, m_InsertElt(m_Value(), m_Value(), m_SpecificInt(1))));
}
+TEST_F(SelectionDAGPatternMatchTest, matchGenericTernaryOp) {
+ SDLoc DL;
+ auto Float32VT = EVT::getFloatingPointVT(32);
+
+ SDValue Op0 = DAG->getCopyFromReg(DAG->getEntryNode(), DL, 1, Float32VT);
+ SDValue Op1 = DAG->getCopyFromReg(DAG->getEntryNode(), DL, 2, Float32VT);
+ SDValue Op2 = DAG->getCopyFromReg(DAG->getEntryNode(), DL, 3, Float32VT);
+
+ SDValue FMA = DAG->getNode(ISD::FMA, DL, Float32VT, Op0, Op1, Op2);
+ SDValue FAdd = DAG->getNode(ISD::FADD, DL, Float32VT, Op0, Op1);
+
+ using namespace SDPatternMatch;
+ SDValue A, B, C;
+
+ EXPECT_TRUE(sd_match(FMA, m_TernaryOp(ISD::FMA, m_Specific(Op0),
+ m_Specific(Op1), m_Specific(Op2))));
+ EXPECT_FALSE(sd_match(FMA, m_TernaryOp(ISD::FADD, m_Specific(Op0),
+ m_Specific(Op1), m_Specific(Op2))));
+ EXPECT_FALSE(
+ sd_match(FAdd, m_TernaryOp(ISD::FMA, m_Value(), m_Value(), m_Value())));
+ EXPECT_FALSE(sd_match(FMA, m_TernaryOp(ISD::FMA, m_Specific(Op1),
+ m_Specific(Op0), m_Specific(Op2))));
+
+ EXPECT_TRUE(
+ sd_match(FMA, m_TernaryOp(ISD::FMA, m_Value(A), m_Value(B), m_Value(C))));
+ EXPECT_EQ(A, Op0);
+ EXPECT_EQ(B, Op1);
+ EXPECT_EQ(C, Op2);
+
+ A = B = C = SDValue();
+
+ EXPECT_TRUE(sd_match(FMA, m_c_TernaryOp(ISD::FMA, m_Specific(Op0),
+ m_Specific(Op1), m_Specific(Op2))));
+ EXPECT_TRUE(sd_match(FMA, m_c_TernaryOp(ISD::FMA, m_Specific(Op1),
+ m_Specific(Op0), m_Specific(Op2))));
+
+ EXPECT_FALSE(sd_match(FMA, m_c_TernaryOp(ISD::FMA, m_Specific(Op2),
+ m_Specific(Op1), m_Specific(Op0))));
+ EXPECT_FALSE(sd_match(FMA, m_c_TernaryOp(ISD::FMA, m_Specific(Op2),
+ m_Specific(Op0), m_Specific(Op1))));
+
+ EXPECT_FALSE(sd_match(FMA, m_c_TernaryOp(ISD::FMA, m_Specific(Op0),
+ m_Specific(Op2), m_Specific(Op1))));
+ EXPECT_FALSE(sd_match(FMA, m_c_TernaryOp(ISD::FMA, m_Specific(Op1),
+ m_Specific(Op2), m_Specific(Op0))));
+
+ EXPECT_TRUE(sd_match(
+ FMA, m_c_TernaryOp(ISD::FMA, m_Value(A), m_Value(B), m_Value(C))));
+ EXPECT_EQ(A, Op0);
+ EXPECT_EQ(B, Op1);
+ EXPECT_EQ(C, Op2);
+
+ A = B = C = SDValue();
+ EXPECT_TRUE(sd_match(
+ FMA, m_c_TernaryOp(ISD::FMA, m_Value(B), m_Value(A), m_Value(C))));
+ EXPECT_EQ(A, Op1);
+ EXPECT_EQ(B, Op0);
+ EXPECT_EQ(C, Op2);
+
+ A = B = C = SDValue();
+ EXPECT_TRUE(sd_match(
+ FMA, m_c_TernaryOp(ISD::FMA, m_Value(A), m_Value(B), m_Value(C))));
+ EXPECT_EQ(A, Op0);
+ EXPECT_EQ(B, Op1);
+ EXPECT_EQ(C, Op2);
+
+ EXPECT_FALSE(
+ sd_match(FAdd, m_c_TernaryOp(ISD::FMA, m_Value(), m_Value(), m_Value())));
+}
+
TEST_F(SelectionDAGPatternMatchTest, matchUnaryOp) {
SDLoc DL;
auto Int32VT = EVT::getIntegerVT(Context, 32);
diff --git a/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp b/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
index e568723..0b3ae64 100644
--- a/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
+++ b/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
@@ -4534,6 +4534,85 @@ TEST_F(OpenMPIRBuilderTest, OMPAtomicCompareCapture) {
EXPECT_FALSE(verifyModule(*M, &errs()));
}
+TEST_F(OpenMPIRBuilderTest, OMPAtomicRWStructType) {
+ // Test for issue #165184: atomic read/write on struct types should use
+ // element type size, not pointer size.
+ OpenMPIRBuilder OMPBuilder(*M);
+ OMPBuilder.initialize();
+ F->setName("func");
+ IRBuilder<> Builder(BB);
+
+ OpenMPIRBuilder::LocationDescription Loc({Builder.saveIP(), DL});
+ BasicBlock *EntryBB = BB;
+ OpenMPIRBuilder::InsertPointTy AllocaIP(EntryBB,
+ EntryBB->getFirstInsertionPt());
+
+ LLVMContext &Ctx = M->getContext();
+
+ // Create a struct type {double, double} to simulate complex(8) - 16 bytes
+ StructType *Complex8Ty = StructType::create(
+ Ctx, {Type::getDoubleTy(Ctx), Type::getDoubleTy(Ctx)}, "complex");
+
+ AllocaInst *XVal = Builder.CreateAlloca(Complex8Ty);
+ XVal->setName("AtomicVar");
+ OpenMPIRBuilder::AtomicOpValue X = {XVal, Complex8Ty, false, false};
+ AtomicOrdering AO = AtomicOrdering::SequentiallyConsistent;
+
+ // Create value to write: {1.0, 1.0}
+ Constant *Real = ConstantFP::get(Type::getDoubleTy(Ctx), 1.0);
+ Constant *Imag = ConstantFP::get(Type::getDoubleTy(Ctx), 1.0);
+ Constant *ValToWrite = ConstantStruct::get(Complex8Ty, {Real, Imag});
+
+ // Test atomic write
+ Builder.restoreIP(
+ OMPBuilder.createAtomicWrite(Loc, X, ValToWrite, AO, AllocaIP));
+
+ // Test atomic read
+ AllocaInst *VVal = Builder.CreateAlloca(Complex8Ty);
+ VVal->setName("ReadDest");
+ OpenMPIRBuilder::AtomicOpValue V = {VVal, Complex8Ty, false, false};
+
+ Builder.restoreIP(OMPBuilder.createAtomicRead(Loc, X, V, AO, AllocaIP));
+
+ Builder.CreateRetVoid();
+ OMPBuilder.finalize();
+ EXPECT_FALSE(verifyModule(*M, &errs()));
+
+ // Verify that __atomic_store and __atomic_load are called with size 16
+ bool FoundAtomicStore = false;
+ bool FoundAtomicLoad = false;
+
+ for (Function &Fn : *M) {
+ if (Fn.getName().starts_with("__atomic_store")) {
+ // Check that first call to __atomic_store has size argument = 16
+ for (User *U : Fn.users()) {
+ if (auto *CB = dyn_cast<CallBase>(U)) {
+ if (auto *SizeArg = dyn_cast<ConstantInt>(CB->getArgOperand(0))) {
+ EXPECT_EQ(SizeArg->getZExtValue(), 16U);
+ FoundAtomicStore = true;
+ break;
+ }
+ }
+ }
+ }
+ if (Fn.getName().starts_with("__atomic_load")) {
+ // Check that first call to __atomic_load has size argument = 16
+ for (User *U : Fn.users()) {
+ if (auto *CB = dyn_cast<CallBase>(U)) {
+ if (auto *SizeArg = dyn_cast<ConstantInt>(CB->getArgOperand(0))) {
+ EXPECT_EQ(SizeArg->getZExtValue(), 16U);
+ FoundAtomicLoad = true;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ EXPECT_TRUE(FoundAtomicStore) << "Did not find __atomic_store call";
+ EXPECT_TRUE(FoundAtomicLoad) << "Did not find __atomic_load call";
+}
+
TEST_F(OpenMPIRBuilderTest, CreateTeams) {
using InsertPointTy = OpenMPIRBuilder::InsertPointTy;
OpenMPIRBuilder OMPBuilder(*M);
@@ -7576,8 +7655,7 @@ TEST_F(OpenMPIRBuilderTest, CreateTaskgroup) {
// Checking the general structure of the IR generated is same as expected.
Instruction *GeneratedStoreInst = TaskgroupCall->getNextNode();
EXPECT_EQ(GeneratedStoreInst, InternalStoreInst);
- Instruction *GeneratedLoad32 =
- GeneratedStoreInst->getNextNode();
+ Instruction *GeneratedLoad32 = GeneratedStoreInst->getNextNode();
EXPECT_EQ(GeneratedLoad32, InternalLoad32);
Instruction *GeneratedLoad128 = GeneratedLoad32->getNextNode();
EXPECT_EQ(GeneratedLoad128, InternalLoad128);
diff --git a/llvm/unittests/Object/ELFObjectFileTest.cpp b/llvm/unittests/Object/ELFObjectFileTest.cpp
index d6a3ca5..1e2955a 100644
--- a/llvm/unittests/Object/ELFObjectFileTest.cpp
+++ b/llvm/unittests/Object/ELFObjectFileTest.cpp
@@ -531,7 +531,7 @@ Sections:
// Check that we can detect unsupported versions.
SmallString<128> UnsupportedVersionYamlString(CommonYamlString);
UnsupportedVersionYamlString += R"(
- - Version: 5
+ - Version: 6
BBRanges:
- BaseAddress: 0x11111
BBEntries:
@@ -543,7 +543,7 @@ Sections:
{
SCOPED_TRACE("unsupported version");
DoCheck(UnsupportedVersionYamlString,
- "unsupported SHT_LLVM_BB_ADDR_MAP version: 5");
+ "unsupported SHT_LLVM_BB_ADDR_MAP version: 6");
}
SmallString<128> ZeroBBRangesYamlString(CommonYamlString);
@@ -1181,8 +1181,8 @@ Sections:
Type: SHT_LLVM_BB_ADDR_MAP
# Link: 0 (by default, can be overriden)
Entries:
- - Version: 2
- Feature: 0x7
+ - Version: 5
+ Feature: 0x87
BBRanges:
- BaseAddress: 0x44444
BBEntries:
@@ -1205,7 +1205,8 @@ Sections:
PGOAnalyses:
- FuncEntryCount: 1000
PGOBBEntries:
- - BBFreq: 1000
+ - BBFreq: 1000
+ PostLinkBBFreq: 50
Successors:
- ID: 1
BrProb: 0x22222222
@@ -1243,8 +1244,8 @@ Sections:
Type: SHT_LLVM_BB_ADDR_MAP
# Link: 0 (by default, can be overriden)
Entries:
- - Version: 2
- Feature: 0xc
+ - Version: 5
+ Feature: 0x8c
BBRanges:
- BaseAddress: 0x66666
BBEntries:
@@ -1265,8 +1266,9 @@ Sections:
PGOAnalyses:
- PGOBBEntries:
- Successors:
- - ID: 1
- BrProb: 0x22222222
+ - ID: 1
+ BrProb: 0x22222222
+ PostLinkBrFreq: 7
- ID: 2
BrProb: 0xcccccccc
- Successors:
@@ -1278,59 +1280,66 @@ Sections:
BBAddrMap E1 = {
{{0x11111, {{1, 0x0, 0x1, {false, true, false, false, false}, {}, 0}}}}};
PGOAnalysisMap P1 = {
- 892, {}, {true, false, false, false, false, false, false}};
+ 892, {}, {true, false, false, false, false, false, false, false}};
BBAddrMap E2 = {
{{0x22222, {{2, 0x0, 0x2, {false, false, true, false, false}, {}, 0}}}}};
PGOAnalysisMap P2 = {{},
- {{BlockFrequency(343), {}}},
- {false, true, false, false, false, false, false}};
+ {{BlockFrequency(343), 0, {}}},
+ {false, true, false, false, false, false, false, false}};
BBAddrMap E3 = {
{{0x33333,
{{0, 0x0, 0x3, {false, true, true, false, false}, {}, 0},
{1, 0x3, 0x3, {false, false, true, false, false}, {}, 0},
{2, 0x6, 0x3, {false, false, false, false, false}, {}, 0}}}}};
- PGOAnalysisMap P3 = {{},
- {{{},
- {{1, BranchProbability::getRaw(0x1111'1111)},
- {2, BranchProbability::getRaw(0xeeee'eeee)}}},
- {{}, {{2, BranchProbability::getRaw(0xffff'ffff)}}},
- {{}, {}}},
- {false, false, true, false, false, false, false}};
+ PGOAnalysisMap P3 = {
+ {},
+ {{{},
+ 0,
+ {{1, BranchProbability::getRaw(0x1111'1111), 0},
+ {2, BranchProbability::getRaw(0xeeee'eeee), 0}}},
+ {{}, 0, {{2, BranchProbability::getRaw(0xffff'ffff), 0}}},
+ {{}, 0, {}}},
+ {false, false, true, false, false, false, false, false}};
BBAddrMap E4 = {
{{0x44444,
{{0, 0x0, 0x4, {false, false, false, true, true}, {}, 0},
{1, 0x4, 0x4, {false, false, false, false, false}, {}, 0},
{2, 0x8, 0x4, {false, false, false, false, false}, {}, 0},
{3, 0xc, 0x4, {false, false, false, false, false}, {}, 0}}}}};
- PGOAnalysisMap P4 = {
- 1000,
- {{BlockFrequency(1000),
- {{1, BranchProbability::getRaw(0x2222'2222)},
- {2, BranchProbability::getRaw(0x3333'3333)},
- {3, BranchProbability::getRaw(0xaaaa'aaaa)}}},
- {BlockFrequency(133),
- {{2, BranchProbability::getRaw(0x1111'1111)},
- {3, BranchProbability::getRaw(0xeeee'eeee)}}},
- {BlockFrequency(18), {{3, BranchProbability::getRaw(0xffff'ffff)}}},
- {BlockFrequency(1000), {}}},
- {true, true, true, false, false, false, false}};
+ PGOAnalysisMap P4 = {1000,
+ {{BlockFrequency(1000),
+ 50,
+ {{1, BranchProbability::getRaw(0x2222'2222), 0},
+ {2, BranchProbability::getRaw(0x3333'3333), 0},
+ {3, BranchProbability::getRaw(0xaaaa'aaaa), 0}}},
+ {BlockFrequency(133),
+ 0,
+ {{2, BranchProbability::getRaw(0x1111'1111), 0},
+ {3, BranchProbability::getRaw(0xeeee'eeee), 0}}},
+ {BlockFrequency(18),
+ 0,
+ {{3, BranchProbability::getRaw(0xffff'ffff), 0}}},
+ {BlockFrequency(1000), 0, {}}},
+ {true, true, true, false, false, false, false, true}};
BBAddrMap E5 = {
{{0x55555, {{2, 0x0, 0x2, {false, false, true, false, false}, {}, 0}}}}};
PGOAnalysisMap P5 = {
- {}, {}, {false, false, false, false, false, false, false}};
+ {}, {}, {false, false, false, false, false, false, false, false}};
BBAddrMap E6 = {
{{0x66666,
{{0, 0x0, 0x6, {false, true, true, false, false}, {}, 0},
{1, 0x6, 0x6, {false, false, true, false, false}, {}, 0}}},
{0x666661,
{{2, 0x0, 0x6, {false, false, false, false, false}, {}, 0}}}}};
- PGOAnalysisMap P6 = {{},
- {{{},
- {{1, BranchProbability::getRaw(0x2222'2222)},
- {2, BranchProbability::getRaw(0xcccc'cccc)}}},
- {{}, {{2, BranchProbability::getRaw(0x8888'8888)}}},
- {{}, {}}},
- {false, false, true, true, false, false, false}};
+ PGOAnalysisMap P6 = {
+ {},
+ {{{},
+ 0,
+ {{1, BranchProbability::getRaw(0x2222'2222), 7},
+ {2, BranchProbability::getRaw(0xcccc'cccc), 0}}},
+ {{}, 0, {{2, BranchProbability::getRaw(0x8888'8888), 0}}},
+ {{}, 0, {}}},
+ {false, false, true, true, false, false, false, true}};
std::vector<BBAddrMap> Section0BBAddrMaps = {E4, E5, E6};
std::vector<BBAddrMap> Section1BBAddrMaps = {E3};
@@ -1465,7 +1474,7 @@ Sections:
DoCheckFails(
TruncatedYamlString, /*TextSectionIndex=*/std::nullopt,
"unable to read SHT_LLVM_BB_ADDR_MAP section with index 6: "
- "unexpected end of data at offset 0xa while reading [0x3, 0xb)");
+ "unexpected end of data at offset 0xa while reading [0x4, 0xc)");
// Check that we can read the other section's bb-address-maps which are
// valid.
DoCheckSucceeds(TruncatedYamlString, /*TextSectionIndex=*/2,
diff --git a/llvm/unittests/Object/ELFTypesTest.cpp b/llvm/unittests/Object/ELFTypesTest.cpp
index 1765e15..9e99b4a 100644
--- a/llvm/unittests/Object/ELFTypesTest.cpp
+++ b/llvm/unittests/Object/ELFTypesTest.cpp
@@ -101,22 +101,24 @@ static_assert(
"PGOAnalysisMap should use the same type for basic block ID as BBAddrMap");
TEST(ELFTypesTest, BBAddrMapFeaturesEncodingTest) {
- const std::array<BBAddrMap::Features, 12> Decoded = {
- {{false, false, false, false, false, false, false},
- {true, false, false, false, false, false, false},
- {false, true, false, false, false, false, false},
- {false, false, true, false, false, false, false},
- {false, false, false, true, false, false, false},
- {true, true, false, false, false, false, false},
- {false, true, true, false, false, false, false},
- {false, true, true, true, false, false, false},
- {true, true, true, true, false, false, false},
- {false, false, false, false, true, false, false},
- {false, false, false, false, false, true, false},
- {false, false, false, false, false, false, true}}};
- const std::array<uint8_t, 12> Encoded = {
+ const std::array<BBAddrMap::Features, 14> Decoded = {
+ {{false, false, false, false, false, false, false, false},
+ {true, false, false, false, false, false, false, false},
+ {false, true, false, false, false, false, false, false},
+ {false, false, true, false, false, false, false, false},
+ {false, false, false, true, false, false, false, false},
+ {true, true, false, false, false, false, false, false},
+ {false, true, true, false, false, false, false, false},
+ {false, true, true, true, false, false, false, false},
+ {true, true, true, true, false, false, false, false},
+ {false, false, false, false, true, false, false, false},
+ {false, false, false, false, false, true, false, false},
+ {false, false, false, false, false, false, true, false},
+ {false, false, false, false, false, false, false, true},
+ {false, false, false, false, false, false, true, true}}};
+ const std::array<uint16_t, 14> Encoded = {
{0b0000, 0b0001, 0b0010, 0b0100, 0b1000, 0b0011, 0b0110, 0b1110, 0b1111,
- 0b1'0000, 0b10'0000, 0b100'0000}};
+ 0b1'0000, 0b10'0000, 0b100'0000, 0b1000'0000, 0b1100'0000}};
for (const auto &[Feat, EncodedVal] : llvm::zip(Decoded, Encoded))
EXPECT_EQ(Feat.encode(), EncodedVal);
for (const auto &[Feat, EncodedVal] : llvm::zip(Decoded, Encoded)) {
@@ -129,9 +131,9 @@ TEST(ELFTypesTest, BBAddrMapFeaturesEncodingTest) {
TEST(ELFTypesTest, BBAddrMapFeaturesInvalidEncodingTest) {
const std::array<std::string, 2> Errors = {
- "invalid encoding for BBAddrMap::Features: 0x80",
- "invalid encoding for BBAddrMap::Features: 0xf0"};
- const std::array<uint8_t, 2> Values = {{0b1000'0000, 0b1111'0000}};
+ "invalid encoding for BBAddrMap::Features: 0x100",
+ "invalid encoding for BBAddrMap::Features: 0x1000"};
+ const std::array<uint16_t, 2> Values = {{0b1'0000'0000, 0b1'0000'0000'0000}};
for (const auto &[Val, Error] : llvm::zip(Values, Errors)) {
EXPECT_THAT_ERROR(BBAddrMap::Features::decode(Val).takeError(),
FailedWithMessage(Error));