Add DISABLED failing test for ext inst import confusion
authorDavid Neto <dneto@google.com>
Fri, 16 Oct 2015 18:26:40 +0000 (14:26 -0400)
committerDavid Neto <dneto@google.com>
Mon, 2 Nov 2015 18:52:00 +0000 (13:52 -0500)
Currently, the assembler does not track external import
IDs when there are two or more.

TODO(dneto): Fix this functionality.

test/ExtInst.OpenCL.std.cpp

index 8713338..0b90386 100644 (file)
@@ -34,6 +34,7 @@ namespace {
 using spvtest::Concatenate;
 using spvtest::MakeInstruction;
 using spvtest::MakeVector;
+using spvtest::TextToBinaryTest;
 using testing::Eq;
 
 struct InstructionCase {
@@ -382,4 +383,26 @@ INSTANTIATE_TEST_CASE_P(
 #undef CASE2Lit
 #undef CASE3Round
 
+// TODO(dneto): Fix this functionality.
+TEST_F(TextToBinaryTest, DISABLED_ExtInstFromTwoDifferentImports) {
+  const std::string input =
+      R"(%1 = OpExtInstImport "OpenCL.std"
+%2 = OpExtInstImport "GLSL.std.450"
+%4 = OpExtInst %3 %1 native_sqrt %5
+%7 = OpExtInst %6 %2 MatrixInverse %8
+)";
+  EXPECT_THAT(
+      CompiledInstructions(input),
+      Eq(Concatenate({
+          MakeInstruction(spv::OpExtInstImport, {1}, MakeVector("OpenCL.std")),
+          MakeInstruction(spv::OpExtInstImport, {2},
+                          MakeVector("GLSL.std.450")),
+          MakeInstruction(
+              spv::OpExtInst,
+              {3, 4, 1, uint32_t(OpenCLLIB::Entrypoints::Native_sqrt), 5}),
+          MakeInstruction(spv::OpExtInst,
+                          {6, 7, 2, uint32_t(GLSLstd450MatrixInverse), 8}),
+      })));
+}
+
 }  // anonymous namespace