OpSelect's condition operand didn't follow spec
authorMais Alnasser <mais.alnasser@amd.com>
Sat, 30 Jan 2016 19:33:27 +0000 (14:33 -0500)
committerMais Alnasser <mais.alnasser@amd.com>
Sat, 30 Jan 2016 19:33:27 +0000 (14:33 -0500)
OpSelect's condition operand should have same component number as OpSelect's result type.

SPIR-V spec p110:
OpSelect
...
Condition must be a scalar or vector of Boolean type. It must have the
same number of components as Result Type.

external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmInstructionTests.cpp

index e49a23b..6b45683 100644 (file)
@@ -3392,6 +3392,7 @@ void createPipelineShaderStages (const DeviceInterface& vk, const VkDevice vkDev
        "%f32 = OpTypeFloat 32\n"                                                                                                                                       \
        "%v3f32 = OpTypeVector %f32 3\n"                                                                                                                        \
        "%v4f32 = OpTypeVector %f32 4\n"                                                                                                                        \
+    "%v4bool = OpTypeVector %bool 4\n"                                                         \
                                                                                                                                                                                                \
        "%v4f32_function = OpTypeFunction %v4f32 %v4f32\n"                                                                                      \
        "%fun = OpTypeFunction %void\n"                                                                                                                         \
@@ -6567,7 +6568,8 @@ tcu::TestCaseGroup* createNoContractionTests(tcu::TestContext& testCtx)
                "%is0            = OpFOrdEqual %bool %add %c_f32_0\n"
                "%isn1n24         = OpFOrdEqual %bool %add %c_f32_n1pn24\n"
                "%success        = OpLogicalOr %bool %is0 %isn1n24\n"
-               "%ret            = OpSelect %v4f32 %success %c_vec4_0 %c_vec4_1\n"
+        "%v4success      = OpCompositeConstruct %v4bool %success %success %success %success\n"
+               "%ret            = OpSelect %v4f32 %v4success %c_vec4_0 %c_vec4_1\n"
                "                  OpReturnValue %ret\n"
                "                  OpFunctionEnd\n";
 
@@ -6952,7 +6954,8 @@ void createOpQuantizeSingleOptionTests(tcu::TestCaseGroup* testCtx)
                "%b             = OpFAdd %f32 %test_constant %a\n"
                "%c             = OpQuantizeToF16 %f32 %b\n"
                "${condition}\n"
-               "%retval        = OpSelect %v4f32 %cond %c_v4f32_1_0_0_1 %param1"
+        "%v4cond        = OpCompositeConstruct %v4bool %cond %cond %cond %cond\n"
+               "%retval        = OpSelect %v4f32 %v4cond %c_v4f32_1_0_0_1 %param1\n"
                "                 OpReturnValue %retval\n"
                "OpFunctionEnd\n"
        );
@@ -6967,7 +6970,8 @@ void createOpQuantizeSingleOptionTests(tcu::TestCaseGroup* testCtx)
                "%param1        = OpFunctionParameter %v4f32\n"
                "%label_testfun = OpLabel\n"
                "${condition}\n"
-               "%retval        = OpSelect %v4f32 %cond %c_v4f32_1_0_0_1 %param1"
+        "%v4cond        = OpCompositeConstruct %v4bool %cond %cond %cond %cond\n"
+               "%retval        = OpSelect %v4f32 %v4cond %c_v4f32_1_0_0_1 %param1\n"
                "                 OpReturnValue %retval\n"
                "OpFunctionEnd\n"
        );
@@ -7081,7 +7085,8 @@ void createOpQuantizeTwoPossibilityTests(tcu::TestCaseGroup* testCtx)
                "%eq_1          = OpFOrdEqual %bool %c %possible_solution1\n"
                "%eq_2          = OpFOrdEqual %bool %c %possible_solution2\n"
                "%cond          = OpLogicalOr %bool %eq_1 %eq_2\n"
-               "%retval        = OpSelect %v4f32 %cond %c_v4f32_1_0_0_1 %param1"
+        "%v4cond        = OpCompositeConstruct %v4bool %cond %cond %cond %cond\n"
+               "%retval        = OpSelect %v4f32 %v4cond %c_v4f32_1_0_0_1 %param1"
                "                 OpReturnValue %retval\n"
                "OpFunctionEnd\n";