Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

properly handle the load and store cache control operand types #5664

Merged
merged 2 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions source/binary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,8 @@ spv_result_t Parser::parseOperand(size_t inst_offset,
case SPV_OPERAND_TYPE_OPTIONAL_PACKED_VECTOR_FORMAT:
case SPV_OPERAND_TYPE_FPENCODING:
case SPV_OPERAND_TYPE_OPTIONAL_FPENCODING:
case SPV_OPERAND_TYPE_LOAD_CACHE_CONTROL:
case SPV_OPERAND_TYPE_STORE_CACHE_CONTROL:
case SPV_OPERAND_TYPE_NAMED_MAXIMUM_NUMBER_OF_REGISTERS: {
// A single word that is a plain enum value.

Expand Down
16 changes: 16 additions & 0 deletions test/binary_to_text_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,22 @@ INSTANTIATE_TEST_SUITE_P(
"OpDecorateId %1 MaxByteOffsetId %2\n",
})));

INSTANTIATE_TEST_SUITE_P(
CacheControlsINTEL, RoundTripInstructionsTest,
Combine(
::testing::Values(SPV_ENV_UNIVERSAL_1_0),
::testing::ValuesIn(std::vector<std::string>{
"OpDecorate %1 CacheControlLoadINTEL 0 UncachedINTEL\n",
"OpDecorate %1 CacheControlLoadINTEL 1 CachedINTEL\n",
"OpDecorate %1 CacheControlLoadINTEL 2 StreamingINTEL\n",
"OpDecorate %1 CacheControlLoadINTEL 3 InvalidateAfterReadINTEL\n",
"OpDecorate %1 CacheControlLoadINTEL 4 ConstCachedINTEL\n",
"OpDecorate %1 CacheControlStoreINTEL 0 UncachedINTEL\n",
"OpDecorate %1 CacheControlStoreINTEL 1 WriteThroughINTEL\n",
"OpDecorate %1 CacheControlStoreINTEL 2 WriteBackINTEL\n",
"OpDecorate %1 CacheControlStoreINTEL 3 StreamingINTEL\n",
})));

using MaskSorting = TextToBinaryTest;

TEST_F(MaskSorting, MasksAreSortedFromLSBToMSB) {
Expand Down