Memory semantics Relaxed is a synonym for None
authorDavid Neto <dneto@google.com>
Fri, 25 Sep 2015 14:30:27 +0000 (10:30 -0400)
committerDavid Neto <dneto@google.com>
Mon, 26 Oct 2015 16:55:33 +0000 (12:55 -0400)
The disassembler should prefer to print Relaxed,
I think. (Untested.)

source/operand.cpp
test/TextToBinary.Barrier.cpp

index 3640a7a..6a82851 100644 (file)
@@ -1046,6 +1046,14 @@ static const spv_operand_desc_t functionControlEntries[] = {
 };
 
 static const spv_operand_desc_t memorySemanticsEntries[] = {
+    // "Relaxed" should be a synonym for "None".
+    // Put the Relaxed entry first so that the disassembler
+    // will prefer to emit "Relaxed".
+    {"Relaxed",
+     MemorySemanticsMaskNone,
+     SPV_OPCODE_FLAGS_NONE,
+     0,
+     {SPV_OPERAND_TYPE_NONE}},
     {"None",
      MemorySemanticsMaskNone,
      SPV_OPCODE_FLAGS_NONE,
index fb3d461..256a769 100644 (file)
@@ -58,6 +58,8 @@ INSTANTIATE_TEST_CASE_P(
     TextToBinaryMemorySemanticsTest, MemorySemanticsTest,
     ::testing::ValuesIn(std::vector<EnumCase<spv::MemorySemanticsMask>>{
         {spv::MemorySemanticsMaskNone, "None", {}},
+        // Relaxed is a synonym for None.
+        {spv::MemorySemanticsMaskNone, "Relaxed", {}},
         CASE(Acquire),
         CASE(Release),
         CASE(SequentiallyConsistent),