Fix list of opcodes allowed for OpSpecConstantOp
authorDavid Neto <dneto@google.com>
Tue, 5 Jan 2016 23:22:22 +0000 (18:22 -0500)
committerDavid Neto <dneto@google.com>
Tue, 5 Jan 2016 23:22:22 +0000 (18:22 -0500)
Was missing BitcastXor, GenericCastToPtr.
Remove duplicate of SLessThanEqual

source/assembly_grammar.cpp
test/TextToBinary.Constant.cpp

index 2419bd5..73be8b6 100644 (file)
@@ -109,6 +109,7 @@ const SpecConstantOpcodeEntry kOpSpecConstantOpcodes[] = {
     CASE(UConvert),
     CASE(ConvertPtrToU),
     CASE(ConvertUToPtr),
+    CASE(GenericCastToPtr),
     CASE(PtrCastToGeneric),
     CASE(Bitcast),
     CASE(QuantizeToF16),
@@ -128,6 +129,7 @@ const SpecConstantOpcodeEntry kOpSpecConstantOpcodes[] = {
     CASE(ShiftLeftLogical),
     CASE(BitwiseOr),
     CASE(BitwiseAnd),
+    CASE(BitwiseXor),
     CASE(FNegate),
     CASE(FAdd),
     CASE(FSub),
@@ -154,7 +156,6 @@ const SpecConstantOpcodeEntry kOpSpecConstantOpcodes[] = {
     CASE(SGreaterThan),
     CASE(ULessThanEqual),
     CASE(SLessThanEqual),
-    CASE(SLessThanEqual),
     CASE(UGreaterThanEqual),
     CASE(SGreaterThanEqual),
     // Memory
@@ -163,6 +164,10 @@ const SpecConstantOpcodeEntry kOpSpecConstantOpcodes[] = {
     CASE(PtrAccessChain),
     CASE(InBoundsPtrAccessChain),
 };
+
+// The 58 is determined by counting the opcodes listed in the spec.
+static_assert(58 == sizeof(kOpSpecConstantOpcodes)/sizeof(kOpSpecConstantOpcodes[0]),
+              "OpSpecConstantOp opcode table is incomplete");
 #undef CASE
 // clang-format on
 
index 9e4f047..c9e4876 100644 (file)
@@ -512,6 +512,7 @@ INSTANTIATE_TEST_CASE_P(
         CASE1(UConvert),
         CASE1(ConvertPtrToU),
         CASE1(ConvertUToPtr),
+        CASE1(GenericCastToPtr),
         CASE1(PtrCastToGeneric),
         CASE1(Bitcast),
         CASE1(QuantizeToF16),
@@ -531,6 +532,7 @@ INSTANTIATE_TEST_CASE_P(
         CASE2(ShiftLeftLogical),
         CASE2(BitwiseOr),
         CASE2(BitwiseAnd),
+        CASE2(BitwiseXor),
         CASE1(FNegate),
         CASE2(FAdd),
         CASE2(FSub),
@@ -554,7 +556,6 @@ INSTANTIATE_TEST_CASE_P(
         CASE2(SGreaterThan),
         CASE2(ULessThanEqual),
         CASE2(SLessThanEqual),
-        CASE2(SLessThanEqual),
         CASE2(UGreaterThanEqual),
         CASE2(SGreaterThanEqual),
         // Memory