From 969ce4b3236a46a5264c7e003cfb029a1b32d559 Mon Sep 17 00:00:00 2001 From: David Neto Date: Tue, 5 Jan 2016 18:22:22 -0500 Subject: [PATCH] Fix list of opcodes allowed for OpSpecConstantOp Was missing BitcastXor, GenericCastToPtr. Remove duplicate of SLessThanEqual --- source/assembly_grammar.cpp | 7 ++++++- test/TextToBinary.Constant.cpp | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/source/assembly_grammar.cpp b/source/assembly_grammar.cpp index 2419bd5..73be8b6 100644 --- a/source/assembly_grammar.cpp +++ b/source/assembly_grammar.cpp @@ -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 diff --git a/test/TextToBinary.Constant.cpp b/test/TextToBinary.Constant.cpp index 9e4f047..c9e4876 100644 --- a/test/TextToBinary.Constant.cpp +++ b/test/TextToBinary.Constant.cpp @@ -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 -- 2.7.4